/* * FLOATIMG - a kluge from tTh */ #include #include #include "../floatimg.h" extern int verbosity; /* * a place for moving here Fonderie effects */ /* -------------------------------------------------------------- */ int fimg_binarize(FloatImg *pimg, int notused) { float mm[6], mR, mG, mB; int foo, size; #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused); #endif foo = fimg_get_minmax_rgb(pimg, mm); mR = (mm[1] - mm[0]) / 2.0; mG = (mm[3] - mm[2]) / 2.0; mB = (mm[5] - mm[4]) / 2.0; if (verbosity > 1) fprintf(stderr, "%s: %f %f %f\n", __func__, mR, mG, mB); size = pimg->width * pimg->height; for (foo=0; fooR[foo] < mR) pimg->R[foo] = mm[0]; else pimg->R[foo] = mm[1]; if (pimg->G[foo] < mG) pimg->G[foo] = mm[2]; else pimg->G[foo] = mm[3]; if (pimg->B[foo] < mB) pimg->B[foo] = mm[4]; else pimg->B[foo] = mm[5]; } return 0; } /* -------------------------------------------------------------- */