moving a function
This commit is contained in:
parent
c7e2ab12ca
commit
3f551e1473
@ -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);
|
||||
|
@ -354,36 +354,10 @@ for (foo=0; foo<size; foo++) {
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int 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; foo<size; foo++) {
|
||||
if (pimg->R[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)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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 $<
|
||||
|
||||
|
@ -69,7 +69,6 @@ for (idx=0; idx<sz; idx++) {
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_highlight_color(FloatImg *src, FloatImg *dst, char color, float fval)
|
||||
{
|
||||
int sz;
|
||||
|
||||
#ifdef DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p [%c] %f )\n", __func__,
|
||||
|
47
funcs/sfx2.c
Normal file
47
funcs/sfx2.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* FLOATIMG - a kluge from tTh
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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; foo<size; foo++) {
|
||||
if (pimg->R[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;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
Loading…
Reference in New Issue
Block a user