I want to create multiple rectangle areas from this image
45 squares

where the rectangle would be defined by the points on the edges of the outer most squares - dont mind the inner ones. In the end there would be 45 rectangle areas. I would then like to perform some tests whether there are certain spots of interest within the newly defined square areas (probably with a test if a point is in the convex area ) but lets leave that part for now.

My code now looks something like this:

img="the 45 squares ime in the provided link"
imgcorner = ImageCorners[img, MaxFeatures -> (45*4)];
HighlightImage[img, imgcorner ]

I get points on the corners of the squares in the given image, but my problem is in the fact that ImageCorners gives the output is ranked by decreasing measure of corner strength and I don't know how to organize the data in a more meaningful way.

  • 2
    $\begingroup$ Take a look at MorphologicalComponents[ ] and ComponentMeasurements[ ]. Much easier to go from those $\endgroup$ – Dr. belisarius Nov 9 '15 at 22:16
  • 2
    $\begingroup$ boxes = image // Binarize // ColorNegate // ComponentMeasurements[#, "BoundingBox"][[All, 2]] & followed by Graphics[{FaceForm[], EdgeForm[Black], Rectangle @@@ boxes}] to verify the result. $\endgroup$ – Stephen Luttrell Nov 9 '15 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.