[go: up one dir, main page]

CN119067894B - Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium - Google Patents

Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium

Info

Publication number
CN119067894B
CN119067894B CN202411192800.8A CN202411192800A CN119067894B CN 119067894 B CN119067894 B CN 119067894B CN 202411192800 A CN202411192800 A CN 202411192800A CN 119067894 B CN119067894 B CN 119067894B
Authority
CN
China
Prior art keywords
chess
chess piece
piece
chessboard
string
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411192800.8A
Other languages
Chinese (zh)
Other versions
CN119067894A (en
Inventor
杨龙强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Love Chess Road Beijing Culture Communication Co ltd
Original Assignee
Love Chess Road Beijing Culture Communication Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Love Chess Road Beijing Culture Communication Co ltd filed Critical Love Chess Road Beijing Culture Communication Co ltd
Priority to CN202411192800.8A priority Critical patent/CN119067894B/en
Publication of CN119067894A publication Critical patent/CN119067894A/en
Application granted granted Critical
Publication of CN119067894B publication Critical patent/CN119067894B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)

Abstract

本公开提供一种棋盘图像矫正方法、装置、电子设备及存储介质。所述方法包括:检测棋盘的初始图像,得到棋盘中每个棋子的棋子类别和绝对坐标,根据棋盘中的每个棋子的绝对坐标,对每个棋子进行分组,得到棋盘的多个棋串,基于每个棋串中任意相邻的两个棋子的两个绝对坐标,得到棋盘中每个棋子的相对坐标,并基于棋盘中每个棋子的相对坐标和棋子类别进行图像重建,得到棋盘的矫正图像。据此,本公开能够精准矫正棋子之间的位置关系,避免因图像畸变而导致棋子定位不精准的问题。

The present disclosure provides a chessboard image correction method, device, electronic device, and storage medium. The method comprises: detecting an initial chessboard image, obtaining the chess piece category and absolute coordinates of each chess piece on the board; grouping each chess piece according to its absolute coordinates to obtain multiple chessboard strings; obtaining the relative coordinates of each chess piece on the board based on the two absolute coordinates of any two adjacent chess pieces in each string; and performing image reconstruction based on the relative coordinates and chess piece category of each chess piece on the board to obtain a corrected image of the chessboard. Consequently, the present disclosure can accurately correct the positional relationship between chess pieces, avoiding the problem of inaccurate chess piece positioning due to image distortion.

Description

Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a chessboard image correction method, device, electronic device, and storage medium.
Background
In the field of computer vision, object detection is one of the important research topics. The chessboard detection has wide application prospects in the fields of game AI, pattern recognition, man-machine interaction and the like. With the development of deep learning technology, more and more researchers apply deep learning to chessboard detection and achieve remarkable results.
In the chessboard detection method based on deep learning, the accuracy of the chessboard detection result can directly influence the win-lose of the chessboard, and the shooting quality of the chessboard image is an important factor influencing whether the chessboard detection result is accurate or not, so that the current chessboard detection technology has more strict limitation on the chessboard shooting environment (such as light rays and the like) and the chessboard shooting angle.
In particular, in a shooting scene with a high degree of freedom, due to reasons such as shooting angles, the positioning result of the chessmen in the chessboard is inaccurate, and the problem is particularly remarkable when the shot chessboard image is severely inclined.
Disclosure of Invention
In view of the above, embodiments of the present disclosure provide a checkerboard image correction method, apparatus, electronic device, and storage medium, so as to at least partially solve the above-mentioned problems.
According to a first aspect of the disclosed embodiments, a chessboard image correction method is provided, which includes detecting an initial image of a chessboard to obtain a chessman category and an absolute coordinate of each chessman in the chessboard, grouping each chessman according to the absolute coordinate of each chessman in the chessboard to obtain a plurality of chessman strings of the chessboard, wherein each chessman belonging to the same chessman string is located in the same row in the chessboard, obtaining a relative coordinate of each chessman in the chessboard based on two absolute coordinates of any two adjacent chessmen in each chessman string, and performing image reconstruction based on the relative coordinate of each chessman in the chessboard and the chessman category to obtain a corrected image of the chessboard.
According to a second aspect of the embodiment of the present disclosure, there is provided a chess board image correction device, including a detection module for detecting an initial image of a chess board to obtain a chess piece category and an absolute coordinate of each chess piece in the chess board, a grouping module for grouping each chess piece according to the absolute coordinate of each chess piece in the chess board to obtain a plurality of chess strings of the chess board, wherein each chess piece belonging to the same chess string is located in the same row in the chess board, a conversion module for obtaining a relative coordinate of each chess piece in the chess board based on two absolute coordinates of any two adjacent chess pieces in each chess string, and a reconstruction module for performing image reconstruction based on the relative coordinate of each chess piece in the chess board and the chess piece category to obtain a corrected image of the chess board.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device comprising a processor, and a memory storing a program, wherein the program comprises instructions which, when executed by the processor, cause the processor to perform the checkerboard image correction method of the first aspect described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the checkerboard image correction method according to the first aspect.
In summary, according to the chessboard image correction scheme provided by the aspects of the disclosure, the absolute coordinates of the chesses are converted into the relative coordinates, so that the positional relationship among the chesses is corrected accurately, and the problem of inaccurate positioning of the chesses caused by image distortion can be solved.
Drawings
Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments, with reference to the following drawings, wherein:
fig. 1 is a process flow diagram of a checkerboard image correction method according to an exemplary embodiment of the present disclosure.
Fig. 2 is a schematic diagram of a checkerboard of an exemplary embodiment of the present disclosure.
Fig. 3 is a process flow diagram of a checkerboard image correction method according to another exemplary embodiment of the present disclosure.
Fig. 4 is a block diagram of a checkerboard image correction device according to an exemplary embodiment of the present disclosure.
Fig. 5 is a schematic architecture diagram of an electronic device according to an exemplary embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment," another embodiment "means" at least one additional embodiment, "and" some embodiments "means" at least some embodiments. Related definitions of other terms will be given in the description below. It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise. The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The existing chessboard detection technology has more limitations on shooting positions, shooting angles and the like of the chessboard, and is easy to generate distortion due to shooting images under shooting scenes with higher degrees of freedom, so that the problem of poor recognition accuracy of the positions of chessmen in the chessboard is caused.
In view of this, embodiments of the present disclosure provide a checkerboard image correction scheme, and the detailed implementation of the embodiments of the present disclosure will be described below with reference to the accompanying drawings.
Fig. 1 is a process flow diagram of a checkerboard image correction method according to an exemplary embodiment of the present disclosure. As shown in the figure, this embodiment mainly includes the following steps:
step 102, detecting an initial image of the chessboard to obtain the chessmen category and absolute coordinates of each chessman in the chessboard.
In some embodiments, the original image of the checkerboard may be pre-processed, including but not limited to resizing, cropping, noise reduction, normalization, etc., to ensure that the image data is best available for subsequent processing.
In some embodiments, the target objects in the initial image may be classified and detected to obtain each piece in the chessboard and the category of each piece, and two diagonal points of the chessboard and two diagonal points of each piece are detected respectively to obtain the absolute coordinates of each vertex angle of the chessboard and the absolute coordinates of each piece.
In this embodiment, the absolute coordinates of each pawn are used to identify the centre point position of each pawn.
In some embodiments, an image detection model (e.g., a deep learning model) may be utilized to detect an initial image of the board, resulting in a piece category and absolute coordinates for each piece in the board.
In this embodiment the absolute coordinates of each pawn consist of a transverse absolute coordinate and a longitudinal absolute coordinate.
In this embodiment, the chessboard may include a go chessboard, and the chess pieces may include a white chess category and a black chess category.
Specifically, the image detection model may be utilized to perform target detection on an initial image of the chessboard based on given class labels (white chess labels and black chess labels), obtain a confidence value of each detection object in the chessboard, and determine each detection object with the confidence value greater than a confidence threshold (e.g., 0.8) as each target object, wherein each obtained target object is the black chess and white chess in the chessboard.
Preferably, the image detection model can be used for detecting the corner coordinates of the lower left corner and the upper right corner of the chess piece, namely the minimum Xmin, the Ymin coordinates and the maximum Xmax, the Ymax coordinates, and the transverse and longitudinal sizes of the chess piece can be calculated according to the coordinates of the two opposite corners to be w=xmax-Xmin and h=ymax-Ymin, so that the position of the central point of the chess piece, namely the absolute coordinates of the chess piece, can be calculated.
In this embodiment, the image detection model also outputs the vertex angle absolute coordinates of the 4 vertices of the checkerboard. Wherein, the detection means of the absolute coordinates of each vertex angle of the chessboard can refer to the description of the detection means of each corner point of the chessman.
Step 104, grouping each piece according to the absolute coordinates of each piece in the chessboard to obtain a plurality of strings of the chessboard.
In this embodiment, each piece belonging to the same string is located in the same row in the board. For example, in a go board, each piece belonging to the same string is located in the same row (row) or column (column) in the go board.
For example, in the example shown in fig. 2, the white chess 1, the white chess 2 and the white chess 3 belong to the same chess string, and the white chess 1, the black chess 1, the white chess 7, the white chess 10 and the black chess 9 belong to the same chess string.
In some embodiments, the plurality of strings of the board includes at least one transverse string and at least one longitudinal string.
For example, in the example shown in FIG. 2, the board includes 5 transverse strings and 7 longitudinal strings. Wherein the white chess 1, the white chess 2 and the white chess 3 belong to the same longitudinal chess string, the white chess 1, the black chess 1, the white chess 7, the white chess 10 and the black chess 9 belong to the same transverse chess string, and the like.
In some embodiments, each of the strings includes at least one chess piece. For example, in the example shown in fig. 2, the transverse chess string 5 includes only white chess 5.
In this embodiment, each piece is grouped into a transverse string and a longitudinal string, respectively, of the board.
For example, in the example shown in fig. 2, white chess 1 belongs to the horizontal chess string 1 and the vertical chess string 1, and white chess 2 belongs to the horizontal chess string 2 and the vertical chess string 1.
And 106, obtaining the relative coordinates of each piece in the chessboard based on the two absolute coordinates of any two adjacent pieces in each chess string.
In some embodiments, any one of the strings may be determined as a current string, one of the current strings is determined as a current piece, and a previous piece of the current string is determined as a previous piece in order of arrangement of pieces in the current string.
For example, in the example shown in fig. 2, a horizontal chess string (hereinafter referred to as a horizontal chess string 1) composed of white chess 1, black chess 1, white chess 7, white chess 10 and black chess 9 may be used as a current chess string, and the chess strings of the horizontal chess strings 1, namely white chess 1, black chess 1, white chess 7, white chess 10 and black chess 9, may be obtained by arranging the chess strings in order based on the absolute coordinates of the chess pieces. Wherein, when the black chess 1 is used as the current chess piece, the white chess 1 is the previous chess piece of the black chess 1, and when the white chess 7 is used as the current chess piece, the previous chess piece is the black chess 1.
In this embodiment, the relative coordinates of the previous chess pieces may be determined, and the distance between the current chess pieces and the previous chess pieces may be obtained according to the absolute coordinates of the current chess pieces and the absolute coordinates of the previous chess pieces, and the relative coordinates of the current chess pieces may be obtained based on the size of the chess grid of the chessboard, the distance between the current chess pieces and the previous chess pieces, and the relative coordinates of the previous chess pieces.
Specifically, according to the absolute coordinates of the current chess piece and the absolute coordinates of the previous chess piece, the interval distance between the current chess piece and the previous chess piece is obtained, the interval distance is divided by the chess grid size of the chessboard, the additional coordinate value of the current chess piece can be obtained, and the relative coordinates of the current chess piece can be obtained by adding operation according to the relative coordinates of the previous chess piece and the additional coordinate value of the current chess piece.
In this embodiment, the relative coordinates of each chess piece are composed of a transverse relative coordinate and a longitudinal relative coordinate, so that the transverse relative coordinate of each chess piece in the chessboard can be identified based on the two transverse absolute coordinates of any adjacent two chess pieces in each transverse chess string, and the longitudinal relative coordinate of each chess piece in the chessboard can be identified based on the two longitudinal absolute coordinates of any adjacent two chess pieces in each longitudinal chess string.
For example, when the current chess string is the horizontal chess string 1 and the current chess is the black chess 1, the horizontal spacing distance between the black chess 1 and the white chess 1 can be obtained according to the horizontal absolute coordinates of the black chess 1 and the white chess 1, then the horizontal spacing distance is divided by the size of the chess grid of the chessboard, the horizontal additional coordinate value of the black chess 1 can be obtained as "1", and the sum operation can be performed according to the horizontal relative coordinate value "1" of the white chess 1 and the horizontal additional coordinate value "1" of the black chess 1, so that the horizontal relative coordinate of the black chess 1 is obtained as "2".
For another example, when the current chess string is the horizontal chess string 1 and the current chess is the white chess 7, the horizontal spacing distance between the black chess 1 and the white chess 7 can be obtained according to the horizontal absolute coordinates of each of the black chess 1 and the white chess 7, then the horizontal spacing distance is divided by the size of the chess lattice of the chessboard, the horizontal additional coordinate value of the white chess 7 can be obtained as '2', and the sum operation can be performed according to the horizontal relative sitting '2' of the black chess 1 and the horizontal additional coordinate value '2' of the white chess 7, so as to obtain the horizontal relative coordinate of the white chess 7 as '4'.
In this embodiment, the transverse relative coordinates and the longitudinal relative coordinates of the same chess piece in the chessboard can be combined to obtain the relative coordinates of each chess piece in the chessboard. For example, the relative coordinates of the white chess 1 are (1, 1), the relative coordinates of the black chess 1 are (1, 2), the relative coordinates of the white chess 2 are (2, 1), and so on.
In some embodiments, in the case that the current chess piece is the first chess piece in the current chess string, the interval distance between the current chess piece and the given reference position is obtained according to the absolute coordinates of the current chess piece and the absolute coordinates of the given reference position of the chessboard, and the relative coordinates of the current chess piece are obtained based on the size of the chess grid of the chessboard and the interval distance between the current chess piece and the given reference position.
Referring to fig. 2, in the case that the current chess string is the horizontal chess string 1 and the current chess piece is the white chess 1, the horizontal interval distance between the white chess 1 and the given reference position can be calculated, the horizontal interval distance is divided by the size of the chess grid of the chessboard to obtain the horizontal additional coordinate value of the white chess 1 as "1", and the horizontal relative coordinate value of the white chess 1 as "1" is obtained according to the addition result of the horizontal relative coordinate value of the given reference position as "0" and the horizontal additional coordinate value of the white chess 1 as "1".
And 108, reconstructing an image based on the relative coordinates of each chess piece in the chessboard and the classification of the chess pieces to obtain a corrected image of the chessboard.
In some embodiments, one of the pawns closest to the given reference position may be determined as a reference pawn and each pawn other than the reference pawn may be determined as a non-reference pawn according to the given reference position in the standard grid of the board, the relative coordinates or the absolute coordinates of each pawn.
In this example, one vertex angle position in the standard grid of the board may be determined as a given reference position in the standard grid of the board. For example, in the example shown in fig. 2, the left lower corner vertex of the board may be determined as a given reference position, and the white chess 1 nearest to the left lower corner vertex may be determined as a reference chess, and the white chess 2 to the white chess 10 and the black chess 1 to the black chess 10 may be determined as non-reference chess pieces.
In some embodiments, the positioning position of the reference chess pieces in the standard chess grid may be determined based on a given reference position of the chess board and the relative coordinates of the reference chess pieces, the positioning position of each non-reference chess piece in the standard chess grid of the chess board may be determined based on the positioning position of the reference chess pieces and the relative coordinates of each non-reference chess piece, and the standard chess grid may be rendered based on the positioning positions of the reference chess pieces and each non-reference chess piece in the standard chess grid and the chess piece category of each non-reference chess piece, resulting in a corrected image of the chess board.
For example, the positioning position of the white chess 1 in the standard chess grid may be determined based on the coordinate position of the left corner vertex of the chessboard and the relative coordinates (1, 1) of the white chess 1, and the positioning position of each non-reference chess piece in the standard chess grid of the chessboard may be reversely deduced based on the positioning position of the white chess 1 and the relative coordinates of each non-reference chess piece (i.e. white chess 2 to white chess 10 and black chess 1 to black chess 10), so that the standard chess grid of the chessboard may be subjected to image rendering processing, and the corrected image of the chessboard may be obtained.
In summary, the chessboard image correction device of the embodiment performs chess piece grouping by detecting the absolute coordinates of each chess piece to obtain a plurality of chess strings in the chessboard, and recursively calculates the relative coordinates of each chess piece according to the position arrangement sequence of each chess piece in the chess strings, thereby effectively reducing the problem of inaccurate positioning of the chess pieces caused by image distortion.
Specifically, in the conventional scheme, a single datum point is generally used for positioning each piece in the chessboard, and when distortion problems such as distortion exist in an image, the positioning offset of the piece far from the datum point is also increased. The positioning positions of adjacent chessmen are sequentially calculated by using a recursion calculation scheme, so that the relative position error between corrected chessmen cannot exceed a checkerboard, the position relationship between the chessmen can be accurately corrected, and the positioning accuracy of the chessmen is effectively improved.
Fig. 3 is a process flow diagram of a checkerboard image correction method according to another exemplary embodiment of the present disclosure. As shown, this embodiment illustrates a specific implementation of step 104 described above.
It should be noted that the chess piece grouping scheme of the present embodiment is performed only for one direction in the chessboard, and each of the transverse strings and each of the longitudinal strings in the chessboard can be determined by performing the processing steps of the present embodiment twice.
In order to avoid obscuring the technical key points of the proposal, and facilitate readers to understand the technical proposal of the embodiment more clearly, the following description only takes the generation of each transverse chess string in the chessboard as an example, and the following proposal is also applicable to the generation of each longitudinal chess string in the chessboard, and is described earlier. As shown in the figure, this embodiment mainly includes the following steps:
Step 302, each piece to be grouped which does not form a chess string is determined from the pieces in the chessboard.
For example, in the example shown in fig. 2, in the case where the lateral strings 1 in the board are determined, the white chess pieces 2 to 6, the white chess pieces 8, the white chess pieces 9, the black chess pieces 2 to 8, and the black chess pieces 10 may be determined as chess pieces to be grouped. In the case of determining the transverse strings 1 and2 in the chessboard, the white 3 to white 6, white 8, black 3 to black 6, black 8 may be determined as the pieces to be grouped.
Step 304, determining a reference chess piece from the chess pieces to be grouped based on the given reference position of the chessboard, and determining each chess piece to be grouped which is not determined as the reference chess piece as a candidate chess piece of the reference chess piece.
In this embodiment, the one piece to be grouped closest to the given reference position may be determined as the reference piece based on the given reference position of the board, the absolute coordinate position of each piece.
In this embodiment, the given reference position of the board is determined based on the absolute coordinates of one of the corners of the board. For example, in the example shown in FIG. 2, the lower left corner position of the checkerboard may be determined to be a given reference position.
Wherein, under the condition that any transverse chess strings are not determined, the white chess 1 (to-be-grouped chess pieces) is the reference chess piece closest to the given reference position, the white chess 2 to the white chess 10 and the black chess 1 to the black chess 10 are all candidate chess pieces of the white chess 1, under the condition that the transverse chess strings 1 are determined, the white chess 2 (to-be-grouped chess pieces) is the reference chess piece closest to the given reference position, and the white chess 3 to the white chess 6, the white chess 8, the white chess 9, the black chess 2 to the black chess 8 and the black chess 10 are candidate chess pieces of the white chess 2.
Step 306, determining each target chess piece of the reference chess piece from the candidate chess pieces according to the coordinate difference between the absolute coordinates of each candidate chess piece and the absolute coordinates of the reference chess pieces, and forming a chess string of the chessboard based on the reference chess piece and each target chess piece.
In this embodiment, that is, under the condition of generating each transverse chess string in the chessboard, the absolute longitudinal coordinate of each candidate chess piece and the absolute longitudinal coordinate of the reference chess piece can be subjected to difference calculation to obtain a longitudinal offset value of each candidate chess piece compared with the reference chess piece, each candidate chess piece with the longitudinal offset value smaller than a given longitudinal offset threshold value is determined as a target chess piece of the reference chess piece, and a transverse chess string of the chessboard is formed based on the reference chess piece and each target chess piece.
In this embodiment, the given longitudinal offset threshold is determined based on the pawn size of each pawn.
For example, in the case that the reference chess piece is the white chess piece 1, the absolute longitudinal coordinate of each candidate chess piece can be traversed, each candidate chess piece (namely, the black chess piece 1, the white chess piece 7, the white chess piece 10 and the black chess piece 9) with the longitudinal deviation value not exceeding the radius of the chess piece is determined as the target chess piece of the white chess piece 1, and the transverse chess strings 1 of the chessboard are formed based on the white chess piece 1, namely, the black chess piece 1, the white chess piece 7, the white chess piece 10 and the black chess piece 9.
In other embodiments, in the case of generating each longitudinal chess string in the chessboard according to the present embodiment, the absolute lateral coordinate of each candidate chess piece and the absolute lateral coordinate of the reference chess piece may be calculated to obtain a lateral offset value of each candidate chess piece compared to the reference chess piece, and each candidate chess piece with the lateral offset value smaller than the given lateral offset threshold value may be determined as the target chess piece of the reference chess piece, so as to form one longitudinal chess string of the chessboard based on the reference chess piece and each target chess piece. Wherein the given lateral offset threshold may also be determined based on the pawn size of each pawn.
In some embodiments, in case that the target chess pieces of the reference chess pieces are not present in the candidate chess pieces, a chess string of the chessboard is directly based on the reference chess pieces. For example, a transverse chess string 5 as shown in fig. 2.
Step 308, judging whether the chessboard has chessmen to be grouped, if so, returning to step 302, otherwise, performing step 310.
Specifically, when judging that the chess pieces to be grouped do not exist in the chessboard, the grouping operation of all the chess pieces in the chessboard is completed.
Step 310, each chess string of the chessboard is obtained.
In summary, the embodiment recursively traverses each piece based on the absolute coordinates of each piece to group each piece into a plurality of strings, so as to implement conversion processing of the relative coordinates of the pieces, realize automatic correction processing of the relative positions between the pieces, and improve the positioning accuracy of the pieces.
Fig. 4 shows a block diagram of a checkerboard image correction device according to an exemplary embodiment of the present disclosure. As shown in the drawing, the checkerboard image correction device 400 of the present embodiment includes:
The detection module 402 detects an initial image of a chessboard to obtain a chessman category and absolute coordinates of each chessman in the chessboard;
Grouping module 404, which groups each piece according to the absolute coordinates of each piece in the chessboard to obtain a plurality of strings of pieces of the chessboard, wherein each piece belonging to the same string is located in the same row in the chessboard;
the conversion module 406 obtains the relative coordinates of each chess piece in the chessboard based on the two absolute coordinates of any two adjacent chess pieces in each chess string;
the reconstruction module 408 performs image reconstruction based on the relative coordinates of each chess piece in the chessboard and the classification of the chess piece, and obtains a corrected image of the chessboard.
In some embodiments, the detection module 402 is further configured to perform classification detection on each target object in the initial image to obtain each piece in the chessboard and a category of each piece, detect two diagonal points of the chessboard and two diagonal points of each piece to obtain an absolute coordinate of each vertex angle of the chessboard and an absolute coordinate of each piece, where the absolute coordinate of each piece is used to identify a center point position of each piece.
In some embodiments grouping module 404 is further configured to determine each piece to be grouped that does not form a string of pieces from among the pieces in the board, determine a reference piece from among the pieces to be grouped based on a given reference position of the board and determine each piece to be grouped that is not determined as a candidate for the reference piece, determine each target piece for the reference piece from among the candidate pieces based on a difference in coordinates between an absolute coordinate of each candidate piece and an absolute coordinate of the reference piece and form a string of pieces of the board based on the reference piece and each target piece, and return to performing the step of determining each piece to be grouped that does not form a string of pieces from among the pieces in the board until no piece to be grouped is present in the board.
In some embodiments grouping module 404 is further configured to determine, as a reference pawn, a pawn to be grouped closest to a given reference position of the board based on an absolute coordinate position of each pawn, wherein the given reference position is determined based on an apex angle absolute coordinate of the board.
In some embodiments, each of the strings includes at least one chess piece.
In some embodiments grouping module 404 is further configured to compose a string of the board directly based on the reference pawn in the absence of a target pawn for the reference pawn in each candidate pawn.
In some embodiments, the plurality of strings includes at least one transverse string and at least one longitudinal string, the absolute coordinates of each of the plurality of pieces being comprised of a transverse absolute coordinate and a longitudinal absolute coordinate.
In some embodiments, the grouping module 404 is further configured to calculate a difference between the absolute longitudinal coordinate of each candidate piece and the absolute longitudinal coordinate of the reference piece, to obtain a longitudinal offset value of each candidate piece compared to the reference piece, determine each candidate piece with a longitudinal offset value smaller than a given longitudinal offset threshold as a target piece of the reference piece, and form a transverse chess string of the chessboard based on the reference piece and each target piece.
In some embodiments, the grouping module 404 is further configured to calculate a difference between the absolute lateral coordinate of each candidate chess piece and the absolute lateral coordinate of the reference chess piece, to obtain a lateral offset value of each candidate chess piece compared to the reference chess piece, determine each candidate chess piece with a lateral offset value smaller than a given lateral offset threshold as a target chess piece of the reference chess piece, and form a longitudinal chess string of the chessboard based on the reference chess piece and each target chess piece.
In some embodiments, the given longitudinal offset threshold or the given lateral offset threshold is determined based on a pawn size of each pawn.
In some embodiments, the conversion module 406 is further configured to determine any one of the strings as a current string, sequentially determine one of the current strings as a current piece, determine a previous piece of the current piece as a previous piece, and determine a relative coordinate of the previous piece according to an arrangement order of pieces in the current string, obtain a distance between the current piece and the previous piece according to an absolute coordinate of the current piece and an absolute coordinate of the previous piece, and obtain a relative coordinate of the current piece based on a size of a checkerboard of the chessboard, a distance between the current piece and the previous piece, and a relative coordinate of the previous piece.
In some embodiments, the conversion module 406 is further configured to obtain, when the current chess piece is a first chess piece in the current chess string, a separation distance between the current chess piece and a given reference position of the chessboard according to an absolute coordinate of the current chess piece and an absolute coordinate of the given reference position, and obtain a relative coordinate of the current chess piece based on a size of a chess grid of the chessboard and the separation distance between the current chess piece and the given reference position.
In some embodiments, the plurality of strings includes at least one transverse string and at least one longitudinal string, each of the pieces being grouped into one transverse string and one longitudinal string of the board, respectively, an absolute coordinate of each of the pieces being composed of one transverse absolute coordinate and one longitudinal absolute coordinate, and a relative coordinate of each of the pieces being composed of one transverse relative coordinate and one longitudinal relative coordinate.
In some embodiments, the conversion module 406 is further configured to identify a lateral relative coordinate of each piece in the chessboard based on two lateral absolute coordinates of any adjacent two pieces in each lateral string, identify a longitudinal relative coordinate of each piece in the chessboard based on two longitudinal absolute coordinates of any adjacent two pieces in each longitudinal string, and combine the lateral relative coordinate and the longitudinal relative coordinate of the same piece in the chessboard to obtain a relative coordinate of each piece in the chessboard.
In some embodiments, the reconstruction module 408 is further configured to determine one of the chess pieces closest to the given reference position as a reference chess piece and each chess piece other than the reference chess piece as a non-reference chess piece based on the given reference position of the chess board and the relative coordinates of the reference chess pieces, determine the positioning position of the reference chess piece in the standard chess piece based on the positioning position of the reference chess piece and the relative coordinates of each non-reference chess piece, determine the positioning position of each non-reference chess piece in the standard chess piece of the chess board based on the positioning position of the reference chess piece and the relative coordinates of each non-reference chess piece, and render the standard chess piece based on the positioning positions of the reference chess piece and each non-reference chess piece in the standard chess piece and the classification of the reference chess piece and each non-reference chess piece, thereby obtaining a corrected image of the chess board.
The embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the checkerboard image correction method according to the exemplary embodiments of the present disclosure.
The exemplary embodiments of the present disclosure also provide an electronic device comprising at least one processor and a memory communicatively coupled to the at least one processor. The memory stores a computer program executable by the at least one processor for causing the electronic device to perform the checkerboard image correction method according to exemplary embodiments of the present disclosure when executed by the at least one processor.
Referring to fig. 5, a block diagram of an electronic device 500 that may be a server or client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the electronic device 500 includes a computing unit 501 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, ROM 502, and RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
A number of components in the electronic device 500 are connected to the I/O interface 505, including an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. The input unit 506 may be any type of device capable of inputting information to the electronic device 500, and the input unit 506 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device. The output unit 507 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, video/audio output terminals, vibrators, and/or printers. Storage unit 508 may include, but is not limited to, magnetic disks, optical disks. The communication unit 509 allows the electronic device 500 to exchange information/data with other devices over a computer network such as the internet and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and/or chipsets, such as bluetooth (TM) devices, wiFi devices, wiMax devices, cellular communication devices, and/or the like.
The computing unit 501 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above. For example, in some embodiments, a checkerboard image correction method as described above may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 500 via the ROM 502 and/or the communication unit 509. In some embodiments, the computing unit 501 may be configured to perform the above-described checkerboard image correction method by any other suitable means (e.g. by means of firmware).
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user, for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback), and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data service), or that includes a middleware component (e.g., an application service), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a Local Area Network (LAN), a Wide Area Network (WAN), and the Internet.
The computer system may include a client and a server. The client and the server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be noted that each component/step described in the embodiments of the present disclosure may be split into more components/steps, or two or more components/steps or partial operations of the components/steps may be combined into new components/steps according to implementation needs, to achieve the objects of the embodiments of the present disclosure.
The above embodiments are only for illustrating the embodiments of the present disclosure, not for limiting the embodiments of the present disclosure, and various changes and modifications may be made by one of ordinary skill in the relevant art without departing from the spirit and scope of the embodiments of the disclosure, so all equivalent technical solutions also fall within the scope of the embodiments of the present disclosure, the scope of which is defined by the claims.

Claims (13)

1.一种棋盘图像矫正方法,包括:1. A chessboard image correction method, comprising: 检测棋盘的初始图像,得到所述棋盘中每个棋子的棋子类别和绝对坐标;Detecting an initial image of a chessboard to obtain a chess piece category and absolute coordinates of each chess piece on the chessboard; 根据所述棋盘中的每个棋子的绝对坐标,对每个棋子进行分组,得到所述棋盘的多个棋串,其中,属于同一棋串的每个棋子位于所述棋盘中的同一排;grouping each chess piece on the chessboard according to its absolute coordinates to obtain a plurality of chess strings on the chessboard, wherein each chess piece belonging to the same chess string is located in the same row on the chessboard; 基于每个棋串中任意相邻的两个棋子的两个绝对坐标,得到所述棋盘中每个棋子的相对坐标,包括:将任意一个棋串确定为当前棋串,按照所述当前棋串中各棋子的排列顺序,依次将所述当前棋串中的一个棋子确定为当前棋子,将所述当前棋子的前一个棋子确定为前续棋子,并确定所述前续棋子的相对坐标,根据所述当前棋子的绝对坐标和所述前续棋子的绝对坐标,得到所述当前棋子与所述前续棋子之间的间隔距离,基于所述棋盘的棋格尺寸、所述当前棋子与所述前续棋子之间的间隔距离、所述前续棋子的相对坐标,得到所述当前棋子的相对坐标;Obtaining relative coordinates of each chess piece on the chessboard based on the two absolute coordinates of any two adjacent chess pieces in each chess string, including: determining any chess string as a current chess string, sequentially determining a chess piece in the current chess string as a current chess piece according to the arrangement order of the chess pieces in the current chess string, determining a chess piece preceding the current chess piece as a predecessor chess piece, and determining relative coordinates of the predecessor chess piece; obtaining a distance between the current chess piece and the predecessor chess piece based on the absolute coordinates of the current chess piece and the absolute coordinates of the predecessor chess piece; and obtaining the relative coordinates of the current chess piece based on a chess board square size, the distance between the current chess piece and the predecessor chess piece, and the relative coordinates of the predecessor chess piece; 基于所述棋盘中每个棋子的相对坐标和棋子类别进行图像重建,得到所述棋盘的矫正图像。Image reconstruction is performed based on the relative coordinates and the category of each chess piece on the chessboard to obtain a rectified image of the chessboard. 2.根据权利要求1所述的方法,其中,所述检测棋盘的初始图像,得到所述棋盘中每个棋子的棋子类别和绝对坐标,包括:2. The method according to claim 1, wherein detecting the initial image of the chessboard and obtaining the chess piece category and absolute coordinates of each chess piece on the chessboard comprises: 对所述初始图像中的各目标对象进行分类检测,得到所述棋盘中的每个棋子及每个棋子的棋子类别;Performing classification detection on each target object in the initial image to obtain each chess piece and the chess piece category of each chess piece on the chessboard; 分别检测所述棋盘的两个对角点和每个棋子的两个对角点,得到所述棋盘的每个顶角绝对坐标和每个棋子的绝对坐标;Detecting two diagonal points of the chessboard and two diagonal points of each chess piece respectively to obtain the absolute coordinates of each vertex of the chessboard and the absolute coordinates of each chess piece; 其中,每个棋子的绝对坐标用于标识每个棋子的中心点位置。The absolute coordinates of each chess piece are used to identify the center point position of each chess piece. 3.根据权利要求1所述的方法,其中,所述根据所述棋盘中的每个棋子的绝对坐标,对每个棋子进行分组,得到所述棋盘的多个棋串,包括:3. The method according to claim 1, wherein grouping each chess piece on the chessboard according to its absolute coordinates to obtain multiple chess strings on the chessboard comprises: 从所述棋盘中的各棋子中确定未组成棋串的每个待分组棋子;Determine each chess piece to be grouped that has not formed a chess string from the chess pieces on the chessboard; 基于所述棋盘的给定基准位置,从各待分组棋子中确定一个参考棋子,并将未被确定为所述参考棋子的每个待分组棋子确定为所述参考棋子的候选棋子;Based on a given reference position of the chess board, determining a reference chess piece from each chess piece to be grouped, and determining each chess piece to be grouped that has not been determined as the reference chess piece as a candidate chess piece for the reference chess piece; 根据每个候选棋子的绝对坐标与所述参考棋子的绝对坐标之间的坐标差,从各候选棋子中确定所述参考棋子的每个目标棋子,并基于所述参考棋子和每个目标棋子,组成所述棋盘的一个棋串;Determining each target piece of the reference piece from each candidate piece based on a coordinate difference between the absolute coordinates of each candidate piece and the absolute coordinates of the reference piece, and forming a chess string on the chessboard based on the reference piece and each target piece; 返回执行所述从所述棋盘中的各棋子中确定未组成棋串的每个待分组棋子的步骤,直至所述棋盘中不存在待分组棋子。Return to the step of determining each chess piece to be grouped that has not formed a chess string from the chess pieces on the chess board until there are no more chess pieces to be grouped on the chess board. 4.根据权利要求3所述的方法,其中,所述基于所述棋盘的给定基准位置,从各待分组棋子中确定一个参考棋子,包括:4. The method according to claim 3, wherein determining a reference piece from the pieces to be grouped based on a given reference position of the chessboard comprises: 基于所述棋盘的给定基准位置、每个棋子的绝对坐标位置,将距离所述给定基准位置最近的一个待分组棋子,确定为参考棋子;Based on a given reference position of the chessboard and the absolute coordinate position of each chess piece, a chess piece to be grouped that is closest to the given reference position is determined as a reference chess piece; 其中,所述给定基准位置是基于所述棋盘的一个顶角绝对坐标确定的。The given reference position is determined based on the absolute coordinates of a vertex of the chessboard. 5.根据权利要求3所述的方法,其中,每个棋串包括至少一个棋子;5. The method according to claim 3, wherein each chess string comprises at least one chess piece; 所述方法还包括:The method further comprises: 在各候选棋子中不存在所述参考棋子的目标棋子的情况下,直接基于所述参考棋子,组成所述棋盘的一个棋串。In the case that the target chess piece of the reference chess piece does not exist among the candidate chess pieces, a chess string of the chessboard is directly composed based on the reference chess piece. 6.根据权利要求3至5中任一项所述的方法,其中,所述多个棋串包括至少一个横向棋串与至少一个纵向棋串,每个棋子的绝对坐标由一个横向绝对坐标和一个纵向绝对坐标构成;6. The method according to any one of claims 3 to 5, wherein the plurality of chess strings include at least one horizontal chess string and at least one vertical chess string, and the absolute coordinates of each chess piece consist of a horizontal absolute coordinate and a vertical absolute coordinate; 其中,通过以下方式组成所述棋盘的任意一个横向棋串:Wherein, any horizontal chess string of the chessboard is formed in the following manner: 将每个候选棋子的绝对纵向坐标与所述参考棋子的绝对纵向坐标进行差值计算,得到每个候选棋子相较于所述参考棋子的纵向偏移值;Calculate the difference between the absolute longitudinal coordinate of each candidate chess piece and the absolute longitudinal coordinate of the reference chess piece to obtain a longitudinal offset value of each candidate chess piece compared to the reference chess piece; 将纵向偏移值小于给定纵向偏移阈值的每个候选棋子,确定为所述参考棋子的目标棋子;Determine each candidate chess piece whose longitudinal offset value is less than a given longitudinal offset threshold as a target chess piece of the reference chess piece; 基于所述参考棋子和每个目标棋子,组成所述棋盘的一个横向棋串;Based on the reference chess piece and each target chess piece, a horizontal chess string of the chessboard is formed; 其中,通过以下方式组成所述棋盘的任意一个纵向棋串:Wherein, any vertical chess string of the chessboard is formed in the following manner: 将每个候选棋子的绝对横向坐标与所述参考棋子的绝对横向坐标进行差值计算,得到每个候选棋子相较于所述参考棋子的横向偏移值;Calculate the difference between the absolute horizontal coordinate of each candidate chess piece and the absolute horizontal coordinate of the reference chess piece to obtain a horizontal offset value of each candidate chess piece compared to the reference chess piece; 将横向偏移值小于给定横向偏移阈值的每个候选棋子,确定为所述参考棋子的目标棋子;Determine each candidate chess piece whose lateral offset value is less than a given lateral offset threshold as a target chess piece of the reference chess piece; 基于所述参考棋子和每个目标棋子,组成所述棋盘的一个纵向棋串;Based on the reference chess piece and each target chess piece, a vertical chess string of the chessboard is formed; 其中,所述给定纵向偏移阈值或所述给定横向偏移阈值,是基于每个棋子的棋子尺寸确定的。The given longitudinal offset threshold or the given lateral offset threshold is determined based on the size of each chess piece. 7.根据权利要求1所述的方法,其中,在所述当前棋子为所述当前棋串中的第一个棋子的情况下,所述方法包括:7. The method according to claim 1, wherein, when the current chess piece is the first chess piece in the current chess string, the method comprises: 根据所述当前棋子的绝对坐标与所述棋盘的给定基准位置的绝对坐标,得到所述当前棋子与所述给定基准位置之间的间隔距离;Obtaining a distance between the current chess piece and the given reference position according to the absolute coordinates of the current chess piece and the absolute coordinates of the given reference position of the chessboard; 基于所述棋盘的棋格尺寸、所述当前棋子与所述给定基准位置之间的间隔距离,得到所述当前棋子的相对坐标。The relative coordinates of the current chess piece are obtained based on the chess grid size of the chessboard and the interval distance between the current chess piece and the given reference position. 8.根据权利要求1或7所述的方法,其中,所述多个棋串包括至少一个横向棋串和至少一个纵向棋串,每个棋子分别被分组到所述棋盘的一个横向棋串与一个纵向棋串中,每个棋子的绝对坐标由一个横向绝对坐标和一个纵向绝对坐标构成,每个棋子的相对坐标由一个横向相对坐标和一个纵向相对坐标构成;8. The method according to claim 1 or 7, wherein the plurality of chess strings include at least one horizontal chess string and at least one vertical chess string, each chess piece is grouped into a horizontal chess string and a vertical chess string respectively, the absolute coordinates of each chess piece consist of a horizontal absolute coordinate and a vertical absolute coordinate, and the relative coordinates of each chess piece consist of a horizontal relative coordinate and a vertical relative coordinate; 其中,所述基于每个棋串中任意相邻的两个棋子的两个绝对坐标,得到所述棋盘中每个棋子的相对坐标,包括:The step of obtaining the relative coordinates of each chess piece on the chessboard based on the two absolute coordinates of any two adjacent chess pieces in each chess string includes: 基于每个横向棋串中任意相邻的两个棋子的两个横向绝对坐标,标识所述棋盘中每个棋子的横向相对坐标,基于每个纵向棋串中任意相邻的两个棋子的两个纵向绝对坐标,标识所述棋盘中每个棋子的纵向相对坐标;Based on the two horizontal absolute coordinates of any two adjacent chess pieces in each horizontal chess string, identify the horizontal relative coordinates of each chess piece on the chess board; based on the two vertical absolute coordinates of any two adjacent chess pieces in each vertical chess string, identify the vertical relative coordinates of each chess piece on the chess board; 合并所述棋盘中同一棋子的横向相对坐标和纵向相对坐标,得到所述棋盘中每个棋子的相对坐标。The horizontal relative coordinate and the vertical relative coordinate of the same chess piece on the chessboard are combined to obtain the relative coordinate of each chess piece on the chessboard. 9.根据权利要求1所述的方法,其中,所述基于所述棋盘中每个棋子的相对坐标和棋子类别进行图像重建,得到所述棋盘的矫正图像,包括:9. The method according to claim 1, wherein the step of reconstructing the image based on the relative coordinates and the category of each chess piece on the chessboard to obtain a rectified image of the chessboard comprises: 根据所述棋盘的标准棋格中的给定基准位置、每个棋子的相对坐标或绝对坐标,将各棋子中距离所述给定基准位置最近的一个棋子确定为基准棋子,将除所述基准棋子之外的每个棋子确定为非基准棋子;According to a given reference position in a standard square of the chessboard and the relative coordinates or absolute coordinates of each chess piece, a chess piece closest to the given reference position among all chess pieces is determined as a reference chess piece, and each chess piece other than the reference chess piece is determined as a non-reference chess piece; 基于所述棋盘的给定基准位置、所述基准棋子的相对坐标,确定所述基准棋子在所述标准棋格中的定位位置;Determining the positioning position of the reference chess piece in the standard chess square based on the given reference position of the chess board and the relative coordinates of the reference chess piece; 基于所述基准棋子的定位位置、每个非基准棋子的相对坐标,确定每个非基准棋子在所述棋盘的标准棋格中的定位位置;Determining the location of each non-reference chess piece in a standard square of the chessboard based on the location of the reference chess piece and the relative coordinates of each non-reference chess piece; 基于所述基准棋子和每个非基准棋子在所述标准棋格中的定位位置、所述基准棋子和每个非基准棋子的棋子类别,渲染所述标准棋格,得到所述棋盘的矫正图像。Based on the positioning positions of the reference chess piece and each non-reference chess piece in the standard chess square and the chess piece categories of the reference chess piece and each non-reference chess piece, the standard chess square is rendered to obtain a corrected image of the chessboard. 10.根据权利要求1或9所述的方法,其中,10. The method according to claim 1 or 9, wherein 所述棋盘包括围棋棋盘;The chessboard includes a Go chessboard; 所述棋子类别包括白棋类别与黑棋类别。The chess piece categories include a white chess piece category and a black chess piece category. 11.一种棋盘图像矫正装置,包括:11. A chessboard image correction device, comprising: 检测模块,检测棋盘的初始图像,得到所述棋盘中每个棋子的棋子类别和绝对坐标;A detection module detects an initial image of a chessboard and obtains a chess piece category and absolute coordinates of each chess piece on the chessboard; 分组模块,根据所述棋盘中的每个棋子的绝对坐标,对每个棋子进行分组,得到所述棋盘的多个棋串,其中,属于同一棋串的每个棋子位于所述棋盘中的同一排;a grouping module, grouping each chess piece on the chessboard according to the absolute coordinates of each chess piece to obtain a plurality of chess strings on the chessboard, wherein each chess piece belonging to the same chess string is located in the same row on the chessboard; 转换模块,基于每个棋串中任意相邻的两个棋子的两个绝对坐标,得到所述棋盘中每个棋子的相对坐标,包括将任意一个棋串确定为当前棋串,按照所述当前棋串中各棋子的排列顺序,依次将所述当前棋串中的一个棋子确定为当前棋子,将所述当前棋子的前一个棋子确定为前续棋子,并确定所述前续棋子的相对坐标,根据所述当前棋子的绝对坐标和所述前续棋子的绝对坐标,得到所述当前棋子与所述前续棋子之间的间隔距离,基于所述棋盘的棋格尺寸、所述当前棋子与所述前续棋子之间的间隔距离、所述前续棋子的相对坐标,得到所述当前棋子的相对坐标;a conversion module, which obtains relative coordinates of each chess piece on the chessboard based on the two absolute coordinates of any two adjacent chess pieces in each chess string, including determining any chess string as a current chess piece, sequentially determining a chess piece in the current chess string as a current chess piece according to the arrangement order of the chess pieces in the current chess string, determining the chess piece immediately preceding the current chess piece as a predecessor chess piece, and determining relative coordinates of the predecessor chess piece; obtaining a distance between the current chess piece and the predecessor chess piece based on the absolute coordinates of the current chess piece and the absolute coordinates of the predecessor chess piece; and obtaining the relative coordinates of the current chess piece based on a chess board square size, the distance between the current chess piece and the predecessor chess piece, and the relative coordinates of the predecessor chess piece; 重建模块,基于所述棋盘中每个棋子的相对坐标和棋子类别进行图像重建,得到所述棋盘的矫正图像。The reconstruction module performs image reconstruction based on the relative coordinates and the category of each chess piece on the chessboard to obtain a corrected image of the chessboard. 12.一种电子设备,包括:12. An electronic device comprising: 处理器;以及processor; and 存储程序的存储器,Memory for storing programs, 其中,所述程序包括指令,所述指令在由所述处理器执行时使所述处理器执行如权利要求1至10中任一项所述的棋盘图像矫正方法。The program includes instructions, which, when executed by the processor, enable the processor to perform the checkerboard image correction method according to any one of claims 1 to 10. 13.一种存储有计算机指令的非瞬时计算机可读存储介质,其特征在于,所述计算机指令用于使所述计算机执行如权利要求1至10中任一项所述的棋盘图像矫正方法。13. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the checkerboard image correction method according to any one of claims 1 to 10.
CN202411192800.8A 2024-08-28 2024-08-28 Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium Active CN119067894B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411192800.8A CN119067894B (en) 2024-08-28 2024-08-28 Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411192800.8A CN119067894B (en) 2024-08-28 2024-08-28 Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN119067894A CN119067894A (en) 2024-12-03
CN119067894B true CN119067894B (en) 2025-07-29

Family

ID=93640338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411192800.8A Active CN119067894B (en) 2024-08-28 2024-08-28 Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN119067894B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107967447A (en) * 2017-11-02 2018-04-27 腾讯科技(成都)有限公司 Display methods, device, storage medium and the electronic device of object

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102008816A (en) * 2009-09-07 2011-04-13 周四红 Electronic chessboard device and automatic chess moving method
JP6152211B1 (en) * 2016-10-07 2017-06-21 株式会社Cygames Board game system etc.
CN106823361A (en) * 2017-02-07 2017-06-13 湖南快玩网络科技有限公司 The coordinate corresponding method and device of a kind of Solid chess-board
CN107480678A (en) * 2017-09-29 2017-12-15 北京深度奇点科技有限公司 A kind of chessboard recognition methods and identifying system
CN107766855B (en) * 2017-10-25 2021-09-07 南京阿凡达机器人科技有限公司 Chessman positioning method and system based on machine vision, storage medium and robot
CN108550169B (en) * 2018-04-24 2021-08-10 中北大学 Method for determining positions of chess pieces in three-dimensional space and calculating heights of chess pieces
CN109145809B (en) * 2018-08-17 2022-03-08 腾讯科技(深圳)有限公司 Notation processing method and device and computer readable storage medium
CN110096999B (en) * 2019-04-29 2021-07-30 达闼科技(北京)有限公司 Chessboard recognition method, chessboard recognition device, electronic equipment and storable medium
CN111798511B (en) * 2020-05-21 2023-03-24 扬州哈工科创机器人研究院有限公司 Chessboard and chessman positioning method and device
CN114782534A (en) * 2022-04-29 2022-07-22 深圳市商汤科技有限公司 Image processing method, device, electronic device, game robot and storage medium
CN115888062B (en) * 2022-12-27 2025-06-27 南京师范大学 Human-computer game method based on classification detection framework and chess decision network
CN116894786B (en) * 2023-07-20 2025-09-16 浙江舜宇光学有限公司 Method for correcting distorted image and computer-readable storage medium
CN117726645A (en) * 2023-12-21 2024-03-19 昆山丘钛微电子科技股份有限公司 Corner positioning method and device of checkerboard image and electronic equipment
CN118015626A (en) * 2024-02-06 2024-05-10 深圳市星桐科技有限公司 Chess piece identification method and device, electronic equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107967447A (en) * 2017-11-02 2018-04-27 腾讯科技(成都)有限公司 Display methods, device, storage medium and the electronic device of object

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
围棋落子模拟系统关键技术研究与应用;邹恒;CNKI硕士电子期刊;20221215;摘要,第3节 *

Also Published As

Publication number Publication date
CN119067894A (en) 2024-12-03

Similar Documents

Publication Publication Date Title
US10977523B2 (en) Methods and apparatuses for identifying object category, and electronic devices
US9639914B2 (en) Portrait deformation method and apparatus
CN114186632B (en) Method, device, equipment and storage medium for training key point detection model
US20220215507A1 (en) Image stitching
JP2018519574A (en) Text image processing method and apparatus
CN110147750B (en) An image search method, system and electronic device based on motion acceleration
US20190278474A1 (en) Systems and methods for interactive image caricaturing by an electronic device
US20230351787A1 (en) Hand-Drawn Graphic Recognition Method, Apparatus and System, and Computer-Readable Storage Medium
CN113850238B (en) Document detection method, device, electronic device and storage medium
US20230298324A1 (en) Image acquisition model training method and apparatus, image detection method and apparatus, and device
CN112528707A (en) Image processing method, device, equipment and storage medium
CN112634366B (en) Location information generation method, related devices and computer program products
CN117372604A (en) 3D face model generation method, device, equipment and readable storage medium
CN115187995B (en) Document correction method, device, electronic equipment and storage medium
JP2022519398A (en) Image processing methods, equipment and electronic devices
WO2023109086A1 (en) Character recognition method, apparatus and device, and storage medium
CN114387605A (en) Text detection method, device, electronic device and storage medium
CN112465692A (en) Image processing method, device, equipment and storage medium
CN119067894B (en) Chessboard image correction method, chessboard image correction device, electronic equipment and storage medium
CN114581973A (en) Face pose estimation method and device, storage medium and computer equipment
CN118799871A (en) Electronic seal direction correction system, method, device and storage medium
CN114119990A (en) Method, apparatus and computer program product for image feature point matching
WO2025025465A1 (en) Infrared face image quality evaluation method and apparatus
CN114924822B (en) Screenshot method and device of three-dimensional topological structure, electronic equipment and storage medium
CN114677743A (en) Face rectification method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant