Chessboard format

It’s reasonable to describe the chessboard format.  It’s relevant because not all chessboard dimensions are valid,  The current implementation only detects 6 colors and there needs to be a black margin around the chessboard (among other reasons).

Chessboard dimensions:

We need to accurately detect the position of every square from every direction.  This is not possible with a symmetric chessboard because one corner can be confused with its opposite.  This becomes relevant when extracting the binary information contained in the chessboard.  Instead of 0001, one could extract 1000.  To avoid this we need a chessboard that has one side with an even number of intersections and the other with an uneven number of intersections.  As you can see from the image (10intersections X 7intersections), the checkered characteristic generates a chessboard that has no equal sides.

Counting sides:

The image has a chessboard that is 11 squares by 8 squares.  But this is irrelevant to the algorithm.  It cares about the square intersections as opposed to the squares themselves.  The reasoning behind this is found in the cvFindChessboardCorners function in opencv.  It takes number of intersections instead of corners.  If you are curious go to [1].  This is not as bad as it seems.  The simple way of calculating the -cS and -cs [2] is to subtract one from each square count.  Finally notice that the image in this post contains 10×7 intersections.

Chessboard Colors:

At the moment we are using only 9 colors: red, yellow, green, cyan, blue, magenta, black and white.  White and black are dead colors in the sense that no information is contained in them.  They are there to delimit the other colors.  The contrast that the black squares make against the colored squares allows the algorithm to find the chessboard. The algorithm uses an 8 bit HSV format.  In this format the colors are represented in a cylinder [3]. I chose 6 points in the cylinder as shown in [4] and used those colors to represent bits.

Bit Representation:

Every square that contains a color other than black or white has data.  Each one contains three binary states represented by the three “main” colors (red, green and blue).  If the square is of one of the “main” colors, it will have one bit on and the rest off.  If the square is blue, it will have the blue bit on and the other two off.  On the other hand, if the square is of an “intermediate” (yellow, cyan or magenta), then two bits will be on and the remaining will be off.  If the square is yellow, it will have the red and green bits on and the blue off.  Theoretically if the square is white, all the bits are on.  Though the white square is non functional yet, I don’t see a reason why it shouldn’t work :)

Known squares:

Different lighting situations change the hue value in the HSV format.  This in turn increases error.  To avoid this we have 6 known positions where we put all the used colors [4].  With these known positions we can pre-set the hue ranges and increase the accuracy of the detection.  The known positions start at the top left corner of the image.  Remember that this position can be known even though the chessboard is rotated.

Black margin:

I have already mentioned the reasoning behind the margin in my previous post.  It basically increases the detection accuracy.

[1] Learning Opencv, Gary Bradski & Adrian Kaeblre, page 381
[2] https://github.com/Joelgranados/imagelabel/blob/master/ia_input.cpp#L48
[3] http://en.wikipedia.org/wiki/HSL_and_HSV
[4] http://upload.wikimedia.org/wikipedia/commons/a/ad/HueScale.svg
Advertisements

About joelgranados

I'm fascinated with how technology and science impact our reality and am drawn to leverage them in order to increase the potential of human activity.
This entry was posted in opencv, PhD. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s