Chessboard coordinates determination

Fig. 4.3.1

Chess is an exciting game that has been gaining popularity every year. When analyzing over-the-board games, mobile apps such as Chessify can scan the physical board and convert it into a digital representation. With the limited resolution of the quadcopter's camera, however, we recognize that it is not possible to develop feature extraction algorithms on our own for identifying the chess pieces and their precise coordinates on a physical chessboard. Instead, we aim to develop an algorithm for determining the precise coordinates of all of the 64 squares themselves on a chessboard (and we refer to the algorithm as "chessboard coordinates calculator").

Our objective in this task is to develop an algorithm that reads an image as input and outputs either

an image in which the exact coordinates are labeled on top of each chess square on the chessboard (if the input image contains an identifiable chessboard) or

an all-black image indicating the absence of an identifiable chessboard in the input image (if the input image does not contain an identifiable chessboard).

(For some assumed knowledge about the chessboard and its coordinates, see Chess Terms - Chess.com.)

A typical input image is shown on the right. The algorithm we have developed is intended for the case where the chessboard does not have any piece on it. However, we collected images of chessboards with pawns on them as well (which made us realize that the resolution was not nearly fine enough for piece identification), and, as we will briefly demonstrate below, our algorithm also occasionally works when there is a pawn on the chessboard.

Fig. 4.3.2

We note that as we conducted our initial research, we found numerous existing chessboard algorithms (such as OBTAIN CHESS MOVES WITH IMAGE PROCESSING and An Extremely Efficient Chess-board Detection for Non-trivial Photos). However, these algorithms appear to be designed for more advanced tasks (such as identifying chess pieces on the board) and thus do not contain enough details as to how to implement the more foundational task of identifying the chessboard itself. Moreover, the complexity of a typical algorithm we find online is likely beyond the scope of our project. Therefore, we decided to develop an algorithm on our own. The source code for our algorithm can be found in this GitHub repository.

Our strategy consists of four stages: segmentation of the chessboard, segmentation of the connected squares, separation of the connected squares, and determination of coordinates. In the interest of space, we present the details of the algorithms for these stages in the hyperlinks. Below, we demonstrate the performance on our algorithm on various input images.

Fig. 4.3.3

Performance demonstration

We present the results of our chessboard coordinates determination algorithm when it is applied to different images. We note that we have tested our algorithm on hundreds of images, but for the purpose of illustration, we will only show a select few that represent the typical images.

Fig. 4.3.4

Fig. 4.3.5

Fig. 4.3.6

Fig. 4.3.7

Fig. 4.3.8

Fig. 4.3.9

Fig. 4.3.10

Fig. 4.3.11

Fig. 4.3.12

Fig. 4.3.13

The results above appear to suggest that our algorithm can reliably determine the coordinates of the squares most of the time when the lighting conditions are normal. When there is severe glare in the image, however, as in sample image 8, our algorithm could struggle to correctly distinguish the light squares from the dark squares. In addition, as in sample image 10, the presence of a white pawn on a dark square could also pose a challenge to our algorithm. We consider our four-stage algorithm to be highly sophisticated for the scope of our project, but overcoming these challenges would require even more sophisticated algorithms than the one we developed.