Browse Source

fix in fimg_auto_shift_to_zero

master
tonton th 1 year ago
parent
commit
fdcc0781eb
  1. 4
      Fonderie/essai.sh
  2. 11
      funcs/saturation.c

4
Fonderie/essai.sh

@ -9,8 +9,8 @@ FILTRES=$(./t -L | awk 'NR>1 { print $1 }' | sort) @@ -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

11
funcs/saturation.c

@ -71,10 +71,14 @@ return 0; @@ -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) { @@ -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__);

Loading…
Cancel
Save