a big commit of garbage

This commit is contained in:
tth
2022-05-14 20:49:59 +02:00
parent 4dcc524fc4
commit 615321eca8
15 changed files with 173 additions and 35 deletions

View File

@@ -2,11 +2,24 @@
# -----------------------------------------------------
TMPF="tmp.fimg"
FIMG="bar.fimg"
CAM="/dev/video0"
# -----------------------------------------------------
./grabvidseq -d $CAM -n 10000 -vv -p 0 -r 90
clear
# -----------------------------------------------------
SEQ=" -n 60 -p 0 "
./grabvidseq -vv -m -d $CAM $SEQ -o $FIMG
echo ; echo ================= STATS ======================
../tools/fimgstats -v $FIMG
exit
echo
echo ================ METADATA ====================
../tools/fimgmetadata -v timestamp $FIMG
echo
../tools/fimgmetadata -v all $FIMG
# -----------------------------------------------------

View File

@@ -80,6 +80,7 @@ if (verbosity) {
puts("options :");
puts("\t-d /dev/?\tselect video device");
puts("\t-g\t\tconvert to gray");
puts("\t-m\t\ttry to add metadata");
puts("\t-n NNN\t\thow many frames ?");
puts("\t-O ./\t\tset Output dir");
puts("\t-o bla.xxx\tset output filename");
@@ -90,7 +91,7 @@ puts("\t-c mode\t\tcontrast enhancement");
puts("\t-u\t\ttry upscaling...");
puts("\t-v\t\tincrease verbosity");
puts("\t-Z\t\tenable systrace");
if (verbosity) {
if (verbosity > 1) {
puts("\n\t\tXXX list all the contrast modes, please\n");
}
exit(0);
@@ -125,13 +126,15 @@ int upscaling = 0;
int contrast = CONTRAST_NONE;
int rotfactor = 0; /* only 0 or 90 here */
char *dest_dir = "."; /* no trailing slash */
char *outfile = "out.pnm";
char *outfile = "out.fimg";
int add_metadata = 0;
FimgMetaData metadata;
#if SAVE_AS_CUMUL
FloatImg cumul, tmpfimg, *to_save;
#endif
while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uvZ")) != -1) {
while ((opt = getopt(argc, argv, "c:d:ghmn:o:O:p:r:s:uvZ")) != -1) {
switch(opt) {
case 'c': contrast = fimg_id_contraste(optarg);
if (contrast < 0) {
@@ -142,6 +145,7 @@ while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uvZ")) != -1) {
case 'd': dev_name = optarg; break;
case 'g': to_gray = 1; break;
case 'h': help(0); break;
case 'm': add_metadata++; break;
case 'n': nbre_capt = atoi(optarg); break;
case 'O': dest_dir = optarg; break;
case 'o': outfile = optarg; break;
@@ -386,11 +390,21 @@ if (90 == rotfactor) {
to_save = &tmpfimg;
}
foo = format_from_extension(outfile);
switch (foo) {
case FILE_TYPE_FIMG:
foo = fimg_dump_to_file(to_save, outfile, 0);
fimg_default_metadata(&metadata, 51);
/* copy some values to mdstruct */
metadata.fval = to_save->fval;
metadata.count = to_save->count;
if (add_metadata) {
fprintf(stderr, ">>> save %s with md\n", outfile);
foo = fimg_dumpmd_to_file(to_save, outfile, \
&metadata, 0);
}
else {
foo = fimg_dump_to_file(to_save, outfile, 0);
}
break;
case FILE_TYPE_PNM:
foo = fimg_save_as_pnm(to_save, outfile, 1);