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.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * floatimg.h
  3. * ugly code from tTh
  4. */
  5. #define FIMG_VERSION 104
  6. /*
  7. * in memory descriptor
  8. */
  9. typedef struct {
  10. int width;
  11. int height;
  12. int type;
  13. float fval;
  14. int count;
  15. float *R, *G, *B, *A;
  16. int reserved;
  17. } FloatImg;
  18. /*
  19. * fimg file header
  20. */
  21. typedef struct {
  22. char magic[8];
  23. int w, h, t;
  24. } FimgFileHead;
  25. #define FIMG_TYPE_GRAY 1
  26. #define FIMG_TYPE_RGB 3
  27. #define FIMG_TYPE_RGBA 4
  28. #define FIMG_TYPE_RGBZ 99
  29. #define FILE_TYPE_FIMG 1
  30. #define FILE_TYPE_PNM 2
  31. #define FILE_TYPE_PNG 3
  32. #define FILE_TYPE_TGA 4
  33. #define FILE_TYPE_TIFF 5
  34. #define FILE_TYPE_FITS 6
  35. /* lib/contrast.c */
  36. #define CONTRAST_NONE 0
  37. #define CONTRAST_SQRT 1
  38. #define CONTRAST_POW2 2
  39. #define CONTRAST_COS01 3
  40. #define CONTRAST_COS010 4
  41. /*
  42. * core module
  43. */
  44. int fimg_create(FloatImg *fimg, int w, int h, int t);
  45. int fimg_destroy(FloatImg *fimg);
  46. int fimg_clone(FloatImg *fimg, FloatImg *newpic, int flags);
  47. int fimg_copy_data(FloatImg *from, FloatImg *to);
  48. int fimg_type_is_valid(int type);
  49. int fimg_print_version(int k);
  50. void fimg_print_sizeof(void);
  51. void fimg_printhead(FloatImg *h);
  52. int fimg_describe(FloatImg *head, char *txt);
  53. char *fimg_str_type(int type);
  54. int fimg_plot_rgb (FloatImg *head, int x, int y,
  55. float r, float g, float b);
  56. int fimg_get_rgb(FloatImg *head, int x, int y, float *rgb);
  57. int fimg_put_rgb(FloatImg *head, int x, int y, float *rgb);
  58. int fimg_clear(FloatImg *fimg);
  59. int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b);
  60. int fimg_rgb_constant(FloatImg *head, float r, float g, float b);
  61. /* --> lib/fimg-compare.c */
  62. int fimg_images_not_compatible(FloatImg *a, FloatImg *b);
  63. int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef);
  64. /* 'operats' module */
  65. int fimg_add_3(FloatImg *a, FloatImg *b, FloatImg *d);
  66. int fimg_add_2(FloatImg *a, FloatImg *b); /* B+=A */
  67. int fimg_sub_3(FloatImg *a, FloatImg *b, FloatImg *d);
  68. int fimg_mul_3(FloatImg *a, FloatImg *b, FloatImg *d);
  69. int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d);
  70. int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
  71. /* funcs/filtrage.c */
  72. typedef struct {
  73. float matrix[9];
  74. float mult;
  75. float offset;
  76. } FimgFilter3x3;
  77. int fimg_killborders(FloatImg *img);
  78. int fimg_lissage_2x2(FloatImg *img);
  79. int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
  80. /* 'sfx0' module */
  81. int fimg_killcolors_a(FloatImg *fimg, float fval);
  82. int fimg_killcolors_b(FloatImg *fimg, float fval);
  83. int fimg_colors_mixer_a(FloatImg *fimg, float fval);
  84. /* funcs/rotate.c module */
  85. /* #coronamaison */
  86. int fimg_rotate_90(FloatImg *src, FloatImg *dst, int notused);
  87. /* PNM files module */
  88. int fimg_save_as_pnm(FloatImg *head, char *fname, int flags);
  89. int fimg_load_from_pnm(char *fname, FloatImg *head, int notused);
  90. double fimg_timer_set(int whot);
  91. double fimg_timer_get(int whot);
  92. /* --> lib/contrast.c */
  93. int fimg_id_contraste(char *name);
  94. int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
  95. int fimg_power_2(FloatImg *s, FloatImg *d, double maxval);
  96. int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval);
  97. int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
  98. int fimg_mix_rgb_gray(FloatImg *img, float mix);
  99. /* module funcs/geometry.c */
  100. int fimg_equalize_compute(FloatImg *src, void *vptr);
  101. int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
  102. int fimg_desaturate(FloatImg *src, FloatImg *dst, int k);
  103. /* module funcs/geometry.c */
  104. int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused);
  105. /* module funcs/rampes.c */
  106. int fimg_hdeg_a(FloatImg *img, double dcoef);
  107. int fimg_vdeg_a(FloatImg *img, double dcoef);
  108. /* FIMG files module */
  109. int fimg_fileinfos(char *fname, int *datas);
  110. int fimg_dump_to_file(FloatImg *head, char *fname, int notused);
  111. int fimg_load_from_dump(char *fname, FloatImg *where);
  112. int fimg_create_from_dump(char *fname, FloatImg *head);
  113. int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags);
  114. int fimg_save_G_as_fits(FloatImg *src, char *outname, int flags);
  115. int fimg_save_B_as_fits(FloatImg *src, char *outname, int flags);
  116. /* mathematics operations */
  117. float fimg_get_maxvalue(FloatImg *head);
  118. int fimg_get_minmax_rgb(FloatImg *head, float mmvals[6]);
  119. int fimg_meanvalues(FloatImg *head, float means[4]);
  120. int fimg_to_gray(FloatImg *head);
  121. void fimg_add_cste(FloatImg *fi, float value);
  122. void fimg_mul_cste(FloatImg *fi, float value);
  123. int fimg_normalize(FloatImg *fi, double maxima, int notused);
  124. void fimg_drand48(FloatImg *fi, float kmul);
  125. int fimg_count_negativ(FloatImg *fi);
  126. int fimg_clamp_negativ(FloatImg *fi);
  127. /* various funcs modules */
  128. int fimg_load_from_png(char *filename, FloatImg *fimg);
  129. int fimg_create_from_png(char *filename, FloatImg *fimg);
  130. int fimg_save_as_png(FloatImg *src, char *outname, int flags);
  131. int fimg_test_pattern(FloatImg *fimg, int type, double dval);
  132. int fimg_draw_something(FloatImg *fimg);
  133. int parse_WxH(char *str, int *pw, int *ph);
  134. int parse_double(char *str, double *dptr);
  135. int format_from_extension(char *fname);