Total Variation Inpainting using Split Bregman
Macros | Functions
randmask.c File Reference

Generate a random inpainting mask. More...

#include <stdio.h>
#include <string.h>
#include "randmt.h"
#include "drawtext.h"
#include "imageio.h"

Go to the source code of this file.

Macros

#define JPEGQUALITY   95
 Quality for writing JPEG images.
 
#define CLAMP(X, A, B)   (((X) <= (A)) ? (A) : (((X) >= (B)) ? (B) : (X)))
 

Functions

void PrintHelpMessage ()
 
int Dots (unsigned char *Mask, int Width, int Height, int PenRadius)
 Fill inpainting mask with random dots. More...
 
int Scribble (unsigned char *Mask, int Width, int Height, int PenRadius)
 Fill inpainting mask with a random scribble. More...
 
void RandomText (unsigned char *Mask, int Width, int Height)
 Fill inpainting mask with random text about TV inpainting. More...
 
int Bernoulli (unsigned char *Image, int Width, int Height, double Ratio)
 Fill inpainting mask with Bernoulli distributed pixel-wise mask. More...
 
int main (int argc, char **argv)
 
unsigned char * MakePen (int PenRadius)
 
void PutPixel (unsigned char *Image, int Width, int Height, int x, int y)
 
void PutPen (unsigned char *Image, int Width, int Height, unsigned char *Pen, int PenRadius, int x0, int y0)
 
unsigned char GetPixel (unsigned char *Image, int Width, int Height, int x, int y)
 

Detailed Description

Generate a random inpainting mask.

Author
Pascal Getreuer getre.nosp@m.uer@.nosp@m.gmail.nosp@m..com
Yiqing Wang yiqin.nosp@m.g.wa.nosp@m.ng@po.nosp@m.lyte.nosp@m.chniq.nosp@m.ue.e.nosp@m.du

Copyright (c) 2012, Pascal Getreuer All rights reserved.

This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.

Definition in file randmask.c.

Function Documentation

int Bernoulli ( unsigned char *  Image,
int  Width,
int  Height,
double  Ratio 
)

Fill inpainting mask with Bernoulli distributed pixel-wise mask.

Parameters
Maskdestination
Width,Heightthe mask dimensions
Ratiomasking ratio: probability that a pixel is part of the mask

Definition at line 204 of file randmask.c.

int Dots ( unsigned char *  Mask,
int  Width,
int  Height,
int  PenRadius 
)

Fill inpainting mask with random dots.

Parameters
Maskdestination
Width,Heightthe mask dimensions
PenRadiusthe radius of the dots
Returns
1 on success, 0 on failure

Definition at line 180 of file randmask.c.

void RandomText ( unsigned char *  Mask,
int  Width,
int  Height 
)

Fill inpainting mask with random text about TV inpainting.

Parameters
Maskdestination
Width,Heightthe mask dimensions

This routine generates a random text from several samples about TV regularized inpainting.

Definition at line 342 of file randmask.c.

int Scribble ( unsigned char *  Mask,
int  Width,
int  Height,
int  PenRadius 
)

Fill inpainting mask with a random scribble.

Parameters
Maskdestination
Width,Heightthe mask dimensions
PenRadiusthe radius of the scribble line
Returns
1 on success, 0 on failure

This routine generates a random path and draws it with radius PenRadius. The path is generated several times and the path with the greatest variance is selected.

Definition at line 234 of file randmask.c.