Efros-Leung
Exemplar-basedtexturesynthesis(Efros-Leung)
Classes | Typedefs | Functions
inc/auxiliary.h File Reference

Image structures definitions. More...

#include "io_png.h"
#include "mt.h"

Go to the source code of this file.

Classes

struct  cimage
 A color image of integers. More...
struct  imageF
 A gray-scale image of floats. More...
struct  pixel
 Some pixel's properties. More...
struct  cand_dist
 Store a patch and a distance. More...

Typedefs

typedef struct cimageCimage
typedef struct imageFImageF
typedef struct pixelPixel
typedef struct cand_distCand_dist

Functions

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

Detailed Description

Image structures definitions.

Definitions of common structures like images or coordinates.

Author:
Cecilia Aguerrebere

Function Documentation

ImageF add_border ( ImageF  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.

Extract the red channel of a color image.

Convert the red channel of a color image into a gray-scale image.

Parameters:
imagea color image
Returns:
the red channel of the color image
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
ImageF 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.
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
void delete_Cimage ( Cimage  v)

Delete a color image.

Free the memory used by the image.

Parameters:
vimage to be deleted
void delete_imageF ( ImageF  v)

Delete a gray-scale 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 not initialized, it contains random values.
ImageF new_ImageF ( int  nrow,
int  ncol 
)

Create an empty gray-scale 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.
void print_algo_info ( char *  in_file_name,
int  nrows,
int  ncols,
int  nchannels,
int  t,
float  tolerance,
int  dims_pca,
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
 All Classes Files Functions Variables