I have this image:

And I want this result, put all squares in a straight line with increasing numbers.

Using connected components function i get this result:
Code: Select all
0: 604x553+0+0 301.7,275.9 325867 srgb(255,255,255)
7: 33x41+44+286 60.0,306.0 1353 srgb(0,0,0)
8: 33x33+502+301 518.0,317.0 1089 srgb(0,0,0)
4: 33x32+383+257 399.0,272.5 1056 srgb(0,0,0)
2: 31x34+254+238 269.0,254.5 1054 srgb(0,0,0)
6: 33x31+444+275 460.0,290.0 1023 srgb(0,0,0)
3: 30x31+179+245 193.5,260.0 930 srgb(0,0,0)
1: 29x30+315+229 329.0,243.5 870 srgb(0,0,0)
5: 22x35+115+263 125.5,280.0 770 srgb(0,0,0)
Thanks!