From 8b8cf74128dd88a7b9de72839040e0f1f60959e8 Mon Sep 17 00:00:00 2001 From: tth Date: Tue, 20 Oct 2020 00:28:33 +0200 Subject: [PATCH] test program is going to be a real application --- funcs/t.c | 22 ++++++++++------------ funcs/vroum.sh | 14 +++++++------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/funcs/t.c b/funcs/t.c index 08d0a4e..a91807b 100644 --- a/funcs/t.c +++ b/funcs/t.c @@ -19,7 +19,7 @@ float global_fvalue; * nouveau 7 octobre 2020 pendant sonoptic */ -int essai_qsort_rgb(char *infile) +int essai_qsort_rgb(char *infile, char *outfile) { FloatImg src, dst; int foo; @@ -45,7 +45,7 @@ if (foo) { return foo; } -foo = fimg_export_picture(&dst, "out.pnm", 0); +foo = fimg_export_picture(&dst, outfile, 0); if (foo) { fprintf(stderr, "%s : err %d saving result\n", __func__, foo); return foo; @@ -59,9 +59,7 @@ return 0; * nouveau 5 octobre 2020 pendant sonoptic */ - - -int essai_contour_2x2(char *infile) +int essai_contour_2x2(char *infile, char *outfile) { FloatImg src, dst; int foo; @@ -87,7 +85,7 @@ if (foo) { return foo; } -foo = fimg_export_picture(&dst, "out2x2.pnm", 0); +foo = fimg_export_picture(&dst, outfile, 0); if (foo) { fprintf(stderr, "%s : err %d saving result\n", __func__, foo); return foo; @@ -99,7 +97,7 @@ return 0; /* * nouveau 5 octobre 2020 pendant sonoptic */ -int essai_classif(char *infile) +int essai_classif(char *infile, char *outfile) { FloatImg src, dst; int foo; @@ -127,7 +125,7 @@ if (foo) { return foo; } -foo = fimg_export_picture(&dst, "out.pnm", 0); +foo = fimg_export_picture(&dst, outfile, 0); if (foo) { fprintf(stderr, "%s : err %d saving result\n", __func__, foo); return foo; @@ -627,7 +625,7 @@ global_fvalue = 1.0; outfile = "out.pnm"; -while ((opt = getopt(argc, argv, "hk:p:v")) != -1) { +while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) { switch(opt) { case 'h': help(0); break; case 'k': global_fvalue = atof(optarg); break; @@ -684,13 +682,13 @@ switch(opt) { foo = fimg_essai_hsv(filename); break; case Classif: - foo = essai_classif(filename); + foo = essai_classif(filename, outfile); break; case Ctr2x2: - foo = essai_contour_2x2(filename); + foo = essai_contour_2x2(filename, outfile); break; case Qsortrgb: - foo = essai_qsort_rgb(filename); + foo = essai_qsort_rgb(filename, outfile); break; default: fprintf(stderr, "%s : bad command\n", command); diff --git a/funcs/vroum.sh b/funcs/vroum.sh index d0bf7ce..dbb5b46 100755 --- a/funcs/vroum.sh +++ b/funcs/vroum.sh @@ -3,10 +3,10 @@ src=/dev/shm/foo.fimg out=out.fimg -maxi=99 +maxi=49 W="640" H="480" -grabopt=" -s 640x480 -v -p 0 -n 500 -c cos01 " +grabopt=" -s 640x480 -vv -p 0 -n 400 -c pow2 " mkdir /tmp/V @@ -20,13 +20,13 @@ do grabvidseq -$grabopt -o $src fval=$(echo "$foo / $maxi" | bc -l) - ./t -k $fval qsortrgb $src - echo $foo ' = ' $fval + ./t -vv -k 0.333 -o $out classif $src + echo $foo ' => ' $fval dst=$(printf "/tmp/V/%03d.png" $foo) - - montage $src $out -geometry $G $dst + echo $dst + montage $src $out -tile 1x2 -geometry $G $dst done -convert -delay 20 /tmp/V/*.png foo.gif +convert -delay 10 /tmp/V/*.png foo.gif