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
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:
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)