From fdcc0781eb6f1149624ab3867a98efa2775b9427 Mon Sep 17 00:00:00 2001 From: tonton th Date: Thu, 25 Feb 2021 08:23:27 +0100 Subject: [PATCH] fix in fimg_auto_shift_to_zero --- Fonderie/essai.sh | 4 ++-- funcs/saturation.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Fonderie/essai.sh b/Fonderie/essai.sh index 9b38da8..9351e57 100755 --- a/Fonderie/essai.sh +++ b/Fonderie/essai.sh @@ -9,8 +9,8 @@ FILTRES=$(./t -L | awk 'NR>1 { print $1 }' | sort) rm /tmp/fstack*.png -# SRC=$(ls -rt1 $HOME/Essais/FondageDePlomb/capture/* | tail -1) -SRC=mire.fimg +SRC=$(ls -rt1 $HOME/Essais/FondageDePlomb/capture/* | tail -1) +# SRC=mire.fimg for F in $FILTRES do diff --git a/funcs/saturation.c b/funcs/saturation.c index 5254463..a335785 100644 --- a/funcs/saturation.c +++ b/funcs/saturation.c @@ -71,10 +71,14 @@ return 0; } /* -------------------------------------------------------------- */ +/* + * I think that this function is fully buggy + */ int fimg_auto_shift_to_zero(FloatImg *src, FloatImg *dst) { float coefs[6]; int foo; +float minima = 1e7; /* magic value ? */ if (FIMG_TYPE_RGB != src->type) { fprintf(stderr, "%s: bad image type %d\n", __func__, src->type); @@ -87,6 +91,13 @@ if (foo) { return foo; } +/* crude hack for now */ +if (coefs[0] < minima) minima = coefs[0]; +if (coefs[2] < minima) minima = coefs[2]; +if (coefs[4] < minima) minima = coefs[4]; + +coefs[0] = coefs[2] = coefs[4] = minima; + foo = fimg_shift_to_zero(src, dst, coefs); if (foo) { fprintf(stderr, "%s WTF?\n", __func__);