Raspberry Pi and OpenCV
One of the most important features of our software system was recognizing the state of the board so that the robot can process the game state and make its next move. We used openCV which is a module that is widely used for image processing. We used a camera module of the Raspberry Pi as our camera.
OpenCV is used to find the contour of the images taken by the robot. Finding the contour determined the boundary of the pieces and the board in the image.
By observing the contour lines and areas, we were able to determine the position of the checker pieces and the board, as shown in the image on the right. Because the board is a big square piece in the image, it contains a large area. We can easily find the center point and the corner point of the board area and these points are used to create the virtual board in terms of image coordinates.
The pieces were also determined by the area. Since all of the checker pieces are homogeneous, we can search for a range of area to find the location of the pieces. Unfortunately, for some strange reasons the color detection did not work on pictures taken by the picamera.
We taped a triangle shape on the red piece to detect the human’s pieces by different shape compared to the robot’s checker pieces. The robot detects the human’s move by taking a picture of the board before and after the human moves and compares the change to make its next move.