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.

essai.c 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. testing some random funcs.
  3. */
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>
  7. #include <math.h>
  8. #include <string.h>
  9. #include "floatimg.h"
  10. int verbosity;
  11. /* --------------------------------------------------------------------- */
  12. void fait_un_dessin(FloatImg *dessin)
  13. {
  14. fimg_draw_something(dessin);
  15. }
  16. /* --------------------------------------------------------------------- */
  17. void help(int k)
  18. {
  19. puts("Options :");
  20. puts("\t-d WxH\timage size");
  21. exit(0);
  22. }
  23. /* --------------------------------------------------------------------- */
  24. int main(int argc, char *argv[])
  25. {
  26. FloatImg fimgA, fimgB;
  27. int foo, opt;
  28. int W = 800, H = 600;
  29. double tb;
  30. while ((opt = getopt(argc, argv, "d:hv")) != -1) {
  31. switch(opt) {
  32. case 'd': parse_WxH(optarg, &W, &H);
  33. break;
  34. case 'h': help(0); break;
  35. case 'v': verbosity++; break;
  36. }
  37. }
  38. if (verbosity) fimg_print_version(0);
  39. fimg_create(&fimgA, W, H, 3);
  40. fimg_create(&fimgB, W, H, 3);
  41. fimg_clear(&fimgA);
  42. fimg_drand48(&fimgB, 100.0);
  43. foo = fimg_dump_to_file(&fimgB, "B.fimg", 0);
  44. fimg_timer_set(0);
  45. #define NBP 500
  46. for (foo=0; foo<NBP; foo++) {
  47. if (verbosity) {
  48. printf("%5d / %5d\n", foo, NBP);
  49. }
  50. fait_un_dessin(&fimgB);
  51. fimg_add_3(&fimgA, &fimgB, &fimgA);
  52. // fimg_mul(&fimgA, &fimgB, &fimgA);
  53. }
  54. tb = fimg_timer_get(0);
  55. fprintf(stderr, "%s = %f seconds\n", __func__, tb);
  56. foo = fimg_save_as_pnm(&fimgA, "drand48.pnm", 0);
  57. foo = fimg_dump_to_file(&fimgA, "drand48.fimg", 0);
  58. fimg_destroy(&fimgA);
  59. fimg_destroy(&fimgB);
  60. return 0;
  61. }
  62. /* --------------------------------------------------------------------- */