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
*/
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);

View File

@ -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