]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Wed, 18 Jan 2017 01:28:20 +0000 (20:28 -0500)
committerCristy <urban-warrior@imagemagick.org>
Wed, 18 Jan 2017 01:28:20 +0000 (20:28 -0500)
MagickCore/vision.c

index 53ebd5b7412b8277ce431aac45ae62add191fe8c..3d4a0a7bb7e46a2fb2d477d5ebd2a99ac462e0b3 100644 (file)
@@ -394,11 +394,11 @@ MagickExport Image *ConnectedComponentsImage(const Image *image,
         object[id].bounding_box.y=y;
       if (y >= (ssize_t) object[id].bounding_box.height)
         object[id].bounding_box.height=(size_t) y;
-      object[id].color.red+=GetPixelRed(image,p);
-      object[id].color.green+=GetPixelGreen(image,p);
-      object[id].color.blue+=GetPixelBlue(image,p);
-      object[id].color.black+=GetPixelBlack(image,p);
-      object[id].color.alpha+=GetPixelAlpha(image,p);
+      object[id].color.red+=QuantumScale*GetPixelRed(image,p);
+      object[id].color.green+=QuantumScale*GetPixelGreen(image,p);
+      object[id].color.blue+=QuantumScale*GetPixelBlue(image,p);
+      object[id].color.black+=QuantumScale*GetPixelBlack(image,p);
+      object[id].color.alpha+=QuantumScale*GetPixelAlpha(image,p);
       object[id].centroid.x+=x;
       object[id].centroid.y+=y;
       object[id].area++;
@@ -435,11 +435,11 @@ MagickExport Image *ConnectedComponentsImage(const Image *image,
   {
     object[i].bounding_box.width-=(object[i].bounding_box.x-1);
     object[i].bounding_box.height-=(object[i].bounding_box.y-1);
-    object[i].color.red=object[i].color.red/object[i].area;
-    object[i].color.green=object[i].color.green/object[i].area;
-    object[i].color.blue=object[i].color.blue/object[i].area;
-    object[i].color.alpha=object[i].color.alpha/object[i].area;
-    object[i].color.black=object[i].color.black/object[i].area;
+    object[i].color.red=QuantumRange*(object[i].color.red/object[i].area);
+    object[i].color.green=QuantumRange*(object[i].color.green/object[i].area);
+    object[i].color.blue=QuantumRange*(object[i].color.blue/object[i].area);
+    object[i].color.alpha=QuantumRange*(object[i].color.alpha/object[i].area);
+    object[i].color.black=QuantumRange*(object[i].color.black/object[i].area);
     object[i].centroid.x=object[i].centroid.x/object[i].area;
     object[i].centroid.y=object[i].centroid.y/object[i].area;
   }