2019-03-04 02:22:55 +11:00
|
|
|
/*
|
|
|
|
* floatimg.h
|
|
|
|
*/
|
|
|
|
|
2020-02-17 17:40:06 +11:00
|
|
|
#define FIMG_VERSION 92
|
2019-03-04 02:22:55 +11:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 {
|
2019-07-08 15:28:04 +11:00
|
|
|
char magic[8];
|
2019-03-04 02:22:55 +11:00
|
|
|
int w, h, t;
|
2019-07-08 15:28:04 +11:00
|
|
|
} FimgFileHead;
|
2019-03-04 02:22:55 +11:00
|
|
|
|
2019-08-07 20:55:29 +11:00
|
|
|
|
|
|
|
#define FIMG_TYPE_GRAY 1
|
|
|
|
#define FIMG_TYPE_RGB 3
|
|
|
|
#define FIMG_TYPE_RGBA 4
|
2020-02-14 06:44:22 +11:00
|
|
|
#define FIMG_TYPE_RGBZ 99
|
2019-08-07 20:55:29 +11:00
|
|
|
|
2019-10-31 01:49:53 +11:00
|
|
|
#define FILE_TYPE_FIMG 1
|
|
|
|
#define FILE_TYPE_PNM 2
|
|
|
|
#define FILE_TYPE_PNG 3
|
2019-12-27 22:25:33 +11:00
|
|
|
#define FILE_TYPE_TGA 4
|
|
|
|
#define FILE_TYPE_TIFF 5
|
2019-10-31 01:49:53 +11:00
|
|
|
|
2019-11-15 20:39:22 +11:00
|
|
|
/* lib/contrast.c */
|
|
|
|
#define CONTRAST_NONE 0
|
|
|
|
#define CONTRAST_SQRT 1
|
|
|
|
#define CONTRAST_POW2 2
|
|
|
|
#define CONTRAST_COS01 3
|
2019-12-04 21:17:45 +11:00
|
|
|
#define CONTRAST_COS010 4
|
2019-11-15 20:39:22 +11:00
|
|
|
|
2019-03-04 02:22:55 +11:00
|
|
|
/*
|
|
|
|
* core module
|
|
|
|
*/
|
|
|
|
int fimg_create(FloatImg *fimg, int w, int h, int t);
|
|
|
|
int fimg_destroy(FloatImg *fimg);
|
2019-11-12 23:57:32 +11:00
|
|
|
int fimg_clone(FloatImg *fimg, FloatImg *newpic, int flags);
|
2020-01-07 23:46:09 +11:00
|
|
|
int fimg_copy_data(FloatImg *from, FloatImg *to);
|
2019-03-04 02:22:55 +11:00
|
|
|
|
|
|
|
int fimg_print_version(int k);
|
|
|
|
void fimg_printhead(FloatImg *h);
|
|
|
|
int fimg_describe(FloatImg *head, char *txt);
|
2019-09-10 21:18:02 +11:00
|
|
|
char *fimg_str_type(int type);
|
2019-03-04 02:22:55 +11:00
|
|
|
int fimg_plot_rgb (FloatImg *head, int x, int y, float r, float g, float b);
|
2020-02-14 06:44:22 +11:00
|
|
|
int fimg_get_rgb(FloatImg *head, int x, int y, float *rgb);
|
2019-03-04 02:22:55 +11:00
|
|
|
int fimg_clear(FloatImg *fimg);
|
|
|
|
int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b);
|
2019-09-29 08:55:45 +11:00
|
|
|
int fimg_rgb_constant(FloatImg *head, float r, float g, float b);
|
2019-03-04 02:22:55 +11:00
|
|
|
|
2019-12-27 22:25:33 +11:00
|
|
|
/* --> lib/fimg-compare.c */
|
2019-09-10 10:31:48 +11:00
|
|
|
int fimg_images_compatible(FloatImg *a, FloatImg *b);
|
|
|
|
|
2019-09-10 01:02:44 +11:00
|
|
|
int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef);
|
|
|
|
|
2019-08-09 02:16:20 +11:00
|
|
|
/* 'operats' module */
|
2020-01-15 21:38:40 +11:00
|
|
|
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);
|
2019-11-20 21:12:16 +11:00
|
|
|
int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d);
|
|
|
|
int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
|
2019-08-09 02:16:20 +11:00
|
|
|
|
2020-02-08 04:01:28 +11:00
|
|
|
|
|
|
|
/* 'sfx0' module */
|
|
|
|
int fimg_killcolors_a(FloatImg *fimg, float fval);
|
2020-02-08 06:09:03 +11:00
|
|
|
int fimg_killcolors_b(FloatImg *fimg, float fval);
|
2020-02-08 04:01:28 +11:00
|
|
|
|
|
|
|
|
2019-03-04 02:22:55 +11:00
|
|
|
/* PNM files module */
|
2019-09-17 20:22:00 +11:00
|
|
|
int fimg_save_as_pnm(FloatImg *head, char *fname, int flags);
|
2019-06-30 04:33:23 +11:00
|
|
|
int fimg_load_from_pnm(char *fname, FloatImg *head, int notused);
|
2019-03-04 02:22:55 +11:00
|
|
|
|
|
|
|
double fimg_timer_set(int whot);
|
|
|
|
double fimg_timer_get(int whot);
|
|
|
|
|
2019-11-12 23:57:32 +11:00
|
|
|
/* --> lib/contrast.c */
|
2019-11-18 20:18:30 +11:00
|
|
|
int fimg_id_contraste(char *name);
|
2019-11-12 23:57:32 +11:00
|
|
|
int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
|
|
|
|
int fimg_power_2(FloatImg *s, FloatImg *d, double maxval);
|
2019-11-15 00:23:12 +11:00
|
|
|
int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval);
|
2019-12-04 00:25:30 +11:00
|
|
|
int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
|
2019-03-04 02:22:55 +11:00
|
|
|
|
2019-08-24 22:06:51 +11:00
|
|
|
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
|
2020-01-23 04:16:26 +11:00
|
|
|
int fimg_desaturate(FloatImg *src, FloatImg *dst, int k);
|
2019-08-24 22:06:51 +11:00
|
|
|
|
2020-02-14 06:44:22 +11:00
|
|
|
/* module funcs/geometry.c */
|
|
|
|
int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused);
|
|
|
|
|
2020-01-04 04:21:43 +11:00
|
|
|
/* module funcs/rampes.c */
|
|
|
|
int fimg_hdeg_a(FloatImg *img, double dcoef);
|
|
|
|
int fimg_vdeg_a(FloatImg *img, double dcoef);
|
|
|
|
|
2019-03-04 02:22:55 +11:00
|
|
|
/* FIMG files module */
|
|
|
|
int fimg_fileinfos(char *fname, int *datas);
|
|
|
|
int fimg_dump_to_file(FloatImg *head, char *fname, int notused);
|
2019-12-19 00:39:47 +11:00
|
|
|
int fimg_load_from_dump(char *fname, FloatImg *where);
|
2019-03-04 02:22:55 +11:00
|
|
|
int fimg_create_from_dump(char *fname, FloatImg *head);
|
|
|
|
|
2019-09-10 10:31:48 +11:00
|
|
|
/* mathematics operations */
|
2019-03-04 02:22:55 +11:00
|
|
|
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);
|
2019-09-10 10:31:48 +11:00
|
|
|
void fimg_mul_cste(FloatImg *fi, float value);
|
2020-01-07 23:46:09 +11:00
|
|
|
int fimg_normalize(FloatImg *fi, double maxima, int notused);
|
2019-03-04 02:22:55 +11:00
|
|
|
void fimg_drand48(FloatImg *fi, float kmul);
|
2019-09-25 18:21:00 +11:00
|
|
|
int fimg_count_negativ(FloatImg *fi);
|
2019-03-04 02:22:55 +11:00
|
|
|
|
2019-05-20 17:47:13 +11:00
|
|
|
/* various funcs modules */
|
2019-03-04 02:22:55 +11:00
|
|
|
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);
|
|
|
|
|
2019-08-29 06:08:59 +11:00
|
|
|
int parse_WxH(char *str, int *pw, int *ph);
|
2019-09-16 21:28:47 +11:00
|
|
|
int parse_double(char *str, double *dptr);
|
2019-10-31 01:49:53 +11:00
|
|
|
int format_from_extension(char *fname);
|
|
|
|
|
2019-09-16 21:28:47 +11:00
|
|
|
|
|
|
|
|
2019-03-04 02:22:55 +11:00
|
|
|
|
|
|
|
|