Perhaps I misunderstand the question. I think cgkas simply wants the coordinates of the black connected components:
Code: Select all
magick Black_and_White.png -threshold 50% +write x.png -define connected-components:verbose=true -define connected-components:area-threshold=10 -connected-components 4 NULL:
The first few lines are:
Code: Select all
Objects (id: bounding-box centroid area mean-color):
0: 990x949+0+0 465.3,331.3 408770 srgb(0,0,0)
141: 421x308+531+635 741.0,788.5 129668 srgb(0,0,0)
140: 420x308+71+635 280.5,788.5 129360 srgb(0,0,0)
135: 421x158+531+425 741.0,503.5 66518 srgb(0,0,0)
134: 420x158+71+425 280.5,503.5 66360 srgb(0,0,0)
28: 423x145+530+203 741.2,275.4 55780 srgb(255,255,255)
27: 423x145+70+203 281.1,275.4 55703 srgb(255,255,255)
1: 264x40+680+109 812.1,128.2 9343 srgb(255,255,255)
139: 423x355+530+589 741.0,778.2 1552 srgb(255,255,255)
138: 422x355+70+589 280.5,778.2 1550 srgb(255,255,255)
133: 423x205+530+379 741.0,496.1 1252 srgb(255,255,255)
132: 422x205+70+379 280.5,496.1 1250 srgb(255,255,255)
35: 46x32+725+222 747.0,236.1 946 srgb(0,0,0)
31: 46x32+266+219 288.0,233.1 946 srgb(0,0,0)
36: 28x32+776+222 789.1,236.9 657 srgb(0,0,0)
The largest black box ("srgb(0,0,0)") is the entire image. The next four are the ones required.