7. The VISION software

Following on from the discussion on page  5 - Software for move recognition :

We can now consider the image in terms of chessboard squares. On the initial board set-up we know where all the white and black pieces are and where the empty squares are.

Empty squares have much less variation in colour than have occupied squares. We compute the standard deviation for each of the three RGB colours for each square across all its pixels (other than those near the borders of the square). The maximum standard deviation for any empty square is much less than the minimum standard deviation for any occupied square, and this allows us, after a subsequent player move, to determine which squares are empty.

Having determined the threshold value for empty versus occupied squares, we now need to determine the piece colour for occupied squares:

On the initial board we calculate for each white square, for each of R, G, B, the mean (average) value of its pixels (other than those near the borders of the square). The minimum of these means for any white square is greater than the maximum of the means across any black square, and so we can determine the piece colour for occupied squares.

As stated previously, this is all we need to do in order to determine what the human player's move was.

The algorithms works best if the chessboard has a colour that is a long way from the colour of the pieces! In my robot, the pieces are off-white and brown, and the chess board is hand-made in card, and is a light green with little difference between the "black" and "white" squares.

Please leave a comment on the blog if you want to know more.

No comments:

Post a Comment

Intro

I have built a chess robot using Lego and Raspberry Pi . I have placed an improved description of the robot at  Chess Robot Made With LEGO...