test program is going to be a real application

This commit is contained in:
tth 2020-10-20 00:28:33 +02:00
parent 29480bfdfd
commit 8b8cf74128
2 changed files with 17 additions and 19 deletions

View File

@ -19,7 +19,7 @@ float global_fvalue;
* nouveau 7 octobre 2020 pendant sonoptic * nouveau 7 octobre 2020 pendant sonoptic
*/ */
int essai_qsort_rgb(char *infile) int essai_qsort_rgb(char *infile, char *outfile)
{ {
FloatImg src, dst; FloatImg src, dst;
int foo; int foo;
@ -45,7 +45,7 @@ if (foo) {
return foo; return foo;
} }
foo = fimg_export_picture(&dst, "out.pnm", 0); foo = fimg_export_picture(&dst, outfile, 0);
if (foo) { if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo); fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo; return foo;
@ -59,9 +59,7 @@ return 0;
* nouveau 5 octobre 2020 pendant sonoptic * nouveau 5 octobre 2020 pendant sonoptic
*/ */
int essai_contour_2x2(char *infile, char *outfile)
int essai_contour_2x2(char *infile)
{ {
FloatImg src, dst; FloatImg src, dst;
int foo; int foo;
@ -87,7 +85,7 @@ if (foo) {
return foo; return foo;
} }
foo = fimg_export_picture(&dst, "out2x2.pnm", 0); foo = fimg_export_picture(&dst, outfile, 0);
if (foo) { if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo); fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo; return foo;
@ -99,7 +97,7 @@ return 0;
/* /*
* nouveau 5 octobre 2020 pendant sonoptic * nouveau 5 octobre 2020 pendant sonoptic
*/ */
int essai_classif(char *infile) int essai_classif(char *infile, char *outfile)
{ {
FloatImg src, dst; FloatImg src, dst;
int foo; int foo;
@ -127,7 +125,7 @@ if (foo) {
return foo; return foo;
} }
foo = fimg_export_picture(&dst, "out.pnm", 0); foo = fimg_export_picture(&dst, outfile, 0);
if (foo) { if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo); fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo; return foo;
@ -627,7 +625,7 @@ global_fvalue = 1.0;
outfile = "out.pnm"; outfile = "out.pnm";
while ((opt = getopt(argc, argv, "hk:p:v")) != -1) { while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) {
switch(opt) { switch(opt) {
case 'h': help(0); break; case 'h': help(0); break;
case 'k': global_fvalue = atof(optarg); break; case 'k': global_fvalue = atof(optarg); break;
@ -684,13 +682,13 @@ switch(opt) {
foo = fimg_essai_hsv(filename); foo = fimg_essai_hsv(filename);
break; break;
case Classif: case Classif:
foo = essai_classif(filename); foo = essai_classif(filename, outfile);
break; break;
case Ctr2x2: case Ctr2x2:
foo = essai_contour_2x2(filename); foo = essai_contour_2x2(filename, outfile);
break; break;
case Qsortrgb: case Qsortrgb:
foo = essai_qsort_rgb(filename); foo = essai_qsort_rgb(filename, outfile);
break; break;
default: default:
fprintf(stderr, "%s : bad command\n", command); fprintf(stderr, "%s : bad command\n", command);

View File

@ -3,10 +3,10 @@
src=/dev/shm/foo.fimg src=/dev/shm/foo.fimg
out=out.fimg out=out.fimg
maxi=99 maxi=49
W="640" W="640"
H="480" 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 mkdir /tmp/V
@ -20,13 +20,13 @@ do
grabvidseq -$grabopt -o $src grabvidseq -$grabopt -o $src
fval=$(echo "$foo / $maxi" | bc -l) fval=$(echo "$foo / $maxi" | bc -l)
./t -k $fval qsortrgb $src ./t -vv -k 0.333 -o $out classif $src
echo $foo ' = ' $fval echo $foo ' => ' $fval
dst=$(printf "/tmp/V/%03d.png" $foo) dst=$(printf "/tmp/V/%03d.png" $foo)
echo $dst
montage $src $out -geometry $G $dst montage $src $out -tile 1x2 -geometry $G $dst
done done
convert -delay 20 /tmp/V/*.png foo.gif convert -delay 10 /tmp/V/*.png foo.gif