Close

Board recognition

A project log for Automatic checkers

Who said you can't play with computer without screen? http://youtu.be/ak5qOJ-Esc4

gregggregg 04/27/2014 at 22:130 Comments

Hello, hello!

To detect pawns we decided to use android camera (with IP Webcam app - it's very good by the way). Phone was mounted over the board to have clear view of situation on it. As light source we have used built-in LED.

The board with mounted camera:

First of all, we have made a board recognition algorithm, using openCV and python (it is really faster to write code in python than in C++, especially in openCV where types names are so "strange"...).

Rukia designed the algorithm and Gregg implemented it:

- crop and transform image to square board of constant size (600x600 px),

- splits it into separate fields,

- for every field:

a) applies median blur,

b) applies Gaussian blur,

c) applies Canny edge-detector,

d) search for circle using Hough method,

e) if the circle was detected it threshold the image and then recognize color of the pawn (it depends of white pixels in threshold image)


Then build an array of field to pass it forward to game logic.

Board after transformation with marked detected pawns:

And the same board after edge detector:

Whole algorithm written in python is on GitHub

Discussions