]> mj.ucw.cz Git - libucw.git/commitdiff
- improvements and corrections in image segmentation
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 28 Aug 2006 13:34:30 +0000 (15:34 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 28 Aug 2006 13:34:30 +0000 (15:34 +0200)
cf/images
images/sig-cmp.c
images/sig-seg.c

index 09d148d183904c16ee8e151366b1c47593d33d23..b93744fee9cb217b75d69b8f8a8276627508a795 100644 (file)
--- a/cf/images
+++ b/cf/images
@@ -12,10 +12,10 @@ ImageSig {
 MinWidth       16
 MinHeight      16
 
-PreQuantThresholds     9 100 400 1000 2000 2000 2000 4000 4000 4000 4000 8000 8000 8000 8000
+PreQuantThresholds     9 40 40 100 100 200 200 400 400 800 800 1600 1600 1600 1600
 PostQuantMinSteps      2
 PostQuantMaxSteps      10
-PostQuantThreshold     2
+PostQuantThreshold     1
 
 TexturedThreshold      0.32
 
index 47b9d28fe4f5f6a7632db4b2588ac5a3862e2c1c..75b8277d6b3eeb7b3360359f55329fd8ea9b3fd3 100644 (file)
@@ -7,7 +7,7 @@
  *     of the GNU Lesser General Public License.
  */
 
-#define LOCAL_DEBUG
+#undef LOCAL_DEBUG
 
 #include "lib/lib.h"
 #include "lib/math.h"
@@ -175,9 +175,9 @@ image_signatures_dist_2(struct image_signature *sig1, struct image_signature *si
 
   /* Get percentages */
   for (i = 0, reg1 = sig1->reg; i < sig1->len; i++, reg1++)
-    p[i] = reg1->wa;
+    p[i] = reg1->wb;
   for (i = 0, reg2 = sig2->reg; i < sig2->len; i++, reg2++)
-    q[i] = reg2->wa;
+    q[i] = reg2->wb;
 
   /* Sort entries in distance matrix */
   image_signatures_dist_2_sort(n, dist);
index 7e6e09f5a2a802ad1e71870848af0e9883ff65b2..dc445bd94fa9544a98f77fedfc304429e1c50609 100644 (file)
@@ -68,7 +68,9 @@ static void
 prequant_finish_region(struct image_sig_region *region)
 {
   if (region->count < 2)
-    memcpy(region->c, region->a, sizeof(region->c));
+    {
+      region->e = 0;
+    }
   else
     {
       u64 a = 0;
@@ -120,13 +122,13 @@ prequant(struct image_sig_block *blocks, uns blocks_count, struct image_sig_regi
       DBG("Step... regions_count=%u heap_count=%u region->count=%u, region->e=%u",
          regions_count, heap_count, region->count, (uns)region->e);
       if (region->count < 2 ||
-         region->e < image_sig_prequant_thresholds[regions_count - 1] * region->count)
+         region->e < image_sig_prequant_thresholds[regions_count - 1] * blocks_count)
         {
          HEAP_DELMIN(struct image_sig_region *, heap, heap_count, prequant_heap_cmp, HEAP_SWAP);
          continue;
        }
 
-      /* Select axis to split - the one with maximum covariance */
+      /* Select axis to split - the one with maximum average quadratic error */
       axis = 0;
       u64 cov = (u64)region->count * region->c[0] - (u64)region->b[0] * region->b[0];
       for (uns i = 1; i < 6; i++)
@@ -324,7 +326,7 @@ postquant(struct image_sig_block *blocks, uns blocks_count, struct image_sig_reg
          if (error > last_error)
            break;
          u64 dif = last_error - error;
-         if (dif * image_sig_postquant_threshold < last_error * 100)
+         if (dif * image_sig_postquant_threshold < (u64)last_error * 100)
            break;
        }
     }