Efros-Leung
Exemplar-basedtexturesynthesis(Efros-Leung)
|
00001 #pragma once 00002 00003 #include "io_png.h" 00004 #include "mt.h" 00005 00006 /*----------------------------------------------------------------------------*/ 00007 /* Structures definition */ 00008 /*----------------------------------------------------------------------------*/ 00009 00010 typedef struct cimage 00011 { 00012 int nrow; /* Number of rows (dy) */ 00013 int ncol; /* Number of columns (dx) */ 00014 int nchannels; /* Number of channels */ 00015 00016 unsigned char *red; /* The red level plane (may be NULL) */ 00017 unsigned char *green; /* The green level plane (may be NULL) */ 00018 unsigned char *blue; /* The blue level plane (may be NULL) */ 00019 } * Cimage; 00020 00021 typedef struct gimage 00022 { 00023 int nrow; /* Number of rows (dy) */ 00024 int ncol; /* Number of columns (dx) */ 00025 int nchannels; /* Number of channels */ 00026 00027 unsigned char *val; /* The graylevel plane (may be NULL) */ 00028 } * Gimage; 00029 00030 typedef struct pixel 00031 { 00032 int x; 00033 int y; 00034 int nbneighbs; 00035 } * Pixel; 00036 00037 typedef struct cand_dist 00038 { 00039 float dist; 00040 long int patch; 00041 00042 } * Cand_dist; 00043 00044 00045 void error(char * msg); 00046 void write_png_image(Cimage v, char * filename); 00047 void write_png_image_gray(Gimage image, char * filename); 00048 void delete_Cimage(Cimage v); 00049 void delete_Gimage(Gimage v); 00050 void print_algo_info( char *in_file_name, int nrows, int ncols, int nchannels, int t, float tolerance, int out_sz); 00051 00052 Cimage new_Cimage(int nrow, int ncol); 00053 Gimage new_Gimage(int nrow, int ncol); 00054 Cimage create_image_map(int nrow, int ncol); 00055 Cimage crop_image( Cimage v, int out_img_sz ); 00056 Gimage crop_image_gray( Gimage v, int out_img_sz ); 00057 Cimage add_border( Cimage v, int t ); 00058 Gimage add_border_gray( Gimage v, int t ); 00059 Cimage create_mask ( int nrow, int ncol, int t ); 00060 Gimage create_mask_gray( int nrow, int ncol, int t ); 00061 int is_grayscale(Cimage image, long num_pixels); 00062 Cimage load_png_image(char *filename);