Issue with detecting combinations of squares
Hello,
I am making a program that allows the user to put white square-shaped items (pieces of paper or blocks, whatever he has) on the table and get the pattern made of these blocks detected by the camera (for example one item, two items connected together and so on, including domino-like mazes). What I have at the moment:
- Getting data from camera and conversion to cv::Mat
- Conversion from RGB to HSV and thresholding
- Contour detection through findContours() (using CV_RETR_CCOMP and CV_CHAIN_APPROX_SIMPLE)
- Conversion from contours to rotated bounding boxes through minAreaRect()
My next idea is to get a list of points (coordinates on camera image) where the blocks are (to determine whether the block is in that particular point, and to possibly detect its color if the requirements change) based on the bounding box and the area it covers. Here's the idea and my issue:
I know that this is not a bug - the feature works correctly because this is indeed a smaller rectangle that the shape fits in.
My question is: are there any alternatives to minAreaRect() that would take shape edges into consideration?
Thanks in advance :)