Bibliothèque de traitements d'images en virgule flottante. http://la.buvette.org/photos/cumul/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FloatImg/floatimg.h

136 lines
3.7 KiB

4 years ago
/*
* floatimg.h
*/
#define FIMG_VERSION 89
4 years ago
/*
* in memory descriptor
*/
typedef struct {
int width;
int height;
int type;
float fval;
int count;
float *R, *G, *B, *A;
int reserved;
} FloatImg;
/*
* fimg file header
*/
typedef struct {
char magic[8];
4 years ago
int w, h, t;
} FimgFileHead;
4 years ago
3 years ago
#define FIMG_TYPE_GRAY 1
#define FIMG_TYPE_RGB 3
#define FIMG_TYPE_RGBA 4
#define FILE_TYPE_FIMG 1
#define FILE_TYPE_PNM 2
#define FILE_TYPE_PNG 3
#define FILE_TYPE_TGA 4
#define FILE_TYPE_TIFF 5
/* lib/contrast.c */
#define CONTRAST_NONE 0
#define CONTRAST_SQRT 1
#define CONTRAST_POW2 2
#define CONTRAST_COS01 3
#define CONTRAST_COS010 4
4 years ago
/*
* core module
*/
int fimg_create(FloatImg *fimg, int w, int h, int t);
int fimg_destroy(FloatImg *fimg);
int fimg_clone(FloatImg *fimg, FloatImg *newpic, int flags);
int fimg_copy_data(FloatImg *from, FloatImg *to);
4 years ago
int fimg_print_version(int k);
void fimg_printhead(FloatImg *h);
int fimg_describe(FloatImg *head, char *txt);
char *fimg_str_type(int type);
4 years ago
int fimg_plot_rgb (FloatImg *head, int x, int y, float r, float g, float b);
int fimg_clear(FloatImg *fimg);
int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b);
int fimg_rgb_constant(FloatImg *head, float r, float g, float b);
4 years ago
/* --> lib/fimg-compare.c */
int fimg_images_compatible(FloatImg *a, FloatImg *b);
int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef);
/* 'operats' module */
int fimg_add_3(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_add_2(FloatImg *a, FloatImg *b); /* B+=A */
int fimg_sub_3(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_mul_3(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
/* 'sfx0' module */
int fimg_killcolors_a(FloatImg *fimg, float fval);
int fimg_killcolors_b(FloatImg *fimg, float fval);
4 years ago
/* PNM files module */
int fimg_save_as_pnm(FloatImg *head, char *fname, int flags);
int fimg_load_from_pnm(char *fname, FloatImg *head, int notused);
4 years ago
double fimg_timer_set(int whot);
double fimg_timer_get(int whot);
/* --> lib/contrast.c */
int fimg_id_contraste(char *name);
int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
int fimg_power_2(FloatImg *s, FloatImg *d, double maxval);
int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval);
int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
4 years ago
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
int fimg_desaturate(FloatImg *src, FloatImg *dst, int k);
/* module funcs/rampes.c */
int fimg_hdeg_a(FloatImg *img, double dcoef);
int fimg_vdeg_a(FloatImg *img, double dcoef);
4 years ago
/* FIMG files module */
int fimg_fileinfos(char *fname, int *datas);
int fimg_dump_to_file(FloatImg *head, char *fname, int notused);
int fimg_load_from_dump(char *fname, FloatImg *where);
4 years ago
int fimg_create_from_dump(char *fname, FloatImg *head);
/* mathematics operations */
4 years ago
float fimg_get_maxvalue(FloatImg *head);
int fimg_meanvalues(FloatImg *head, float means[4]);
int fimg_to_gray(FloatImg *head);
void fimg_add_cste(FloatImg *fi, float value);
void fimg_mul_cste(FloatImg *fi, float value);
int fimg_normalize(FloatImg *fi, double maxima, int notused);
4 years ago
void fimg_drand48(FloatImg *fi, float kmul);
int fimg_count_negativ(FloatImg *fi);
4 years ago
4 years ago
/* various funcs modules */
4 years ago
int fimg_load_from_png(char *filename, FloatImg *fimg);
int fimg_create_from_png(char *filename, FloatImg *fimg);
int fimg_save_as_png(FloatImg *src, char *outname, int flags);
int fimg_draw_something(FloatImg *fimg);
int parse_WxH(char *str, int *pw, int *ph);
int parse_double(char *str, double *dptr);
int format_from_extension(char *fname);
4 years ago