Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

My suggestion is to do something like THIS tutorial or use a line segment detector or HoughLinesP to extract just the horizontal and vertical lines. Then search to find the ones that make boxes. If they are within a certain range of aspect ratios, they could be the sides of one of your boxes.

Resize and warp the resulting box face so it's a square image of a consistent size, say 256x256. Then use cv::moments and cv::HuMoments to calculate a descriptor and if the moments are similar, they're probably the same box.