a new "rescale" option in cumulfimgs

This commit is contained in:
tTh
2022-09-17 19:18:45 +02:00
parent e6379f6338
commit feafd2799d
3 changed files with 51 additions and 14 deletions

View File

@@ -40,9 +40,10 @@ void help(int v)
puts("");
puts("$ cumulfimgs a.fimg b.fimg c-fimg ...");
puts("cumulator options :");
puts("\t-v\tincrease verbosity");
puts("\t-o\tname of output file");
puts("\t-g\tconvert to gray level");
puts("\t-o\tname of output file");
puts("\t-s\trescale end image");
puts("\t-v\tincrease verbosity");
puts("");
if (verbosity) { puts("Xperiment"); fimg_print_version(v); }
exit(0);
@@ -52,22 +53,25 @@ int main(int argc, char *argv[])
{
int foo, idx;
int opt;
int compte = 0;
int to_gray = 0;
int experiment = 0;
char *output_file = "out.fimg";
int compte = 0;
int to_gray = 0;
int experiment = 0;
int rescale = 0;
int src_loaded = 0;
char *output_file = "out.fimg";
FloatImg accu, temp;
int src_loaded = 0;
float vals[6];
g_width = g_height = 0;
while ((opt = getopt(argc, argv, "gho:vx")) != -1) {
while ((opt = getopt(argc, argv, "gho:svx")) != -1) {
switch(opt) {
case 'g': to_gray = 1; break;
case 'h': help(1); break;
case 'o': output_file = optarg; break;
case 's': rescale = 1; break;
case 'v': verbosity++; break;
case 'x': experiment++; break;
}
@@ -84,7 +88,7 @@ for (idx=optind; idx<argc; idx++) {
#endif
foo = testfile(argv[idx]);
if (foo) {
fprintf(stderr, "testfile %s -> %d\n", argv[idx],foo);
fprintf(stderr, "testfile %s -> %d\n", argv[idx], foo);
exit(1);
}
@@ -104,11 +108,16 @@ for (idx=optind; idx<argc; idx++) {
compte++;
}
/* XXX */
if (rescale) {
fprintf(stderr, "cumulfimg: count = %d\n", compte);
fimg_div_cste(&accu, (float)compte);
}
/* XXX */
if (experiment) {
}
/* XXX */
}
/* XXX */
if (to_gray) {