From 91b5fe08a62e5f4afa684934e0085f6169e28d9a Mon Sep 17 00:00:00 2001 From: tth Date: Tue, 6 Oct 2020 12:48:17 +0200 Subject: [PATCH] pimp my parameters --- floatimg.h | 3 ++- funcs/classif.c | 21 ++++++++++++--------- funcs/t.c | 5 +++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/floatimg.h b/floatimg.h index 35add61c..4c021d0f 100644 --- a/floatimg.h +++ b/floatimg.h @@ -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); diff --git a/funcs/classif.c b/funcs/classif.c index d9c52a7e..eb6dc373 100644 --- a/funcs/classif.c +++ b/funcs/classif.c @@ -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]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++; } diff --git a/funcs/t.c b/funcs/t.c index d9c57ce5..726598f9 100644 --- a/funcs/t.c +++ b/funcs/t.c @@ -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);