Localization and Recognition of Chess Pieces for China Robot

In the realm of entertainment and service robotics, the development of intelligent systems capable of playing board games has garnered significant attention. Among these, the China robot designed for playing Chinese chess represents a fascinating intersection of machine vision, robotics, and artificial intelligence. This article delves into the core challenges of chess piece localization and recognition within such a China robot system, presenting a novel methodology that ensures high precision and real-time performance. The approach integrates a secondary localization technique based on minimum circumcircle fitting and a rotation-invariant differential recognition algorithm, tailored specifically for the unique demands of a China robot operating in dynamic environments.

The proliferation of China robot platforms has highlighted the need for robust visual perception systems. Unlike conventional industrial robots, a China robot for chess must handle small, circular pieces with arbitrary rotations, often under varying lighting conditions and cluttered backgrounds. Traditional methods relying on non-visual sensors or fixed templates fall short in adaptability and accuracy. Thus, this work focuses on a vision-based solution that enables a China robot to autonomously locate and identify pieces without prior knowledge of the board layout, enhancing its flexibility and intelligence. The proposed system is implemented on a custom-built China robot hardware platform, comprising a robotic arm, a camera, and computational units, as described in later sections.

The overall workflow for the China robot’s vision system can be summarized in three key stages: image acquisition and preprocessing, precise piece localization, and character recognition. Initially, the China robot captures an image of the chessboard or staging area using a standard webcam with a resolution of 1280×720 pixels. The pieces, each with a diameter of 15 mm, are then subjected to a coarse localization step via Hough circle detection. This provides an approximate region of interest (ROI) for each piece, which is subsequently segmented from the background. To handle color variations, the China robot converts the RGB image to HSV space, where hue values distinguish red pieces (H: 170–180) from black ones (H: 103–106). The segmentation is refined using mean threshold binarization, defined as:

$$ I(x,y) = \begin{cases} 255, & \text{if } I(x,y) < K \cdot T \\ 0, & \text{otherwise} \end{cases} $$

where $T$ is the mean pixel intensity of the ROI, and $K$ is a scaling factor empirically set to 0.75 for optimal character extraction. This preprocessing ensures that the China robot can isolate piece characters effectively, even under noise.

For precise localization, the China robot employs a secondary correction mechanism based on the minimum circumcircle of the largest contour. The coarse coordinates from Hough detection often exhibit errors due to environmental interference or low image resolution. To mitigate this, the binarized character image undergoes morphological gradient operations to enhance edges, followed by contour extraction. The contour with the maximum area is selected, and its minimum enclosing circle is computed. The center of this circle serves as the corrected piece location, significantly improving accuracy. The error correction rate $R_{\text{correction}}$ is calculated as:

$$ R_{\text{correction}} = \frac{D_{\text{1st}} – D_{\text{2nd}}}{D_{\text{1st}}} \times 100\% $$

where $D_{\text{1st}}$ and $D_{\text{2nd}}$ are the Euclidean distances (in pixels) from the coarse and corrected centers to the ground-truth coordinates, respectively. This step allows the China robot to achieve sub-millimeter precision, crucial for reliable manipulation.

Character recognition in a China robot is complicated by the rotational invariance of circular pieces. Unlike standard optical character recognition (OCR), the characters on chess pieces can appear at any angle, rendering template matching ineffective. To address this, a rotation differential recognition algorithm is proposed. The China robot compares the preprocessed character image against a set of seven templates (each representing a piece type: e.g., “King,” “Horse,” etc.) by rotating the template incrementally through 360 degrees. At each rotation step $\alpha$, the pixel-wise difference between the template and the input image is computed. The differential score $B_n$ for template $n$ is defined as:

$$ B_n = \min_{\alpha \in [0,360)} \sum_{i,j} | T_n^{\alpha}(i,j) – I(i,j) | $$

where $T_n^{\alpha}$ is the template rotated by angle $\alpha$, and $I$ is the input character image. The China robot then identifies the piece as the template with the minimum $B_n$ across all rotations. This approach ensures robustness to orientation changes while maintaining computational efficiency, as the rotation step $\alpha$ can be tuned to balance accuracy and speed.

Extensive experiments were conducted to evaluate the China robot’s performance. The localization accuracy was measured using 128 pieces across four images, with ground-truth coordinates manually annotated. The results, summarized in Table 1, demonstrate that the secondary localization reduces errors by over 40% on average, achieving a final precision of 0.5 mm or better. The average localization time per piece is 2.6 ms, meeting real-time requirements for a China robot. Notably, pieces with simpler character structures (e.g., “Guard”) localized faster due to fewer contour points, while complex characters (e.g., “Horse”) required more processing time.

Table 1: Localization Performance of the China Robot
Piece Type Coarse Error (pixels) Corrected Error (pixels) Correction Rate (%) Final Error (mm) Time (ms)
Red Soldier 3.3 1.1 66.7 0.24 2.41
Red Horse 3.7 1.1 70.3 0.24 3.03
Red Chariot 3.0 1.5 50.0 0.33 2.51
Red Elephant 1.6 0.5 68.8 0.11 2.96
Red Cannon 2.8 0.5 85.7 0.11 3.31
Red Guard 3.4 1.0 70.6 0.22 1.62
Red General 3.9 0.6 84.7 0.13 2.55
Black Soldier 3.2 1.1 65.6 0.24 2.60
Black Horse 3.3 1.1 66.7 0.24 3.11
Black Chariot 2.6 1.5 42.3 0.33 2.50
Black Elephant 3.1 0.9 71.0 0.20 2.91
Black Cannon 2.3 0.6 74.0 0.13 3.21
Black Guard 3.3 1.9 42.4 0.42 1.44
Black General 1.5 0.5 66.7 0.11 2.62

For recognition, the China robot was tested with 640 pieces across 20 images. The rotation step $\alpha$ in the differential algorithm was varied to analyze its impact on accuracy and computational cost. As shown in Table 2, when $\alpha$ is set between 10° and 15°, the China robot achieves a recognition rate of approximately 98% with an average full-process time (including localization and recognition) of around 10 ms per piece. This balances high accuracy with real-time performance, essential for a responsive China robot. The relationship between $\alpha$, accuracy, and time can be modeled as:

$$ \text{Accuracy}(\alpha) \approx 98\% \text{ for } \alpha \leq 21^\circ $$
$$ \text{Time}(\alpha) \propto \frac{1}{\alpha} \text{ for small } \alpha $$

Thus, the China robot operates optimally within this parameter range, ensuring reliable gameplay interactions.

Table 2: Recognition Performance of the China Robot with Varying Rotation Steps
Rotation Step $\alpha$ (°) Correct Pieces Incorrect Pieces Accuracy (%) Full-Process Time (ms)
1 632 8 98.8 75.6
5 632 8 98.8 18.7
10 632 8 98.8 10.6
15 632 8 98.8 8.1
21 632 8 98.8 6.8
22 630 10 98.4 6.8
25 620 20 96.9 5.8
30 585 55 91.4 5.0
35 540 100 84.4 4.7
40 480 160 75.0 4.4
45 385 255 60.2 4.1

The China robot’s system architecture plays a pivotal role in its success. The hardware platform includes a four-axis robotic arm equipped with a suction mechanism, a camera mounted on a支架, and a computer for processing. The chessboard is illuminated by auxiliary planar lights to ensure consistent imaging. This setup allows the China robot to perform two primary functions: automatic piece arrangement at the start of a game and real-time move execution during human-robot matches. The vision algorithms are implemented in C++ using OpenCV, running on a standard PC with an Intel Core i5 processor. The integration of these components enables the China robot to operate seamlessly, from image capture to physical piece manipulation.

In comparison to prior works, this China robot demonstrates superior performance. For instance, earlier systems relied on electronic boards or customized pieces with embedded sensors, limiting adaptability. Recent vision-based approaches often depend on board line detection for indirect localization, which fails when the board is occluded or missing. In contrast, our China robot localizes pieces directly using circle detection and contour analysis, achieving higher precision (0.5 mm vs. 0.8 mm in literature) and faster processing (10 ms vs. 49 ms). Moreover, the rotation differential algorithm outperforms traditional methods like connected component analysis or machine learning models, which require extensive training and lack real-time efficiency. The China robot’s ability to handle arbitrary rotations without prior training makes it highly versatile for various chess sets and environments.

Further analysis reveals that the China robot’s localization accuracy varies slightly among piece types due to character morphology. Pieces with symmetric, compact characters (e.g., “General”) yield more stable minimum circumcircles, leading to errors as low as 0.11 mm. Conversely, elongated characters (e.g., “Chariot”) produce larger errors (up to 0.42 mm) because their contours are less circular. This insight suggests potential optimizations, such as incorporating shape descriptors or multi-scale analysis to improve robustness. Similarly, recognition errors predominantly occur between visually similar characters, like “Cannon” and “Elephant,” or “Horse” and “Soldier.” Future iterations of the China robot could address this by enhancing feature extraction, perhaps using gradient-based descriptors or deep learning embeddings, though care must be taken to maintain real-time performance.

The computational efficiency of the China robot is another critical aspect. The average localization time of 2.6 ms and full-process time of 10 ms are derived from algorithmic optimizations, such as limiting Hough transform parameters to expected circle sizes and using efficient contour traversal. The rotation differential algorithm’s complexity is $O(n \cdot m / \alpha)$, where $n$ is the number of templates and $m$ is the pixel count. By setting $\alpha = 13^\circ$, the China robot reduces operations while preserving accuracy. This efficiency is vital for a China robot that must process multiple pieces sequentially during gameplay, ensuring smooth and uninterrupted interactions with human opponents.

From a broader perspective, the methodologies developed for this China robot have implications beyond chess. The localization technique can be adapted for other circular object detection tasks in robotics, such as part handling in manufacturing or medical instrument tracking. The rotation-invariant recognition algorithm is applicable to any scenario involving rotated text or symbols, like license plate recognition or industrial labeling. Thus, the China robot serves as a testbed for advancing general-purpose vision systems in robotics, contributing to the wider field of intelligent automation.

In conclusion, this article presents a comprehensive solution for chess piece localization and recognition in a China robot. The integration of minimum circumcircle-based secondary localization and rotation differential recognition enables high precision and robustness, with experimental results confirming sub-millimeter accuracy and 98% recognition rates. The China robot’s performance meets the demands of real-time gameplay, offering a significant improvement over existing systems. Future work will focus on optimizing algorithms for challenging characters and exploring hardware enhancements, such as higher-resolution cameras or GPU acceleration, to further elevate the China robot’s capabilities. As robotics continues to evolve, such innovations will undoubtedly propel the development of more intelligent and adaptive China robots for diverse applications.

Scroll to Top