diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index d09a10da..dfa6901d 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -217,7 +217,7 @@ switch (idFx) { retval = fimg_classif_trial(image, image, 0.37, 0); break; case CR_binarize: - retval = binarize(image, 0); + retval = fimg_binarize(image, 0); break; case CR_trinarize: retval = trinarize(image, 0); diff --git a/Fonderie/sfx.c b/Fonderie/sfx.c index e193cd76..7b8c88ab 100644 --- a/Fonderie/sfx.c +++ b/Fonderie/sfx.c @@ -354,36 +354,10 @@ for (foo=0; foo>> %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; -} +/* + * int binarize(FloatImg *pimg, int notused) was now in + * funcs/sfx2.c + */ /* -------------------------------------------------------------- */ int brotche_rand48_a(FloatImg *fimg, float ratio, float mval) { diff --git a/floatimg.h b/floatimg.h index f86e984a..70e34dab 100644 --- a/floatimg.h +++ b/floatimg.h @@ -111,6 +111,8 @@ int fimg_colors_mixer_a(FloatImg *fimg, float fval); int fimg_highlight_color(FloatImg *src, FloatImg *dst, char color, float fval); +/* module sfx2.c */ +int fimg_binarize(FloatImg *pimg, int notused); /* funcs/rotate.c module */ /* #coronamaison */ diff --git a/funcs/Makefile b/funcs/Makefile index c43a5f0d..bd572514 100644 --- a/funcs/Makefile +++ b/funcs/Makefile @@ -4,7 +4,7 @@ COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0 DEPS = ../floatimg.h Makefile OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ - fimg-libpnm.o rampes.o sfx0.o sfx1.o \ + fimg-libpnm.o rampes.o sfx0.o sfx1.o sfx2.o \ geometry.o rotate.o \ equalize.o fimg-fits.o saturation.o histogram.o \ hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \ @@ -81,6 +81,9 @@ sfx0.o: sfx0.c $(DEPS) sfx1.o: sfx1.c $(DEPS) gcc $(COPT) -c $< +sfx2.o: sfx2.c $(DEPS) + gcc $(COPT) -c $< + contour2x2.o: contour2x2.c $(DEPS) gcc $(COPT) -c $< diff --git a/funcs/sfx1.c b/funcs/sfx1.c index 58fc2acf..e8dda3b7 100644 --- a/funcs/sfx1.c +++ b/funcs/sfx1.c @@ -69,7 +69,6 @@ for (idx=0; idx>> %s ( %p %p [%c] %f )\n", __func__, diff --git a/funcs/sfx2.c b/funcs/sfx2.c new file mode 100644 index 00000000..12acbecb --- /dev/null +++ b/funcs/sfx2.c @@ -0,0 +1,47 @@ +/* + * 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; +} +/* -------------------------------------------------------------- */