diff --git a/install.sh b/install.sh index 32c19a3..fbcaa14 100755 --- a/install.sh +++ b/install.sh @@ -6,7 +6,7 @@ cp floatimg.h /usr/local/include cp tools/mkfimg tools/fimg2pnm tools/fimgops \ tools/fimg2png tools/fimg2tiff tools/fimg2fits \ tools/png2fimg tools/fimgstats tools/fimgfx \ - tools/cumulfimgs \ + tools/cumulfimgs tools/fimg2text \ /usr/local/bin cp v4l2/grabvidseq v4l2/video-infos \ diff --git a/tools/fimg2png.c b/tools/fimg2png.c index 154fe53..d38a9aa 100644 --- a/tools/fimg2png.c +++ b/tools/fimg2png.c @@ -88,8 +88,9 @@ if (2 != argc-optind) { } foo = convertir_fimg_en_PNG(argv[optind], argv[optind+1], to_gray); -if (foo) +if (foo) { fprintf(stderr, "%s : got a %d from convertor\n", argv[0], foo); + } return 0; } diff --git a/tools/fimg2text.c b/tools/fimg2text.c index 7108d8f..18f1e1c 100644 --- a/tools/fimg2text.c +++ b/tools/fimg2text.c @@ -12,7 +12,7 @@ int verbosity; /* ------------------------------------------------------------------------- */ -int export_as_machinable(FloatImg *src, char *fname, int flags) +int export_as_machinable(FloatImg *src, char *fname, int steps, int flags) { FILE *fp; int x, y, idx; @@ -32,11 +32,12 @@ if (strcmp("-", fname)) { /* real file */ idx = 0; fp = stdout; /* XXX */ -for (y=0; yheight; y++) { - for (x=0; xwidth; x++) { +for (y=0; yheight; y+=steps) { + for (x=0; xwidth; x+=steps) { - fprintf(fp, "%d %d %d ", x, y, idx); - fprintf(fp, " %f %f %f\n", src->R[idx], src->G[idx], src->B[idx]); + fprintf(fp, "%d %d ", x, y); + fprintf(fp, " %f %f %f\n", + src->R[idx], src->G[idx], src->B[idx]); idx++; } @@ -45,7 +46,7 @@ for (y=0; yheight; y++) { return 0; } /* ------------------------------------------------------------------------- */ -int convertir_fimg_en_machinable(char *srcname, char *dstname, int grisaille) +int convertir_fimg_en_machinable(char *srcname, char *dstname, int steps) { int foo, infos[3]; FloatImg fimg; @@ -78,7 +79,7 @@ if (verbosity) { fimg_describe(&fimg, srcname); } -foo = export_as_machinable(&fimg, dstname, 0); +foo = export_as_machinable(&fimg, dstname, steps, 0); fimg_destroy(&fimg); @@ -100,11 +101,13 @@ exit(0); int main(int argc, char *argv[]) { int foo, opt; +int steps = 16; -while ((opt = getopt(argc, argv, "ghv")) != -1) { +while ((opt = getopt(argc, argv, "hs:v")) != -1) { switch(opt) { case 'v': verbosity++; break; case 'h': help(1); exit(1); + case 's': steps = atoi(optarg); break; } } @@ -113,7 +116,7 @@ if (1 != argc-optind) { exit(1); } -foo = convertir_fimg_en_machinable(argv[optind], "-", 0); +foo = convertir_fimg_en_machinable(argv[optind], "-", steps); if (foo) fprintf(stderr, "%s : got a %d from convertor\n", argv[0], foo);