big cleanup, word on metadata
This commit is contained in:
@@ -21,6 +21,11 @@ int foo, x, y, idx;
|
||||
fprintf(stderr, ">>> %s ( '%s' %s' )\n", __func__, srcname, dstname);
|
||||
#endif
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "in %s, notused must be 0, was %d !\n",
|
||||
__func__, notused);
|
||||
}
|
||||
|
||||
foo = fimg_create_from_dump(dstname, &dst);
|
||||
if (foo) fprintf(stderr, "create dst fimg from '%s' -> %d\n", dstname, foo);
|
||||
#if DEBUG_LEVEL
|
||||
|
||||
@@ -43,7 +43,7 @@ puts("\t-v\tincrease verbosity");
|
||||
puts("\t-o\tname of output file");
|
||||
puts("\t-g\tconvert to gray level");
|
||||
puts("");
|
||||
if (verbosity) { puts("Xperiment"); fimg_print_version(1); }
|
||||
if (verbosity) { puts("Xperiment"); fimg_print_version(v); }
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -65,7 +65,7 @@ g_width = g_height = 0;
|
||||
while ((opt = getopt(argc, argv, "gho:vx")) != -1) {
|
||||
switch(opt) {
|
||||
case 'g': to_gray = 1; break;
|
||||
case 'h': help(0); break;
|
||||
case 'h': help(1); break;
|
||||
case 'o': output_file = optarg; break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'x': experiment++; break;
|
||||
|
||||
@@ -39,12 +39,13 @@ static void help(int k)
|
||||
{
|
||||
puts("export to FITS format");
|
||||
puts("\t-p select colorplane : R, G, B");
|
||||
fimg_print_version(k);
|
||||
}
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt;
|
||||
int opt;
|
||||
int plane = '?';
|
||||
|
||||
while ((opt = getopt(argc, argv, "p:hv")) != -1) {
|
||||
|
||||
@@ -64,7 +64,7 @@ puts("usage:\n\tfimg2png [options] foo.fimg bar.png");
|
||||
puts("options:");
|
||||
puts("\t-g\tconvert to gray");
|
||||
puts("\t-v\tincrease verbosity");
|
||||
if (verbosity) fimg_print_version(1);
|
||||
if (verbosity) fimg_print_version(k);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@ fprintf(stderr, ">>> %25s ( %p '%s' %d )\n", __func__,
|
||||
src, fname, flags);
|
||||
#endif
|
||||
|
||||
if (0 != flags) {
|
||||
fprintf(stderr, "bad flags in %s\n", __func__);
|
||||
}
|
||||
|
||||
fp = NULL; /* molly guard */
|
||||
if (strcmp("-", fname)) { /* real file */
|
||||
fprintf(stderr, "real file '%s'\n", fname);
|
||||
@@ -142,7 +146,7 @@ puts("\t-n 3.14\t\tnormalize picture");
|
||||
puts("\t-s N\t\tsteps on x & y");
|
||||
if (verbosity) {
|
||||
printf("*** compiled: %s at %s\n", __DATE__, __TIME__);
|
||||
fimg_print_version(1);
|
||||
fimg_print_version(k);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
@@ -153,11 +157,11 @@ int main(int argc, char *argv[])
|
||||
int foo, opt;
|
||||
int steps = 1;
|
||||
float norm_val = 222.0; /* < 0 : don't normalize */
|
||||
char separator = ' ';
|
||||
// char separator = ' ';
|
||||
|
||||
while ((opt = getopt(argc, argv, "f:hn:s:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'f': separator = optarg[0]; break;
|
||||
// case 'f': separator = optarg[0]; break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'h': help(1); exit(1);
|
||||
case 's': steps = atoi(optarg); break;
|
||||
|
||||
@@ -65,7 +65,7 @@ puts("usage:\n\tfimg2tiff [options] foo.fimg bar.tiff");
|
||||
puts("options:");
|
||||
// puts("\t-g\tconvert to gray");
|
||||
puts("\t-v\tincrease verbosity");
|
||||
if (verbosity) fimg_print_version(1);
|
||||
if (verbosity) fimg_print_version(k);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0,
|
||||
Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm,
|
||||
Fx_classtrial, Fx_mirror, Fx_shift0, Fx_trimul,
|
||||
Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R,
|
||||
Fx_absolute, Fx_clamp, Fx_shiftZ };
|
||||
Fx_absolute, Fx_clamp, Fx_fakol0 };
|
||||
|
||||
Fx fx_list[] = {
|
||||
{ "cos01", Fx_cos01, 0, 1 },
|
||||
@@ -52,7 +52,7 @@ Fx fx_list[] = {
|
||||
{ "hilightr", Fx_hilight_R, 0, 1 },
|
||||
{ "abs", Fx_absolute, 0, 1 },
|
||||
{ "clamp", Fx_clamp, 0, 1 },
|
||||
{ "shiftzero", Fx_shiftZ, 0, 1 },
|
||||
{ "fakol0", Fx_fakol0, 0, 1 },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ else {
|
||||
|
||||
action = fx_list[fxidx].id;
|
||||
|
||||
if (verbosity) {
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "%s: fxidx=%d action=%d\n", __func__,
|
||||
fxidx, action);
|
||||
}
|
||||
@@ -189,7 +189,6 @@ switch (action) {
|
||||
case Fx_gray0: /* new 2020 01 10 */
|
||||
fimg_to_gray(&src); fimg_copy_data(&src, &dest);
|
||||
break;
|
||||
|
||||
case Fx_xper:
|
||||
do_experiment(&src, &dest, maxval); break;
|
||||
|
||||
@@ -210,7 +209,6 @@ switch (action) {
|
||||
global_fvalue);
|
||||
foo = fimg_classif_trial(&src, &dest, global_fvalue, 0);
|
||||
break;
|
||||
|
||||
case Fx_desat:
|
||||
fimg_copy_data(&src, &dest);
|
||||
foo = fimg_mix_rgb_gray(&dest, global_fvalue);
|
||||
@@ -221,9 +219,12 @@ switch (action) {
|
||||
case Fx_shift0:
|
||||
// fprintf(stderr, "Krkrk %d\n", action);
|
||||
foo = fimg_auto_shift_to_zero(&src, &dest);
|
||||
if (foo) {
|
||||
fprintf(stderr, "*** shiftzero -> %d\n", foo);
|
||||
}
|
||||
break;
|
||||
case Fx_trimul:
|
||||
fprintf(stderr, "trimul %d\n", action);
|
||||
// fprintf(stderr, "trimul %d\n", action);
|
||||
foo = fimg_sfx_triplemul(&src, &dest, 0);
|
||||
break;
|
||||
case Fx_ctr2x2:
|
||||
@@ -253,12 +254,12 @@ switch (action) {
|
||||
if (foo > 0) foo = 0;
|
||||
break;
|
||||
|
||||
case Fx_shiftZ:
|
||||
foo = fimg_auto_shift_to_zero(&src, &dest);
|
||||
if (foo) {
|
||||
fprintf(stderr, "*** shiftzero -> %d\n", foo);
|
||||
}
|
||||
break;
|
||||
case Fx_fakol0:
|
||||
/***********************/
|
||||
/* DO SOMETHING HERE ! */
|
||||
/***********************/
|
||||
foo = fimg_falsecolors_0(&src, &dest, 0, 1.0);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s %s : %d is bad action\n",
|
||||
|
||||
@@ -52,6 +52,7 @@ void help(int u)
|
||||
puts("Usage:\n\tfimghalfsize [options] in.fimg out.fimg");
|
||||
puts("Options:");
|
||||
puts("\t-g\tconvert output to gray");
|
||||
fimg_print_version(u);
|
||||
exit(0);
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum comId { C_timestamp, C_count, C_fval, C_cpid, C_origin,
|
||||
int verbosity;
|
||||
|
||||
enum comId { C_timestamp, C_daytime, C_count, C_fval, C_cpid, C_origin,
|
||||
C_idcam, C_all };
|
||||
|
||||
typedef struct {
|
||||
@@ -24,6 +25,7 @@ typedef struct {
|
||||
|
||||
Cmd Cmd_list[] = {
|
||||
{ "timestamp", C_timestamp },
|
||||
{ "daytime", C_daytime },
|
||||
{ "cpid", C_cpid },
|
||||
{ "count", C_count },
|
||||
{ "fval", C_fval },
|
||||
@@ -73,7 +75,9 @@ action = lookup_cmd(command);
|
||||
|
||||
switch(action) {
|
||||
case C_timestamp:
|
||||
printf("timestamp %ld\n", metadata.timestamp.tv_sec); break;
|
||||
printf("timestamp %ld\n", metadata.timestamp.tv_sec); break;
|
||||
case C_daytime:
|
||||
printf("%s\n", ctime(&metadata.timestamp.tv_sec)); break;
|
||||
case C_count:
|
||||
printf("count %d\n", metadata.count); break;
|
||||
case C_fval:
|
||||
@@ -87,7 +91,7 @@ switch(action) {
|
||||
case C_all:
|
||||
fimg_show_metadata(&metadata, fname, 0); break;
|
||||
default:
|
||||
fprintf(stderr, "WTF?\n"); exit(1);
|
||||
fprintf(stderr, "%s WTF?\n", __func__); exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -104,7 +108,6 @@ exit(0);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt, nbargs;
|
||||
char *fname;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
||||
switch(opt) {
|
||||
|
||||
@@ -70,7 +70,7 @@ puts("options:");
|
||||
printf("\t-k N.N\t\tset float value (def=%.3f)\n", global_fvalue);
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
pr_opcodes();
|
||||
if (verbosity) fimg_print_version(1);
|
||||
if (verbosity) fimg_print_version(lj);
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user