diff --git a/floatimg.h b/floatimg.h index 797dbd8..214d828 100644 --- a/floatimg.h +++ b/floatimg.h @@ -20,7 +20,7 @@ * https://git.tetalab.org/tTh/FloatImg */ -#define FIMG_VERSION (223) +#define FIMG_VERSION (224) #define RELEASE_NAME ("noname") /* XXX add a test for stdint.h / uint32_t XXX */ @@ -153,6 +153,7 @@ typedef struct { */ int fimg_killborders(FloatImg *img); int fimg_lissage_2x2(FloatImg *img); +int fimg_lissage_3x3(FloatImg *img); int fimg_show_filter(char *title, FimgFilter3x3 *filtr); int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr); diff --git a/funcs/filtrage.c b/funcs/filtrage.c index e4b25b2..212a870 100644 --- a/funcs/filtrage.c +++ b/funcs/filtrage.c @@ -200,7 +200,6 @@ for (idx=0; idxR[idx] = 0.0; @@ -233,4 +232,42 @@ fimg_killborders(img); return foo; } /* -------------------------------------------------------------------- */ +/* -------------------------------------------------------------------- */ +int fimg_lissage_3x3(FloatImg *img) +{ +int foo; +FloatImg tmp; + +fprintf(stderr, ">>> %s ( %p )\n", __func__, img); + +static FimgFilter3x3 lowpass = { + { + 1.0, 2.0, 1.0, + 2.0, 4.0, 2.0, + 1.0, 2.0, 1.0, + }, + 16.0, 0.0 + }; + +foo = fimg_clone(img, &tmp, 1); +if (foo) { + fprintf(stderr, "%s: clone -> %d\n", __func__, foo); + abort(); + } +foo = fimg_filter_3x3(&tmp, img, &lowpass); +if (foo) { + fprintf(stderr, "%s: lowpass -> %d\n", __func__, foo); + abort(); + } +foo = fimg_destroy(&tmp); +if (foo) { + fprintf(stderr, "%s: destroy -> %d\n", __func__, foo); + abort(); + } + +fimg_killborders(img); + +return 0; +} +/* -------------------------------------------------------------------- */