Ask Your Question
0

Detect Chessboard on Images/Scans from Books and Newspapers

asked 2013-06-27 12:24:34 -0600

sysrmr gravatar image

Hi.

I want to write a program which takes a scan or photo taken from books/newspaper and detects a chessboard (like this) on it and gives a image of the chessboard (with parallel edges) as output. My idea was to detect the corners of the chessboard an then generate from this the output chessboard.

So i trained a Haar Classifier for each of the corners. For that i wrote a program in Qt to generate positive Images of the Corner (mark the corner on a image, program generates small image with corner in the middle of the image).

Now i have around 120 Images like this for each corner. I also have ~200 Negative Samples consisting of Images of Books with only printed Text, some with small images and some are just the inside of a chessboard without Corners and Edges.

So i trained the Classifier and tested the performance. About the half of the objects were found. But there where around 80.000 false positive.

I know 120/200 Samples are not much but i wanted to know if i am on the right track and the false positives will go away with more positive/negative samples. Or is there another, better way to detect the Corners of the chessboard.

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-06-27 13:25:10 -0600

BeS gravatar image

updated 2013-06-28 06:05:39 -0600

Hi!

You can use the Calibration module for detecting the chessboard in the image. For this function, there findChessboardCorners(...)

upd: for your image, you can adapt the example of opencv / squares. Here is a sample output of the adapted code:

squares

Best regards, BeS

edit flag offensive delete link more

Comments

@sysrmr Did you try? Is it working with your image? I'm very interesting to know!

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-06-27 20:50:21 -0600 )edit

Very nice! After, if you are looking for the position of the pieces, you could unwrap the image to a defined scale and use the template matching algorithm to find which one is it.

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-06-28 06:16:01 -0600 )edit

Wow, thats a suprising "abuse" of a specifc function for something else. I wonder when they add findCarWheels().

SR gravatar imageSR ( 2013-06-28 17:44:16 -0600 )edit

Thank you for your answer. I didn't have much time the last few days and will not the next few days, i had just enough time to try out your suggestion. I adapted the opencv Squares sample. Now i get 0 to max 30 detected Squares for the different images. Most of the times the squares are nearly the same. Just a little bit bigger/smaller then the chessboard. Only on a few images there is a big square detected which isn't the chessboard. Now i don't know how do minmize the output to 1 square or how to find out which of the squares is the best approx. for the chessboard. Any suggestions for that? Or will that just be solved if I play around a little bit more with the code (as soon as i have time i will).

sysrmr gravatar imagesysrmr ( 2013-07-08 15:25:50 -0600 )edit

Question Tools

Stats

Asked: 2013-06-27 12:24:34 -0600

Seen: 3,743 times

Last updated: Jun 28 '13