pimp my parameters

This commit is contained in:
tth 2020-10-06 12:48:17 +02:00
parent 3e0b227520
commit 91b5fe08a6
3 changed files with 17 additions and 12 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_mix_rgb_gray(FloatImg *img, float mix);
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]); 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 */ /* module funcs/geometry.c */
int fimg_equalize_compute(FloatImg *src, void *vptr, float vmax); 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 */ /* 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 minmax[6], delta[3], baryc[3];
float range, dist, rgb[3], dr, dg, db; float range, dist, rgb[3], dr, dg, db;
int x, y, on, off; int x, y, on, off;
#if DEBUG_LEVEL #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 #endif
/* calculer les amplitudes RGB de l'image source */ /* calculer les amplitudes RGB de l'image source */
@ -35,9 +35,9 @@ range = delta[0]; if (delta[1]<range) range=delta[1];
if (delta[2]<range) range=delta[2]; if (delta[2]<range) range=delta[2];
/* convertir le diametre en rayon (magic inside) */ /* convertir le diametre en rayon (magic inside) */
range /= 2.0; range *= fval;
fprintf(stderr, "deltas : %f %f %f / %f\n", if (verbosity ) fprintf(stderr, "deltas : %f %f %f / %f\n",
delta[0], delta[1], delta[2], range); delta[0], delta[1], delta[2], range);
@ -45,7 +45,8 @@ fprintf(stderr, "deltas : %f %f %f / %f\n",
baryc[0] = (minmax[1] + minmax[0]) / 2; baryc[0] = (minmax[1] + minmax[0]) / 2;
baryc[1] = (minmax[3] + minmax[2]) / 2; baryc[1] = (minmax[3] + minmax[2]) / 2;
baryc[2] = (minmax[5] + minmax[4]) / 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; on = off = 0;
@ -66,11 +67,13 @@ for (y=0; y<psrc->height; y++) {
/* action !!! */ /* action !!! */
if (dist > range) { if (dist > range) {
rgb[0] = rgb[1] = rgb[2] = /* make our pixel gray-level */
(rgb[0] + rgb[1] + rgb[2]) / 3.0; rgb[0] = rgb[1] = rgb[2] = 0.0;
// (rgb[0] + rgb[1] + rgb[2]) / 3.0;
on++; on++;
} }
else { else {
/* the easy part : do nothing */
off++; off++;
} }

View File

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