minor tweaks

This commit is contained in:
tth 2020-03-02 14:51:34 +01:00
parent 20da2de7fb
commit 7e0f2f87dd
3 changed files with 35 additions and 4 deletions

View File

@ -190,13 +190,17 @@ if (foo) {
return foo; return foo;
} }
fimg_get_minmax_rgb(&dessin, vals); foo = fimg_get_minmax_rgb(&dessin, vals);
if (foo) {
fprintf(stderr, "%s: err %d on fimg_get_minmax_rgb\n",
__func__, foo);
return foo;
}
for (foo=0; foo<6; foo++) { for (foo=0; foo<6; foo++) {
fprintf(stderr, "%7d %17.6g\n", foo, vals[foo]); fprintf(stderr, "%7d %17.6g\n", foo, vals[foo]);
} }
return -1; return -1;
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

11
tools/README.md Normal file
View File

@ -0,0 +1,11 @@
# Images en virgule flottante, les outils.
## mkfimg
## fimgops
## fimgfx
## fimgstats
## fimg2pnm - fimg2png

View File

@ -18,9 +18,11 @@ int various_numbers(FloatImg *fimg, int k)
float moyennes[4]; float moyennes[4];
int foo; int foo;
float fvalue; float fvalue;
float vals[6];
if (verbosity) if (verbosity) {
fprintf(stderr, " numbers from %p :\n", fimg); fprintf(stderr, " numbers from %p :\n", fimg);
}
fimg_printhead(fimg); fimg_printhead(fimg);
fprintf(stderr, "surface %d\n", fimg->width * fimg->height); fprintf(stderr, "surface %d\n", fimg->width * fimg->height);
@ -30,14 +32,27 @@ fprintf(stderr, "mean values:\n");
for (foo=0; foo<4; foo++) for (foo=0; foo<4; foo++)
printf(" %c %14.6f\n", "RGBA"[foo], moyennes[foo]); printf(" %c %14.6f\n", "RGBA"[foo], moyennes[foo]);
/*
fvalue = fimg_get_maxvalue(fimg); fvalue = fimg_get_maxvalue(fimg);
printf("max value %f\n", fvalue); printf("max value %f\n", fvalue);
*/
foo = fimg_count_negativ(fimg); foo = fimg_count_negativ(fimg);
if (foo) { if (foo) {
fprintf(stderr, "%d negative values\n", foo); fprintf(stderr, "%d negative values\n", foo);
} }
foo = fimg_get_minmax_rgb(fimg, vals);
if (foo) {
fprintf(stderr, "%s: err %d on fimg_get_minmax_rgb\n",
__func__, foo);
return foo;
}
printf("Rmin %12.4g Rmax %12.4g\n", vals[0], vals[1]);
printf("Gmin %12.4g Gmax %12.4g\n", vals[2], vals[3]);
printf("Bmin %12.4g Bmax %12.4g\n", vals[4], vals[5]);
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -80,6 +95,7 @@ if (argc == 1) {
foo = fimg_print_version(1); help(0); foo = fimg_print_version(1); help(0);
exit(0); exit(0);
} }
while ((opt = getopt(argc, argv, "cv")) != -1) { while ((opt = getopt(argc, argv, "cv")) != -1) {
switch(opt) { switch(opt) {
case 'c': make_csv++; break; case 'c': make_csv++; break;