add 'fimg_lissage_3x3' function

This commit is contained in:
tTh
2023-07-05 10:59:06 +02:00
parent 54b061232d
commit 99bbd20b47
2 changed files with 40 additions and 2 deletions

View File

@@ -200,7 +200,6 @@ for (idx=0; idx<h; idx++) {
}
o = w * (h - 1);
for (idx=0; idx<w; idx++) {
#if FAST
img->R[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;
}
/* -------------------------------------------------------------------- */