Chessboard recognition and calibration method for complex scenes and device used by the method
Patent Information
- Application Number
- CN202511690807.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2045-11-18
AI Technical Summary
该方法的主要缺陷在于:对理想的直线特征依赖性极强,一旦棋盘存在物理形变(如纸张褶皱、书本曲面导致的非线性畸变),或因拍摄角度造成严重透视,霍夫变换等直线检测算法便会失效,无法构建准确的网格,导致识别失败;而对于非线性扭曲的网格棋盘,采用全局直线矫正过程困难,效果不佳
[0016] Compared with existing technologies, this invention, due to its aforementioned structure, offers the following advantages: First, it boasts strong robustness and wide applicability: In addition to its excellent recognition and correction effects on chessboards, this solution also excels in recognizing and correcting grid-like objects. Through a "dual-path feature extraction and intelligent fusion" strategy, it combines high precision and high robustness. The iterative interpolation algorithm, employing a "minimum gap priority" strategy, ensures that the grid reconstruction process starts from the most information-dense and reliable region, progressively reducing errors and guaranteeing the global smoothness and local accuracy of the final grid completion. Second, it is low-cost and highly efficient: By adopting a "functional separation" approach, the complex whole-board recognition task is decomposed into independent corner detection and piece classification sub-tasks, significantly reducing data labeling and model training costs, and providing greater flexibility for model re-labeling. First, it offers several advantages: 1) Convenience and ease of use, significantly reducing the time and difficulty of model accuracy iteration; 2) High accuracy and reliable results: Employing a deep learning model, it achieves high-precision modeling of complex nonlinear relationships. The target detection model learns abstract features from massive amounts of data to accurately capture the global nonlinear contour of the chessboard, while the image classification model accurately identifies the core features of different pieces, avoiding interference from distortion and blurring that could lead to missing or offset pixels; 3) Flexible and practical solutions: Instead of traditional global straight-line correction, it uses a global target detection model to locate corner points and a local image classification model to identify the cropping results. This eliminates the need for global straight-line correction, providing two recognition processes for different scenarios. It can efficiently process regular chess scores and overcome distortion problems, ensuring both recognition effectiveness and operational efficiency.
Smart Images

Figure CN121305043B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision and deep learning technology, and relates to a chessboard recognition and calibration method for complex scenes and the apparatus used in the method. Specifically, it relates to a chessboard image state recognition and correction method based on deep learning function separation and the apparatus used in the method. Background Technology
[0002] With the development of artificial intelligence technology, the use of computer vision to automatically identify Go board images and digitize them into game record files has become an important requirement in fields such as game record recording, online game analysis, and Go AI research.
[0003] Currently, there are several main technical solutions for chessboard recognition. The first is based on traditional computer vision methods. These methods typically use algorithms such as the Hough Transform to detect the straight lines of the chessboard grid and then correct it using perspective transformation. The main drawback of this method is its strong dependence on ideal straight line features. Once the chessboard has physical deformation (such as nonlinear distortion caused by paper wrinkles or the curved surface of a book), or severe perspective distortion due to the shooting angle, the Hough Transform and other straight line detection algorithms will fail, making it impossible to construct an accurate grid and leading to recognition failure. Furthermore, for nonlinearly distorted grid chessboards, the global straight line correction process is difficult and ineffective. The second method is based on single end-to-end deep learning. This type of method attempts to train a large neural network to directly output the state of the pieces at each intersection point from the input image end-to-end. The main drawbacks of this method are: First, it is highly dependent on data and has high annotation costs, requiring massive amounts of pixel-level labeled data covering various scenarios (e.g., labeling each of the 361 points in an image), making dataset construction extremely difficult and expensive; Second, its generalization ability and robustness are limited, as the model structure is complex and it is prone to poor performance in scenarios not covered by the training data (such as specific fuzzy types or distortion forms), making it difficult to guarantee generalization ability; Third, the training cost is high, as training such a complex model requires huge computational resources and time.
[0004] Regardless of the method mentioned above, current approaches generally suffer from a series of technical bottlenecks when processing chessboard images in non-ideal, complex scenarios (especially those with nonlinear physical deformation and piece blur), including poor robustness, high data costs, and the inability to effectively correct local distortions. To address these challenges, the applicant has developed a beneficial design, and the technical solution described below arose from this context. Summary of the Invention
[0005] The primary objective of this invention is to provide a chessboard recognition and calibration method for complex scenarios. This method integrates the global localization capability of deep learning with the fine geometric analysis capability of multi-scale computer vision, enabling it to accurately reconstruct chessboard grids with nonlinear distortions in a low-cost and robust manner, and to identify the state of the chess pieces on them.
[0006] Another objective of this invention is to provide an apparatus for a chessboard recognition and calibration method for complex scenarios, which can ensure the full realization of the technical effect of the chessboard recognition and calibration method for complex scenarios.
[0007] The primary objective of this invention is to provide a chessboard recognition and calibration method for complex scenarios, comprising the following steps: S1) Preprocess the input chessboard image to obtain a binarized image, and use at least two different sizes of morphological kernels to perform morphological operations on the binarized image in parallel to obtain a first candidate point set and a second candidate point set respectively. The first candidate point set is used as a high-precision point set, and the second candidate point set is used as a high-robust point set. S2) The trained target detection model is used to process the input chessboard image to identify and locate the four global corner points of the chessboard; S3) Reconstruct four high-precision boundary lines of the chessboard based on the first candidate point set, and obtain the internal anchor points of the chessboard based on the second candidate point set; S4) Integrate all grid points on the high-precision boundary line with the internal anchor points to form a fused anchor point set; use a geometric projection algorithm to determine the logical row and column coordinates of each anchor point in the fused anchor point set on the chessboard, and construct a sparse logical coordinate grid. S5) Based on the sparse logical coordinate grid, an iterative interpolation algorithm is used to fill in all the missing grid coordinates to obtain a complete chessboard grid containing the physical coordinates of all grid points. S6) Based on the coordinates of each anchor point in the complete chessboard grid, crop out the corresponding image block on the chessboard image, classify it using a trained image classification model to determine the state of the chess piece at each anchor point, and generate a chess score file. S7) Visualize the state of the pieces on the graphical user interface and receive correction instructions from the user for incorrect corner points or piece states in order to update the game record file.
[0008] In a specific embodiment of the present invention, in step S1), multi-scale morphological operation is performed according to the recognition mode. The recognition mode includes a first recognition mode and a second recognition mode. The first recognition mode is applicable to highly blurred chessboard images without obvious nonlinear distortion, and the second recognition mode is applicable to chessboard images with obvious nonlinear distortion. If the second recognition mode is selected, the input chessboard image is preprocessed to obtain a binarized image.
[0009] In another specific embodiment of the present invention, step S2) includes the following steps: S21) Scale the input chessboard image and fill it to a preset standardized size; S22) A target detection model trained on a convolutional neural network is used to process the standardized image to output the bounding boxes of the four global corner points of the chessboard; S23) Post-process the bounding box to calculate its center point coordinates, and reverse the center point coordinates from the coordinate system of the normalized image back to the original coordinate system of the chessboard image to obtain the final global corner points.
[0010] In yet another specific embodiment of the present invention, step S3) includes the following steps: S31) If the second recognition mode is executed, calculate the best-fit quadrilateral based on the first candidate point set; S32) Select points in the first candidate point set whose distance from each side of the best-fit quadrilateral is less than a first preset threshold as boundary anchor points, and reconstruct the four high-precision boundary lines of the chessboard based on the boundary anchor points. S33) Select points in the second candidate point set whose distance from each side of the best-fit quadrilateral is greater than a second preset threshold as internal anchor points.
[0011] In another specific embodiment of the present invention, in step S4), the geometric projection algorithm calculates the distance from each internal anchor point to all horizontal and vertical lines in the coordinate network using a bilinear interpolation algorithm, and selects the closest row and column combination as its logical coordinates.
[0012] In another specific embodiment of the present invention, step S5) includes the following steps: S51) If the second identification mode is executed, then based on the sparse logical coordinate grid constructed in step S4), in each iteration, the size of the logical coordinate gap between all adjacent known point pairs in the row direction and column direction is detected and calculated. S52) Sort the points according to the size of the logical coordinate gaps, and prioritize linear interpolation between the pair of known points with the smallest gaps to fill in the missing grid point physical coordinates. S53) After each interpolation, update the sparse logical coordinate grid and repeat steps S51) and S52) until all missing grid points are filled in to obtain a complete chessboard grid.
[0013] In a further specific embodiment of the present invention, step S6) includes the following steps: S61) If the first recognition mode is executed, the complete chessboard grid is calculated by bilinear interpolation algorithm based on the global corner points obtained in step S2). S62) Based on the coordinates of each grid point in the complete chessboard grid, crop out the corresponding image block on the chessboard image with the coordinates as the center; S63) The image blocks are uniformly scaled to a preset size and input into an image classification model trained on a convolutional neural network for processing, so as to output the classification result of whether it is a black piece, a white piece or no piece; S64) Summarize the classification results of all grid points and generate a standard chess notation file.
[0014] Another objective of the present invention is achieved by providing an apparatus for a chessboard recognition and calibration method for complex scenarios, comprising: The preprocessing module is used to preprocess the input chessboard image and employs parallel operations of at least two different morphological kernel sizes to obtain a first candidate point set and a second candidate point set. The global localization module is equipped with a target detection model to process the input chessboard image in order to identify and locate the global geometric anchor points of the chessboard. The grid reconstruction module, based on the global geometric anchor points, calculates and reconstructs the complete grid coordinates of the chessboard using a geometric reconstruction algorithm. The chess piece recognition module is equipped with an image classification model, which is used to determine the state of each chess piece at each grid point based on the complete grid coordinates and generate a chess notation file. In a further specific embodiment of the present invention, the target detection model and the image classification model are independent models with separate functions. The target detection model is a corner detection model that identifies and outputs the bounding boxes of the global geometric corners. The image classification model is a chess piece classification model that classifies the cropped image blocks into three states: black pieces, white pieces, or no pieces.
[0015] In yet another specific embodiment of the present invention, the grid reconstruction module is configured to, when the chessboard image has nonlinear distortion, use a global target detection model to locate corner points, integrate morphological algorithms and iterative interpolation algorithms to complete the global anchor points, and use the image classification model locally to identify the cropping results, without performing straight line correction on the global image.
[0016] Compared with existing technologies, this invention, due to its aforementioned structure, offers the following advantages: First, it boasts strong robustness and wide applicability: In addition to its excellent recognition and correction effects on chessboards, this solution also excels in recognizing and correcting grid-like objects. Through a "dual-path feature extraction and intelligent fusion" strategy, it combines high precision and high robustness. The iterative interpolation algorithm, employing a "minimum gap priority" strategy, ensures that the grid reconstruction process starts from the most information-dense and reliable region, progressively reducing errors and guaranteeing the global smoothness and local accuracy of the final grid completion. Second, it is low-cost and highly efficient: By adopting a "functional separation" approach, the complex whole-board recognition task is decomposed into independent corner detection and piece classification sub-tasks, significantly reducing data labeling and model training costs, and providing greater flexibility for model re-labeling. First, it offers several advantages: 1) Convenience and ease of use, significantly reducing the time and difficulty of model accuracy iteration; 2) High accuracy and reliable results: Employing a deep learning model, it achieves high-precision modeling of complex nonlinear relationships. The target detection model learns abstract features from massive amounts of data to accurately capture the global nonlinear contour of the chessboard, while the image classification model accurately identifies the core features of different pieces, avoiding interference from distortion and blurring that could lead to missing or offset pixels; 3) Flexible and practical solutions: Instead of traditional global straight-line correction, it uses a global target detection model to locate corner points and a local image classification model to identify the cropping results. This eliminates the need for global straight-line correction, providing two recognition processes for different scenarios. It can efficiently process regular chess scores and overcome distortion problems, ensuring both recognition effectiveness and operational efficiency. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the functional modules of the present invention; Figure 2 This is a schematic diagram showing the result of the target detection model identifying global corner points mentioned in step S2) of the present invention; Figure 3 This is a schematic diagram of the results of the present invention in the first recognition mode; Figure 4a This is the original image of the standard chessboard used in this invention before recognition; Figure 4b To Figure 4a A schematic diagram of the final recognition result; Figure 5 This is a schematic diagram of the binarized image obtained by preprocessing the input chessboard image in step S1) of the present invention. Figure 6a This is a high-precision horizontal line graph extracted using a small kernel during multi-scale feature extraction in step S1) of the present invention. Figure 6b This is a high-precision vertical line image extracted using a small kernel during multi-scale feature extraction in step S1) of the present invention. Figure 7a This is a robust horizontal line graph extracted using a large kernel during multi-scale feature extraction in step S1) of the present invention. Figure 7b This is a robust longitudinal line graph extracted using a large kernel during multi-scale feature extraction in step S1) of the present invention. Figure 8a This is a schematic diagram of the first candidate point set obtained from multi-scale features in step S1) of the present invention; Figure 8b This is a schematic diagram of the second candidate point set obtained from multi-scale features in step S1) of the present invention; Figure 9 This is a schematic diagram of the complete chessboard mesh for the final completion of sparse anchor points on a distorted chessboard according to the present invention; Figure 10a This is a schematic diagram of the nonlinear distortion chessboard used in this invention before recognition. Figure 10b for Figure 10a A schematic diagram of the final result of the recognition process. Detailed Implementation
[0018] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings. However, the description of the embodiments is not a limitation on the technical solution. Any formal but not substantive changes made based on the concept of the present invention should be considered within the scope of protection of the present invention.
[0019] In the following description, all directional (or orientational) concepts involving up, down, left, right, front, and back refer to the position of the figure being described, and are intended to facilitate public understanding. Therefore, they should not be construed as a special limitation on the technical solution provided by this invention.
[0020] This invention relates to a chessboard recognition and calibration method and apparatus for complex scenarios, aiming to solve the problems of poor robustness and high data cost in existing technologies when processing chessboard images in complex scenarios with nonlinear distortions (such as curved surfaces of books or wrinkled paper) or image blur. This invention, through a "functional separation" design, decomposes the recognition task into global localization and local state classification handled by different deep learning models. Furthermore, for nonlinear distortion scenarios, it employs a geometric reconstruction algorithm of "dual-path feature fusion and iterative interpolation" to achieve high-precision and high-efficiency chessboard state recognition.
[0021] The chessboard recognition and calibration method for complex scenarios includes the following seven steps.
[0022] S1) The input chessboard image is preprocessed to obtain a binarized image. At least two different morphological kernel sizes are used to perform parallel morphological operations on the binarized image to obtain a first candidate point set and a second candidate point set. The first candidate point set is used as a high-precision point set, and the second candidate point set is used as a high-robust point set. In step S1), multi-scale morphological operations are used according to the recognition mode. The recognition mode includes a first recognition mode and a second recognition mode. The first recognition mode is suitable for highly blurred chessboard images without obvious nonlinear distortion, and the second recognition mode is suitable for chessboard images with obvious nonlinear distortion. If the first recognition mode is selected, only steps S2) and S6) are performed. If the second recognition mode is selected, all steps S2) to S7) are performed.
[0023] Furthermore, this step S1) is mainly performed under the second recognition mode (distorted recognition process). First, as... Figure 5 As shown, the input chessboard image is first preprocessed, including converting it to grayscale, blurring it with a Gaussian filter (e.g., kernel size 5x5) to suppress noise, and finally obtaining a binarized image that clearly highlights the lines using an adaptive thresholding method. Then, as... Figure 6a and Figure 6b As shown, a small first morphological kernel (e.g., a rectangular kernel with a length of 3 pixels) is used to perform morphological opening operations in the horizontal and vertical directions on the binarized image to extract high-precision horizontal and vertical lines. Meanwhile, as... Figure 7a and 7b As shown, the same operation is performed in parallel using a larger second morphological core (e.g., a rectangular core with a length of 12 pixels). Due to the large core size, it can effectively bridge line breaks caused by piece occlusion, thereby extracting robust horizontal and vertical lines with good continuity but slightly lower precision. Next, referring to... Figure 8a and Figure 8b By calculating the intersection points of the high-precision lines and the high-robustness lines, the first candidate point set and the second candidate point set are obtained respectively.
[0024] S2) The trained object detection model is used to process the input chessboard image to identify and locate the four global corner points of the chessboard. Further, step S2) includes the following steps: S21) Scale the input chessboard image and fill it to a preset standardized size; S22) A target detection model trained on a convolutional neural network is used to process the standardized image to output the bounding boxes of the four global corner points of the chessboard; S23) Post-process the bounding box to calculate its center point coordinates, and reverse the center point coordinates from the coordinate system of the normalized image back to the original coordinate system of the chessboard image to obtain the final global corner points.
[0025] Please refer to Figure 2 Regardless of the recognition mode, step S2) is performed. The trained object detection model is a convolutional neural network-based object detection model, such as the Mask R-CNN model trained on the Detectron2 framework. To handle input images of different sizes, the system first standardizes the input chessboard image before feeding it into the model. By learning the high-level semantic features of the chessboard corner points under various lighting and angles, the model can robustly output the bounding boxes of the four global corner points of the chessboard. The system obtains high-precision global corner point positions by calculating the coordinates of the center point of the bounding boxes. These corner points provide highly robust global geometric constraints and scale benchmarks for all subsequent geometric analyses.
[0026] S3) Reconstruct four high-precision boundary lines of the chessboard based on the first candidate point set, and obtain the internal anchor points of the chessboard based on the second candidate point set. Further, step S3) includes the following steps: S31) If the second recognition mode is executed, calculate the best-fit quadrilateral based on the first candidate point set; S32) Select points in the first candidate point set whose distance from each side of the best-fit quadrilateral is less than a first preset threshold as boundary anchor points, and reconstruct the four high-precision boundary lines of the chessboard based on the boundary anchor points. S33) Select points in the second candidate point set whose distance from each side of the best-fit quadrilateral is greater than a second preset threshold as internal anchor points.
[0027] This step follows the principle of "specialized division of labor" to achieve complementary advantages. First, based on the first candidate point set, which serves as a high-precision point set, the system calculates its best-fit quadrilateral and selects points whose distances to each side of this quadrilateral are less than a preset threshold as "boundary anchor points." Then, using a line segment reconstruction algorithm, the four high-precision boundary lines of the chessboard are accurately reconstructed based on these boundary anchor points. Second, based on the second candidate point set, which serves as a highly robust point set, the system selects all "internal anchor points" located inside the chessboard and far from the boundaries. S4) Integrate all grid points on the high-precision boundary line with the internal anchor points to form a fused anchor point set; use a geometric projection algorithm to determine the logical row and column coordinates of each anchor point in the fused anchor point set on the chessboard, constructing a precise sparse logical coordinate grid. The geometric projection algorithm here calculates the distance from each internal anchor point to all horizontal and vertical lines in the coordinate network using bilinear interpolation, and selects the closest row and column combination as its logical coordinates.
[0028] Specifically, step S4) integrates all grid points on the reconstructed boundary lines from step S3) with the acquired internal anchor points. Then, a geometric projection algorithm is used to determine the logical row and column coordinates of each anchor point on the chessboard. For example, for each internal anchor point on a 19x19 chessboard, its projected distance to the 19 reconstructed horizontal and 19 vertical boundary lines is calculated, and the row and column number closest to it is taken as its logical coordinates. Thus, a sparse anchor point coordinate system is constructed, containing the physical coordinates of some grid points and their corresponding logical coordinates.
[0029] S5) Based on the sparse logical coordinate grid, an iterative interpolation algorithm is used to complete all missing grid point coordinates, resulting in a complete chessboard grid containing the physical coordinates of all grid points. Further, step S5) includes the following steps: S51) If the second identification mode is executed, based on the sparse logical coordinate grid constructed in step S4), in each iteration, the logical coordinate gap size between all adjacent known point pairs in the row direction and column direction is detected and calculated, and the logical coordinate network is used to replace the actual distance to simplify the distance calculation. S52) Sort the points according to the size of the logical coordinate gaps, and prioritize linear interpolation between the pair of known points with the smallest gaps to fill in the missing grid point physical coordinates. S53) After each interpolation, update the sparse logical coordinate grid and repeat steps S51) and S52) until all missing grid points are filled in to obtain a complete chessboard grid.
[0030] Reference Figure 9 Step S5) aims to accurately complete all missing grid points based on the sparse anchor point coordinate system constructed in step S4). The system initiates an iterative interpolation algorithm. In each iteration, the algorithm detects the gaps between all known anchor points and prioritizes linear interpolation at the position with the smallest gap (i.e., the most reliable). This process is repeated cyclically, gradually and dynamically completing the entire chessboard grid until a complete chessboard grid containing the coordinates of all 361 anchor points is obtained.
[0031] S6) Based on the coordinates of each anchor point in the complete chessboard grid, crop the corresponding image patch from the chessboard image, classify it using a trained image classification model to determine the piece state of each anchor point, and generate a chess notation file. Further, step S6) includes the following steps: S61) If the first recognition mode is executed, the complete chessboard grid is calculated by bilinear interpolation algorithm based on the global corner points obtained in step S2). S62) Based on the coordinates of each grid point in the complete chessboard grid, crop out the corresponding image block on the chessboard image with the coordinates as the center; S63) The image blocks are uniformly scaled to a preset size and input into an image classification model trained on a convolutional neural network for processing, so as to output the classification result of whether it is a black piece, a white piece or no piece; S64) Summarize the classification results of all grid points and generate a standard chess notation file. After obtaining the complete chessboard grid (whether through the first recognition pattern) Figure 3 Or is it the second recognition mode? Figure 9 The system uses the coordinates of each grid point to crop corresponding image patches from the original chessboard image, centered at those coordinates. These image patches are uniformly scaled to a preset classification size (e.g., 36x36 pixels) and fed into a specialized image classification model. This classification model is also based on a convolutional neural network and is specifically trained to perform high-precision classification of small image patches, such as classifying them into black pieces, white pieces, and no pieces. Figure 4a and Figure 4b This example demonstrates the situation where a highly blurred image exists. Figure 4a The image before recognition is highly blurred, and Figure 4b For the recognized image, based on the original image, a smaller image of each chess piece is marked on each piece to show the recognition result at this anchor point. Figure 10a and Figure 10b This embodiment demonstrates a chessboard image with severe nonlinear distortion, wherein... Figure 10a The original intensity distortion map before identification. Figure 10b The image shows the recognition results. The final recognition result after processing shows that the states of all pieces have been accurately identified.
[0032] S7) Provides a graphical user interface for visualization and interactive correction. Specifically, it visualizes the state of all pieces on the graphical user interface and receives correction instructions from the user for incorrect corner points or piece states to update the game record file, thereby ensuring a 100% accurate final result under any circumstances.
[0033] Further details can be found here. Figure 1 The present invention also relates to an apparatus for a chessboard recognition and calibration method for complex scenarios, comprising: a preprocessing module for preprocessing an input chessboard image and employing at least two different morphological cores in parallel operation to obtain a first candidate point set and a second candidate point set; a global localization module configured with a target detection model for processing the input chessboard image to identify and locate the four global corner points of the chessboard; a mesh reconstruction module for calculating and reconstructing a complete chessboard mesh containing the physical coordinates of all grid points based on the sparse logical coordinate mesh using a geometric reconstruction algorithm; and a piece recognition module configured with an image classification model for determining the piece state of each grid point according to the complete chessboard mesh and generating a chess notation file.
[0034] Furthermore, the target detection model and the image classification model are functionally separate independent models. The target detection model is a corner detection model that identifies and outputs the bounding box or center point coordinates of the global geometric anchor points. The image classification model is a chess piece classification model that classifies the cropped image blocks into three states: black pieces, white pieces, or no pieces. The mesh reconstruction module is configured to, when the chessboard image exhibits nonlinear distortion, globally use the target detection model to locate corner points, integrate morphological algorithms and iterative interpolation algorithms to complete the global anchor points, and locally use the image classification model to identify the cropping results, without performing global straight-line correction. Compared to traditional schemes that use global straight-line correction, this invention globally uses the target detection model to locate corner points and locally uses the image classification model to identify the cropping results, eliminating the need for global straight-line correction. It provides two recognition processes for different scenarios, efficiently processing regular chess scores while overcoming distortion challenges. It ensures both recognition effectiveness and operational efficiency, thus achieving the invention's objective.
Claims
1. A chessboard recognition and calibration method for complex scenarios, characterized in that, Includes the following steps: S1) The input chessboard image is preprocessed to obtain a binarized image. A smaller first rectangular morphological kernel is used to perform morphological opening operations in the horizontal and vertical directions on the binarized image to extract high-precision horizontal and vertical lines. The first candidate point set is obtained as the high-precision point set by calculating the intersection points of the high-precision horizontal and vertical lines. At the same time, a larger second rectangular morphological kernel is used to perform morphological opening operations in the horizontal and vertical directions on the binarized image to extract highly robust horizontal and vertical lines. The second candidate point set is obtained as the highly robust point set by calculating the intersection points of the highly robust horizontal and vertical lines. S2) The trained target detection model is used to process the input chessboard image to identify and locate the four global corner points of the chessboard; S3) Reconstruct four high-precision boundary lines of the chessboard based on the first candidate point set, and obtain the internal anchor points of the chessboard based on the second candidate point set; S4) Integrate all grid points on the high-precision boundary line with the internal anchor points to form a fused anchor point set; use a geometric projection algorithm to determine the logical row and column coordinates of each anchor point in the fused anchor point set on the chessboard, and construct a sparse logical coordinate grid. S5) Based on the sparse logical coordinate grid, an iterative interpolation algorithm is used to fill in all the missing grid coordinates to obtain a complete chessboard grid containing the physical coordinates of all grid points. S6) Based on the coordinates of each anchor point in the complete chessboard grid, crop out the corresponding image block on the chessboard image, classify it using a trained image classification model to determine the state of the chess piece at each anchor point, and generate a chess score file. S7) Visualize the state of the pieces on the graphical user interface and receive correction instructions from the user for incorrect corner points or piece states in order to update the game record file; In step S1), multi-scale morphological operations are performed according to the recognition mode. The recognition mode includes a first recognition mode and a second recognition mode. The first recognition mode is suitable for highly blurred chessboard images without obvious nonlinear distortion, and the second recognition mode is suitable for chessboard images with obvious nonlinear distortion. If the second recognition mode is selected, the input chessboard image is preprocessed to obtain a binarized image. Step S3) includes the following steps: S31) If the second recognition mode is executed, calculate the best-fit quadrilateral based on the first candidate point set; S32) Select points in the first candidate point set whose distance from each side of the best-fit quadrilateral is less than a first preset threshold as boundary anchor points, and reconstruct the four high-precision boundary lines of the chessboard based on the boundary anchor points. S33) Select points in the second candidate point set whose distance from each side of the best-fit quadrilateral is greater than a second preset threshold as internal anchor points; Step S5) includes the following steps: S51) If the second identification mode is executed, then based on the sparse logical coordinate grid constructed in step S4), in each iteration, the size of the logical coordinate gap between all adjacent known point pairs in the row direction and column direction is detected and calculated. S52) Sort the points according to the size of the logical coordinate gaps, and prioritize linear interpolation between the pair of known points with the smallest gaps to fill in the missing grid point physical coordinates. S53) After each interpolation, update the sparse logical coordinate grid and repeat steps S51) and S52) until all missing grid points are filled in to obtain a complete chessboard grid.
2. The chessboard recognition and calibration method for complex scenarios according to claim 1, characterized in that, Step S2) includes the following steps: S21) Scale the input chessboard image and fill it to a preset standardized size; S22) A target detection model trained on a convolutional neural network is used to process the standardized image to output the bounding boxes of the four global corner points of the chessboard; S23) Post-process the bounding box to calculate its center point coordinates, and reverse the center point coordinates from the coordinate system of the normalized image back to the original coordinate system of the chessboard image to obtain the final global corner points.
3. The chessboard recognition and calibration method for complex scenarios according to claim 1, characterized in that, In step S4), the geometric projection algorithm calculates the distance from each internal anchor point to all horizontal and vertical lines in the coordinate network using a bilinear interpolation algorithm, and selects the closest row and column combination as its logical coordinates.
4. The chessboard recognition and calibration method for complex scenarios according to claim 1, characterized in that, Step S6) includes the following steps: S61) If the first recognition mode is executed, the complete chessboard grid is calculated by bilinear interpolation algorithm based on the global corner points obtained in step S2). S62) Based on the coordinates of each grid point in the complete chessboard grid, crop out the corresponding image block on the chessboard image with the coordinates as the center; S63) The image blocks are uniformly scaled to a preset size and input into an image classification model trained on a convolutional neural network for processing, so as to output the classification result of whether it is a black piece, a white piece or no piece; S64) Summarize the classification results of all grid points and generate a standard chess notation file.
5. An apparatus used in the chessboard recognition and calibration method for complex scenarios as described in claim 4, characterized in that, include: The preprocessing module is used to preprocess the input chessboard image and employs parallel operations of at least two different morphological kernel sizes to obtain a first candidate point set and a second candidate point set. The global localization module is equipped with a target detection model to process the input chessboard image in order to identify and locate the four global corner points of the chessboard. The grid reconstruction module, based on the sparse logical coordinate grid, calculates and reconstructs a complete chessboard grid containing the physical coordinates of all grid points through a geometric reconstruction algorithm. The chess piece recognition module is equipped with an image classification model, which is used to determine the state of each chess piece on the complete chessboard grid and generate a chess score file.
6. The apparatus used in the chessboard recognition and calibration method for complex scenarios according to claim 5, characterized in that, The target detection model and the image classification model are independent models with separate functions. The target detection model is a corner detection model that identifies and outputs the bounding box or center point coordinates of the sparse logical coordinate grid. The image classification model is a chess piece classification model that classifies the cropped image blocks into three states: black pieces, white pieces, or no pieces.
7. The apparatus used in the chessboard recognition and calibration method for complex scenarios according to claim 5, characterized in that, The grid reconstruction module is configured to use a global target detection model to locate corner points when the chessboard image has nonlinear distortion, and to complete the global anchor points by fusing morphological algorithms and iterative interpolation algorithms. The image classification model is used locally to identify the cropping results, instead of performing straight line correction on the global image.
Citation Information
Patent Citations
Image-based weiqi manual identification method
CN107730522A
A go chess manual recognition method based on a chess manual RGB image
CN109559325A