Possible bug -connected-components IM 6.9.6.7 Q16 Mac OSX

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25951
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Possible bug -connected-components IM 6.9.6.7 Q16 Mac OSX

Post by fmw42 »

One id shows in the listing that has area=416, which is below the threshold=40000, but it is actually not in the resulting image.

Input:
https://www.dropbox.com/s/frmfjv3wawxp4 ... 4.jpg?dl=0

Code: Select all

convert f3_f4.jpg -threshold 70% \
-morphology smooth Octagon \
-shave 10x10 -bordercolor white -border 10x10 \
-gravity east -chop 130x0 -background white -gravity east -splice 130x0 -negate out.png

convert out.png \
-define connected-components:mean-color=true \
-define connected-components:area-threshold=40000 \
-define connected-components:verbose=true \
-connected-components 4 mask.png
9 ids listed and the last one is area 416 and should not be listed since the threshold was 40000

Objects (id: bounding-box centroid area mean-color):
0: 1700x2340+0+0 834.7,1175.6 3133346 gray(0)
15: 657x410+271+490 613.9,689.7 174785 gray(255)
12: 548x378+826+307 1124.7,476.3 142044 gray(255)
66: 509x382+351+1668 609.7,1858.3 135930 gray(255)
19: 551x350+860+736 1159.6,923.1 135762 gray(255)
71: 437x331+775+1871 1011.5,2043.3 108776 gray(255)
65: 467x317+830+1466 1076.7,1630.1 105779 gray(255)
9: 1479x138+51+128 794.2,176.7 41162 gray(255)
31: 33x29+65+1194 80.9,1207.8 416 gray(0)

To show that it is really not in the mask.png result, I run CCL again on mask.png and then it shows only 8 ids and none with area 416

Code: Select all

convert mask.png \
-define connected-components:verbose=true \
-connected-components 4 null:
0: 1700x2340+0+0 834.6,1175.6 3133762 gray(0)
3: 657x410+271+490 613.9,689.7 174785 gray(255)
2: 548x378+826+307 1124.7,476.3 142044 gray(255)
6: 509x382+351+1668 609.7,1858.3 135930 gray(255)
4: 551x350+860+736 1159.6,923.1 135762 gray(255)
7: 437x331+775+1871 1011.5,2043.3 108776 gray(255)
5: 467x317+830+1466 1076.7,1630.1 105779 gray(255)
1: 1479x138+51+128 794.2,176.7 41162 gray(255)

User avatar
magick
Site Admin
Posts: 11128
Joined: 2003-05-31T11:32:55-07:00

Re: Possible bug -connected-components IM 6.9.6.7 Q16 Mac OSX

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

Post Reply