Compare commits

..

2 Commits

Author SHA1 Message Date
tth
f034c77401 vroum testing in progress 2020-10-06 13:01:48 +02:00
tth
91b5fe08a6 pimp my parameters 2020-10-06 12:48:17 +02:00
5 changed files with 42 additions and 13 deletions

View File

@ -124,7 +124,8 @@ int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
int fimg_mix_rgb_gray(FloatImg *img, float mix);
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]);
int fimg_classif_trial(FloatImg *src, FloatImg*dst, int notused);
/* experimental ! */
int fimg_classif_trial(FloatImg *src, FloatImg*dst, float fval, int notused);
/* module funcs/geometry.c */
int fimg_equalize_compute(FloatImg *src, void *vptr, float vmax);

View File

@ -14,14 +14,14 @@ int verbosity;
/* --------------------------------------------------------------------- */
/* nouveau 2 octobre 2020, juste avant sonoptic de la pluie craignos */
int fimg_classif_trial(FloatImg *psrc, FloatImg *pdst, int notused)
int fimg_classif_trial(FloatImg *psrc, FloatImg *pdst, float fval, int notused)
{
float minmax[6], delta[3], baryc[3];
float range, dist, rgb[3], dr, dg, db;
int x, y, on, off;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__, psrc, pdst, fval, notused);
#endif
/* calculer les amplitudes RGB de l'image source */
@ -35,17 +35,18 @@ range = delta[0]; if (delta[1]<range) range=delta[1];
if (delta[2]<range) range=delta[2];
/* convertir le diametre en rayon (magic inside) */
range /= 2.0;
range *= fval;
fprintf(stderr, "deltas : %f %f %f / %f\n",
delta[0], delta[1], delta[2], range);
if (verbosity ) fprintf(stderr, "deltas : %f %f %f / %f\n",
delta[0], delta[1], delta[2], range);
/* calcul du "barycentre" chromatique */
baryc[0] = (minmax[1] + minmax[0]) / 2;
baryc[1] = (minmax[3] + minmax[2]) / 2;
baryc[2] = (minmax[5] + minmax[4]) / 2;
fprintf(stderr, "barycs : %f %f %f\n", baryc[0], baryc[1], baryc[2]);
if (verbosity) fprintf(stderr, "barycs : %f %f %f\n",
baryc[0], baryc[1], baryc[2]);
on = off = 0;
@ -64,13 +65,15 @@ for (y=0; y<psrc->height; y++) {
if (x==y) fprintf(stderr, "%4d %4d %f\n", x, y, dist);
#endif
/* action !!! */
/* action !!! */
if (dist > range) {
rgb[0] = rgb[1] = rgb[2] =
(rgb[0] + rgb[1] + rgb[2]) / 3.0;
/* make our pixel gray-level */
rgb[0] = rgb[1] = rgb[2] = 0.0;
// (rgb[0] + rgb[1] + rgb[2]) / 3.0;
on++;
}
else {
/* the easy part : do nothing */
off++;
}

View File

@ -36,7 +36,7 @@ else {
fimg_clone(&src, &dst, 1);
foo = fimg_classif_trial(&src, &dst, 0);
foo = fimg_classif_trial(&src, &dst, global_fvalue, 0);
if (foo) {
fprintf(stderr, "%s: err %d in classif_trial\n", __func__, foo);
return foo;
@ -48,7 +48,7 @@ if (foo) {
return foo;
}
return foo;
return 0;
}
/* --------------------------------------------------------------------- */
/* nouveau 19 aout 2020, le matin avant la canicule */
@ -551,6 +551,7 @@ filename = argv[optind+1];
if (verbosity) {
fprintf(stderr, "running command '%s' on '%s'\n", command, filename);
fprintf(stderr, "global fvalue : %f\n", global_fvalue);
}
opt = lookup_cmd(command);

24
funcs/vroum.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
src=foo.fimg
maxi=90
grabvidseq -s 640x480 -vv -p 0 -n 2000 -c cos01 -o $src
for foo in $(seq 0 $maxi)
do
fval=$(echo "$foo / $maxi" | bc -l)
./t -k $fval -v classif $src
echo $foo $fval
nom=$(printf "v_%03d.pnm" $foo)
cp out.pnm $nom
echo $nom
done
convert -delay 10 v_*.pnm foo.gif

View File

@ -77,7 +77,7 @@ if (foo) {
return -98;
}
foo = fimg_classif_trial(S, D, 0);
foo = fimg_classif_trial(S, D, kf, 0);
if (foo) {
fprintf(stderr, "%s err %d classif_trial %p\n", __func__,
foo, S);