Efros-Leung
Exemplar-basedtexturesynthesis(Efros-Leung)
Classes | Typedefs | Functions
inc/auxiliary.h File Reference
#include "io_png.h"
#include "mt.h"

Go to the source code of this file.

Classes

struct  cimage
struct  gimage
struct  pixel
struct  cand_dist

Typedefs

typedef struct cimageCimage
typedef struct gimageGimage
typedef struct pixelPixel
typedef struct cand_distCand_dist

Functions

void error (char *msg)
 Fatal error function.
void write_png_image (Cimage v, char *filename)
 Save a color image as a PNG file.
void write_png_image_gray (Gimage image, char *filename)
 Save a gray level image as a PNG file.
void delete_Cimage (Cimage v)
 Delete a color image.
void delete_Gimage (Gimage v)
 Delete a gray level image.
void print_algo_info (char *in_file_name, int nrows, int ncols, int nchannels, int t, float tolerance, int out_sz)
 Print information about the parameters.
Cimage new_Cimage (int nrow, int ncol)
 Create an empty color image.
Gimage new_Gimage (int nrow, int ncol)
 Create an empty gray level image.
Cimage create_image_map (int nrow, int ncol)
 Create a color map.
Cimage crop_image (Cimage v, int out_img_sz)
 Crop a color image.
Gimage crop_image_gray (Gimage v, int out_img_sz)
 Crop a gray level image.
Cimage add_border (Cimage v, int t)
 Add a border of zeros of width t to the input image.
Gimage add_border_gray (Gimage v, int t)
 Add a border of zeros of width t to the input image.
Cimage create_mask (int nrow, int ncol, int t)
 Create an image of size (nrow+t) times (ncol+t).
Gimage create_mask_gray (int nrow, int ncol, int t)
 Create an image of size (nrow+t) times (ncol+t).
int is_grayscale (Cimage image, long num_pixels)
 Check if an image is a real color image or a 3-channel gray image.
Cimage load_png_image (char *filename)
 Load a color image from a PNG file.

Detailed Description


Function Documentation

Cimage add_border ( Cimage  v,
int  t 
)

Add a border of zeros of width t to the input image.

Parameters:
vinput image add the border.
twidth of the border to be added.
Gimage add_border_gray ( Gimage  v,
int  t 
)

Add a border of zeros of width t to the input image.

Idem add_border for gray level images.

See also:
add_border
Cimage create_image_map ( int  nrow,
int  ncol 
)

Create a color map.

Parameters:
nrownumber of rows (dy)
ncolnumber of columns (dx)
Returns:
the created map
Cimage create_mask ( int  nrow,
int  ncol,
int  t 
)

Create an image of size (nrow+t) times (ncol+t).

The image is filled with ones in the central region of size nrow x ncol and has a border of zeros of width t.

Parameters:
nrownumber of rows of the region filled with ones.
ncolnumber of columns of the region filled with ones.
twidth of the border filled with zeros.
Gimage create_mask_gray ( int  nrow,
int  ncol,
int  t 
)

Create an image of size (nrow+t) times (ncol+t).

Idem create_mask for gray level images.

See also:
create_mask
Cimage crop_image ( Cimage  v,
int  out_img_sz 
)

Crop a color image.

Parameters:
vcolor image to be cropped
out_img_szsize of the new image
Returns:
the top-left part of the image
Gimage crop_image_gray ( Gimage  v,
int  out_img_sz 
)

Crop a gray level image.

Parameters:
vgray level image to be cropped
out_img_szsize of the new image
Returns:
the top-left part of the image
void delete_Cimage ( Cimage  v)

Delete a color image.

Free the memory used by the image.

Parameters:
vimage to be deleted
void delete_Gimage ( Gimage  v)

Delete a gray level image.

Free the memory used by the image.

Parameters:
vimage to be deleted
void error ( char *  msg)

Fatal error function.

Print a message to standard-error output and exit.

Parameters:
msgString to be printed to standard-error output.
int is_grayscale ( Cimage  image,
long  num_pixels 
)

Check if an image is a real color image or a 3-channel gray image.

Parameters:
imageinput image to be tested.
num_pixelstotal number of pixels in the image (nrows * ncols)
Cimage load_png_image ( char *  filename)

Load a color image from a PNG file.

Parameters:
filenamename (path) of the image
Returns:
The loaded image
Cimage new_Cimage ( int  nrow,
int  ncol 
)

Create an empty color image.

Initialize the size of the image and allocate the memory.

Parameters:
nrownumber of rows (dy)
ncolnumber of columns (dx)
Returns:
The created image
Warning:
Image is initialized to zero.
Gimage new_Gimage ( int  nrow,
int  ncol 
)

Create an empty gray level image.

Initialize the size of the image and allocate the memory.

Parameters:
nrownumber of rows (dy)
ncolnumber of columns (dx)
Returns:
The created image
Warning:
Image initialized to zero.
void print_algo_info ( char *  in_file_name,
int  nrows,
int  ncols,
int  nchannels,
int  t,
float  tolerance,
int  out_sz 
)

Print information about the parameters.

Parameters:
tHalf-size of the patches.
out_szSize of the synthesized image.
toleranceTolerance parameter $\varepsilon$.
dims_pcaNumber of PCA components used to compute distances between (the known parts of) patches.
weightsIf 'G', use Gaussian-weighted $l^2$ distance between patches instead of uniform $l^2$ distance.
in_file_nameExample image name.
nrowsNumber of rows (dy) in example image.
ncolsNumber of columns (dx) in example image.
nchannelsNumber of channels in example image.
void write_png_image ( Cimage  image,
char *  filename 
)

Save a color image as a PNG file.

Parameters:
imagecolor image to be saves
filenamename (path) of the file
void write_png_image_gray ( Gimage  image,
char *  filename 
)

Save a gray level image as a PNG file.

Parameters:
imagegray level image to be saves
filenamename (path) of the file
 All Classes Files Functions