work in progress

This commit is contained in:
tth 2020-08-13 07:25:55 +02:00
parent 1364698e63
commit 5aa9d5b88b
3 changed files with 22 additions and 8 deletions

View File

@ -3,7 +3,7 @@
* ugly code from tTh * ugly code from tTh
*/ */
#define FIMG_VERSION 105 #define FIMG_VERSION 106
/* /*
* in memory descriptor * in memory descriptor
@ -126,7 +126,7 @@ int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]);
/* module funcs/geometry.c */ /* module funcs/geometry.c */
int fimg_equalize_compute(FloatImg *src, void *vptr); int fimg_equalize_compute(FloatImg *src, void *vptr, float vmax);
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k); int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
int fimg_desaturate(FloatImg *src, FloatImg *dst, int k); int fimg_desaturate(FloatImg *src, FloatImg *dst, int k);

View File

@ -1,6 +1,6 @@
/* /*
* FLOATIMG * FLOATIMG
* egalisation dinamique approximative * egalisation dynamique approximative
* #coronamaison Thu 09 Apr 2020 03:37:10 PM CEST * #coronamaison Thu 09 Apr 2020 03:37:10 PM CEST
*/ */
@ -12,25 +12,39 @@
extern int verbosity; extern int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int fimg_equalize_compute(FloatImg *src, void *vptr) int fimg_equalize_compute(FloatImg *src, void *vptr, float vmax)
{ {
float minmax[6]; float minmax[6];
int foo; int foo;
float dr, dg, db;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p )\n", __func__, src); fprintf(stderr, ">>> %s ( %p )\n", __func__, src);
#endif #endif
memset(minmax, 0, 6*sizeof(float));
foo = fimg_get_minmax_rgb(src, minmax); foo = fimg_get_minmax_rgb(src, minmax);
printf("Rmin %12.4g Rmax %12.4g\n", minmax[0], minmax[1]); if (foo) {
printf("Gmin %12.4g Gmax %12.4g\n", minmax[2], minmax[3]); fprintf(stderr, "err %d get minmax in %s\n", foo, __func__);
printf("Bmin %12.4g Bmax %12.4g\n", minmax[4], minmax[5]); return foo;
}
dr = minmax[1] - minmax[0];
dg = minmax[3] - minmax[2];
db = minmax[5] - minmax[4];
printf("Rmin %12.4g Rmax %12.4g delta %12.4g\n", minmax[0], minmax[1], dr);
printf("Gmin %12.4g Gmax %12.4g delta %12.4g\n", minmax[2], minmax[3], dg);
printf("Bmin %12.4g Bmax %12.4g delta %12.4g\n", minmax[4], minmax[5], db);
if ( (minmax[0]<0.0) || (minmax[2]<0.0) || (minmax[4]<0.0) ) { if ( (minmax[0]<0.0) || (minmax[2]<0.0) || (minmax[4]<0.0) ) {
fprintf(stderr, "%s: negative value ?\n", __func__); fprintf(stderr, "%s: negative value ?\n", __func__);
return -4; return -4;
} }
// printf("deltas %12.4g %12.4g %12.4g\n", dr, dg, db);
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -55,7 +55,7 @@ else {
abort(); abort();
} }
foo = fimg_equalize_compute(&src, NULL); foo = fimg_equalize_compute(&src, NULL, 666.666);
fprintf(stderr, "equalize compute --> %d\n", foo); fprintf(stderr, "equalize compute --> %d\n", foo);
fimg_destroy(&src); fimg_destroy(&src);