Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opencv: Best way to detect corners on chessboard

BACKGROUND

So I'm creating a program that recognizes chess moves. So far, I have implemented a fair number of algorithms to come up with the best results possible. What I've found so far is that the combination of undistorting an image (using undistort ), then applying a histogram equalization algorithm, and finally the goodFeaturesToTrack algorithm (I've found this to be better than the harris corner detection) yields pretty decent results. The goal here is to have every corner of every square accounted for with a point. That way, when I apply canny edge detection, I can process individual squares.

EXAMPLE

enter image description here

WHAT I'VE CONSIDERED

http://www.nandanbanerjee.com/index.php?option=com_content&view=article&id=71:buttercup-chess-robot&catid=78&Itemid=470

To summarize the link above, the idea is to find the upper-leftmost, upper-rightmost, lower-leftmost, and lower-rightmost points and divide the distance between them by eight. From there you would come up with probable points and compare them to the points that are actually on the board. If one of the points doesn't match, simply replace the point.

I've also considered some sort of mode, like finding the distance between neighboring points and storing them in a list. Then I would perform a mode operation to figure out the most probable distance and use that to draw points.

QUESTION

As you can see, the points are fairly accurate over most of the squares (though there are random points that do not do what I want). My question is what do you think the best way to find all corners on the chessboard (I'm open to all ideas) and could you give me a somewhat detailed description (just enough to steer me in the right direction or more if you choose :)? Also, (and this is a secondary question) do you have any recommendations on how to proceed in order to best recognize a move? I'm attempting to implement multiple ways of doing so and am going to compare methods to obtain best results! Thank you.

like image 772
user1243 Avatar asked Dec 17 '14 08:12

user1243


1 Answers

Please read these two links:

http://www.aishack.in/tutorials/sudoku-grabber-opencv-plot/

How to remove convexity defects in a Sudoku square?

like image 90
guneykayim Avatar answered Oct 03 '22 16:10

guneykayim