Compare commits

..

No commits in common. "60b4181f3cbbb1eaf9f620f27302fb64af9c4c1a" and "0cdb977a827791023d7e1fdce47b5e0a8b4998fb" have entirely different histories.

3 changed files with 13 additions and 40 deletions

View File

@ -298,7 +298,7 @@ if (NULL==(fp=fopen(fname, "w"))) {
* some software (yes, povray, I look at you) doesn't like * some software (yes, povray, I look at you) doesn't like
* width and height on two separate lines. * width and height on two separate lines.
*/ */
fprintf(fp, "P2\n%d %d\n65535\n\n", src->width, src->height); fprintf(fp, "P2\n%d %d\n65532\n\n", src->width, src->height);
area = src->width * src->height; area = src->width * src->height;
maximum = fimg_get_maxvalue(src); maximum = fimg_get_maxvalue(src);

View File

@ -14,33 +14,15 @@ int verbosity; /* global */
int make_csv; int make_csv;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int machinable(FloatImg *fimg) int various_numbers(FloatImg *fimg, int k)
{
float vals[6];
float means[4];
if (verbosity) {
fprintf(stderr, "%s numbers from %p :\n", __func__, fimg);
}
fimg_meanvalues(fimg, means);
fimg_get_minmax_rgb(fimg, vals);
printf( "%.3f %.3f %.3f %f.3 %.3f %.3f %.3f %.3f %.3f\n",
vals[0], means[0], vals[1],
vals[2], means[1], vals[3],
vals[4], means[2], vals[5]);
return 0;
}
/* --------------------------------------------------------------------- */
int various_numbers(FloatImg *fimg)
{ {
float moyennes[4]; float moyennes[4];
int foo; int foo;
// float fvalue;
float vals[6]; float vals[6];
if (verbosity) { if (verbosity) {
fprintf(stderr, "%s numbers from %p :\n", __func__, fimg); fprintf(stderr, " numbers from %p :\n", fimg);
} }
fimg_printhead(fimg); fimg_printhead(fimg);
@ -78,9 +60,7 @@ int various_numbers_from_file(char *fname, int k)
FloatImg fimg; FloatImg fimg;
int foo; int foo;
if (verbosity) {
fprintf(stderr, "------ numbers from '%s' :\n", fname); fprintf(stderr, "------ numbers from '%s' :\n", fname);
}
foo = fimg_create_from_dump(fname, &fimg); foo = fimg_create_from_dump(fname, &fimg);
if (foo) { if (foo) {
@ -88,17 +68,10 @@ if (foo) {
return -2; return -2;
} }
if (k) { various_numbers(&fimg, k);
foo = machinable(&fimg);
}
else {
foo = various_numbers(&fimg);
}
fimg_destroy(&fimg); fimg_destroy(&fimg);
if (foo) {
fprintf(stderr, "%s: got a %d\n", __func__, foo);
return foo;
}
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -113,7 +86,7 @@ fputs( "usage : fimgstats [options] file.fimg\n"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int foo, opt; int foo, opt;
int do_machinable = 0;
extern char *optarg; extern char *optarg;
extern int optind, opterr, optopt; extern int optind, opterr, optopt;
@ -122,11 +95,11 @@ if (argc == 1) {
exit(0); exit(0);
} }
while ((opt = getopt(argc, argv, "chmv")) != -1) { while ((opt = getopt(argc, argv, "chv")) != -1) {
switch(opt) { switch(opt) {
case 'c': make_csv++; break; case 'c': make_csv++; break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'm': do_machinable = 1; break;
case 'h': /* tombe dedans */ case 'h': /* tombe dedans */
default: help(1); exit(1); default: help(1); exit(1);
} }
@ -136,7 +109,7 @@ if (NULL==argv[optind]) {
fprintf(stderr, "optind %d is wtf\n", optind); fprintf(stderr, "optind %d is wtf\n", optind);
return 1; return 1;
} }
foo = various_numbers_from_file(argv[optind], do_machinable); foo = various_numbers_from_file(argv[optind], 0);
if (foo) { if (foo) {
fprintf(stderr, "got a %d ?\n", foo); fprintf(stderr, "got a %d ?\n", foo);
} }