Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

So, I shall assume you can isolate just the blocks and their contours. Before you do minAreaRect, you should analyze the contours. Since you have just the edges of the boxes, you can estimate the rotation needed to make them vertical and horizontal lines.

Then rotate the image to make the edges vertical and horizontal. Your bounding box is then a tight, non rotated box around the contours, which should be simple.