]> mj.ucw.cz Git - libucw.git/blobdiff - images/sig-txt.c
XTypes: Added support to configuration and option parser.
[libucw.git] / images / sig-txt.c
index ab04143428848fa9c0eb97d5506828689e4cc7d9..c11e5eb7008fad8bff2a33cc00de854552d8544e 100644 (file)
@@ -9,10 +9,10 @@
 
 #undef LOCAL_DEBUG
 
 
 #undef LOCAL_DEBUG
 
-#include "sherlock/sherlock.h"
-#include "images/images.h"
-#include "images/signature.h"
-#include "images/math.h"
+#include <ucw/lib.h>
+#include <images/images.h>
+#include <images/signature.h>
+#include <images/math.h>
 
 #include <string.h>
 
 
 #include <string.h>
 
@@ -27,14 +27,14 @@ image_sig_detect_textured(struct image_sig_data *data)
       DBG("Zero textured threshold.");
       return;
     }
       DBG("Zero textured threshold.");
       return;
     }
-       
-  uns cols = data->cols;
-  uns rows = data->rows;
-  uns cell_cols = MIN((cols + 1) / 2, MAX_CELLS_COLS);
-  uns cell_rows = MIN((rows + 1) / 2, MAX_CELLS_ROWS);
-  uns cell_x[MAX_CELLS_COLS + 1];
-  uns cell_y[MAX_CELLS_ROWS + 1];
-  uns i, j;
+
+  uint cols = data->cols;
+  uint rows = data->rows;
+  uint cell_cols = MIN((cols + 1) / 2, MAX_CELLS_COLS);
+  uint cell_rows = MIN((rows + 1) / 2, MAX_CELLS_ROWS);
+  uint cell_x[MAX_CELLS_COLS + 1];
+  uint cell_y[MAX_CELLS_ROWS + 1];
+  uint i, j;
   u32 cnt[IMAGE_REG_MAX];
 
   if (cell_cols * cell_rows < 4)
   u32 cnt[IMAGE_REG_MAX];
 
   if (cell_cols * cell_rows < 4)
@@ -44,7 +44,7 @@ image_sig_detect_textured(struct image_sig_data *data)
     }
 
   DBG("Detecting textured image... cols=%u rows=%u cell_cols=%u cell_rows=%u", cols, rows, cell_cols, cell_rows);
     }
 
   DBG("Detecting textured image... cols=%u rows=%u cell_cols=%u cell_rows=%u", cols, rows, cell_cols, cell_rows);
-  
+
   /* Compute cells boundaries */
   for (i = 1, j = 0; i < cell_cols; i++)
     cell_x[i] = fast_div_u32_u8(j += cols, cell_cols);
   /* Compute cells boundaries */
   for (i = 1, j = 0; i < cell_cols; i++)
     cell_x[i] = fast_div_u32_u8(j += cols, cell_cols);
@@ -56,30 +56,30 @@ image_sig_detect_textured(struct image_sig_data *data)
   cell_y[cell_rows] = rows;
 
   /* Preprocess blocks */
   cell_y[cell_rows] = rows;
 
   /* Preprocess blocks */
-  for (uns i = 0; i < data->regions_count; i++)
+  for (uint i = 0; i < data->regions_count; i++)
     for (struct image_sig_block *block = data->regions[i].blocks; block; block = block->next)
       block->region = i;
     for (struct image_sig_block *block = data->regions[i].blocks; block; block = block->next)
       block->region = i;
-  
+
   /* Process cells */
   double e = 0;
   /* Process cells */
   double e = 0;
-  for (uns j = 0; j < cell_rows; j++)
-    for (uns i = 0; i < cell_cols; i++)
+  for (uint j = 0; j < cell_rows; j++)
+    for (uint i = 0; i < cell_cols; i++)
       {
       {
-       uns cell_area = 0;
+       uint cell_area = 0;
         bzero(cnt, data->regions_count * sizeof(u32));
        struct image_sig_block *b1 = data->blocks + cell_x[i] + cell_y[j] * cols, *b2;
         bzero(cnt, data->regions_count * sizeof(u32));
        struct image_sig_block *b1 = data->blocks + cell_x[i] + cell_y[j] * cols, *b2;
-        for (uns y = cell_y[j]; y < cell_y[j + 1]; y++, b1 += cols)
+        for (uint y = cell_y[j]; y < cell_y[j + 1]; y++, b1 += cols)
          {
            b2 = b1;
          {
            b2 = b1;
-            for (uns x = cell_x[i]; x < cell_x[i + 1]; x++, b2++)
+            for (uint x = cell_x[i]; x < cell_x[i + 1]; x++, b2++)
              {
                cnt[b2->region]++;
                cell_area++;
              }
          }
              {
                cnt[b2->region]++;
                cell_area++;
              }
          }
-       for (uns k = 0; k < data->regions_count; k++)
+       for (uint k = 0; k < data->regions_count; k++)
          {
          {
-           int a = data->blocks_count * cnt[k] - cell_area * data->regions[k].count; 
+           int a = data->blocks_count * cnt[k] - cell_area * data->regions[k].count;
            e += (double)a * a / ((double)isqr(data->regions[k].count) * cell_area);
          }
       }
            e += (double)a * a / ((double)isqr(data->regions[k].count) * cell_area);
          }
       }