I\'m trying to use OpenCV to \"parse\" screenshots from the iPhone game Blocked. The screenshots are cropped to look like this:
Since your problem is the small rectangles I would start by removing them. Since those lines are much thinner than the borders of the rectangles I would start by applying morphological operations on the image.
Using a structural element that looks like this:
element = [ 1 1
1 1 ]
should remove lines that are less than two pixels wide. After the small lines are removed the rectangle finding algorithm of OpenCV will most likely do the rest of the job for you.
The erosion can be done in OpenCV by the function cvErode