snibgo wrote:This command thresholds to black/white, then writes a text list of the components.
Code: Select all
convert testblob.jpg -threshold 50% -define connected-components:verbose=true -connected-components 4 -auto-level null:
...
Hmm - I am after a similar functionality and the new connected-components functionality is really great, but using
Code: Select all
convert DSCN2258.JPG -fuzz 5% -threshold 76% -define connected-components:verbose=true -define connected-components:area-threshold=35271 -connected-components 4 null:
for
a real-life (non-binary) image I get back the following lines:
Code: Select all
Objects (id: bounding-box centroid area mean-color):
0: 2592x1944+0+0 1107.7,1124.7 3668601 srgb(21,21,21)
13: 2542x1440+49+0 1718.5,387.7 987843 srgb(247,247,247)
73: 594x858+1998+0 2416.6,213.4 156252 srgb(27,27,27)
31734: 579x286+1876+1658 2171.9,1823.2 127362 srgb(243,243,243)
20271: 492x559+653+1016 953.6,1277.9 58337 srgb(240,240,240)
19897: 393x444+1272+987 1400.2,1137.2 40345 srgb(252,252,252)
18496: 15x8+2553+864 2560.8,866.9 49 srgb(177,177,177)
33938: 8x6+1890+1879 1894.1,1880.7 10 srgb(255,255,255)
707: 4x3+2023+11 2024.3,12.3 9 srgb(170,170,170)
19197: 9x2+2532+925 2536.8,925.8 6 srgb(43,43,43)
28223: 2x4+2421+1382 2421.5,1383.5 6 srgb(255,255,255)
27638: 1x6+2394+1356 2394.0,1358.8 5 srgb(255,255,255)
18477: 6x1+2560+865 2562.0,865.0 4 srgb(0,0,0)
19483: 4x1+2545+950 2546.5,950.0 4 srgb(255,255,255)
19793: 2x3+2548+975 2548.2,976.2 4 srgb(0,0,0)
25168: 3x2+2497+1233 2498.2,1233.8 4 srgb(0,0,0)
20319: 2x1+699+1018 699.5,1018.0 2 srgb(255,255,255)
25971: 2x1+2462+1275 2462.5,1275.0 2 srgb(128,128,128)
12: 1x1+92+0 92.0,0.0 1 srgb(255,255,255)
60: 1x1+2052+0 2052.0,0.0 1 srgb(0,0,0)
27242: 1x1+2441+1336 2441.0,1336.0 1 srgb(255,255,255)
What I don't understand:
# Why are areas reported that are definitely smaller than the value given by my "define connected-components:area-threshold=35271"?
# Why do a get back srgb[,,] values that are definitely not "white" or "black", even though I define a certain threshold value to induce binarization?
I'm using the freshly downloaded IM 6.9.0-5.
Cheers,
Petra