How to recognize rectangles in this image?

Opencv (image processing and computer vision library written in c) has implementation for hough transform (the simple hough transform find lines in an image, while the generalized one finds more complex objects) so that could be a good start. For the rectangles which do have closed corners there are also corner detectors such as cornerHarris which can help.

I ran the houghlines demo provided with opencv and here’s the result on the image you gave (detected lines marked in red):
alt text
(source: splintec.com)

Leave a Comment