|
|
|
@ -37,7 +37,6 @@ FloatImg img; |
|
|
|
|
int retval; |
|
|
|
|
|
|
|
|
|
fimg_clone(pimg, &img, 0); |
|
|
|
|
// XXX fimg_clear(&img);
|
|
|
|
|
retval = fimg_contour_2x2(pimg, &img, 0); |
|
|
|
|
if (retval) { |
|
|
|
|
fprintf(stderr, "%s : err contour %d\n", |
|
|
|
@ -50,19 +49,43 @@ fimg_destroy(&img); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
/* -------------------------------------------------------------- */ |
|
|
|
|
static int insitu_filtre3x3(FloatImg *pimg) |
|
|
|
|
{ |
|
|
|
|
FloatImg img; |
|
|
|
|
int retval; |
|
|
|
|
|
|
|
|
|
FimgFilter3x3 filtre = { |
|
|
|
|
{ |
|
|
|
|
1.0, 2.0, 1.0, |
|
|
|
|
2.0, 4.0, 2.0, |
|
|
|
|
1.0, 2.0, 1.0, |
|
|
|
|
}, |
|
|
|
|
16.0, 0.0 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
fimg_clone(pimg, &img, 0); |
|
|
|
|
retval = fimg_filter_3x3(pimg, &img, &filtre); |
|
|
|
|
if (retval) { |
|
|
|
|
fprintf(stderr, "%s error %d on filter\n", __func__, retval); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
fimg_copy_data(&img, pimg); |
|
|
|
|
fimg_destroy(&img); |
|
|
|
|
|
|
|
|
|
return retval; |
|
|
|
|
} |
|
|
|
|
/* -------------------------------------------------------------- */ |
|
|
|
|
/*
|
|
|
|
|
* This is the main filter engine |
|
|
|
|
* used both for input and output |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#define DEBUG_THIS_CRAP 1 |
|
|
|
|
#define DEBUG_THIS_CRAP 0 |
|
|
|
|
|
|
|
|
|
int crapulator(FloatImg *image, int idFx, float fval) |
|
|
|
|
{ |
|
|
|
|
int retval; |
|
|
|
|
// FloatImg imgtmp;
|
|
|
|
|
static int count = 0; |
|
|
|
|
int flag_debug = 0; |
|
|
|
|
|
|
|
|
|
#if DEBUG_LEVEL |
|
|
|
|
fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__, |
|
|
|
@ -72,6 +95,8 @@ fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__, |
|
|
|
|
retval = 0; |
|
|
|
|
|
|
|
|
|
#if DEBUG_THIS_CRAP |
|
|
|
|
static int count = 0; |
|
|
|
|
int flag_debug = 0; |
|
|
|
|
if (666==count) { |
|
|
|
|
flag_debug = 1; |
|
|
|
|
fprintf(stderr, "DEBUG PT 1 in %s:%d\n", __func__, __LINE__); |
|
|
|
@ -112,10 +137,6 @@ switch (idFx) { |
|
|
|
|
break; |
|
|
|
|
case 9: |
|
|
|
|
retval = fimg_classif_trial(image, image, 0.37, 0); |
|
|
|
|
if (retval) { |
|
|
|
|
fprintf(stderr, "err %d in classif\n", retval); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 10: |
|
|
|
|
retval = binarize(image, 0); |
|
|
|
@ -126,6 +147,9 @@ switch (idFx) { |
|
|
|
|
case 12: |
|
|
|
|
retval = fimg_lissage_2x2(image); |
|
|
|
|
break; |
|
|
|
|
case 13: |
|
|
|
|
retval = insitu_filtre3x3(image); |
|
|
|
|
break; |
|
|
|
|
case 24: /* experiment ! */ |
|
|
|
|
retval = des_bords_sombres_a(image, 160); |
|
|
|
|
break; |
|
|
|
@ -146,9 +170,8 @@ if (flag_debug) { |
|
|
|
|
fimg_save_as_png(image, "crap_after.png", 0); |
|
|
|
|
flag_debug = 0; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
count++; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
return retval; |
|
|
|
|
} |
|
|
|
|