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 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * floatimg.h
  3. */
  4. #define FIMG_VERSION 87
  5. /*
  6. * in memory descriptor
  7. */
  8. typedef struct {
  9. int width;
  10. int height;
  11. int type;
  12. float fval;
  13. int count;
  14. float *R, *G, *B, *A;
  15. int reserved;
  16. } FloatImg;
  17. /*
  18. * fimg file header
  19. */
  20. typedef struct {
  21. char magic[8];
  22. int w, h, t;
  23. } FimgFileHead;
  24. #define FIMG_TYPE_GRAY 1
  25. #define FIMG_TYPE_RGB 3
  26. #define FIMG_TYPE_RGBA 4
  27. #define FILE_TYPE_FIMG 1
  28. #define FILE_TYPE_PNM 2
  29. #define FILE_TYPE_PNG 3
  30. #define FILE_TYPE_TGA 4
  31. #define FILE_TYPE_TIFF 5
  32. /* lib/contrast.c */
  33. #define CONTRAST_NONE 0
  34. #define CONTRAST_SQRT 1
  35. #define CONTRAST_POW2 2
  36. #define CONTRAST_COS01 3
  37. #define CONTRAST_COS010 4
  38. /*
  39. * core module
  40. */
  41. int fimg_create(FloatImg *fimg, int w, int h, int t);
  42. int fimg_destroy(FloatImg *fimg);
  43. int fimg_clone(FloatImg *fimg, FloatImg *newpic, int flags);
  44. int fimg_copy_data(FloatImg *from, FloatImg *to);
  45. int fimg_print_version(int k);
  46. void fimg_printhead(FloatImg *h);
  47. int fimg_describe(FloatImg *head, char *txt);
  48. char *fimg_str_type(int type);
  49. int fimg_fileinfo(char *fname, int *datas);
  50. int fimg_plot_rgb (FloatImg *head, int x, int y, float r, float g, float b);
  51. int fimg_clear(FloatImg *fimg);
  52. int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b);
  53. int fimg_rgb_constant(FloatImg *head, float r, float g, float b);
  54. /* --> lib/fimg-compare.c */
  55. int fimg_images_compatible(FloatImg *a, FloatImg *b);
  56. int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef);
  57. /* 'operats' module */
  58. int fimg_add_3(FloatImg *a, FloatImg *b, FloatImg *d);
  59. int fimg_add_2(FloatImg *a, FloatImg *b); /* B+=A */
  60. int fimg_sub_3(FloatImg *a, FloatImg *b, FloatImg *d);
  61. int fimg_mul_3(FloatImg *a, FloatImg *b, FloatImg *d);
  62. int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d);
  63. int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
  64. /* PNM files module */
  65. int fimg_save_as_pnm(FloatImg *head, char *fname, int flags);
  66. int fimg_load_from_pnm(char *fname, FloatImg *head, int notused);
  67. double fimg_timer_set(int whot);
  68. double fimg_timer_get(int whot);
  69. /* --> lib/contrast.c */
  70. int fimg_id_contraste(char *name);
  71. int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
  72. int fimg_power_2(FloatImg *s, FloatImg *d, double maxval);
  73. int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval);
  74. int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
  75. int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
  76. /* module funcs/rampes.c */
  77. int fimg_hdeg_a(FloatImg *img, double dcoef);
  78. int fimg_vdeg_a(FloatImg *img, double dcoef);
  79. /* FIMG files module */
  80. int fimg_fileinfos(char *fname, int *datas);
  81. int fimg_dump_to_file(FloatImg *head, char *fname, int notused);
  82. int fimg_load_from_dump(char *fname, FloatImg *where);
  83. int fimg_create_from_dump(char *fname, FloatImg *head);
  84. /* mathematics operations */
  85. float fimg_get_maxvalue(FloatImg *head);
  86. int fimg_meanvalues(FloatImg *head, float means[4]);
  87. int fimg_to_gray(FloatImg *head);
  88. void fimg_add_cste(FloatImg *fi, float value);
  89. void fimg_mul_cste(FloatImg *fi, float value);
  90. int fimg_normalize(FloatImg *fi, double maxima, int notused);
  91. void fimg_drand48(FloatImg *fi, float kmul);
  92. int fimg_count_negativ(FloatImg *fi);
  93. /* various funcs modules */
  94. int fimg_load_from_png(char *filename, FloatImg *fimg);
  95. int fimg_create_from_png(char *filename, FloatImg *fimg);
  96. int fimg_save_as_png(FloatImg *src, char *outname, int flags);
  97. int fimg_draw_something(FloatImg *fimg);
  98. int parse_WxH(char *str, int *pw, int *ph);
  99. int parse_double(char *str, double *dptr);
  100. int format_from_extension(char *fname);