diff --git a/README.md b/README.md index 6e9011c..3eaf074 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ C'est d"abord un ensemble de fonctions pour traiter des images avec une énorme dynamique sur les niveaux de pixels. C'est aussi quelques outils pour traiter ces images. -Et c'est enfin un embryon de logiciel destiné à faire des photos floues, voire même -des [films flous](Fonderie/). +Et c'est enfin plusieurs embryons de logiciel destiné à faire des photos floues, +voire même des [films flous](Fonderie/). ![horloge floue](http://la.buvette.org/photos/cumul/horloge.png "horloge floue") diff --git a/experiment/Makefile b/experiment/Makefile index 5a441f8..6664958 100644 --- a/experiment/Makefile +++ b/experiment/Makefile @@ -8,10 +8,7 @@ LIBS = -ltiff -lpnglite -lcfitsio all: assemblage extracteur -incrustator.o: incrustator.c incrustator.h Makefile - gcc -c $(COPT) $< - -assemblage: assemblage.c Makefile incrustator.o +assemblage: assemblage.c Makefile gcc $(COPT) $< incrustator.o ../libfloatimg.a $(LIBS) -o $@ extracteur: extracteur.c Makefile diff --git a/experiment/extracteur.c b/experiment/extracteur.c index 5033123..4474d6f 100644 --- a/experiment/extracteur.c +++ b/experiment/extracteur.c @@ -14,7 +14,7 @@ int verbosity; /* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */ /* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */ -int print_rectangle(Rectangle *rect) +int print_rectangle(FimgArea51 *rect) { printf("rect @ %p : %dx%d at %d,%d\n", rect, rect->w, rect->h, @@ -24,7 +24,7 @@ return 0; } /* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */ /* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */ -int essai_extraction(FloatImg *in, FloatImg *out, Rectangle *rect) +int essai_extraction(FloatImg *in, FloatImg *out, FimgArea51 *rect) { int foo; int xs, ys, xd, yd; @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { int foo, opt; FloatImg src, dst; -Rectangle zone; +FimgArea51 zone; char *infile = "foo.fimg"; char *outfile = "out.fimg"; diff --git a/experiment/incrustator.h b/experiment/incrustator.h index b1f60cb..b9ca174 100644 --- a/experiment/incrustator.h +++ b/experiment/incrustator.h @@ -2,11 +2,8 @@ * incrustator experimental */ -typedef struct { - unsigned long magic; - int w, h; - int x, y; - } FimgArea51; - +/* + * MOVED TO 'funcs/inscrutator.c' + */ int incrustator_0(FloatImg *psrc, FloatImg *pdst, int xpos, int ypos, int flags); diff --git a/floatimg.h b/floatimg.h index c97db60..04d89ad 100644 --- a/floatimg.h +++ b/floatimg.h @@ -4,7 +4,7 @@ * http://la.buvette.org/photos/cumul */ -#define FIMG_VERSION 137 +#define FIMG_VERSION 141 /* * in memory descriptor @@ -33,7 +33,7 @@ typedef struct { int w, h; int x, y; int flags; - } Rectangle; + } FimgArea51; #define FIMG_TYPE_GRAY 1 #define FIMG_TYPE_RGB 3 @@ -164,11 +164,16 @@ int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k); int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused); /* module funcs/geometry.c */ + /* warning, this module is a mess */ int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused); int fimg_halfsize_1(FloatImg *src, FloatImg *dst, int notused); -int fimg_extractor(FloatImg *in, FloatImg *out, Rectangle *rect); +int fimg_extractor(FloatImg *in, FloatImg *out, FimgArea51 *rect); int fimg_mirror(FloatImg *src, FloatImg *dst, int notused); + +int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst, + int xpos, int ypos, int flags); + int fimg_displacement_0(FloatImg *psrc, FloatImg *pdst, int flags); /* module funcs/rampes.c */ @@ -217,7 +222,7 @@ int fimg_multirandom(FloatImg *fimg, long nbpass); void fimg_print_minmax(float minmax[6], char *titre); int parse_WxH(char *str, int *pw, int *ph); int parse_double(char *str, double *dptr); -int parse_rectangle(char *str, Rectangle *r, int notused); +int parse_rectangle(char *str, FimgArea51 *r, int notused); int format_from_extension(char *fname); char * extension_from_format(int fmt); diff --git a/funcs/Makefile b/funcs/Makefile index bdc9f77..de11a42 100644 --- a/funcs/Makefile +++ b/funcs/Makefile @@ -11,7 +11,7 @@ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ geometry.o rotate.o fimg-openexr.o \ equalize.o fimg-fits.o saturation.o histogram.o \ hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \ - displacement.o dithering.o plasmas.o + displacement.o dithering.o plasmas.o incrustator.o #--------------------------------------------------------------- @@ -33,7 +33,12 @@ tests.o: tests.c tests.h $(DEPS) ../libfloatimg.a: $(OBJS) $(AR) r $@ $? -displacement.o: displacement.c $(DEPS) +# ### + +incrustator.o: incrustator.c $(DEPS) + gcc $(COPT) -c $< + +displacement.o: displacement.c $(DEPS) gcc $(COPT) -c $< fimg-png.o: fimg-png.c $(DEPS) diff --git a/funcs/geometry.c b/funcs/geometry.c index 3343c2e..3040036 100644 --- a/funcs/geometry.c +++ b/funcs/geometry.c @@ -105,7 +105,7 @@ for (y=0; yh; yd++) { return 0; } /* --------------------------------------------------------------------- */ +/* ho, btw, you can have a locck at 'incrustator.c' :) */ +/* --------------------------------------------------------------------- */ int fimg_mirror(FloatImg *src, FloatImg *dst, int notused) { float *fptr; diff --git a/experiment/incrustator.c b/funcs/incrustator.c similarity index 95% rename from experiment/incrustator.c rename to funcs/incrustator.c index 096e33c..3b8b902 100644 --- a/experiment/incrustator.c +++ b/funcs/incrustator.c @@ -1,5 +1,6 @@ /* * incrustator experimental + * KRKRK */ #include @@ -8,7 +9,7 @@ #include "../floatimg.h" -#include "incrustator.h" +// XXX #include "incrustator.h" extern int verbosity; @@ -43,7 +44,7 @@ fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__, return -1; } /* ---------------------------------------------------------------- */ -int incrustator_0(FloatImg *psrc, FloatImg *pdst, +int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst, int xpos, int ypos, int flags) { int y, srcpos, dstpos, szl; diff --git a/funcs/saturation.c b/funcs/saturation.c index a335785..4aac814 100644 --- a/funcs/saturation.c +++ b/funcs/saturation.c @@ -1,5 +1,5 @@ /* - * FloatImg library from tTh - ugly code inside + * FloatImg library from tTh - really ugly code inside */ #include @@ -7,7 +7,7 @@ #include "../floatimg.h" /* -------------------------------------------------------------- */ -/* global vars from main +/* global vars exported from main */ extern int verbosity; @@ -28,7 +28,6 @@ if (FIMG_TYPE_RGB != img->type) { for (y=0; yheight; y++) { p = y * img->width; /* first pixel of the row */ - for (x=0; xwidth; x++) { gr = (img->R[p] + img->G[p] + img->R[p]) / 3.0; @@ -36,15 +35,12 @@ for (y=0; yheight; y++) { img->R[p] = ((gr * mix) + (img->R[p] * (1.0-mix))) / 2.0; img->G[p] = ((gr * mix) + (img->G[p] * (1.0-mix))) / 2.0; img->B[p] = ((gr * mix) + (img->B[p] * (1.0-mix))) / 2.0; - p++; /* next pixel in the row */ } - } return 0; } - /* -------------------------------------------------------------- */ /* * The third parameter was a six value array with min and max @@ -60,7 +56,6 @@ if (FIMG_TYPE_RGB != s->type) { } sz = s->width * s->height; - for (idx=0; idxR[idx] = s->R[idx] - coefs[0]; d->G[idx] = s->G[idx] - coefs[2]; @@ -69,10 +64,10 @@ for (idx=0; idx>> %s ( %p %p )\n", __func__, src, dst); +#endif + if (FIMG_TYPE_RGB != src->type) { fprintf(stderr, "%s: bad image type %d\n", __func__, src->type); return -6; diff --git a/funcs/utils.c b/funcs/utils.c index 93572d8..4ccfc55 100644 --- a/funcs/utils.c +++ b/funcs/utils.c @@ -75,7 +75,7 @@ return -1; /* * /!\ return 4 on success */ -int parse_rectangle(char *str, Rectangle *r, int notused) +int parse_rectangle(char *str, FimgArea51 *r, int notused) { int x, y, w, h, foo; diff --git a/tools/fimgfx.c b/tools/fimgfx.c index 2ae43f6..85bffe9 100644 --- a/tools/fimgfx.c +++ b/tools/fimgfx.c @@ -22,7 +22,7 @@ typedef struct { enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0, Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm, - Fx_classtrial, Fx_mirror, + Fx_classtrial, Fx_mirror, Fx_shift0, Fx_xper, Fx_binarize, Fx_trinarize,Fx_hilight_R }; Fx fx_list[] = { @@ -38,6 +38,7 @@ Fx fx_list[] = { { "desat", Fx_desat, 0, 1 }, { "ctr2x2", Fx_ctr2x2, 0, 1 }, { "mirror", Fx_mirror, 0, 1 }, + { "shift0", Fx_shift0, 0, 1 }, // { "norm", Fx_norm, 0, 1 }, { "classtrial", Fx_classtrial, 0, 1 }, { "binarize", Fx_binarize, 0, 1 }, @@ -208,6 +209,10 @@ switch (action) { case Fx_mirror: foo = fimg_mirror(&src, &dest, 0); break; + case Fx_shift0: + fprintf(stderr, "Krkrk %d\n", action); + foo = fimg_auto_shift_to_zero(&src, &dest); + break; case Fx_ctr2x2: foo = fimg_contour_2x2(&src, &dest, 0); break; diff --git a/tools/fimghalfsize.c b/tools/fimghalfsize.c index edc5a4f..e070e26 100644 --- a/tools/fimghalfsize.c +++ b/tools/fimghalfsize.c @@ -84,7 +84,10 @@ if (verbosity) { } foo = faire_un_halfsize(srcname, dstname, grayed); - +if (foo) { + fprintf(stderr, "in %s: make halfsize give a %d\n", argv[0], foo); + exit(1); + } return 0; }