X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=images%2Fsig-txt.c;h=ab04143428848fa9c0eb97d5506828689e4cc7d9;hb=0e5c5828c3f3e1abd14bd012827e6b467075290b;hp=0429b7390162c31e9938b7fc829690600f33e180;hpb=a71db29f49ca53affdec9bb557d386fbd2c04328;p=libucw.git diff --git a/images/sig-txt.c b/images/sig-txt.c index 0429b739..ab041434 100644 --- a/images/sig-txt.c +++ b/images/sig-txt.c @@ -7,7 +7,7 @@ * of the GNU Lesser General Public License. */ -#define LOCAL_DEBUG +#undef LOCAL_DEBUG #include "sherlock/sherlock.h" #include "images/images.h" @@ -22,6 +22,12 @@ void image_sig_detect_textured(struct image_sig_data *data) { + if (image_sig_textured_threshold <= 0) + { + DBG("Zero textured threshold."); + return; + } + uns cols = data->cols; uns rows = data->rows; uns cell_cols = MIN((cols + 1) / 2, MAX_CELLS_COLS); @@ -31,6 +37,12 @@ image_sig_detect_textured(struct image_sig_data *data) uns i, j; u32 cnt[IMAGE_REG_MAX]; + if (cell_cols * cell_rows < 4) + { + DBG("Image is not textured."); + return; + } + DBG("Detecting textured image... cols=%u rows=%u cell_cols=%u cell_rows=%u", cols, rows, cell_cols, cell_rows); /* Compute cells boundaries */ @@ -75,7 +87,7 @@ image_sig_detect_textured(struct image_sig_data *data) DBG("Coefficient=%g", (double)e / (data->regions_count * data->blocks_count)); /* Threshold */ - if (e <= image_sig_textured_threshold * data->regions_count * data->blocks_count) + if (e < image_sig_textured_threshold * data->regions_count * data->blocks_count) { data->flags |= IMAGE_SIG_TEXTURED; DBG("Image is textured.");