WO2023178920A1 - Chess placement method and apparatus, electronic device, chess playing robot, storage medium, and program - Google Patents

Chess placement method and apparatus, electronic device, chess playing robot, storage medium, and program Download PDF

Info

Publication number
WO2023178920A1
WO2023178920A1 PCT/CN2022/114913 CN2022114913W WO2023178920A1 WO 2023178920 A1 WO2023178920 A1 WO 2023178920A1 CN 2022114913 W CN2022114913 W CN 2022114913W WO 2023178920 A1 WO2023178920 A1 WO 2023178920A1
Authority
WO
WIPO (PCT)
Prior art keywords
chess
area
image
placement
chess piece
Prior art date
Application number
PCT/CN2022/114913
Other languages
French (fr)
Chinese (zh)
Inventor
吴华栋
张展鹏
杨帆
贾凡
成慧
Original Assignee
上海商汤智能科技有限公司
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 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Publication of WO2023178920A1 publication Critical patent/WO2023178920A1/en

Links

Images

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J11/00Manipulators not otherwise provided for
    • B25J11/003Manipulators for entertainment
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1602Programme controls characterised by the control system, structure, architecture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • G06T7/74Determining position or orientation of objects or cameras using feature-based methods involving reference images or patches

Definitions

  • the present disclosure relates to, but is not limited to, the field of intelligent device control, and in particular, to a chess playing method, device, electronic device, chess-playing robot, computer storage medium, and computer program.
  • game robots can be used to realize normal games of Go, chess, chess and other chess events; the human-computer interaction chess placement algorithm is an important part of the game robot software, and its core work is to be in the game before the game starts.
  • the pieces on the chess board are arranged in preparation for a standard opening or endgame game.
  • the embodiments of the present disclosure at least provide a chess playing method, device, electronic device, chess robot, computer storage medium and computer program.
  • the embodiment of the present disclosure provides a method of playing chess, which may include:
  • the image acquisition device to collect a first image
  • the first image represents the image of the chessboard and each chess piece
  • in response to the occlusion area in the chessboard image area in the first image, in the chessboard image area except the occlusion area In the area a first area is determined; in response to the at least one correct placement position in the first area not placing a chess piece corresponding to the at least one correct placement position, according to the at least one correct placement position and the first
  • the actual position of at least one chess piece in the image is used to generate a chess placement instruction;
  • the correct placement position represents the placement position of the chess piece determined according to the chess piece placement rules;
  • the actuator of the chess robot is controlled to execute the chess placement instruction.
  • determining the first area in the area of the checkerboard image area except the occlusion area includes: selecting the first area in the area of the chessboard image area except the occlusion area. A partial area is used as the first area; wherein the distance between each pixel point in the first area and the boundary of the occlusion area is greater than a first distance threshold, and each pixel point in the first area is connected to each already-occluded area. The distance of the placed chess pieces is greater than the second distance threshold.
  • a partial area can be selected as the third chessboard image area in the area other than the occlusion area based on the distance to the boundary of the occlusion area and the distance to each placed chess piece.
  • One area; and, the chess placement process is determined based on the correct placement of the first area. Therefore, the impact of the occlusion area and each placed chess piece in the chessboard image area on the chess placement process can be effectively reduced.
  • the chess placement process can be In the process, it effectively copes with the obstruction of the chessboard and chess pieces by various objects such as human arms and robotic arms.
  • the method further includes: re-executing the control of the image acquisition device to collect the first image, determining the first area, and generating the chess placement. instructions, and the step of executing the chess placement instruction until each correct placement position in the first area has a chess piece corresponding to each correct placement position.
  • the chessboard image area can be In the area except the occlusion area, placing the chess pieces corresponding to each correct placement position in the first area is beneficial to the area in the chessboard image area except the occlusion area. Play chess efficiently.
  • the method further includes: in response to the presence of an occlusion area in the chessboard image area, and each of the correct placement positions in the first area is placed with a corresponding to each correct placement position.
  • the chess piece controls the actuator to move to the initial position of the actuator; the initial position is located in an area outside the chessboard; re-execute the control image acquisition device to collect the first image, determine the first area, and generate the The steps of placing the chess instruction, executing the chess instruction, and controlling the actuator to move to the initial position until there is no occlusion area in the chessboard image area and each correct placement position in the chessboard image area A chess piece is placed corresponding to each correctly placed position.
  • the actuator can be moved outside the chessboard, and then the first image is re-acquired, and the chess playing is realized based on the re-collected first image. Therefore, when the actuator of the chess-playing robot does not block the chessboard, high-reliability chess placement can be achieved through the actuator.
  • generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image includes: responding to the first correct placement position not placing all chess pieces. In the case of chess pieces, determine the first chess piece category corresponding to the first correct placement position; the first correct placement position is the correct placement position among the at least one correct placement position; determine all chess pieces in each of the chess pieces. The first chess piece to be placed of the first chess piece category; according to the actual position of the first chess piece to be placed and the first correct placement position, generate the chess placement instruction for the first chess piece to be placed .
  • the first chess piece to be placed can be accurately placed in the first correct placement position according to the actual position of the first chess piece to be placed and the first correct placement position. Meet actual chess placement needs.
  • determining the first chess piece to be placed of the first chess piece category among the chess pieces includes: determining each chess piece of the first chess piece category among the chess pieces; Among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position is determined as the first chess piece to be placed. It can be seen that among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position can be determined as the first chess piece to be placed, and the movement path of the first chess piece to be placed is from the first The actual position of the chess piece to be placed is the first correct position. Therefore, the efficiency of placing the chess piece for the first chess piece to be placed can be improved.
  • generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image includes: in response to the first correct placement position being changed by the first The first chess piece to be placed corresponding to the correct placement position is occupied, and the distance between the center point of the first correct placement position and the center point of the first chess piece to be placed is greater than the third distance threshold, according to the first chess piece to be placed. The actual position of the chess piece and the first correct placement position are used to generate the chess placement instruction for the first chess piece to be placed; the first correct placement position is the correct one of the at least one correct placement position. Place the location.
  • the placement of the first chess piece to be placed is not accurate enough.
  • the second correct chess piece can be accurately placed at the first correct placement position.
  • the method further includes: traversing the correct placement positions in the first area in order of distance from the actuator to determining the first correct placement position. Understandably, since the first correct position is obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is conducive to efficient implementation during the chess placement process. Movement of the actuator.
  • the number of the at least one correct placement position is greater than or equal to two; the chess placement instruction is generated based on the at least one correct placement position and the actual position of at least one chess piece in the first image, Including: in response to the situation that at least two correct placement positions are mutually occupied by at least two chess pieces to be placed, based on the actual positions of at least some of the chess pieces in the at least two chess pieces to be placed and a predefined area outside the chessboard , generating the chess placement instructions for at least some of the chess pieces.
  • the method further includes: traversing the correct placement locations in the first area in order of distance from the actuator to determining the at least two correct placement locations. Location. Understandably, since at least two correct positions are obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is beneficial to reduce execution during the chess placement process. The moving distance of the actuator can be effectively realized.
  • the method further includes: in response to the fact that there is no occlusion area in the chessboard image area and the number of chess pieces in the first image is less than the first number, determining that the chess placement state is a missing piece state;
  • the first quantity is the total number of chess pieces determined according to the chess piece placement rules. Understandably, there is no occlusion area in the chessboard image area, and the number of chess pieces in the first image is less than the first number. It can be considered that the chess pieces in the first image are not enough to achieve a complete chess placement process. Therefore, by accurately determining The status of the chess piece is a lack of pieces, which is conducive to subsequent targeted processing based on the lack of pieces.
  • the method further includes: generating prompt information indicating a missing substate when a missing substate is generated at least twice in a row. It can be seen that since the prompt information indicating a missing son is generated when the missing son state is generated at least twice in a row, the occurrence of a missing son can be determined more reliably to a certain extent.
  • the embodiment of the present disclosure also provides a chess playing device, which may include: a control part and a processing part, wherein,
  • the control part is configured to control the image acquisition device to acquire a first image, where the first image represents an image of the chessboard and each chess piece;
  • a processing part configured to determine a first area in a region other than the occlusion area in the chessboard image area in response to the presence of an occlusion area in the chessboard image area; in response to the first area
  • the chess piece corresponding to the at least one correct placement position is not placed in at least one correct placement position, and a chess placement instruction is generated based on the at least one correct placement position and the actual position of at least one chess piece in the first image; so
  • the above-mentioned correct placement position means the placement position of the chess pieces determined according to the chess piece placement rules;
  • the control part is also configured to control the actuator of the chess-playing robot to execute the chess-playing instructions.
  • Embodiments of the present disclosure also provide an electronic device, which includes an image acquisition device, a processor, and a memory for storing a computer program that can be run on the processor; wherein the processor is used to run the computer program. To perform any of the above chess placement methods.
  • An embodiment of the present disclosure also provides a chess-playing robot.
  • the chess-playing robot includes an actuator for grabbing objects, and also includes any of the above-mentioned chess-playing devices or any of the above-mentioned electronic devices.
  • the actuator is a robotic arm.
  • Embodiments of the present disclosure also provide a computer storage medium on which a computer program is stored.
  • the computer program is executed by a processor, any one of the above chess playing methods can be implemented.
  • An embodiment of the present disclosure also provides a computer program, which includes computer readable code.
  • the processor in the electronic device executes for implementing any of the above chess playing. method.
  • chess placing instructions can be generated based on the correct placement of chess pieces outside the occlusion area on the chessboard and the actual position of the chess pieces. , Therefore, the impact of the occlusion area on the chess placement process can be effectively reduced, that is, when the chessboard or chess pieces are occluded, the unoccluded image information can be used to reliably achieve chess placement.
  • Figure 1 is a flow chart of a chess placement method according to an embodiment of the present disclosure
  • Figure 2 is a flow chart of another chess placement method according to an embodiment of the present disclosure.
  • Figure 3 is a schematic flowchart of generating chess placement instructions in an embodiment of the present disclosure
  • Figure 4 is a schematic diagram of a scene for generating chess placement instructions in an embodiment of the present disclosure
  • Figure 5 is a flow chart for determining the first chess piece to be placed in an embodiment of the present disclosure
  • Figure 6 is a schematic diagram of another scenario for generating chess placement instructions in an embodiment of the present disclosure.
  • Figure 7 is a schematic diagram of another scene for generating chess placement instructions in an embodiment of the present disclosure.
  • Figure 8 is a flow chart of yet another chess placing method according to an embodiment of the present disclosure.
  • Figure 9 is a schematic flow chart of calling the chess placement algorithm function to execute the chess placement algorithm in an embodiment of the present disclosure
  • Figure 10 is a schematic structural diagram of a chess placing device according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • first/second/third involved are only used to distinguish similar objects and do not represent a specific ordering of objects. It is understood that “first/second/third” can be used interchangeably if permitted. The specific order or sequence may be changed so that the embodiments of the disclosure described herein can be implemented in an order other than that illustrated or described herein.
  • a and/or B can mean: A exists alone, A and B exist simultaneously, and they exist alone. B these three situations.
  • at least one herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, and C, which can mean including from A, Any one or more elements selected from the set composed of B and C.
  • the chess placement method implemented based on the chess robot needs to assume that there is no obstruction between the chess board and the chess pieces (for example, people cannot block any chess pieces), and that there is no interference during the chess placement process (for example, people cannot move any chess pieces). ), which makes the chess-playing robot less efficient and less interactive with users, which reduces the user experience to a certain extent.
  • the process in which humans and robots play chess at the same time can be called human-computer interactive chess playing.
  • human-computer interactive chess playing the following issues need to be considered: First, different objects may appear on the chessboard, including But it is not limited to the human arm and the mechanical arm of the chess robot, which causes the chessboard and chess pieces to be blocked to varying degrees; secondly, people may move unplaced chess pieces or move already placed chess pieces, interfering with the chess placement process; thirdly, The chess pieces placed by humans may not be as accurate as those of a robotic arm, and there will be a certain degree of offset. The robotic arm needs to be fine-tuned without affecting the user experience.
  • the embodiment of the present disclosure proposes a chess-playing method, which can be applied to a chess-playing robot.
  • the chess-playing robot may include a processor and an actuator for grabbing objects; for example, the processor is used to control the working state of the actuator, and execute
  • the device may be a robotic arm or other device, and the end of the robotic arm may be provided with a suction cup or clamp.
  • the above-mentioned processor can be an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), or a Programmable Logic device.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processor
  • DSPD Digital Signal Processing Device
  • PLD Programmable Logic device
  • the above-mentioned chess-playing method can also be applied to electronic devices.
  • the electronic device can be a part of the chess-playing robot, or it can be another device that forms a communication connection with the chess-playing robot.
  • the electronic device may include at least one of the host computer and cloud device corresponding to the robot; the electronic device may include a processor; in the case of other devices that form a communication connection with the chess robot, The electronic device can send chess placement instructions to the chess robot.
  • An image acquisition device can be installed in the game robot or electronic device, and the processor of the game robot can control the image acquisition device of the game robot to collect images; in the case where the electronic device is another device that forms a communication connection with the game robot, the electronic device can control the image The acquisition device acquires images.
  • Figure 1 is a flow chart of a chess placement method according to an embodiment of the present disclosure. As shown in Figure 1, the process may include:
  • Step 101 Control the image acquisition device to acquire a first image, where the first image represents the image of the chessboard and each chess piece.
  • the image acquisition device may be disposed toward the chessboard for capturing at least an image of the chessboard.
  • the shooting area of the image acquisition device may also include the surrounding area of the chessboard.
  • the chessboard may be a chess board, a chess board, a Go board, etc.
  • the chess pieces are chess pieces, chess pieces, Go pieces, etc.
  • Step 102 In response to the presence of an occlusion area in the chessboard image area in the first image, determine a first area in the chessboard image area except the occlusion area.
  • the first image can be analyzed to obtain the analysis result of the first image; the analysis result of the first image at least includes the chessboard image area and the position of each chess piece in the image; according to the analysis result of the first image, Determine whether there is an occlusion area in the checkerboard image area.
  • the first image can be segmented into regions to determine the chessboard image area and the image area outside the chessboard; by detecting and identifying the chess pieces on the first image, the chess pieces can be determined The position in the first image; for example, the chess piece can be detected and recognized in the first image according to a pre-trained target detection model.
  • the chessboard image in the first image can be input into a pre-trained occlusion recognition model, and the occlusion recognition model is used to identify the occlusion areas in the chessboard image area; for example, the occlusion recognition model refers to pre-training based on a large number of The classifier obtained by training image data for classification training.
  • the training image data for pre-training includes a first type of sample image in which the chessboard or chess pieces are occluded, and a second type of sample image in which the chessboard and chess pieces are not occluded. The first type of sample image and the second type of sample image are classified through a classification algorithm.
  • the first type of sample image may be an image in which at least one of the chessboard and the chess pieces is blocked by other objects.
  • the other objects may be the actuators of a chess robot or human hands.
  • the entire area in the checkerboard image area except the occlusion area may be used as the first area, or a part of the checkerboard image area except the occlusion area may be used as the first area.
  • Step 103 In response to the fact that the chess piece corresponding to the at least one correct placement position is not placed in the at least one correct placement position in the first area, generate a chess placing instruction based on the at least one correct placement position and the actual position of the at least one chess piece in the first image. ;
  • the correct placement position means the placement position of the chess pieces determined according to the chess piece placement rules.
  • the chess piece placement rules may represent rules that meet the opening standards of the chess game, or may be rules determined based on the preset endgame chess record. It is understandable that the chess piece placement rules are known rules, for example, chess The rules for placing chess pieces at the beginning of the game, the rules for placing chess pieces at the beginning of chess, and the rules for placing chess pieces corresponding to the end game of chess are all known rules.
  • the chess pieces corresponding to each correctly placed position on the chess board are determined according to the chess piece placement rules; for example, for a chess board or a Go chess board, the correct placement position of the chess pieces is part of the horizontal line on the chess board. At the intersection point with the vertical line, the correct placement position of the chess piece can be expressed by the coordinates of the corresponding intersection point; for the chess board, the correct placement position of the chess piece is part of the grid on the chessboard, and the correct placement position of the chess piece can be expressed by the corresponding grid The coordinates of the center point of .
  • the chess pieces corresponding to each correctly placed position are the same type of chess pieces, and each correctly placed chess piece can be used to place a chess piece in a type of chess piece.
  • a chess board a certain correctly placed chess piece The position is used to place the chess pieces with the category "Pawn". There are 5 chess pieces with the category "Pawn”. The correct placement position can place one of the 5 chess pieces with the category "Pawn". Different chess pieces of the same category can be placed in different correct placement positions. For example, in the scene of the chess opening game, different chess pieces of the category "bishop" are placed at different chessboard intersections.
  • At least one chess piece to be placed and the target position of at least one chess piece to be placed can be determined based on at least one correct placement position and the actual position of at least one chess piece in the first image; according to at least one chess piece to be placed The current actual position and target position of the chess pieces can determine the chess placement instructions for moving the chess pieces to be placed.
  • the position of the chess piece (actual position and target position) can be represented by the coordinates of the center point of the chess piece.
  • Step 104 Control the actuator of the chess-playing robot to execute the chess-playing instructions.
  • the processor of the chess-playing robot can control the working state of the robotic arm so that the robotic arm executes chess placement instructions to realize the placement of each chess piece on the chessboard.
  • the electronic device can send a chess placement instruction to the chess robot to control the actuator of the chess robot to execute the chess placement instructions.
  • chess placement instructions can be generated based on the correct placement of chess pieces outside the occlusion area on the chessboard and the actual position of the chess pieces. Therefore, the interference with the occlusion area can be effectively reduced.
  • the impact of the chess placement process that is, when the chessboard or chess pieces are occluded, the unoccluded image information can be used to reliably achieve chess placement.
  • a part of the area in the checkerboard image area other than the occlusion area can be selected as the first area; wherein the distance between each pixel in the first area and the boundary of the occlusion area is greater than the first area. distance threshold, and the distance between each pixel in the first area and each placed chess piece is greater than the second distance threshold.
  • the position that is within a first distance threshold from the boundary of the occlusion area can be determined as a position where chess pieces cannot be placed; for example, the first distance threshold It can be the radius of a chess piece, the diameter of a chess piece, 1.1 times the diameter of a chess piece, etc.; similarly, in order to reduce the impact of each placed chess piece on the chess placement process, the distance to the chess piece can be set to the second distance
  • the position within the threshold is determined as a position where chess pieces cannot be placed; for example, the second distance threshold is the diameter of a chess piece, 1.2 times the diameter of a chess piece, etc.
  • the first distance threshold and the second distance threshold may be the same or different. For example, the first distance threshold and the second distance threshold may both be the diameter of a chess piece.
  • a partial area can be selected as the third chessboard image area in the area other than the occlusion area based on the distance to the boundary of the occlusion area and the distance to each placed chess piece.
  • One area; and, the chess placement process is determined based on the correct placement of the first area. Therefore, the impact of the occlusion area and each placed chess piece in the chessboard image area on the chess placement process can be effectively reduced.
  • the chess placement process can be In the process, it effectively copes with the obstruction of the chessboard and chess pieces by various objects such as human arms and robotic arms.
  • steps 101 to 104 can be re-executed until each correct placement position in the first area has a chess piece corresponding to each correct placement position.
  • step 101 when step 101 is re-executed, due to the change in the position of the chess pieces caused by the latest chess placement, the first image collected by the image acquisition device will change, that is, the first image collected by the image acquisition device will be the updated The first image, that is, it is necessary to perform steps 102 to 104 based on the updated first image until each correct placement position in the first area has a chess piece corresponding to each correct placement position.
  • the first area can be determined based on the first image, and it can be determined whether each correct placement position in the first area is placed corresponding to each correct placement position. chess piece.
  • the actuator may be continued to be controlled to place the chess piece by performing steps 103 to 104 .
  • the chessboard image area can be In the area except the occlusion area, placing the chess pieces corresponding to each correct placement position in the first area is beneficial to the area in the chessboard image area except the occlusion area. Play chess efficiently.
  • the chess placement method according to the embodiment of the present disclosure may further include the following steps:
  • Step 201 In response to the presence of an occlusion area in the chessboard image area, and each correct placement position in the first area has a chess piece corresponding to each correct placement position, control the actuator to move to the initial position of the actuator; the initial position is located on the chessboard outside the area.
  • the initial position can be the default position of the actuator, and the default position of the actuator can be the position set by the user; in some embodiments, the distance between the initial position and the chessboard can be less than the set value, which is beneficial to improving the actuator The efficiency and speed of playing chess.
  • Step 202 Re-execute the steps of controlling the image acquisition device to collect the first image, determining the first area, generating chess placement instructions, executing chess placement instructions, and controlling the actuator to move to the initial position until there is no occlusion area in the chessboard image area. , and each correctly placed position in the chessboard image area has a chess piece corresponding to each correctly placed position.
  • the chess placement state is the chess placement completion state; in some cases
  • a prompt message indicating the completion of the chess placement may be issued and the process ends;
  • the prompt information indicating the completion of the chess placement may be text prompt information, sound prompt information, etc., for example , the prompt message for completing the chess placement can be the following text prompt message: "The robot is ready, please move first.”
  • the actuator can be moved outside the chessboard, and then the first image is re-acquired, and the chess playing is realized based on the re-collected first image. Therefore, when the actuator of the chess-playing robot does not block the chessboard, high-reliability chess placement can be achieved through the actuator.
  • the process of generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image may include:
  • Step 301 In response to the fact that no chess piece is placed at the first correct placement position, determine the first chess piece category corresponding to the first correct placement position; the first correct placement position is the correct placement position among at least one correct placement position.
  • the first correct placement can be one correct placement position, or it can be at least two correct placement positions; based on the contents recorded in the foregoing embodiments, in response to the situation that the chess piece is not placed at the first correct placement position, the chess piece placement rules can be , determine the first chess piece category corresponding to the first correct placement position; for example, referring to Figure 4, when the first correct placement position is point E, according to the chess piece placement rules at the beginning of chess, the first correct placement position can be determined The corresponding first chess piece category is "rook". When the first correct placement position is point F, according to the chess piece placement rules at the beginning of chess, it can be determined that the first chess piece category corresponding to the first correct placement position is "horse".
  • Step 302 Determine the first chess piece to be placed of the first chess piece category among each chess piece.
  • one chess piece when there are at least two chess pieces in the first chess category, one chess piece can be selected as the first chess piece to be placed among the chess pieces in the first chess category.
  • Chess pieces for example, if the first chess piece category is "Pawn", and there are 5 chess pieces in the first chess piece category, you can select one chess piece as the first chess piece to be placed among the 5 chess pieces of the "Pawn" category. piece.
  • the chess piece of the first chess piece category is one chess piece
  • the chess piece of the first chess piece category can be directly used as the first chess piece to be placed.
  • Step 303 Generate a chess placement instruction for the first chess piece to be placed based on the actual position of the first chess piece to be placed and the first correct placement position.
  • the first correct placement position can be used as the target position of the first chess piece to be placed, and the placement instruction for the first chess piece to be placed can be to move the first placed chess piece from the actual position to the target position.
  • the placement instruction for the first chess piece to be placed can be to move the first placed chess piece from the actual position to the target position.
  • the first chess piece to be placed corresponding to point E is the first chess piece 401, and the target position of the first chess piece 401 is determined as point E, thereby generating a target for The placement instruction of the first chess piece 401.
  • the first chess piece to be placed can be accurately placed at the first correct placement position according to the actual position of the first chess piece to be placed and the first correct placement position. Meet actual chess placement needs.
  • step 302 may specifically include the following steps:
  • Step 3021 Determine each chess piece of the first chess piece category among each chess piece in the first image.
  • Step 3022 Among the chess pieces of the first chess piece category, determine the chess piece closest to the first correct placement position as the first chess piece to be placed.
  • the chess pieces of the first chess piece category may include at least two chess pieces. It can be seen that among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position can be determined as the first chess piece to be placed, and the movement path of the first chess piece to be placed is from the first The actual position of the chess piece to be placed is the first correct position. Therefore, the efficiency of placing the chess piece for the first chess piece to be placed can be improved; the placed or unplaced chess pieces that humans move intentionally or unintentionally can be placed in the shortest path. to the correct location.
  • the process of generating a chess placement instruction based on at least one correct placement position and the actual position of at least one chess piece in the first image may include:
  • the chess placing instruction for the first chess piece to be placed is generated according to the actual position of the first chess piece to be placed and the first correct placement position; the first correct placement position is the correct one of the at least one correct placement position. Place the location.
  • the center point of the first correct placement position is the first correct placement position itself; for example, for chess, the center point of the first correct placement position is Intersection point; when the correct placement position of the chess piece is a grid, the center point of the first correct placement position is the center point of the corresponding grid; for example, for chess, the center point of the first correct placement position is the center point of the grid point.
  • the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed can be recorded as D, and the third distance threshold is smaller than the second distance threshold.
  • the third distance threshold is the difference between the side length of the grid on the chessboard minus the diameter of the chess piece.
  • the distance D is greater than the second distance threshold, based on the foregoing description, it can be considered that no chess piece is placed at the first correct placement position, that is, the first correct placement position is not occupied by a chess piece.
  • the distance D is less than or equal to the third distance threshold, based on the aforementioned content, it can be considered that the first correct placement position is occupied by the first chess piece to be placed, and the placement accuracy of the chess piece at the first correct placement position is relatively high. In this case, it is not necessary to re-place the chess piece for the first chess piece to be placed.
  • the placement of the first chess piece to be placed is not accurate enough. In this case, it is necessary to place the first chess piece to be placed. Fine-tuning the position of the chess piece, that is, it is necessary to generate a chess placement instruction for the first chess piece to be placed, in order to improve the placement accuracy of the chess pieces placed in the first zone.
  • the first correct placement position is point E
  • the first chess piece category corresponding to the first correct placement position is "rook"
  • the first chess piece to be placed corresponding to point E is the second chess piece 601.
  • the distance between the center point of the second chess piece 601 and point E is recorded as distance D.
  • a placement instruction for the second chess piece 601 is generated to achieve fine-tuning of the position of the second chess piece 601 .
  • the placement of the first chess piece to be placed is not accurate enough.
  • the second correct chess piece can be accurately placed at the first correct placement position.
  • the correct placement positions in the first area can also be traversed in order of distance from the actuator from closest to far to determine the first correct placement position.
  • the first correct position is obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is conducive to efficient implementation during the chess placement process. Movement of the actuator.
  • the process of generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image which can include:
  • chess placement instructions In response to the situation that at least two correct placement positions are mutually occupied by at least two chess pieces to be placed, generating a target for at least some of the chess pieces based on the actual positions of at least some of the chess pieces in the at least two chess pieces to be placed and a predefined area outside the chessboard.
  • the chess placement instructions In response to the situation that at least two correct placement positions are mutually occupied by at least two chess pieces to be placed, generating a target for at least some of the chess pieces based on the actual positions of at least some of the chess pieces in the at least two chess pieces to be placed and a predefined area outside the chessboard.
  • the predefined area is the position outside the chessboard where chess pieces are placed.
  • the size of the predefined area can be determined according to the size and number of chess pieces. When the total number of chess pieces determined according to the chess piece placement rules is large, a larger predefined area can be set. Define the area; when the total number of chess pieces determined according to the chess piece placement rules is small, a smaller predefined area can be set. If the chess pieces are larger, a larger predefined area can be set; if the chess pieces are smaller, a smaller predefined area can be set.
  • At least part of the at least two chess pieces to be placed may be part of the at least two chess pieces to be placed, or may be all of the at least two chess pieces to be placed.
  • the third chess piece 701 with the chess piece category "Pawn” is in the correct placement position
  • the fourth chess piece 702 with the chess piece category "Rook” occupies the correct position of the chess piece with the chess piece category "Horse” Placement position
  • the fifth chess piece 703 with the chess piece category "horse” occupies the correct placement position of the chess piece with the chess piece category "rook”; that is, the fourth chess piece 702 and the fifth chess piece 703 occupy each other's correct positions.
  • the correct placement positions in the first area can also be traversed in order of distance from the actuator from nearest to far, and at least two correct placement positions are determined.
  • the chess placement state is a lack of pieces state; the first number is determined according to the chess piece placement rules. The total number of chess pieces.
  • the number of chess pieces in the first image is less than the first number. It can be considered that the chess pieces in the first image are not enough to achieve a complete chess placement process. Therefore, by accurately determining The status of the chess piece is a lack of pieces, which is conducive to subsequent targeted processing based on the lack of pieces.
  • prompt information indicating a missing substate may be generated. For example, when a missing substate is generated three times in a row, prompt information indicating a missing substate may be generated.
  • the prompt information indicating missing pieces may be text prompt information, sound prompt information, etc.
  • the prompt information indicating the completion of chess placement may be the following text prompt information: "There is a missing piece, please add chess pieces.” After generating a prompt message indicating a missing child, the process can be ended.
  • the prompt information indicating a missing son is generated when the missing son state is generated at least twice in a row, the occurrence of a missing son can be determined more reliably to a certain extent.
  • Another method of placing chess may include the following steps:
  • Step 801 Complete the initial placement of each chess piece and the chessboard.
  • each chess piece and chess board can be completed by the user.
  • the user can place each chess piece and chess board in an area that can be photographed by the image acquisition device; for example, the user can place at least some of the chess pieces flatly on the on the chessboard to achieve the initial placement of chess pieces and chessboard.
  • Step 802 Control the camera to collect the first image.
  • the camera is the above-mentioned image acquisition device.
  • the camera can be controlled by the processor of the game robot to acquire the first image.
  • Step 803 Perform image tagging.
  • the first image can be analyzed, and image labeling can be performed based on the analysis results of the first image.
  • the implementation of image marking may include: marking the occlusion area, the position of each chess piece, and the category identification of each chess piece in the first image.
  • the position of each chess piece may be identified by the center point of each chess piece. coordinate representation.
  • the impact of the occlusion area on the correct placement of the chessboard and the chess pieces can be judged, which helps to determine which positions on the chessboard cannot be placed and which chess pieces cannot be placed at the current moment.
  • the correct placement position for example, the correct placement position in the occlusion area cannot place the chess piece; in response to the correct placement position of a specific chess piece being in the occlusion area or occupied by other chess pieces, the specific chess piece cannot be placed in the corresponding correct position at the current moment. Place the location.
  • the grayscale value of the occlusion area can be set to 255 or other non-zero value, and the grayscale value of the background of the non-occlusion area can be set to 0;
  • the position with the category identifier of the chess piece in the chessboard image area is The correct placement position of the corresponding chess piece; within a chess piece radius of the boundary pixel point of the occlusion area, the category identifier of the chess piece cannot be identified, that is, the correct placement position is not within a chess piece radius range of the boundary pixel point of the occlusion area; two
  • the category identifiers of chess pieces should be spaced at least twice the chess piece radius (i.e. the diameter of a chess piece).
  • the distance between the intersection point and the boundary of the occlusion area is less than or equal to The diameter of a chess piece determines that the intersection point is not the correct placement position; similarly, in response to the distance between the intersection point and any placed chess piece being less than or equal to the diameter of a chess piece, it is determined that the intersection point is not the correct placement position.
  • step 803 may be executed by the processor of the game robot.
  • Step 804 Call the chess placement algorithm function to execute the chess placement algorithm.
  • the chess-playing algorithm function can be called by the processor of the chess-playing robot to execute the chess-playing algorithm.
  • the output result can be obtained by calling the chess-playing algorithm function to execute the chess-playing algorithm.
  • the input information of the chess placement algorithm may include the location of the occlusion area, the location of the non-occlusion area, the location of the chessboard, the location of each chess piece, and the category identifier of each chess piece.
  • the position and category identification of each chess piece can be represented by the array (x, y, p), where x and y represent the abscissa and ordinate coordinates of the center point of the chess piece, and p represents the category identification of the chess piece, for example, the category identification of the chess piece It can be "gun", "general”, etc.
  • the output result at least includes a status code indicating the state of the chess placement. For example, when the status code is status code 0, the status code indicates that the chess is being placed; when the status code is status code 1, the status code indicates that the chess is being placed; when the status code is status code 2 In this case, the status code indicates the state of moving the robotic arm to the initial position; in the case where the status code is status code 3, the status code indicates the missing child state.
  • the output result may also include the current actual position of the chess piece to be placed, the target position, and the chess piece category identifier.
  • the chess piece category identifier may be the name or identity of the chess piece category.
  • the output result can also include an array (x1, y1, x2, y2, p1), where x1 represents the abscissa of the actual position of the center point of the chess piece to be placed, and y1 represents The ordinate of the actual position of the center point of the chess piece to be placed, x2 represents the abscissa of the target position of the chess piece to be placed, y2 represents the ordinate of the target position of the chess piece to be placed, and p1 represents the chess piece category identifier of the chess piece to be placed. .
  • Step 805 Perform corresponding operations according to the status code.
  • step 805 may be performed by the processing of the game robot.
  • step 805 may include step 8051; when the status code is status code 2, step 805 may include step 8052; when the status code is status code 3 , step 805 may include step 8053; when the status code is status code 0, step 805 may include step 8054.
  • Step 8051 Control the robotic arm to execute the chess placement instruction, and then return to step 802.
  • the robotic arm can be controlled to complete the grabbing and placing of the chess piece to be placed, that is, the chess placement operation for the chess piece to be placed is realized.
  • Step 8052 Control the robotic arm to move to the initial position, and then return to step 802.
  • Step 8053 Generate voice prompt information, and then end the process.
  • the embodiment of the present disclosure can accurately distinguish whether the chess placement cannot be completed due to occlusion or the chess placement cannot be completed due to a lack of pieces, and when a missing piece occurs, a prompt is given to require the person to cooperate to complete the chess placement.
  • Step 8054 Generate a prompt message indicating the completion of chess placement, and end the process.
  • the process of calling the chess placement algorithm function to execute the chess placement algorithm may include:
  • Step 901 Determine whether the chess placement status is the chess placement completion state. If yes, execute step 902. If not, execute step 903.
  • Step 902 Output status code 0.
  • Step 903 Determine whether there is a first correct placement position for unplaced chess pieces. If yes, execute step 906. If not, execute step 904.
  • the first correct placement position is the correct placement position in the first area.
  • the distance between each pixel point in the first area and the boundary of the occlusion area is greater than the diameter of a chess piece, and each pixel point in the first area is The distance between each placed chess piece is greater than the diameter of one chess piece.
  • step 906 is executed. If not, step 904 is executed.
  • the target chess record is a chess record that represents the rules for placing chess pieces.
  • the target chess record may be a standard opening chess record or a predetermined endgame chess record.
  • the target chess record is a chess record that represents the rules for placing chess pieces.
  • the target chess record may be a standard opening chess record or a predetermined endgame chess record.
  • Step 904 Determine whether there is a first correct placement position that meets the set conditions; if yes, execute step 906; if not, execute step 905.
  • the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed is recorded as D.
  • the setting condition may be: the distance D is greater than the third distance threshold, and the distance D is less than or equal to the second Distance threshold; in this step, the third distance threshold is the difference between the side length of the grid on the chessboard minus the diameter of the chess piece, and the second distance threshold is the diameter of a chess piece.
  • the chess piece in the scene of playing chess, for the 10x9 horizontal and vertical line intersections on the chessboard, traverse starting from the left side of the proximal end of the robotic arm to find the first correct placement position and determine the first correct placement position. Whether the chess piece can be placed at the correct placement position. If the chess piece cannot be placed, based on the type of chess piece in the target chess record at that position, it is judged whether it is because the first chess piece to be placed is in the first correct placement position but the placement is not accurate enough (that is, the distance D is greater than The third distance threshold, and the distance D is less than or equal to the second distance threshold), resulting in the first correct placement position being unable to be placed. If yes, the actual position and target position of the first chess piece to be placed are obtained; the target position of the first chess piece to be placed is the first correct placement position.
  • the position can be placed, if not, based on the type of chess pieces in the target chess record at that position, determine whether the first chess piece to be placed is in the first correct position but the placement is not accurate enough (that is, the distance D is greater than the third distance threshold, and the distance D is less than or equal to the second distance threshold), resulting in the first correct placement position being unable to be placed. If so, obtain the actual position and target position of the first chess piece to be placed.
  • Step 905 Determine whether there are at least two correct placement positions occupied by at least two chess pieces to be placed. If yes, step 906 is executed. If not, step 907 is executed.
  • this step in response to the fact that there are at least two correct placement positions occupied by at least two chess pieces to be placed, some of the chess pieces of the at least two chess pieces to be placed can be moved to the free predefined positions on the left and right sides of the chessboard. area.
  • the 10x9 horizontal and vertical line intersections on the chessboard traverse starting from the left side of the proximal end of the robotic arm to find whether there are at least two correct placement positions.
  • at least two chess pieces to be placed occupy each other, if so, then at least one of the two chess pieces to be placed needs to be moved to a predefined area, and the actual position and target position of the chess piece that needs to be moved can be determined.
  • the target position of the chess piece that needs to be moved is a predefined area.
  • the chess piece to be placed in the scenario of playing chess, for each square on the chess board, traverse starting from the left side of the proximal end of the robotic arm to find whether there are at least two correct placement positions that are occupied by at least two The chess pieces to be placed occupy each other. If so, at least one of the two chess pieces to be placed needs to be moved to a predefined area.
  • the actual position and target position of the chess piece that needs to be moved can be determined.
  • the chess piece that needs to be moved The target position of the chess piece is a predefined area.
  • Step 906 Output status code 1 and related information of the chess piece to be placed.
  • the relevant information of the chess piece to be placed may include the actual position and the target position of the chess piece to be placed; the chess piece to be placed in this step may be the first chess piece to be placed or one of the at least two chess pieces to be placed.
  • Step 907 Determine whether the chess placement state is a missing piece state. If yes, step 908 is executed. If not, step 909 is executed.
  • Step 908 Output status code 3.
  • Step 909 Output status code 2.
  • the chess placement method can effectively deal with the obstruction of the chessboard and chess pieces by various objects.
  • the relevant unoccluded image information can be used to achieve efficient chess placement.
  • placed or unplaced chess pieces that humans move intentionally or unintentionally they can be placed in the correct position through the shortest path. Accurately feedback the completion status or lack of pieces status of the chess piece in the case of possible occlusion.
  • the relevant unobstructed image information can be used to realize the efficient chess playing of the robotic arm, which is beneficial to the realization of the interaction between the robotic arm and the human on the chess robot.
  • the interactive chess playing is more efficient than playing chess with only mechanical arms. Since there is good interaction between humans and robots during the chess playing process, it can better meet the actual needs of users and is more interactive.
  • the chess placement method of the embodiment of the present disclosure can effectively deal with various situations of occlusion of the chess board and chess pieces. When a person places the chess pieces crookedly or incorrectly, a mechanical arm can be used to correct the position. Therefore, the chess placement process is improved in the smoothness of the chess placement process. Great sex.
  • Embodiments of the present disclosure can be applied to game scenarios of various chess sports. For example, when the user restarts a new game of chess or a new game of international chess, the chess placement method of the embodiment of the present disclosure is used. , which can achieve efficient and accurate chess placement.
  • a new chess game can be a standard opening game or an endgame game; correspondingly, a new chess game can be a standard opening game or an endgame game.
  • embodiments of the present disclosure provide a chess-playing device, which includes various parts and can be implemented by a processor in an electronic device; of course, it can also be implemented by a specific logic circuit; in implementation In the process, the processor may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
  • the processor may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
  • Figure 10 is a schematic structural diagram of a chess playing device according to an embodiment of the present disclosure. As shown in Figure 10, the device includes a control part 1001 and a processing part 1002, wherein,
  • the control part 1001 is configured to control the image collection device to collect a first image, where the first image represents the image of the chessboard and each chess piece;
  • the processing part 1002 is configured to, in response to the presence of an occlusion area in the checkerboard image area in the first image, determine a first area in the checkerboard image area other than the occlusion area; in response to the first The chess piece corresponding to the at least one correct placement position is not placed in at least one correct placement position in the area, and a chess placement instruction is generated based on the at least one correct placement position and the actual position of at least one chess piece in the first image;
  • the correct placement position represents the placement position of the chess pieces determined according to the chess piece placement rules;
  • the control part 1001 is also configured to control the actuator of the chess-playing robot to execute the chess-playing instruction.
  • chess placing instructions can be generated based on the correct placement of chess pieces outside the occlusion area on the chessboard and the actual position of the chess pieces. , Therefore, the impact of the occlusion area on the chess placement process can be effectively reduced, that is, when the chessboard or chess pieces are occluded, the unoccluded image information can be used to reliably achieve chess placement.
  • the processing part 1002 is configured to determine the first area in the area of the checkerboard image area except the occlusion area, including:
  • the occlusion area select a partial area as the first area; wherein the distance between each pixel point in the first area and the boundary of the occlusion area is greater than the third area.
  • a distance threshold, and the distance between each pixel in the first area and each placed chess piece is greater than the second distance threshold.
  • a partial area can be selected as the third chessboard image area in the area other than the occlusion area based on the distance to the boundary of the occlusion area and the distance to each placed chess piece.
  • One area; and, the chess placement process is determined based on the correct placement of the first area. Therefore, the impact of the occlusion area and each placed chess piece in the chessboard image area on the chess placement process can be effectively reduced.
  • the chess placement process can be In the process, it effectively copes with the obstruction of the chessboard and chess pieces by various objects such as human arms and robotic arms.
  • control part 1001 is also configured to, after controlling the actuator and executing the chess placement instruction, re-execute the control of the image acquisition device to collect the first image, determine the first area, and generate the The chess placement instruction and the step of executing the chess placement instruction are provided until each correct placement position in the first area has a chess piece corresponding to each correct placement position.
  • the chessboard image area can be In the area except the occlusion area, placing the chess pieces corresponding to each correct placement position in the first area is beneficial to the area in the chessboard image area except the occlusion area. Play chess efficiently.
  • control part 1001 is also configured to:
  • the actuator In response to the existence of an occlusion area in the chessboard image area, and each of the correct placement positions in the first area is placed with a chess piece corresponding to each of the correct placement positions, the actuator is controlled to move to the execution The initial position of the chessboard; the initial position is located in an area outside the chessboard;
  • the actuator can be moved outside the chessboard, and then the first image is re-acquired, and the chess playing is realized based on the re-collected first image. Therefore, when the actuator of the chess-playing robot does not block the chessboard, high-reliability chess placement can be achieved through the actuator.
  • the processing part 1002 is configured to generate a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image, including:
  • the first chess piece category corresponding to the first correct placement position is determined; the first correct placement position is the at least one correct placement position. Correct placement;
  • the chess placement instruction for the first chess piece to be placed is generated.
  • the first chess piece to be placed can be accurately placed in the first correct placement position according to the actual position of the first chess piece to be placed and the first correct placement position. Meet actual chess placement needs.
  • the processing part 1002 is configured to determine the first chess piece to be placed of the first chess piece category among the chess pieces, including:
  • the chess piece closest to the first correct placement position is determined as the first chess piece to be placed.
  • the chess piece closest to the first correct placement position can be determined as the first chess piece to be placed, and the movement path of the first chess piece to be placed is from the first The actual position of the chess piece to be placed is to the first correct position. Therefore, the efficiency of placing the chess piece for the first chess piece to be placed can be improved.
  • the processing part 1002 is configured to generate a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image, including:
  • the chess placement instruction for the first chess piece to be placed is generated based on the actual position of the first chess piece to be placed and the first correct placement position; the first correct placement The position is a correct placement position among the at least one correct placement position.
  • the placement of the first chess piece to be placed is not accurate enough.
  • the second correct chess piece can be accurately placed at the first correct placement position.
  • the processing part 1002 is further configured to traverse the correct placement positions in the first area in order of distance from the actuator to determine the first correct placement position. .
  • the first correct position is obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is conducive to efficient implementation during the chess placement process. Movement of the actuator.
  • the number of the at least one correctly placed position is greater than or equal to two; the processing part 1002 is configured to determine the actual position of the at least one chess piece in the first image according to the at least one correctly placed position. , generate chess placement instructions, including:
  • the processing part 1002 is further configured to traverse the correct placement positions in the first area in order of distance from the actuator to determine the at least two correct placement.
  • the processing part 1002 is further configured to determine that the chess placement status is a missing piece in response to the fact that there is no occlusion area in the chessboard image area and the number of chess pieces in the first image is less than the first number. State; the first number is the total number of chess pieces determined according to the chess piece placement rules.
  • the number of chess pieces in the first image is less than the first number. It can be considered that the chess pieces in the first image are not enough to achieve a complete chess placement process. Therefore, by accurately determining The status of the chess piece is a lack of pieces, which is conducive to subsequent targeted processing based on the lack of pieces.
  • the processing part 1002 is further configured to generate prompt information indicating a missing substate when a missing substate is generated at least twice in a row.
  • the prompt information indicating a missing son is generated when the missing son state is generated at least twice in a row, the occurrence of a missing son can be determined more reliably to a certain extent.
  • the description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment.
  • the functions or parts of the device provided by the embodiments of the present disclosure can be used to perform the methods described in the above method embodiments.
  • the methods of the present disclosure please refer to the descriptions of the embodiments.
  • the above-mentioned chess placement method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
  • the software product is stored in a storage medium and includes a number of instructions to enable a A computer device (which may be a personal computer, a server, a network device, etc.) executes all or part of the methods described in various embodiments of the present disclosure.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read Only Memory, ROM), magnetic disk or optical disk and other media that can store program code.
  • U disk mobile hard disk
  • read-only memory Read Only Memory
  • ROM Read Only Memory
  • magnetic disk or optical disk and other media that can store program code.
  • the embodiments of the present disclosure are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.
  • Embodiments of the present disclosure provide a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, some or all of the steps in any of the above-mentioned chess-playing methods are implemented.
  • the computer-readable storage medium may be transient or non-transitory.
  • Computer-readable storage media may be volatile storage media or non-volatile storage media.
  • the computer-readable storage medium may be, for example, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above.
  • Non-exhaustive list of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), ROM, electrical programmable read-only memory (Electrical Programmable Read) Only Memory, EPROM), flash memory, Static Random-Access Memory (Static Random-Access Memory, SRAM), Portable Compact Disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM), Digital Multi-Function Disk (Digital Video Disc) , DVD), memory sticks, floppy disks, mechanical encoding devices, such as punched cards or raised-in-groove structures with instructions stored thereon, and any suitable combination of the above.
  • computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or transmitted through wires electrical signal.
  • Embodiments of the present disclosure provide a computer program, including computer readable code.
  • the processor in the computer device executes for implementing any of the above chess playing. Some or all of the steps in a method.
  • Embodiments of the present disclosure provide a computer program product.
  • the computer program product includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, some of the above methods are implemented or All steps.
  • the computer program product can be implemented specifically through hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium.
  • the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) and so on.
  • FIG. 11 is a schematic diagram of a hardware entity of an electronic device in an embodiment of the present disclosure.
  • the electronic device 1100 may include: a memory 1101, a processor 1102, an image acquisition device 1103, and images stored in the memory 1101.
  • the processor 1102 is used to run the computer program to execute any of the above-mentioned chess placing methods.
  • the above-mentioned memory 1101 can be volatile memory (volatile memory), such as RAM; or non-volatile memory (non-volatile memory), such as ROM, flash memory (flash memory), hard disk (Hard Disk) Drive, HDD) or solid-state drive (Solid-State Drive, SSD); or a combination of the above types of memories, and provides instructions and data to the processor 1102.
  • volatile memory such as RAM
  • non-volatile memory non-volatile memory
  • ROM read-only memory
  • flash memory flash memory
  • HDD hard disk
  • SSD solid-state drive
  • An embodiment of the present disclosure also provides a chess-playing robot.
  • the chess-playing robot includes an actuator for grabbing objects, and also includes any of the above-mentioned chess-playing devices or any of the above-mentioned electronic devices.
  • the actuator is a robotic arm.
  • the disclosed devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division.
  • the coupling, direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be electrical, mechanical, or other forms. of.
  • the units described above as separate components may or may not be physically separated; the components shown as units may or may not be physical units; they may be located in one place or distributed to multiple network units; Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present disclosure can be all integrated into one processing unit, or each unit can be separately used as a unit, or two or more units can be integrated into one unit; the above-mentioned integration
  • the unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the aforementioned program can be stored in a computer-readable storage medium.
  • the execution includes: The steps of the above method embodiment; and the aforementioned storage media include: mobile storage devices, read-only memory (Read Only Memory, ROM), magnetic disks or optical disks and other various media that can store program codes.
  • the above-mentioned integrated units of the present disclosure are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium.
  • the technical solution of the present disclosure can be embodied in the form of a software product in essence or that contributes to related technologies.
  • the computer software product is stored in a storage medium and includes a number of instructions to enable a computer.
  • a computer device (which may be a personal computer, a server, a network device, etc.) executes all or part of the methods described in various embodiments of the present disclosure.
  • the aforementioned storage media include: mobile storage devices, ROMs, magnetic disks or optical disks and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Robotics (AREA)
  • Mechanical Engineering (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Manipulator (AREA)

Abstract

A chess placement method and apparatus, an electronic device, a chess playing robot, a computer storage medium, and a computer program. The chess placement method comprises: controlling an image acquisition device to acquire a first image, the first image representing an image of a chessboard and each chess piece; in response to the existence of a blocking area in a chessboard image area in the first image, determining a first area in the area other than the blocking area in the chessboard image area; in response a chess piece corresponding to at least one correct placement position is not placed in the at least one correct placement position in the first area, generating a chess placement instruction according to the at least one correct placement position and the actual position of at least one chess piece in the first image, the correct placement position representing a chess piece placement position determined according to a chess piece placement rule; and controlling an executor of a chess playing robot to execute the chess placement instruction.

Description

摆棋方法、装置、电子设备、对弈机器人、存储介质和程序Chess playing method, device, electronic equipment, game robot, storage medium and program
相关申请的交叉引用Cross-references to related applications
本申请基于申请号为202210293846.3、申请日为2022年3月23日,名称为“摆棋方法、装置、电子设备、对弈机器人及存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。This application is based on a Chinese patent application with application number 202210293846.3 and a filing date of March 23, 2022, titled "Chess placing method, device, electronic equipment, game robot and storage medium", and requires priority for this Chinese patent application The entire content of this Chinese patent application is hereby incorporated into this application as a reference.
技术领域Technical field
本公开涉及但不限于智能设备控制领域,尤其涉及一种摆棋方法、装置、电子设备、对弈机器人、计算机存储介质和计算机程序。The present disclosure relates to, but is not limited to, the field of intelligent device control, and in particular, to a chess playing method, device, electronic device, chess-playing robot, computer storage medium, and computer program.
背景技术Background technique
在相关技术中,可以利用对弈机器人实现围棋、象棋、国际象棋等棋类项目的正常对弈;人机互动摆棋算法是对弈机器人软件的重要组成部分,其核心工作是在对弈开始前,将处于棋盘上的棋子摆放好,以准备进行标准开局的对弈或残局对弈。In related technologies, game robots can be used to realize normal games of Go, chess, chess and other chess events; the human-computer interaction chess placement algorithm is an important part of the game robot software, and its core work is to be in the game before the game starts. The pieces on the chess board are arranged in preparation for a standard opening or endgame game.
发明内容Contents of the invention
本公开实施例至少提供了一种摆棋方法、装置、电子设备、对弈机器人、计算机存储介质和计算机程序。The embodiments of the present disclosure at least provide a chess playing method, device, electronic device, chess robot, computer storage medium and computer program.
本公开实施例提供了一种摆棋方法,该方法可以包括:The embodiment of the present disclosure provides a method of playing chess, which may include:
控制图像采集设备采集第一图像,第一图像表示棋盘和各棋子的图像;响应于所述第一图像中的棋盘图像区域存在遮挡区域,在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域;响应于所述第一区域中的至少一个正确放置位置未放置与所述至少一个正确放置位置对应的棋子,根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令;所述正确放置位置表示按照棋子摆放规则确定的棋子放置位置;控制所述对弈机器人的执行器,执行所述摆棋指令。Control the image acquisition device to collect a first image, the first image represents the image of the chessboard and each chess piece; in response to the occlusion area in the chessboard image area in the first image, in the chessboard image area except the occlusion area In the area, a first area is determined; in response to the at least one correct placement position in the first area not placing a chess piece corresponding to the at least one correct placement position, according to the at least one correct placement position and the first The actual position of at least one chess piece in the image is used to generate a chess placement instruction; the correct placement position represents the placement position of the chess piece determined according to the chess piece placement rules; the actuator of the chess robot is controlled to execute the chess placement instruction.
在一些实施例中,所述在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域,包括:在所述棋盘图像区域中除所述遮挡区域外的区域中,选取部分区域作为所述第一区域;其中,所述第一区域的每个像素点与所述遮挡区域的边界的距离大于第一距离阈值,且所述第一区域的每个像素点与各个已经摆放的棋子的距离大于第二距离阈值。In some embodiments, determining the first area in the area of the checkerboard image area except the occlusion area includes: selecting the first area in the area of the chessboard image area except the occlusion area. A partial area is used as the first area; wherein the distance between each pixel point in the first area and the boundary of the occlusion area is greater than a first distance threshold, and each pixel point in the first area is connected to each already-occluded area. The distance of the placed chess pieces is greater than the second distance threshold.
可以理解地,本公开实施例由于可以根据与遮挡区域的边界的距离、以及与各个已经摆放的棋子的距离,在棋盘图像区域中除所述遮挡区域外的区域中,选取部分区域作为第一区域;并且,摆棋过程是根据第一区域的正确放置位置确定的,因此,可以有效地降低棋盘图像区域中遮挡区域和各个已经摆放的棋子对摆棋过程的影响,可以在摆棋过程中,有效地应对人的手臂、机械臂等各种物体对棋盘和棋子的遮挡。It can be understood that in the embodiment of the present disclosure, a partial area can be selected as the third chessboard image area in the area other than the occlusion area based on the distance to the boundary of the occlusion area and the distance to each placed chess piece. One area; and, the chess placement process is determined based on the correct placement of the first area. Therefore, the impact of the occlusion area and each placed chess piece in the chessboard image area on the chess placement process can be effectively reduced. The chess placement process can be In the process, it effectively copes with the obstruction of the chessboard and chess pieces by various objects such as human arms and robotic arms.
在一些实施例中,在控制所述执行器,执行所述摆棋指令后,所述方法还包括:重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、以及执行所述摆棋指令的步骤,直至所述第一区域中的每个所述正确放置位置放置有与所述每个正确放置位置对应的棋子。可以看出,本公开实施例通过重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、以及执行所述摆棋指令的步骤,可以将在棋盘图像区域中除所述遮挡区域外的区域中,将第一区域中的每个正确放置位置放置与每个正确放置位置对应的棋子,有利于针对棋盘图像区域中除所述遮挡区域外的区域,实现高效摆棋。In some embodiments, after controlling the actuator and executing the chess placement instruction, the method further includes: re-executing the control of the image acquisition device to collect the first image, determining the first area, and generating the chess placement. instructions, and the step of executing the chess placement instruction until each correct placement position in the first area has a chess piece corresponding to each correct placement position. It can be seen that in the embodiment of the present disclosure, by re-executing the steps of controlling the image acquisition device to collect the first image, determining the first area, generating the chess placement instruction, and executing the chess placement instruction, the chessboard image area can be In the area except the occlusion area, placing the chess pieces corresponding to each correct placement position in the first area is beneficial to the area in the chessboard image area except the occlusion area. Play chess efficiently.
在一些实施例中,所述方法还包括:响应于所述棋盘图像区域存在遮挡区域,且所 述第一区域中的每个所述正确放置位置放置有与所述每个正确放置位置对应的棋子,控制所述执行器移动至所述执行器的初始位置;所述初始位置位于所述棋盘之外的区域;重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、执行所述摆棋指令、以及控制所述执行器移动至所述初始位置的步骤,直至所述棋盘图像区域不存在遮挡区域,且所述棋盘图像区域中每个正确放置位置放置有所述每个正确放置位置对应的棋子。In some embodiments, the method further includes: in response to the presence of an occlusion area in the chessboard image area, and each of the correct placement positions in the first area is placed with a corresponding to each correct placement position. The chess piece controls the actuator to move to the initial position of the actuator; the initial position is located in an area outside the chessboard; re-execute the control image acquisition device to collect the first image, determine the first area, and generate the The steps of placing the chess instruction, executing the chess instruction, and controlling the actuator to move to the initial position until there is no occlusion area in the chessboard image area and each correct placement position in the chessboard image area A chess piece is placed corresponding to each correctly placed position.
可以看出,在人机互动摆棋场景或单独使用对弈机器人摆棋的场景中,由于可以将执行器移动至棋盘之外,然后重新采集第一图像,并根据重新采集的第一图像实现摆棋,因此,可以在对弈机器人的执行器未形成对棋盘的遮挡的情况下,通过执行器实现高可靠性的摆棋。It can be seen that in the human-computer interaction chess playing scene or the chess playing scene using a chess robot alone, the actuator can be moved outside the chessboard, and then the first image is re-acquired, and the chess playing is realized based on the re-collected first image. Therefore, when the actuator of the chess-playing robot does not block the chessboard, high-reliability chess placement can be achieved through the actuator.
在一些实施例中,所述根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:响应于所述第一正确放置位置未放置所述棋子的情况,确定与所述第一正确放置位置对应的第一棋子类别;所述第一正确放置位置为所述至少一个正确放置位置中的正确放置位置;在所述各棋子中确定所述第一棋子类别的第一待摆放棋子;根据所述第一待摆放棋子的实际位置和所述第一正确放置位置,生成针对所述第一待摆放棋子的所述摆棋指令。In some embodiments, generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image includes: responding to the first correct placement position not placing all chess pieces. In the case of chess pieces, determine the first chess piece category corresponding to the first correct placement position; the first correct placement position is the correct placement position among the at least one correct placement position; determine all chess pieces in each of the chess pieces. The first chess piece to be placed of the first chess piece category; according to the actual position of the first chess piece to be placed and the first correct placement position, generate the chess placement instruction for the first chess piece to be placed .
可以看出,在第一正确放置位置未放置棋子的情况下,可以根据第一待摆放棋子的实际位置和第一正确放置位置,将第一正确放置位置准确放置第一待摆放棋子,符合实际的摆棋需求。It can be seen that when the chess piece is not placed in the first correct placement position, the first chess piece to be placed can be accurately placed in the first correct placement position according to the actual position of the first chess piece to be placed and the first correct placement position. Meet actual chess placement needs.
在一些实施例中,所述在所述各棋子中确定所述第一棋子类别的第一待摆放棋子,包括:在所述各棋子中确定所述第一棋子类别的各棋子;在所述第一棋子类别的各棋子中,将与所述第一正确放置位置距离最近的棋子确定为所述第一待摆放棋子。可以看出,由于可以在第一棋子类别的各棋子中,将与第一正确放置位置距离最近的棋子确定为第一待摆放棋子,并且第一待摆放棋子的移动路径为从第一待摆放棋子的实际位置至第一正确位置,因此,可以提高针对第一待摆放棋子的摆棋效率。In some embodiments, determining the first chess piece to be placed of the first chess piece category among the chess pieces includes: determining each chess piece of the first chess piece category among the chess pieces; Among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position is determined as the first chess piece to be placed. It can be seen that among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position can be determined as the first chess piece to be placed, and the movement path of the first chess piece to be placed is from the first The actual position of the chess piece to be placed is the first correct position. Therefore, the efficiency of placing the chess piece for the first chess piece to be placed can be improved.
在一些实施例中,所述根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:响应于第一正确放置位置被所述第一正确放置位置对应的第一待摆放棋子占据,且所述第一正确放置位置的中心点与所述第一待摆放棋子的中心点的距离大于第三距离阈值,根据所述第一待摆放棋子的实际位置和所述第一正确放置位置,生成针对所述第一待摆放棋子的所述摆棋指令;所述第一正确放置位置为所述至少一个正确放置位置中的正确放置位置。In some embodiments, generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image includes: in response to the first correct placement position being changed by the first The first chess piece to be placed corresponding to the correct placement position is occupied, and the distance between the center point of the first correct placement position and the center point of the first chess piece to be placed is greater than the third distance threshold, according to the first chess piece to be placed. The actual position of the chess piece and the first correct placement position are used to generate the chess placement instruction for the first chess piece to be placed; the first correct placement position is the correct one of the at least one correct placement position. Place the location.
可以看出,响应于第一正确放置位置被第一正确放置位置对应的第一待摆放棋子占据,且第一正确放置位置的中心点与第一待摆放棋子的中心点的距离大于第三距离阈值,可以认为第一待摆放棋子摆放不够准确,在这种情况下,根据第一待摆放棋子的实际位置和第一正确放置位置,可以在第一正确放置位置准确放置第一待摆放棋子。在人机互动摆棋的场景中,人摆的棋子可能不如机械臂精确,会存在一定程度的偏移,通过执行本公开实施例的技术方案,可以针对人摆的不够精确的棋子,在不影响用户体验的情况下进行位置微调,从而符合实际的摆棋需求。It can be seen that in response to the first correctly placed position being occupied by the first chess piece to be placed corresponding to the first correctly placed position, and the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed is greater than the Three distance thresholds, it can be considered that the placement of the first chess piece to be placed is not accurate enough. In this case, according to the actual position of the first chess piece to be placed and the first correct placement position, the second correct chess piece can be accurately placed at the first correct placement position. Once the chess pieces are placed. In the scenario of human-machine interactive chess playing, the chess pieces placed by humans may not be as accurate as the mechanical arms, and there will be a certain degree of offset. By implementing the technical solutions of the embodiments of the present disclosure, chess pieces placed by humans that are not accurate enough can be solved without The position is fine-tuned without affecting the user experience, so as to meet the actual chess placement needs.
在一些实施例中,所述方法还包括:按照与所述执行器的距离从近到远的顺序,对所述第一区域中的正确放置位置进行遍历,确定第一正确放置位置。可以理解地,由于第一正确位置是按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历得到的,因此,有利于在摆棋过程中,高效地实现执行器的移动。In some embodiments, the method further includes: traversing the correct placement positions in the first area in order of distance from the actuator to determining the first correct placement position. Understandably, since the first correct position is obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is conducive to efficient implementation during the chess placement process. Movement of the actuator.
在一些实施例中,所述至少一个正确放置位置的数量大于或等于二;所述根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:响应于至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,根据所述 至少两个待摆放棋子中至少部分棋子的实际位置和所述棋盘之外的预定义区域,生成针对所述至少部分棋子的所述摆棋指令。In some embodiments, the number of the at least one correct placement position is greater than or equal to two; the chess placement instruction is generated based on the at least one correct placement position and the actual position of at least one chess piece in the first image, Including: in response to the situation that at least two correct placement positions are mutually occupied by at least two chess pieces to be placed, based on the actual positions of at least some of the chess pieces in the at least two chess pieces to be placed and a predefined area outside the chessboard , generating the chess placement instructions for at least some of the chess pieces.
可以理解地,在至少两个正确放置位置被至少两个待摆放棋子互相占据的情况下,由于已经摆放的棋子对待摆放棋子的摆放过程的影响,不能直接将至少两个待摆放棋子中的任意一个棋子移动至正确的位置,通过将至少两个待摆放棋子的至少部分棋子移动至棋盘之外的预定义区域,有利于在下一次摆棋过程中实现至少两个待摆放棋子的正确摆放。It can be understood that when at least two correct placement positions are occupied by at least two chess pieces to be placed, due to the influence of the placed chess pieces on the placement process of the chess pieces to be placed, the at least two chess pieces to be placed cannot be directly placed. Any one of the chess pieces to be placed is moved to the correct position. By moving at least part of the at least two chess pieces to be placed to a predefined area outside the chessboard, it is beneficial to realize at least two chess pieces to be placed in the next chess placement process. Correct placement of chess pieces.
在一些实施例中,所述方法还包括:按照与所述执行器的距离从近到远的顺序,对所述第一区域中的正确放置位置进行遍历,确定出所述至少两个正确放置位置。可以理解地,由于至少两个正确位置是按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历得到的,因此,有利于在摆棋过程中,减少执行器的移动距离,高效地实现执行器的移动。In some embodiments, the method further includes: traversing the correct placement locations in the first area in order of distance from the actuator to determining the at least two correct placement locations. Location. Understandably, since at least two correct positions are obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is beneficial to reduce execution during the chess placement process. The moving distance of the actuator can be effectively realized.
在一些实施例中,所述方法还包括:响应于所述棋盘图像区域不存在遮挡区域,且所述第一图像中的棋子的数量小于第一数量,确定摆棋状态为缺子状态;所述第一数量为根据所述棋子摆放规则确定的棋子总数量。可以理解地,在棋盘图像区域不存在遮挡区域,且第一图像中的棋子的数量小于第一数量,可以认为第一图像中的棋子不足以实现完整的摆棋过程,因此,通过准确地确定摆棋状态为缺子状态,有利于后续根据缺子状态进行针对性地处理。In some embodiments, the method further includes: in response to the fact that there is no occlusion area in the chessboard image area and the number of chess pieces in the first image is less than the first number, determining that the chess placement state is a missing piece state; The first quantity is the total number of chess pieces determined according to the chess piece placement rules. Understandably, there is no occlusion area in the chessboard image area, and the number of chess pieces in the first image is less than the first number. It can be considered that the chess pieces in the first image are not enough to achieve a complete chess placement process. Therefore, by accurately determining The status of the chess piece is a lack of pieces, which is conducive to subsequent targeted processing based on the lack of pieces.
在一些实施例中,所述方法还包括:在连续至少两次生成缺子状态的情况下,生成表示缺子的提示信息。可以看出,由于表示缺子的提示信息,是在连续至少两次生成缺子状态的情况下生成的,因此,在一定程度上可以更加可靠地确定出现缺子的情况。In some embodiments, the method further includes: generating prompt information indicating a missing substate when a missing substate is generated at least twice in a row. It can be seen that since the prompt information indicating a missing son is generated when the missing son state is generated at least twice in a row, the occurrence of a missing son can be determined more reliably to a certain extent.
本公开实施例还提供了一种摆棋装置,该装置可以包括:控制部分和处理部分,其中,The embodiment of the present disclosure also provides a chess playing device, which may include: a control part and a processing part, wherein,
控制部分,配置为控制图像采集设备采集第一图像,第一图像表示棋盘和各棋子的图像;The control part is configured to control the image acquisition device to acquire a first image, where the first image represents an image of the chessboard and each chess piece;
处理部分,配置为响应于所述第一图像中的棋盘图像区域存在遮挡区域,在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域;响应于所述第一区域中的至少一个正确放置位置未放置与所述至少一个正确放置位置对应的棋子,根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令;所述正确放置位置表示按照棋子摆放规则确定的棋子放置位置;A processing part configured to determine a first area in a region other than the occlusion area in the chessboard image area in response to the presence of an occlusion area in the chessboard image area; in response to the first area The chess piece corresponding to the at least one correct placement position is not placed in at least one correct placement position, and a chess placement instruction is generated based on the at least one correct placement position and the actual position of at least one chess piece in the first image; so The above-mentioned correct placement position means the placement position of the chess pieces determined according to the chess piece placement rules;
所述控制部分,还配置为控制所述对弈机器人的执行器,执行所述摆棋指令。The control part is also configured to control the actuator of the chess-playing robot to execute the chess-playing instructions.
本公开实施例还提供了一种电子设备,该电子设备包括图像采集设备、处理器和用于存储能够在处理器上运行的计算机程序的存储器;其中,所述处理器用于运行所述计算机程序以执行上述任意一种摆棋方法。Embodiments of the present disclosure also provide an electronic device, which includes an image acquisition device, a processor, and a memory for storing a computer program that can be run on the processor; wherein the processor is used to run the computer program. To perform any of the above chess placement methods.
本公开实施例还提供了一种对弈机器人,该对弈机器人包括用于抓取物体的执行器,还包括上述任意一种摆棋装置或上述任意一种电子设备。An embodiment of the present disclosure also provides a chess-playing robot. The chess-playing robot includes an actuator for grabbing objects, and also includes any of the above-mentioned chess-playing devices or any of the above-mentioned electronic devices.
在一些实施例中,所述执行器为机械臂。In some embodiments, the actuator is a robotic arm.
本公开实施例还提供了一种计算机存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述任意一种摆棋方法。Embodiments of the present disclosure also provide a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, any one of the above chess playing methods can be implemented.
本公开实施例还提供了一种计算机程序,包括计算机可读代码,当所述计算机可读代码在电子设备中运行时,所述电子设备中的处理器执行用于实现上述任意一种摆棋方法。An embodiment of the present disclosure also provides a computer program, which includes computer readable code. When the computer readable code is run in an electronic device, the processor in the electronic device executes for implementing any of the above chess playing. method.
可以看出,采用本公开实施例的技术方案,在棋盘存在遮挡区域的情况下,由于可以根据棋盘上遮挡区域外的正确放置位置的棋子摆放情况、以及棋子的实际位置,生成摆棋指令,因此,可以有效降低遮挡区域对摆棋过程的影响,即,在棋盘或棋子被遮挡 的情况下,可以利用未遮挡的图像信息可靠地实现摆棋。It can be seen that, using the technical solutions of the embodiments of the present disclosure, when there is an occlusion area on the chessboard, chess placing instructions can be generated based on the correct placement of chess pieces outside the occlusion area on the chessboard and the actual position of the chess pieces. , Therefore, the impact of the occlusion area on the chess placement process can be effectively reduced, that is, when the chessboard or chess pieces are occluded, the unoccluded image information can be used to reliably achieve chess placement.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开的技术方案。It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit the technical solution of the present disclosure.
附图说明Description of the drawings
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings herein are incorporated into and constitute a part of this specification. They illustrate embodiments consistent with the disclosure and, together with the description, serve to explain the technical solutions of the disclosure.
图1为本公开实施例的一种摆棋方法的流程图;Figure 1 is a flow chart of a chess placement method according to an embodiment of the present disclosure;
图2为本公开实施例的另一种摆棋方法的流程图;Figure 2 is a flow chart of another chess placement method according to an embodiment of the present disclosure;
图3为本公开实施例中生成摆棋指令的一个流程示意图;Figure 3 is a schematic flowchart of generating chess placement instructions in an embodiment of the present disclosure;
图4为本公开实施例中生成摆棋指令的一个场景示意图;Figure 4 is a schematic diagram of a scene for generating chess placement instructions in an embodiment of the present disclosure;
图5为本公开实施例中确定第一待摆放棋子的流程图;Figure 5 is a flow chart for determining the first chess piece to be placed in an embodiment of the present disclosure;
图6为本公开实施例中生成摆棋指令的另一个场景示意图;Figure 6 is a schematic diagram of another scenario for generating chess placement instructions in an embodiment of the present disclosure;
图7为本公开实施例中生成摆棋指令的又一个场景示意图;Figure 7 is a schematic diagram of another scene for generating chess placement instructions in an embodiment of the present disclosure;
图8为本公开实施例的又一种摆棋方法的流程图;Figure 8 is a flow chart of yet another chess placing method according to an embodiment of the present disclosure;
图9为本公开实施例中调用摆棋算法函数执行摆棋算法的流程示意图;Figure 9 is a schematic flow chart of calling the chess placement algorithm function to execute the chess placement algorithm in an embodiment of the present disclosure;
图10为本公开实施例的摆棋装置的结构示意图;Figure 10 is a schematic structural diagram of a chess placing device according to an embodiment of the present disclosure;
图11为本公开实施例的电子设备的结构示意图。FIG. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
具体实施方式Detailed ways
为了使本公开的目的、技术方案和优点更加清楚,下面结合附图和实施例对本公开的技术方案进一步详细阐述,所描述的实施例不应视为对本公开的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本公开保护的范围。In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions of the present disclosure are further elaborated below in conjunction with the accompanying drawings and examples. The described embodiments should not be regarded as limiting the present disclosure. Those of ordinary skill in the art will All other embodiments obtained without creative efforts belong to the scope of protection of this disclosure.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or a different subset of all possible embodiments, and Can be combined with each other without conflict.
所涉及的术语“第一/第二/第三”仅仅是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一/第二/第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本公开实施例能够以除了在这里图示或描述的以外的顺序实施。The terms "first/second/third" involved are only used to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first/second/third" can be used interchangeably if permitted. The specific order or sequence may be changed so that the embodiments of the disclosure described herein can be implemented in an order other than that illustrated or described herein.
除非另有定义,本文所使用的所有的技术和科学术语与属于本公开的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本公开的目的,不是旨在限制本公开。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terminology used herein is for the purpose of describing the disclosure only and is not intended to be limiting of the disclosure.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is just an association relationship that describes related objects, indicating that three relationships can exist. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and they exist alone. B these three situations. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, and C, which can mean including from A, Any one or more elements selected from the set composed of B and C.
为了更好地理解本公开实施例提供的摆棋方法,下面先对相关技术中采用的摆棋方法进行说明。In order to better understand the chess placement method provided by the embodiments of the present disclosure, the chess placement method used in related technologies will be described below.
在相关技术中,基于对弈机器人实现的摆棋方法需要是假设棋盘与棋子无任何遮挡(例如人不能挡住任何一个棋子),并且,摆棋的过程中不出现任何干扰(例如人不能移动任何棋子),这使得对弈机器人的摆棋效率较低,与用户的互动性差,在一定程度上降低了用户体验。In related technologies, the chess placement method implemented based on the chess robot needs to assume that there is no obstruction between the chess board and the chess pieces (for example, people cannot block any chess pieces), and that there is no interference during the chess placement process (for example, people cannot move any chess pieces). ), which makes the chess-playing robot less efficient and less interactive with users, which reduces the user experience to a certain extent.
在一些场景中,可以将人和对弈机器人同时摆棋的过程称为人机互动摆棋,实现高 效率的人机互动摆棋需要考虑以下几个问题:第一,棋盘上可能出现不同物体,包括但不限于人的手臂和对弈机器人的机械臂,导致棋盘和棋子不同程度的被遮挡;第二,人可能移动未摆好的棋子,也可能移动已摆好的棋子,干扰摆棋过程;第三,人摆的棋子可能不如机械臂精确,会存在一定程度的偏移,需要机械臂在不影响用户体验的情况下微调;第四,要准确区分由于遮挡导致无法完成摆棋,还是由于缺子导致无法完成摆棋,并给出提示要求人配合完成摆棋;第五,要选取最高效的方式完成摆棋,以更好地满足用户实际需求。In some scenarios, the process in which humans and robots play chess at the same time can be called human-computer interactive chess playing. To achieve efficient human-computer interactive chess playing, the following issues need to be considered: First, different objects may appear on the chessboard, including But it is not limited to the human arm and the mechanical arm of the chess robot, which causes the chessboard and chess pieces to be blocked to varying degrees; secondly, people may move unplaced chess pieces or move already placed chess pieces, interfering with the chess placement process; thirdly, The chess pieces placed by humans may not be as accurate as those of a robotic arm, and there will be a certain degree of offset. The robotic arm needs to be fine-tuned without affecting the user experience. Fourth, it is necessary to accurately distinguish between the failure to complete the chess piece due to occlusion and the lack of pieces. It is impossible to complete the chess placement, and prompts are given to ask people to cooperate to complete the chess placement; fifth, the most efficient way must be selected to complete the chess placement to better meet the actual needs of users.
本公开实施例提出了一种摆棋方法,可以应用于对弈机器人中,对弈机器人可以包括处理器和用于抓取物体的执行器;示例性地,处理器用于控制执行器的工作状态,执行器可以是机械臂或其它器件,机械臂的末端可以设置有吸盘或夹具等器件。上述处理器可以为特定用途集成电路(Application Specific Integrated Circuit,ASIC)、数字信号处理器(Digital Signal Processor,DSP)、数字信号处理装置(Digital Signal Processing Device,DSPD)、可编程逻辑装置(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器中的至少一种。The embodiment of the present disclosure proposes a chess-playing method, which can be applied to a chess-playing robot. The chess-playing robot may include a processor and an actuator for grabbing objects; for example, the processor is used to control the working state of the actuator, and execute The device may be a robotic arm or other device, and the end of the robotic arm may be provided with a suction cup or clamp. The above-mentioned processor can be an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), or a Programmable Logic device. At least one of Device (PLD), Field-Programmable Gate Array (FPGA), Central Processing Unit (CPU), controller, microcontroller, and microprocessor.
本公开实施例中,上述摆棋方法还可以应用于电子设备中,电子设备可以是对弈机器人中的一部分,也可以是与对弈机器人形成通信连接的其它设备,在电子设备是与对弈机器人形成通信连接的其它设备的情况下,电子设备可以包括对应机器人的上位机和云端设备中的至少一项;电子设备可以包括处理器;在电子设备是与对弈机器人形成通信连接的其它设备的情况下,电子设备可以向对弈机器人发送摆棋指令。In the embodiment of the present disclosure, the above-mentioned chess-playing method can also be applied to electronic devices. The electronic device can be a part of the chess-playing robot, or it can be another device that forms a communication connection with the chess-playing robot. In the case where the electronic device forms a communication connection with the chess-playing robot, In the case of other connected devices, the electronic device may include at least one of the host computer and cloud device corresponding to the robot; the electronic device may include a processor; in the case of other devices that form a communication connection with the chess robot, The electronic device can send chess placement instructions to the chess robot.
对弈机器人或电子设备中可以设置图像采集设备,对弈机器人的处理器可以控制对弈机器人的图像采集设备采集图像;在电子设备是与对弈机器人形成通信连接的其它设备的情况下,电子设备可以控制图像采集设备采集图像。An image acquisition device can be installed in the game robot or electronic device, and the processor of the game robot can control the image acquisition device of the game robot to collect images; in the case where the electronic device is another device that forms a communication connection with the game robot, the electronic device can control the image The acquisition device acquires images.
图1为本公开实施例的一种摆棋方法的流程图,如图1所示,该流程可以包括:Figure 1 is a flow chart of a chess placement method according to an embodiment of the present disclosure. As shown in Figure 1, the process may include:
步骤101:控制图像采集设备采集第一图像,第一图像表示棋盘和各棋子的图像。Step 101: Control the image acquisition device to acquire a first image, where the first image represents the image of the chessboard and each chess piece.
本公开实施例中,图像采集设备可以朝向棋盘设置,用于至少拍摄棋盘的图像,示例性地,图像采集设备的拍摄区域还可以包括棋盘的周围区域。In the embodiment of the present disclosure, the image acquisition device may be disposed toward the chessboard for capturing at least an image of the chessboard. For example, the shooting area of the image acquisition device may also include the surrounding area of the chessboard.
在一些实施例中,棋盘可以是象棋的棋盘、国际象棋的棋盘、围棋的棋盘等,相应地,棋子为象棋的棋子、国际象棋的棋子、围棋的棋子等。In some embodiments, the chessboard may be a chess board, a chess board, a Go board, etc., and correspondingly, the chess pieces are chess pieces, chess pieces, Go pieces, etc.
步骤102:响应于第一图像中的棋盘图像区域存在遮挡区域,在棋盘图像区域中除遮挡区域外的区域中,确定第一区域。Step 102: In response to the presence of an occlusion area in the chessboard image area in the first image, determine a first area in the chessboard image area except the occlusion area.
在一些实施例中,可以对第一图像进行分析,得到第一图像的分析结果;第一图像的分析结果至少包括棋盘图像区域、各棋子在图像中的位置;根据第一图像的分析结果可以确定棋盘图像区域是否存在遮挡区域。在实际应用中,在获取第一图像后,可以对第一图像进行区域分割,从而确定出棋盘图像区域和棋盘外的图像区域;通过对第一图像进行棋子的检测和识别,可以确定出棋子在第一图像中的位置;示例性地,可以根据预先训练的目标检测模型,对第一图像进行棋子的检测和识别。In some embodiments, the first image can be analyzed to obtain the analysis result of the first image; the analysis result of the first image at least includes the chessboard image area and the position of each chess piece in the image; according to the analysis result of the first image, Determine whether there is an occlusion area in the checkerboard image area. In practical applications, after acquiring the first image, the first image can be segmented into regions to determine the chessboard image area and the image area outside the chessboard; by detecting and identifying the chess pieces on the first image, the chess pieces can be determined The position in the first image; for example, the chess piece can be detected and recognized in the first image according to a pre-trained target detection model.
在一些实施例中,可以将第一图像中的棋盘图像输入至预先训练好的遮挡识别模型中,利用遮挡识别模型识别棋盘图像区域中的遮挡区域;例如,遮挡识别模型是指预先根据大量的训练图像数据进行分类训练所获得的分类器。可以理解地,预先进行训练的训练图像数据包含棋盘或棋子被遮挡的第一类样本图像、以及棋盘和棋子未被遮挡的第二类样本图像,通过分类算法对第一类样本图像和第二类样本图像进行训练,可以得到训练完成的遮挡识别模型。第一类样本图像可以是棋盘和棋子的至少之一被其它物体遮挡的图像,例如,其它物体可以是对弈机器人的执行器或人的手部。In some embodiments, the chessboard image in the first image can be input into a pre-trained occlusion recognition model, and the occlusion recognition model is used to identify the occlusion areas in the chessboard image area; for example, the occlusion recognition model refers to pre-training based on a large number of The classifier obtained by training image data for classification training. It can be understood that the training image data for pre-training includes a first type of sample image in which the chessboard or chess pieces are occluded, and a second type of sample image in which the chessboard and chess pieces are not occluded. The first type of sample image and the second type of sample image are classified through a classification algorithm. Class sample images are used for training, and the trained occlusion recognition model can be obtained. The first type of sample image may be an image in which at least one of the chessboard and the chess pieces is blocked by other objects. For example, the other objects may be the actuators of a chess robot or human hands.
在一些实施例中,可以将棋盘图像区域中除遮挡区域外的全部区域作为第一区域, 或者,可以将棋盘图像区域中除遮挡区域外的部分区域作为第一区域。In some embodiments, the entire area in the checkerboard image area except the occlusion area may be used as the first area, or a part of the checkerboard image area except the occlusion area may be used as the first area.
步骤103:响应于第一区域中的至少一个正确放置位置未放置与至少一个正确放置位置对应的棋子,根据至少一个正确放置位置、以及第一图像中至少一个棋子的实际位置,生成摆棋指令;正确放置位置表示按照棋子摆放规则确定的棋子放置位置。Step 103: In response to the fact that the chess piece corresponding to the at least one correct placement position is not placed in the at least one correct placement position in the first area, generate a chess placing instruction based on the at least one correct placement position and the actual position of the at least one chess piece in the first image. ; The correct placement position means the placement position of the chess pieces determined according to the chess piece placement rules.
本公开实施例中,棋子摆放规则可以表示符合棋局开局标准的规则,或者,可以是根据预设的残局棋谱确定的规则,可以理解地,棋子摆放规则为已知的规则,例如,象棋开局时的棋子摆放规则、国际象棋开局时的棋子摆放规则、象棋的残局棋谱对应棋子摆放规则均是已知的规则。In the embodiment of the present disclosure, the chess piece placement rules may represent rules that meet the opening standards of the chess game, or may be rules determined based on the preset endgame chess record. It is understandable that the chess piece placement rules are known rules, for example, chess The rules for placing chess pieces at the beginning of the game, the rules for placing chess pieces at the beginning of chess, and the rules for placing chess pieces corresponding to the end game of chess are all known rules.
本公开实施例中,棋盘上的每个正确放置位置对应的棋子是根据棋子放置规则确定的;示例性地,对于象棋的棋盘或围棋的棋盘,棋子的正确放置位置为棋盘上的部分横线与竖线的交叉点,棋子的正确放置位置可以用对应的交叉点的坐标表示;对于国际象棋的棋盘,棋子的正确放置位置为棋盘上的部分格子,棋子的正确放置位置可以用对应的格子的中心点坐标表示。In the embodiment of the present disclosure, the chess pieces corresponding to each correctly placed position on the chess board are determined according to the chess piece placement rules; for example, for a chess board or a Go chess board, the correct placement position of the chess pieces is part of the horizontal line on the chess board. At the intersection point with the vertical line, the correct placement position of the chess piece can be expressed by the coordinates of the corresponding intersection point; for the chess board, the correct placement position of the chess piece is part of the grid on the chessboard, and the correct placement position of the chess piece can be expressed by the corresponding grid The coordinates of the center point of .
可以理解地,对于同一棋盘,每个正确放置位置对应的棋子为同一类棋子,每个正确放置位置可以用于放置一类棋子中的一个棋子,例如,在象棋的棋盘中,某个正确放置位置用于放置类别为“兵”的棋子,类别为“兵”的棋子共有5个棋子,该正确放置位置可以放置类别为“兵”的5个棋子中的一个棋子。同一类别的不同棋子可以放置在不同的正确放置位置,例如,在象棋开局对弈的场景中,类别为“象”的不同棋子放置不同的棋盘交叉点。It can be understood that for the same chessboard, the chess pieces corresponding to each correctly placed position are the same type of chess pieces, and each correctly placed chess piece can be used to place a chess piece in a type of chess piece. For example, in a chess board, a certain correctly placed chess piece The position is used to place the chess pieces with the category "Pawn". There are 5 chess pieces with the category "Pawn". The correct placement position can place one of the 5 chess pieces with the category "Pawn". Different chess pieces of the same category can be placed in different correct placement positions. For example, in the scene of the chess opening game, different chess pieces of the category "bishop" are placed at different chessboard intersections.
在一些实施例中,可以根据至少一个正确放置位置、以及第一图像中至少一个棋子的实际位置,确定至少一个待摆放棋子以及至少一个待摆放棋子的目标位置;根据至少一个待摆放棋子的当前实际位置和目标位置,可以确定出将待摆放棋子移动的摆棋指令。In some embodiments, at least one chess piece to be placed and the target position of at least one chess piece to be placed can be determined based on at least one correct placement position and the actual position of at least one chess piece in the first image; according to at least one chess piece to be placed The current actual position and target position of the chess pieces can determine the chess placement instructions for moving the chess pieces to be placed.
在实际应用中,棋子的位置(实际位置和目标位置)可以利用棋子的中心点的坐标表示。In practical applications, the position of the chess piece (actual position and target position) can be represented by the coordinates of the center point of the chess piece.
步骤104:控制对弈机器人的执行器,执行摆棋指令。Step 104: Control the actuator of the chess-playing robot to execute the chess-playing instructions.
在一些实施例中,在执行器包括机械臂的情况下,可以由对弈机器人的处理器控制机械臂的工作状态,使机械臂执行摆棋指令,实现各棋子在棋盘的摆放。或者,电子设备可以向对弈机器人发送摆棋指令,以控制对弈机器人的执行器,执行摆棋指令。In some embodiments, when the actuator includes a robotic arm, the processor of the chess-playing robot can control the working state of the robotic arm so that the robotic arm executes chess placement instructions to realize the placement of each chess piece on the chessboard. Alternatively, the electronic device can send a chess placement instruction to the chess robot to control the actuator of the chess robot to execute the chess placement instructions.
可以看出,在棋盘存在遮挡区域的情况下,由于可以根据棋盘上遮挡区域外的正确放置位置的棋子摆放情况、以及棋子的实际位置,生成摆棋指令,因此,可以有效降低遮挡区域对摆棋过程的影响,即,在棋盘或棋子被遮挡的情况下,可以利用未遮挡的图像信息可靠地实现摆棋。It can be seen that when there is an occlusion area on the chessboard, chess placement instructions can be generated based on the correct placement of chess pieces outside the occlusion area on the chessboard and the actual position of the chess pieces. Therefore, the interference with the occlusion area can be effectively reduced. The impact of the chess placement process, that is, when the chessboard or chess pieces are occluded, the unoccluded image information can be used to reliably achieve chess placement.
在一些实施例中,可以在棋盘图像区域中除所述遮挡区域外的区域中,选取部分区域作为第一区域;其中,第一区域的每个像素点与遮挡区域的边界的距离大于第一距离阈值,且第一区域的每个像素点与各个已经摆放的棋子的距离大于第二距离阈值。In some embodiments, a part of the area in the checkerboard image area other than the occlusion area can be selected as the first area; wherein the distance between each pixel in the first area and the boundary of the occlusion area is greater than the first area. distance threshold, and the distance between each pixel in the first area and each placed chess piece is greater than the second distance threshold.
本公开实施例中,为了降低遮挡区域对摆棋过程的影响,可以将与遮挡区域的边界的距离在第一距离阈值内的位置,确定为不可摆放棋子的位置;例如,第一距离阈值可以是一个棋子的半径、一个棋子的直径、一个棋子的直径的1.1倍等;同理,为了降低各个已经摆放的棋子对摆棋过程造成的影响,可以将与棋子的距离在第二距离阈值内的位置,确定为不可摆放棋子的位置;例如,第二距离阈值为一个棋子的直径、一个棋子的直径的1.2倍等。第一距离阈值与第二距离阈值可以相同,也可以不相同,例如,第一距离阈值和第二距离阈值均为一个棋子的直径。In the embodiment of the present disclosure, in order to reduce the impact of the occlusion area on the chess placement process, the position that is within a first distance threshold from the boundary of the occlusion area can be determined as a position where chess pieces cannot be placed; for example, the first distance threshold It can be the radius of a chess piece, the diameter of a chess piece, 1.1 times the diameter of a chess piece, etc.; similarly, in order to reduce the impact of each placed chess piece on the chess placement process, the distance to the chess piece can be set to the second distance The position within the threshold is determined as a position where chess pieces cannot be placed; for example, the second distance threshold is the diameter of a chess piece, 1.2 times the diameter of a chess piece, etc. The first distance threshold and the second distance threshold may be the same or different. For example, the first distance threshold and the second distance threshold may both be the diameter of a chess piece.
可以理解地,本公开实施例由于可以根据与遮挡区域的边界的距离、以及与各个已经摆放的棋子的距离,在棋盘图像区域中除所述遮挡区域外的区域中,选取部分区域作为第一区域;并且,摆棋过程是根据第一区域的正确放置位置确定的,因此,可以有效 地降低棋盘图像区域中遮挡区域和各个已经摆放的棋子对摆棋过程的影响,可以在摆棋过程中,有效地应对人的手臂、机械臂等各种物体对棋盘和棋子的遮挡。It can be understood that in the embodiment of the present disclosure, a partial area can be selected as the third chessboard image area in the area other than the occlusion area based on the distance to the boundary of the occlusion area and the distance to each placed chess piece. One area; and, the chess placement process is determined based on the correct placement of the first area. Therefore, the impact of the occlusion area and each placed chess piece in the chessboard image area on the chess placement process can be effectively reduced. The chess placement process can be In the process, it effectively copes with the obstruction of the chessboard and chess pieces by various objects such as human arms and robotic arms.
在一些实施例中,在控制执行器执行摆棋指令后,还可以重新执行步骤101至步骤104,直至第一区域中的每个正确放置位置放置有与每个正确放置位置对应的棋子。In some embodiments, after the control actuator executes the chess placement instruction, steps 101 to 104 can be re-executed until each correct placement position in the first area has a chess piece corresponding to each correct placement position.
可以理解地,在重新执行步骤101的情况下,由于最近一次摆棋导致的棋子位置变化,图像采集设备采集的第一图像会发生变化,即,图像采集设备采集的第一图像为更新后的第一图像,即,需要基于更新后的第一图像执行步骤102至步骤104,直至第一区域中的每个正确放置位置放置有与每个正确放置位置对应的棋子。It can be understood that when step 101 is re-executed, due to the change in the position of the chess pieces caused by the latest chess placement, the first image collected by the image acquisition device will change, that is, the first image collected by the image acquisition device will be the updated The first image, that is, it is necessary to perform steps 102 to 104 based on the updated first image until each correct placement position in the first area has a chess piece corresponding to each correct placement position.
在实际应用中,在每次控制图像采集设备采集第一图像后,可以根据第一图像确定第一区域,并判断第一区域中的每个正确放置位置是否放置有与每个正确放置位置对应的棋子。In practical applications, after each time the image acquisition device is controlled to collect the first image, the first area can be determined based on the first image, and it can be determined whether each correct placement position in the first area is placed corresponding to each correct placement position. chess piece.
响应于第一区域中的至少一个正确放置位置未放置与至少一个正确放置位置对应的棋子,可以通过执行步骤103至步骤104,继续控制执行器进行摆棋。In response to the chess piece corresponding to the at least one correctly placed position not being placed at at least one correctly placed position in the first area, the actuator may be continued to be controlled to place the chess piece by performing steps 103 to 104 .
可以看出,本公开实施例通过重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、以及执行所述摆棋指令的步骤,可以将在棋盘图像区域中除所述遮挡区域外的区域中,将第一区域中的每个正确放置位置放置与每个正确放置位置对应的棋子,有利于针对棋盘图像区域中除所述遮挡区域外的区域,实现高效摆棋。It can be seen that in the embodiment of the present disclosure, by re-executing the steps of controlling the image acquisition device to collect the first image, determining the first area, generating the chess placement instruction, and executing the chess placement instruction, the chessboard image area can be In the area except the occlusion area, placing the chess pieces corresponding to each correct placement position in the first area is beneficial to the area in the chessboard image area except the occlusion area. Play chess efficiently.
在一些实施例中,参照图2,本公开实施例的摆棋方法还可以包括如下步骤:In some embodiments, referring to Figure 2, the chess placement method according to the embodiment of the present disclosure may further include the following steps:
步骤201:响应于棋盘图像区域存在遮挡区域,且第一区域中的每个正确放置位置放置有与每个正确放置位置对应的棋子,控制执行器移动至执行器的初始位置;初始位置位于棋盘之外的区域。Step 201: In response to the presence of an occlusion area in the chessboard image area, and each correct placement position in the first area has a chess piece corresponding to each correct placement position, control the actuator to move to the initial position of the actuator; the initial position is located on the chessboard outside the area.
这里,初始位置可以是执行器的默认位置,执行器的默认位置可以是用户设定的位置;在一些实施例中,初始位置与棋盘的距离可以小于设定值,如此,有利于提升执行器的摆棋效率和速度。Here, the initial position can be the default position of the actuator, and the default position of the actuator can be the position set by the user; in some embodiments, the distance between the initial position and the chessboard can be less than the set value, which is beneficial to improving the actuator The efficiency and speed of playing chess.
步骤202:重新执行控制图像采集设备采集第一图像、确定第一区域、生成摆棋指令、执行摆棋指令、以及控制执行器移动至所述初始位置的步骤,直至棋盘图像区域不存在遮挡区域,且棋盘图像区域中每个正确放置位置放置有每个正确放置位置对应的棋子。Step 202: Re-execute the steps of controlling the image acquisition device to collect the first image, determining the first area, generating chess placement instructions, executing chess placement instructions, and controlling the actuator to move to the initial position until there is no occlusion area in the chessboard image area. , and each correctly placed position in the chessboard image area has a chess piece corresponding to each correctly placed position.
本公开实施例中,响应于棋盘图像区域不存在遮挡区域,且棋盘图像区域中每个正确放置位置放置有每个正确放置位置对应的棋子,可以确定摆棋状态为摆棋完成状态;在一些实施例中,在确定摆棋状态为摆棋完成状态的情况下,可以发出表示摆棋完成的提示信息,并结束流程;摆棋完成的提示信息可以是文字提示信息、声音提示信息等,例如,摆棋完成的提示信息可以是如下文字提示信息:“机器人准备完毕,请您先走棋”。In the embodiment of the present disclosure, in response to the fact that there is no occlusion area in the chessboard image area, and each correctly placed position in the chessboard image area has a chess piece corresponding to each correctly placed position, it can be determined that the chess placement state is the chess placement completion state; in some cases In the embodiment, when it is determined that the chess placement state is the chess placement completion state, a prompt message indicating the completion of the chess placement may be issued and the process ends; the prompt information indicating the completion of the chess placement may be text prompt information, sound prompt information, etc., for example , the prompt message for completing the chess placement can be the following text prompt message: "The robot is ready, please move first."
可以看出,在人机互动摆棋场景或单独使用对弈机器人摆棋的场景中,由于可以将执行器移动至棋盘之外,然后重新采集第一图像,并根据重新采集的第一图像实现摆棋,因此,可以在对弈机器人的执行器未形成对棋盘的遮挡的情况下,通过执行器实现高可靠性的摆棋。It can be seen that in the human-computer interaction chess playing scene or the chess playing scene using a chess robot alone, the actuator can be moved outside the chessboard, and then the first image is re-acquired, and the chess playing is realized based on the re-collected first image. Therefore, when the actuator of the chess-playing robot does not block the chessboard, high-reliability chess placement can be achieved through the actuator.
在一些实施例中,参照图3,根据所述至少一个正确放置位置、以及第一图像中至少一个棋子的实际位置,生成摆棋指令的流程,可以包括:In some embodiments, referring to Figure 3, the process of generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image may include:
步骤301:响应于第一正确放置位置未放置棋子的情况,确定与第一正确放置位置对应的第一棋子类别;第一正确放置位置为至少一个正确放置位置中的正确放置位置。Step 301: In response to the fact that no chess piece is placed at the first correct placement position, determine the first chess piece category corresponding to the first correct placement position; the first correct placement position is the correct placement position among at least one correct placement position.
这里,第一正确放置可以是一个正确放置位置,也可以是至少两个正确放置位置;基于前述实施例记载的内容,响应于第一正确放置位置未放置棋子的情况,可以根据棋子摆放规则,确定第一正确放置位置对应的第一棋子类别;例如,参照图4,在第一正确放置位置为点E的情况下,按照象棋开局时的棋子摆放规则,可以确定第一正确放置位置对应的第一棋子类别为“车”。在第一正确放置位置为点F的情况下,按照象棋开局时 的棋子摆放规则,可以确定第一正确放置位置对应的第一棋子类别为“马”。Here, the first correct placement can be one correct placement position, or it can be at least two correct placement positions; based on the contents recorded in the foregoing embodiments, in response to the situation that the chess piece is not placed at the first correct placement position, the chess piece placement rules can be , determine the first chess piece category corresponding to the first correct placement position; for example, referring to Figure 4, when the first correct placement position is point E, according to the chess piece placement rules at the beginning of chess, the first correct placement position can be determined The corresponding first chess piece category is "rook". When the first correct placement position is point F, according to the chess piece placement rules at the beginning of chess, it can be determined that the first chess piece category corresponding to the first correct placement position is "horse".
步骤302:在各棋子中确定第一棋子类别的第一待摆放棋子。Step 302: Determine the first chess piece to be placed of the first chess piece category among each chess piece.
在一些实施例中,基于前述实施例记载的内容,在第一棋子类别的棋子为至少两个棋子的情况下,可以在第一棋子类别的各棋子中,选择一个棋子作为第一待摆放棋子;例如,第一棋子类别为“兵”,在第一棋子类别的棋子为5个棋子的情况下,可以在5个类别为“兵”的棋子中,选择一个棋子作为第一待摆放棋子。In some embodiments, based on the contents recorded in the foregoing embodiments, when there are at least two chess pieces in the first chess category, one chess piece can be selected as the first chess piece to be placed among the chess pieces in the first chess category. Chess pieces; for example, if the first chess piece category is "Pawn", and there are 5 chess pieces in the first chess piece category, you can select one chess piece as the first chess piece to be placed among the 5 chess pieces of the "Pawn" category. piece.
在第一棋子类别的棋子为一个棋子的情况下,可以直接将第一棋子类别的棋子作为第一待摆放棋子。When the chess piece of the first chess piece category is one chess piece, the chess piece of the first chess piece category can be directly used as the first chess piece to be placed.
步骤303:根据第一待摆放棋子的实际位置和第一正确放置位置,生成针对第一待摆放棋子的摆棋指令。Step 303: Generate a chess placement instruction for the first chess piece to be placed based on the actual position of the first chess piece to be placed and the first correct placement position.
在实际应用中,可以将第一正确放置位置作为第一待摆放棋子的目标位置,针对第一待摆放棋子的摆棋指令可以是将第一摆放棋子从实际位置移动至目标位置的指令,可以理解地,在将第一摆放棋子从实际位置移动至目标位置的指令后,第一待摆放棋子的实际位置发生了变化。In practical applications, the first correct placement position can be used as the target position of the first chess piece to be placed, and the placement instruction for the first chess piece to be placed can be to move the first placed chess piece from the actual position to the target position. Instruction, it can be understood that after the instruction to move the first placed chess piece from the actual position to the target position, the actual position of the first chess piece to be placed has changed.
参照图4,在第一正确放置位置为点E的情况下,点E对应的第一待摆放棋子为第一棋子401,将第一棋子401的目标位置确定为点E,从而,生成针对第一棋子401的摆棋指令。Referring to Figure 4, when the first correct placement position is point E, the first chess piece to be placed corresponding to point E is the first chess piece 401, and the target position of the first chess piece 401 is determined as point E, thereby generating a target for The placement instruction of the first chess piece 401.
可以看出,在第一正确放置位置未放置棋子的情况下,可以根据第一待摆放棋子的实际位置和第一正确放置位置,将第一正确放置位置准确放置第一待摆放棋子,符合实际的摆棋需求。It can be seen that when the chess piece is not placed at the first correct placement position, the first chess piece to be placed can be accurately placed at the first correct placement position according to the actual position of the first chess piece to be placed and the first correct placement position. Meet actual chess placement needs.
在一些实施例中,参照图5,步骤302具体可以包括如下步骤:In some embodiments, referring to Figure 5, step 302 may specifically include the following steps:
步骤3021:在第一图像中的各棋子中确定第一棋子类别的各棋子。Step 3021: Determine each chess piece of the first chess piece category among each chess piece in the first image.
步骤3022:在第一棋子类别的各棋子中,将与第一正确放置位置距离最近的棋子确定为第一待摆放棋子。Step 3022: Among the chess pieces of the first chess piece category, determine the chess piece closest to the first correct placement position as the first chess piece to be placed.
本公开实施例中,基于前述实施例记载的内容可知,第一棋子类别的棋子可以包括至少两个棋子。可以看出,由于可以在第一棋子类别的各棋子中,将与第一正确放置位置距离最近的棋子确定为第一待摆放棋子,并且第一待摆放棋子的移动路径为从第一待摆放棋子的实际位置至第一正确位置,因此,可以提高针对第一待摆放棋子的摆棋效率;针对人类有意或无意移动的已摆好或未摆好的棋子,能够以最短路径摆放到正确的位置。In the embodiments of the present disclosure, based on the contents recorded in the foregoing embodiments, it can be known that the chess pieces of the first chess piece category may include at least two chess pieces. It can be seen that among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position can be determined as the first chess piece to be placed, and the movement path of the first chess piece to be placed is from the first The actual position of the chess piece to be placed is the first correct position. Therefore, the efficiency of placing the chess piece for the first chess piece to be placed can be improved; the placed or unplaced chess pieces that humans move intentionally or unintentionally can be placed in the shortest path. to the correct location.
在一些实施例中,根据至少一个正确放置位置、以及第一图像中至少一个棋子的实际位置,生成摆棋指令的流程,可以包括:In some embodiments, the process of generating a chess placement instruction based on at least one correct placement position and the actual position of at least one chess piece in the first image may include:
响应于第一正确放置位置被第一正确放置位置对应的第一待摆放棋子占据,且第一正确放置位置的中心点与第一待摆放棋子的中心点的距离大于第三距离阈值,根据第一待摆放棋子的实际位置和第一正确放置位置,生成针对第一待摆放棋子的所述摆棋指令;所述第一正确放置位置为所述至少一个正确放置位置中的正确放置位置。In response to the first correctly placed position being occupied by the first chess piece to be placed corresponding to the first correctly placed position, and the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed is greater than the third distance threshold, The chess placing instruction for the first chess piece to be placed is generated according to the actual position of the first chess piece to be placed and the first correct placement position; the first correct placement position is the correct one of the at least one correct placement position. Place the location.
本公开实施例中,在棋子的正确放置位置为交叉点的情况,第一正确放置位置的中心点为第一正确放置位置自身;例如,对于象棋而言,第一正确放置位置的中心点为交叉点;在棋子的正确放置位置为格子的情况,第一正确放置位置的中心点为对应的格子的中心点;例如,对于国际象棋而言,第一正确放置位置的中心点为格子的中心点。In the embodiment of the present disclosure, when the correct placement position of the chess piece is an intersection point, the center point of the first correct placement position is the first correct placement position itself; for example, for chess, the center point of the first correct placement position is Intersection point; when the correct placement position of the chess piece is a grid, the center point of the first correct placement position is the center point of the corresponding grid; for example, for chess, the center point of the first correct placement position is the center point of the grid point.
在一些实施例中,可以将第一正确放置位置的中心点与第一待摆放棋子的中心点的距离记为D,第三距离阈值小于第二距离阈值。示例性地,第三距离阈值为棋盘中格子的边长减去棋子的直径的差。In some embodiments, the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed can be recorded as D, and the third distance threshold is smaller than the second distance threshold. For example, the third distance threshold is the difference between the side length of the grid on the chessboard minus the diameter of the chess piece.
在距离D大于第二距离阈值的情况下,基于前述记载的内容,可以认为第一正确放置位置未放置棋子,即第一正确放置位置未被棋子占据。In the case where the distance D is greater than the second distance threshold, based on the foregoing description, it can be considered that no chess piece is placed at the first correct placement position, that is, the first correct placement position is not occupied by a chess piece.
在距离D小于或等于第三距离阈值的情况下,基于前述记载的内容,可以认为第一 正确放置位置被第一待摆放棋子占据,且第一正确放置位置的棋子放置精确度比较高,在这种情况下,可以不针对第一待摆放棋子重新进行摆棋。When the distance D is less than or equal to the third distance threshold, based on the aforementioned content, it can be considered that the first correct placement position is occupied by the first chess piece to be placed, and the placement accuracy of the chess piece at the first correct placement position is relatively high. In this case, it is not necessary to re-place the chess piece for the first chess piece to be placed.
在距离D大于第三距离阈值,且距离D小于或等于第二距离阈值的情况下,可以认为第一待摆放棋子摆放不够准确,在这种情况下,需要对第一待摆放棋子的位置进行微调,即,需要生成针对第一待摆放棋子的摆棋指令,以提高第一带摆放棋子的摆棋精准度。When the distance D is greater than the third distance threshold and the distance D is less than or equal to the second distance threshold, it can be considered that the placement of the first chess piece to be placed is not accurate enough. In this case, it is necessary to place the first chess piece to be placed. Fine-tuning the position of the chess piece, that is, it is necessary to generate a chess placement instruction for the first chess piece to be placed, in order to improve the placement accuracy of the chess pieces placed in the first zone.
参照图6,在第一正确放置位置为点E的情况下,按照象棋开局时的棋子摆放规则,可以确定第一正确放置位置对应的第一棋子类别为“车”;在图6中,在第一正确放置位置为点E的情况下,点E对应的第一待摆放棋子为第二棋子601,将第二棋子601的中心点与点E的距离记为距离D,在距离D大于第三距离阈值,且距离D小于或等于第二距离阈值的情况下,生成针对第二棋子601的摆棋指令,实现对第二棋子601的位置微调。Referring to Figure 6, when the first correct placement position is point E, according to the chess piece placement rules at the beginning of chess, it can be determined that the first chess piece category corresponding to the first correct placement position is "rook"; in Figure 6, In the case where the first correct placement position is point E, the first chess piece to be placed corresponding to point E is the second chess piece 601. The distance between the center point of the second chess piece 601 and point E is recorded as distance D. At distance D When the distance D is greater than the third distance threshold and the distance D is less than or equal to the second distance threshold, a placement instruction for the second chess piece 601 is generated to achieve fine-tuning of the position of the second chess piece 601 .
可以看出,响应于第一正确放置位置被第一正确放置位置对应的第一待摆放棋子占据,且第一正确放置位置的中心点与第一待摆放棋子的中心点的距离大于第三距离阈值,可以认为第一待摆放棋子摆放不够准确,在这种情况下,根据第一待摆放棋子的实际位置和第一正确放置位置,可以在第一正确放置位置准确放置第一待摆放棋子。在人机互动摆棋的场景中,人摆的棋子可能不如机械臂精确,会存在一定程度的偏移,通过执行本公开实施例的技术方案,可以针对人摆的不够精确的棋子,在不影响用户体验的情况下进行位置微调,从而符合实际的摆棋需求。It can be seen that in response to the first correctly placed position being occupied by the first chess piece to be placed corresponding to the first correctly placed position, and the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed is greater than the Three distance thresholds, it can be considered that the placement of the first chess piece to be placed is not accurate enough. In this case, according to the actual position of the first chess piece to be placed and the first correct placement position, the second correct chess piece can be accurately placed at the first correct placement position. Once the chess pieces are placed. In the scenario of human-machine interactive chess playing, the chess pieces placed by humans may not be as accurate as the mechanical arms, and there will be a certain degree of offset. By implementing the technical solutions of the embodiments of the present disclosure, chess pieces placed by humans that are not accurate enough can be solved without The position is fine-tuned without affecting the user experience, so as to meet the actual chess placement needs.
在一些实施例中,还可以按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历,确定第一正确放置位置。In some embodiments, the correct placement positions in the first area can also be traversed in order of distance from the actuator from closest to far to determine the first correct placement position.
可以理解地,由于第一正确位置是按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历得到的,因此,有利于在摆棋过程中,高效地实现执行器的移动。Understandably, since the first correct position is obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is conducive to efficient implementation during the chess placement process. Movement of the actuator.
在一些实施例中,在上述至少一个正确放置位置的数量大于或等于二的情况下,根据所述至少一个正确放置位置、以及第一图像中至少一个棋子的实际位置,生成摆棋指令的流程,可以包括:In some embodiments, when the number of the above-mentioned at least one correct placement position is greater than or equal to two, the process of generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image , which can include:
响应于至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,根据至少两个待摆放棋子中至少部分棋子的实际位置和棋盘之外的预定义区域,生成针对至少部分棋子的所述摆棋指令。In response to the situation that at least two correct placement positions are mutually occupied by at least two chess pieces to be placed, generating a target for at least some of the chess pieces based on the actual positions of at least some of the chess pieces in the at least two chess pieces to be placed and a predefined area outside the chessboard. The chess placement instructions.
这里,预定义区域为棋盘外放置棋子的位置,预定义区域的大小可以根据棋子的大小和数量确定,在按照棋子摆放规则确定的棋子总数量较多的情况下,可以设置较大的预定义区域;在按照棋子摆放规则确定的棋子总数量较少的情况下,可以设置较小的预定义区域。在棋子较大的情况下,可以设置较大的预定义区域;在棋子较小情况下,可以设置较小的预定义区域。Here, the predefined area is the position outside the chessboard where chess pieces are placed. The size of the predefined area can be determined according to the size and number of chess pieces. When the total number of chess pieces determined according to the chess piece placement rules is large, a larger predefined area can be set. Define the area; when the total number of chess pieces determined according to the chess piece placement rules is small, a smaller predefined area can be set. If the chess pieces are larger, a larger predefined area can be set; if the chess pieces are smaller, a smaller predefined area can be set.
在一些实施例中,至少两个待摆放棋子中至少部分棋子可以是至少两个待摆放棋子中的部分棋子,也可以是至少两个待摆放棋子中的全部棋子。In some embodiments, at least part of the at least two chess pieces to be placed may be part of the at least two chess pieces to be placed, or may be all of the at least two chess pieces to be placed.
参照图7,在遮挡区域700之外,棋子类别为“兵”的第三棋子701处于正确放置位置,棋子类别为“车”的第四棋子702占据了棋子类别为“马”的棋子的正确放置位置,棋子类别为“马”的第五棋子703占据了棋子类别为“车”的棋子的正确放置位置;即,第四棋子702和第五棋子703出现了互相占据对方的正确位置的情况,通过将第四棋子702和第五棋子703中的至少一个棋子移动至预定义区域,有利于在下一次摆棋过程中实现第四棋子702和第五棋子703的正确放置。Referring to Figure 7, outside the occlusion area 700, the third chess piece 701 with the chess piece category "Pawn" is in the correct placement position, and the fourth chess piece 702 with the chess piece category "Rook" occupies the correct position of the chess piece with the chess piece category "Horse" Placement position, the fifth chess piece 703 with the chess piece category "horse" occupies the correct placement position of the chess piece with the chess piece category "rook"; that is, the fourth chess piece 702 and the fifth chess piece 703 occupy each other's correct positions. , by moving at least one of the fourth chess piece 702 and the fifth chess piece 703 to a predefined area, it is beneficial to achieve the correct placement of the fourth chess piece 702 and the fifth chess piece 703 in the next chess placement process.
可以理解地,在至少两个正确放置位置被至少两个待摆放棋子互相占据的情况下,由于已经摆放的棋子对待摆放棋子的摆放过程的影响,不能直接将至少两个待摆放棋子 中的任意一个棋子移动至正确的位置,通过将至少两个待摆放棋子的至少部分棋子移动至棋盘之外的预定义区域,有利于在下一次摆棋过程中实现至少两个待摆放棋子的正确摆放。It can be understood that when at least two correct placement positions are occupied by at least two chess pieces to be placed, due to the influence of the placed chess pieces on the placement process of the chess pieces to be placed, the at least two chess pieces to be placed cannot be directly placed. Any one of the chess pieces to be placed is moved to the correct position. By moving at least part of the at least two chess pieces to be placed to a predefined area outside the chessboard, it is beneficial to realize at least two chess pieces to be placed in the next chess placement process. Correct placement of chess pieces.
在一些实施例中,还可以按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历,确定出至少两个正确放置位置。In some embodiments, the correct placement positions in the first area can also be traversed in order of distance from the actuator from nearest to far, and at least two correct placement positions are determined.
可以理解地,由于至少两个正确位置是按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历得到的,因此,有利于在摆棋过程中,减少执行器的移动距离,高效地实现执行器的移动。Understandably, since at least two correct positions are obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is beneficial to reduce execution during the chess placement process. The moving distance of the actuator can be effectively realized.
在一些实施例中,响应于棋盘图像区域不存在遮挡区域,且第一图像中的棋子的数量小于第一数量,确定摆棋状态为缺子状态;第一数量为根据棋子摆放规则确定的棋子总数量。In some embodiments, in response to the fact that there is no occlusion area in the chessboard image area and the number of chess pieces in the first image is less than the first number, it is determined that the chess placement state is a lack of pieces state; the first number is determined according to the chess piece placement rules. The total number of chess pieces.
可以理解地,在棋盘图像区域不存在遮挡区域,且第一图像中的棋子的数量小于第一数量,可以认为第一图像中的棋子不足以实现完整的摆棋过程,因此,通过准确地确定摆棋状态为缺子状态,有利于后续根据缺子状态进行针对性地处理。Understandably, there is no occlusion area in the chessboard image area, and the number of chess pieces in the first image is less than the first number. It can be considered that the chess pieces in the first image are not enough to achieve a complete chess placement process. Therefore, by accurately determining The status of the chess piece is a lack of pieces, which is conducive to subsequent targeted processing based on the lack of pieces.
在一些实施例中,可以在连续至少两次生成缺子状态的情况下,生成表示缺子的提示信息。示例性地,可以在连续三次生成缺子状态的情况下,生成表示缺子的提示信息。In some embodiments, when a missing substate is generated at least twice in a row, prompt information indicating a missing substate may be generated. For example, when a missing substate is generated three times in a row, prompt information indicating a missing substate may be generated.
在实际应用中,表示缺子的提示信息可以是文字提示信息、声音提示信息等,例如,摆棋完成的提示信息可以是如下文字提示信息:“出现缺子,请补充棋子”。在生成表示缺子的提示信息后,可以结束流程。In practical applications, the prompt information indicating missing pieces may be text prompt information, sound prompt information, etc. For example, the prompt information indicating the completion of chess placement may be the following text prompt information: "There is a missing piece, please add chess pieces." After generating a prompt message indicating a missing child, the process can be ended.
可以看出,由于表示缺子的提示信息,是在连续至少两次生成缺子状态的情况下生成的,因此,在一定程度上可以更加可靠地确定出现缺子的情况。It can be seen that since the prompt information indicating a missing son is generated when the missing son state is generated at least twice in a row, the occurrence of a missing son can be determined more reliably to a certain extent.
下面说明本公开实施例提供的摆棋方法在实际场景中的应用,以象棋或国际象棋为例对摆棋方法进行说明。The following describes the application of the chess placement method provided by the embodiments of the present disclosure in actual scenarios, taking chess or chess as an example to illustrate the chess placement method.
参照图8,本公开实施例提供的又一种摆棋方法可以包括如下步骤:Referring to Figure 8, another method of placing chess provided by an embodiment of the present disclosure may include the following steps:
步骤801:完成各棋子和棋盘的初始放置。Step 801: Complete the initial placement of each chess piece and the chessboard.
这里,可以由用户完成各棋子和棋盘的初始放置,示例性地,用户可以将各棋子和棋盘放置于图像采集设备能够拍摄的区域中;示例性地,用户可以将至少部分棋子平铺放置于棋盘上,从而实现棋子和棋盘的初始放置。Here, the initial placement of each chess piece and chess board can be completed by the user. For example, the user can place each chess piece and chess board in an area that can be photographed by the image acquisition device; for example, the user can place at least some of the chess pieces flatly on the on the chessboard to achieve the initial placement of chess pieces and chessboard.
步骤802:控制相机采集第一图像。Step 802: Control the camera to collect the first image.
这里,相机为上述的图像采集设备,在实际应用中,可以由对弈机器人的处理器控制相机采集第一图像。Here, the camera is the above-mentioned image acquisition device. In practical applications, the camera can be controlled by the processor of the game robot to acquire the first image.
步骤803:进行图像标记。Step 803: Perform image tagging.
在一些实施例中,基于前述记载的内容,可以对第一图像进行分析,根据第一图像的分析结果,进行图像标记。In some embodiments, based on the foregoing description, the first image can be analyzed, and image labeling can be performed based on the analysis results of the first image.
在一些实施例中,进行图像标记的实现方式可以包括:在第一图像中标记遮挡区域、各棋子的位置、各棋子的类别标识,这里,每个棋子的位置可以用每个棋子的中心点的坐标表示。In some embodiments, the implementation of image marking may include: marking the occlusion area, the position of each chess piece, and the category identification of each chess piece in the first image. Here, the position of each chess piece may be identified by the center point of each chess piece. coordinate representation.
可以理解地,根据在第一图像中标记的信息,可以判断遮挡区域对棋盘的正确放置位置和棋子的影响,有助于判断棋盘上哪些位置不可摆放棋子、以及当前时刻哪些棋子不可摆放至正确放置位置;例如,遮挡区域中的正确放置位置不能够摆放棋子;响应于特定棋子的正确放置位置处于遮挡区域或被其它棋子占据,则当前时刻该特定棋子不可摆放至对应的正确放置位置。Understandably, based on the information marked in the first image, the impact of the occlusion area on the correct placement of the chessboard and the chess pieces can be judged, which helps to determine which positions on the chessboard cannot be placed and which chess pieces cannot be placed at the current moment. to the correct placement position; for example, the correct placement position in the occlusion area cannot place the chess piece; in response to the correct placement position of a specific chess piece being in the occlusion area or occupied by other chess pieces, the specific chess piece cannot be placed in the corresponding correct position at the current moment. Place the location.
在一些实施例中,可以将遮挡区域的灰度值设置为255或其它非零数值,将非遮挡区域的背景的灰度值设置为0;在棋盘图像区域中具有棋子的类别标识的位置为相应棋子的正确放置位置;在遮挡区域的边界像素点的一个棋子半径范围内,不可以标识棋子的 类别标识,即正确放置位置不处于遮挡区域的边界像素点的一个棋子半径范围内;两个棋子的类别标识应该至少间隔两倍棋子半径(即一个棋子的直径)的距离。In some embodiments, the grayscale value of the occlusion area can be set to 255 or other non-zero value, and the grayscale value of the background of the non-occlusion area can be set to 0; the position with the category identifier of the chess piece in the chessboard image area is The correct placement position of the corresponding chess piece; within a chess piece radius of the boundary pixel point of the occlusion area, the category identifier of the chess piece cannot be identified, that is, the correct placement position is not within a chess piece radius range of the boundary pixel point of the occlusion area; two The category identifiers of chess pieces should be spaced at least twice the chess piece radius (i.e. the diameter of a chess piece).
在一些实施例中,在针对象棋进行摆棋的场景中,对于棋盘上存在的10x9个交叉点(横线与竖线的交叉点),响应于交叉点与遮挡区域的边界的距离小于或等于一个棋子的直径,确定交叉点不是正确放置位置;同理,响应于交叉点与任意一个已经摆放的棋子的距离小于或等于一个棋子的直径,确定交叉点不是正确放置位置。In some embodiments, in the scene of playing chess, for the 10x9 intersection points (intersection points of horizontal lines and vertical lines) existing on the chessboard, the distance between the intersection point and the boundary of the occlusion area is less than or equal to The diameter of a chess piece determines that the intersection point is not the correct placement position; similarly, in response to the distance between the intersection point and any placed chess piece being less than or equal to the diameter of a chess piece, it is determined that the intersection point is not the correct placement position.
在针对国际象棋进行摆棋的场景中,对于国际象棋棋盘上的每一个格子,响应于格子与遮挡区域的边界的距离小于或等于一个棋子的直径,确定对应的格子不是正确放置位置;响应于格子与任意一个已经摆放的棋子的距离小于或等于一个棋子的直径,确定对应的格子不是正确放置位置。In the scene of chess placement, for each grid on the chess board, in response to the fact that the distance between the grid and the boundary of the occlusion area is less than or equal to the diameter of one chess piece, it is determined that the corresponding grid is not in the correct position; in response to If the distance between the grid and any placed chess piece is less than or equal to the diameter of a chess piece, it is determined that the corresponding grid is not placed in the correct position.
在实际应用中,可以由对弈机器人的处理器执行步骤803。In practical applications, step 803 may be executed by the processor of the game robot.
步骤804:调用摆棋算法函数执行摆棋算法。Step 804: Call the chess placement algorithm function to execute the chess placement algorithm.
本公开实施例中,可以由对弈机器人的处理器调用摆棋算法函数执行摆棋算法。这里,可以针对摆棋算法的输入信息,通过调用摆棋算法函数执行摆棋算法,可以得到输出结果。In the embodiment of the present disclosure, the chess-playing algorithm function can be called by the processor of the chess-playing robot to execute the chess-playing algorithm. Here, according to the input information of the chess-playing algorithm, the output result can be obtained by calling the chess-playing algorithm function to execute the chess-playing algorithm.
在一些实施例中,摆棋算法的输入信息可以包括遮挡区域的位置、非遮挡区域的位置、棋盘的位置、各棋子的位置、各棋子的类别标识。每个棋子的位置和类别标识可以通过数组(x,y,p)表示,其中,x和y表示棋子的中心点的横坐标和纵坐标,p表示棋子的类别标识,例如,棋子的类别标识可以是“炮”、“将”等。In some embodiments, the input information of the chess placement algorithm may include the location of the occlusion area, the location of the non-occlusion area, the location of the chessboard, the location of each chess piece, and the category identifier of each chess piece. The position and category identification of each chess piece can be represented by the array (x, y, p), where x and y represent the abscissa and ordinate coordinates of the center point of the chess piece, and p represents the category identification of the chess piece, for example, the category identification of the chess piece It can be "gun", "general", etc.
在一些实施例中,输出结果至少包括表示摆棋状态的状态码。示例性地,在状态码为状态码0的情况下,状态码表示摆棋完成状态;在状态码为状态码1的情况下,状态码表示正在摆棋状态;在状态码为状态码2的情况下,状态码表示将机械臂移动至初始位置的状态;在状态码为状态码3的情况下,状态码表示缺子状态。In some embodiments, the output result at least includes a status code indicating the state of the chess placement. For example, when the status code is status code 0, the status code indicates that the chess is being placed; when the status code is status code 1, the status code indicates that the chess is being placed; when the status code is status code 2 In this case, the status code indicates the state of moving the robotic arm to the initial position; in the case where the status code is status code 3, the status code indicates the missing child state.
在一些实施例中,在状态码为状态码1的情况下,输出结果还可以包括待摆放棋子的当前实际位置、目标位置和棋子类别标识,例如,棋子类别标识可以棋子类别的名称、身份标识号(Identity Document,ID)等标识信息,输出结果还可以包括数组(x1,y1,x2,y2,p1),其中,x1表示待摆放棋子的中心点的实际位置的横坐标,y1表示待摆放棋子的中心点的实际位置的纵坐标,x2表示待摆放棋子的目标位置的横坐标,y2表示待摆放棋子的目标位置的纵坐标,p1表示待摆放棋子的棋子类别标识。In some embodiments, when the status code is status code 1, the output result may also include the current actual position of the chess piece to be placed, the target position, and the chess piece category identifier. For example, the chess piece category identifier may be the name or identity of the chess piece category. Identity Document (ID) and other identification information, the output result can also include an array (x1, y1, x2, y2, p1), where x1 represents the abscissa of the actual position of the center point of the chess piece to be placed, and y1 represents The ordinate of the actual position of the center point of the chess piece to be placed, x2 represents the abscissa of the target position of the chess piece to be placed, y2 represents the ordinate of the target position of the chess piece to be placed, and p1 represents the chess piece category identifier of the chess piece to be placed. .
步骤805:根据状态码执行相应的操作。Step 805: Perform corresponding operations according to the status code.
在实际应用中,可以由对弈机器人的处理执行步骤805。In practical applications, step 805 may be performed by the processing of the game robot.
参照图8,在状态码为状态码1的情况下,步骤805可以包括步骤8051;在状态码为状态码2的情况下,步骤805可以包括步骤8052;在状态码为状态码3的情况下,步骤805可以包括步骤8053;在状态码为状态码0的情况下,步骤805可以包括步骤8054。Referring to Figure 8, when the status code is status code 1, step 805 may include step 8051; when the status code is status code 2, step 805 may include step 8052; when the status code is status code 3 , step 805 may include step 8053; when the status code is status code 0, step 805 may include step 8054.
步骤8051:控制机械臂执行摆棋指令,然后,返回至步骤802。Step 8051: Control the robotic arm to execute the chess placement instruction, and then return to step 802.
这里,可以根据待摆放棋子的当前实际位置和目标位置,控制机械臂完成针对待摆放棋子的抓子和落子,即,实现针对待摆放棋子的摆棋操作。Here, according to the current actual position and target position of the chess piece to be placed, the robotic arm can be controlled to complete the grabbing and placing of the chess piece to be placed, that is, the chess placement operation for the chess piece to be placed is realized.
步骤8052:控制机械臂移动至初始位置,然后,返回至步骤802。Step 8052: Control the robotic arm to move to the initial position, and then return to step 802.
这里,通过控制机械臂移动至初始位置,有利于降低机械臂对棋盘造成的遮挡,提高后续摆棋的效率。Here, by controlling the robot arm to move to the initial position, it is helpful to reduce the occlusion caused by the robot arm to the chessboard and improve the efficiency of subsequent chess placement.
步骤8053:生成语音提示信息,然后,结束流程。Step 8053: Generate voice prompt information, and then end the process.
这里,可以在连续三次收到的状态码为状态码3的情况下,生成表示缺子的语音提示信息。Here, when the status code received three consecutive times is status code 3, voice prompt information indicating a missing son can be generated.
可见,本公开实施例可以准确区分由于遮挡导致无法完成摆棋,还是由于缺子导致无法完成摆棋,并在出现缺子时给出提示要求人配合完成摆棋。It can be seen that the embodiment of the present disclosure can accurately distinguish whether the chess placement cannot be completed due to occlusion or the chess placement cannot be completed due to a lack of pieces, and when a missing piece occurs, a prompt is given to require the person to cooperate to complete the chess placement.
步骤8054:生成表示摆棋完成的提示信息,并结束流程。Step 8054: Generate a prompt message indicating the completion of chess placement, and end the process.
在一些实施例中,参照图9,调用摆棋算法函数执行摆棋算法的流程可以包括:In some embodiments, referring to Figure 9, the process of calling the chess placement algorithm function to execute the chess placement algorithm may include:
步骤901:判断摆棋状态是否为摆棋完成状态,如果是,则执行步骤902,如果否,则执行步骤903。Step 901: Determine whether the chess placement status is the chess placement completion state. If yes, execute step 902. If not, execute step 903.
步骤902:输出状态码0。Step 902: Output status code 0.
步骤903:判断是否存在未放置棋子的第一正确放置位置,如果是,则执行步骤906,如果否,则执行步骤904。Step 903: Determine whether there is a first correct placement position for unplaced chess pieces. If yes, execute step 906. If not, execute step 904.
本步骤中,第一正确放置位置为第一区域中的正确放置位置,第一区域的每个像素点与遮挡区域的边界的距离大于一个棋子的直径,且第一区域的每个像素点与各个已经摆放的棋子的距离大于一个棋子的直径。In this step, the first correct placement position is the correct placement position in the first area. The distance between each pixel point in the first area and the boundary of the occlusion area is greater than the diameter of a chess piece, and each pixel point in the first area is The distance between each placed chess piece is greater than the diameter of one chess piece.
通过执行本步骤可以判断是否存在一个应该摆棋的位置并且该位置没有被遮挡或占据,如果是,则执行步骤906,如果否,则执行步骤904。By executing this step, it can be determined whether there is a position where the chess should be placed and the position is not blocked or occupied. If yes, step 906 is executed. If not, step 904 is executed.
在一些实施例中,在针对象棋进行摆棋的场景中,对于棋盘上的10x9个横线竖线交叉点,从机械臂近端左侧开始遍历,从而查找第一正确放置位置,判断该第一正确放置位置是否可以可摆子,如果可以摆子,根据目标棋谱在该位置上的棋子类别,在第一图像中寻找该类别的棋子,选择距离第一正确放置位置最近的一个正确类别的第一待摆放棋子,获取第一待摆放棋子的实际位置和目标位置;第一待摆放棋子的目标位置为第一正确放置位置。本公开实施例中,目标棋谱为表征棋子放置规则的棋谱,目标棋谱可以是标准开局的棋谱,也可以是预先确定的残局棋谱。In some embodiments, in the scene of playing chess, for the 10x9 horizontal and vertical line intersections on the chessboard, traverse starting from the left side of the proximal end of the robotic arm to find the first correct placement position and determine the first correct placement position. Whether the piece can be placed at a correctly placed position? If it can be placed, according to the type of chess piece in the target chess record at that position, search for the piece of this category in the first image, and select the correct category closest to the first correctly placed position. The first chess piece to be placed is to obtain the actual position and target position of the first chess piece to be placed; the target position of the first chess piece to be placed is the first correct placement position. In the embodiment of the present disclosure, the target chess record is a chess record that represents the rules for placing chess pieces. The target chess record may be a standard opening chess record or a predetermined endgame chess record.
在一些实施例中,在针对国际象棋进行摆棋的场景中,对于国际象棋棋盘上每个格子,从机械臂近端左侧开始遍历,从而查找第一正确放置位置,判断该第一正确放置位置是否可以可摆子,如果可以摆子,根据目标棋谱在该位置上的棋子类别,在第一图像中寻找该类别的棋子,选择距离第一正确放置位置最近的一个正确类别的第一待摆放棋子,获取第一待摆放棋子的实际位置和目标位置;第一待摆放棋子的目标位置为第一正确放置位置。本公开实施例中,目标棋谱为表征棋子放置规则的棋谱,目标棋谱可以是标准开局的棋谱,也可以是预先确定的残局棋谱。In some embodiments, in the scenario of playing chess, for each square on the chess board, traverse from the left side of the proximal end of the robotic arm to find the first correct placement position and determine the first correct placement Whether the position can be placed. If it can be placed, according to the category of the target chess piece at the position, search for the chess piece of this category in the first image, and select the first correct category that is closest to the first correct placement position. Place the chess pieces and obtain the actual position and target position of the first chess piece to be placed; the target position of the first chess piece to be placed is the first correct placement position. In the embodiment of the present disclosure, the target chess record is a chess record that represents the rules for placing chess pieces. The target chess record may be a standard opening chess record or a predetermined endgame chess record.
步骤904:判断是否存在满足设定条件的第一正确放置位置;如果是,则执行步骤906,如果否,则执行步骤905。Step 904: Determine whether there is a first correct placement position that meets the set conditions; if yes, execute step 906; if not, execute step 905.
这里,将第一正确放置位置的中心点与第一待摆放棋子的中心点的距离记为D,则设定条件可以是:距离D大于第三距离阈值,且距离D小于或等于第二距离阈值;本步骤中,第三距离阈值为棋盘中格子的边长减去棋子的直径的差,第二距离阈值为一个棋子的直径。Here, the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed is recorded as D. The setting condition may be: the distance D is greater than the third distance threshold, and the distance D is less than or equal to the second Distance threshold; in this step, the third distance threshold is the difference between the side length of the grid on the chessboard minus the diameter of the chess piece, and the second distance threshold is the diameter of a chess piece.
在一些实施例中,在针对象棋进行摆棋的场景中,对于棋盘上10x9个横线竖线交叉点,从机械臂近端左侧开始遍历,从而查找第一正确放置位置,判断该第一正确放置位置是否可以可摆子,如果不能摆子,根据目标棋谱在该位置上的棋子类别,判断是否由于第一待摆放棋子在第一正确放置位置但摆放不够精确(即距离D大于第三距离阈值,且距离D小于或等于第二距离阈值),导致第一正确放置位置不能摆子。如果是,则获取第一待摆放棋子的实际位置和目标位置;第一待摆放棋子的目标位置为第一正确放置位置。In some embodiments, in the scene of playing chess, for the 10x9 horizontal and vertical line intersections on the chessboard, traverse starting from the left side of the proximal end of the robotic arm to find the first correct placement position and determine the first correct placement position. Whether the chess piece can be placed at the correct placement position. If the chess piece cannot be placed, based on the type of chess piece in the target chess record at that position, it is judged whether it is because the first chess piece to be placed is in the first correct placement position but the placement is not accurate enough (that is, the distance D is greater than The third distance threshold, and the distance D is less than or equal to the second distance threshold), resulting in the first correct placement position being unable to be placed. If yes, the actual position and target position of the first chess piece to be placed are obtained; the target position of the first chess piece to be placed is the first correct placement position.
在一些实施例中,在针对国际象棋进行摆棋的场景中,对于国际象棋棋盘上每个格子,从机械臂近端左侧开始遍历,从而查找第一正确放置位置,判断该第一正确放置位置是否可以可摆子,如果不能摆子,根据目标棋谱在该位置上的棋子类别,判断是否由于第一待摆放棋子在第一正确放置位置但摆放不够精确(即距离D大于第三距离阈值,且距离D小于或等于第二距离阈值),导致第一正确放置位置不能摆子。如果是,则获取第一待摆放棋子的实际位置和目标位置。In some embodiments, in the scenario of playing chess, for each square on the chess board, traverse from the left side of the proximal end of the robotic arm to find the first correct placement position and determine the first correct placement Whether the position can be placed, if not, based on the type of chess pieces in the target chess record at that position, determine whether the first chess piece to be placed is in the first correct position but the placement is not accurate enough (that is, the distance D is greater than the third distance threshold, and the distance D is less than or equal to the second distance threshold), resulting in the first correct placement position being unable to be placed. If so, obtain the actual position and target position of the first chess piece to be placed.
步骤905:判断是否存在至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,如果是,则执行步骤906,如果否,则执行步骤907。Step 905: Determine whether there are at least two correct placement positions occupied by at least two chess pieces to be placed. If yes, step 906 is executed. If not, step 907 is executed.
本步骤中,响应于存在至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,则可以将至少两个待摆放棋子的部分棋子移动到棋盘左右两侧的空闲的预定义区域。In this step, in response to the fact that there are at least two correct placement positions occupied by at least two chess pieces to be placed, some of the chess pieces of the at least two chess pieces to be placed can be moved to the free predefined positions on the left and right sides of the chessboard. area.
在一些实施例中,在针对象棋进行摆棋的场景中,对于棋盘上的10x9个横线竖线交叉点,从机械臂近端左侧开始遍历,从而查找是否存在至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,如果是,则需要将至少两个待摆放棋子中的一个棋子移动至预定义区域,可以确定需要移动的棋子的实际位置和目标位置,这里,需要移动的棋子的目标位置为预定义区域。In some embodiments, in the scenario of playing chess, for the 10x9 horizontal and vertical line intersections on the chessboard, traverse starting from the left side of the proximal end of the robotic arm to find whether there are at least two correct placement positions. When at least two chess pieces to be placed occupy each other, if so, then at least one of the two chess pieces to be placed needs to be moved to a predefined area, and the actual position and target position of the chess piece that needs to be moved can be determined. Here, The target position of the chess piece that needs to be moved is a predefined area.
在一些实施例中,在针对国际象棋进行摆棋的场景中,对于国际象棋棋盘上每个格子,从机械臂近端左侧开始遍历,从而查找是否存在至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,如果是,则需要将至少两个待摆放棋子中的一个棋子移动至预定义区域,可以确定需要移动的棋子的实际位置和目标位置,这里,需要移动的棋子的目标位置为预定义区域。In some embodiments, in the scenario of playing chess, for each square on the chess board, traverse starting from the left side of the proximal end of the robotic arm to find whether there are at least two correct placement positions that are occupied by at least two The chess pieces to be placed occupy each other. If so, at least one of the two chess pieces to be placed needs to be moved to a predefined area. The actual position and target position of the chess piece that needs to be moved can be determined. Here, the chess piece that needs to be moved The target position of the chess piece is a predefined area.
步骤906:输出状态码1和待摆放棋子的相关信息。Step 906: Output status code 1 and related information of the chess piece to be placed.
这里,待摆放棋子的相关信息可以包括待摆放棋子的实际位置和目标位置;本步骤中的待摆放棋子可以是上述第一待摆放棋子或上述至少两个待摆放棋子中的一个棋子。Here, the relevant information of the chess piece to be placed may include the actual position and the target position of the chess piece to be placed; the chess piece to be placed in this step may be the first chess piece to be placed or one of the at least two chess pieces to be placed. A chess piece.
步骤907:判断摆棋状态是否为缺子状态,如果是,则执行步骤908,如果否,则执行步骤909。Step 907: Determine whether the chess placement state is a missing piece state. If yes, step 908 is executed. If not, step 909 is executed.
步骤908:输出状态码3。Step 908: Output status code 3.
步骤909:输出状态码2。Step 909: Output status code 2.
综上,可以看出,本公开实施例的摆棋方法能够有效应对各种物体对棋盘和棋子的遮挡。在棋盘和棋子被部分遮挡的时候,能利用未被遮挡的相关图像信息实现高效摆棋。对于人类有意或无意移动的已摆好或未摆好的棋子,都能将其以最短路径摆放到正确的位置。在可能存在遮挡的情况下准确反馈摆棋完成状态或缺子状态。In summary, it can be seen that the chess placement method according to the embodiment of the present disclosure can effectively deal with the obstruction of the chessboard and chess pieces by various objects. When the chessboard and chess pieces are partially obscured, the relevant unoccluded image information can be used to achieve efficient chess placement. For placed or unplaced chess pieces that humans move intentionally or unintentionally, they can be placed in the correct position through the shortest path. Accurately feedback the completion status or lack of pieces status of the chess piece in the case of possible occlusion.
在人机互动摆棋场景中,可以在人体对棋盘和棋子形成遮挡的情况下,利用未被遮挡的相关图像信息实现机械臂的高效摆棋,即有利于实现对弈机器人上的机械臂与人的交互摆棋,相比于只有机械臂摆棋效率更高。由于在摆棋过程中人与机器人有良好的交互,因而更加能够符合用户实际需求,互动性更强。本公开实施例的摆棋方法能够有效应对各种对棋盘和棋子的遮挡情况,对于人将棋子摆歪摆错的情况,可以利用机械臂实现位置的纠正,因此,提高了摆棋过程的鲁棒性。In the human-computer interactive chess playing scene, when the human body blocks the chessboard and chess pieces, the relevant unobstructed image information can be used to realize the efficient chess playing of the robotic arm, which is beneficial to the realization of the interaction between the robotic arm and the human on the chess robot. The interactive chess playing is more efficient than playing chess with only mechanical arms. Since there is good interaction between humans and robots during the chess playing process, it can better meet the actual needs of users and is more interactive. The chess placement method of the embodiment of the present disclosure can effectively deal with various situations of occlusion of the chess board and chess pieces. When a person places the chess pieces crookedly or incorrectly, a mechanical arm can be used to correct the position. Therefore, the chess placement process is improved in the smoothness of the chess placement process. Great sex.
本公开实施例可以应用于各种棋类运动的对弈场景中,例如,用户在重新开始新的一局象棋对弈或新的一局国际象棋对弈的情况下,采用本公开实施例的摆棋方法,可以实现高效准确地摆棋。这里,新的一局象棋对弈可以是标准开局的对弈,也可以是残局对弈;相应地,新的一局国际象棋对弈可以是标准开局的对弈,也可以是残局对弈。Embodiments of the present disclosure can be applied to game scenarios of various chess sports. For example, when the user restarts a new game of chess or a new game of international chess, the chess placement method of the embodiment of the present disclosure is used. , which can achieve efficient and accurate chess placement. Here, a new chess game can be a standard opening game or an endgame game; correspondingly, a new chess game can be a standard opening game or an endgame game.
基于前述的实施例,本公开实施例提供一种摆棋装置,该装置包括所包括的各部分,可以通过电子设备中的处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为ASIC、DSP、DSPD、PLD、FPGA、CPU、控制器、微控制器、微处理器中的至少一种。Based on the foregoing embodiments, embodiments of the present disclosure provide a chess-playing device, which includes various parts and can be implemented by a processor in an electronic device; of course, it can also be implemented by a specific logic circuit; in implementation In the process, the processor may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
图10为本公开实施例的摆棋装置的结构示意图,如图10所示,该装置包括控制部分1001和处理部分1002,其中,Figure 10 is a schematic structural diagram of a chess playing device according to an embodiment of the present disclosure. As shown in Figure 10, the device includes a control part 1001 and a processing part 1002, wherein,
控制部分1001,配置为控制图像采集设备采集第一图像,第一图像表示棋盘和各棋子的图像;The control part 1001 is configured to control the image collection device to collect a first image, where the first image represents the image of the chessboard and each chess piece;
处理部分1002,配置为响应于所述第一图像中的棋盘图像区域存在遮挡区域,在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域;响应于所述第一区域中 的至少一个正确放置位置未放置与所述至少一个正确放置位置对应的棋子,根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令;所述正确放置位置表示按照棋子摆放规则确定的棋子放置位置;The processing part 1002 is configured to, in response to the presence of an occlusion area in the checkerboard image area in the first image, determine a first area in the checkerboard image area other than the occlusion area; in response to the first The chess piece corresponding to the at least one correct placement position is not placed in at least one correct placement position in the area, and a chess placement instruction is generated based on the at least one correct placement position and the actual position of at least one chess piece in the first image; The correct placement position represents the placement position of the chess pieces determined according to the chess piece placement rules;
所述控制部分1001,还配置为控制所述对弈机器人的执行器,执行所述摆棋指令。The control part 1001 is also configured to control the actuator of the chess-playing robot to execute the chess-playing instruction.
可以看出,采用本公开实施例的技术方案,在棋盘存在遮挡区域的情况下,由于可以根据棋盘上遮挡区域外的正确放置位置的棋子摆放情况、以及棋子的实际位置,生成摆棋指令,因此,可以有效降低遮挡区域对摆棋过程的影响,即,在棋盘或棋子被遮挡的情况下,可以利用未遮挡的图像信息可靠地实现摆棋。It can be seen that, using the technical solutions of the embodiments of the present disclosure, when there is an occlusion area on the chessboard, chess placing instructions can be generated based on the correct placement of chess pieces outside the occlusion area on the chessboard and the actual position of the chess pieces. , Therefore, the impact of the occlusion area on the chess placement process can be effectively reduced, that is, when the chessboard or chess pieces are occluded, the unoccluded image information can be used to reliably achieve chess placement.
在一些实施例中,所述处理部分1002,配置为在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域,包括:In some embodiments, the processing part 1002 is configured to determine the first area in the area of the checkerboard image area except the occlusion area, including:
在所述棋盘图像区域中除所述遮挡区域外的区域中,选取部分区域作为所述第一区域;其中,所述第一区域的每个像素点与所述遮挡区域的边界的距离大于第一距离阈值,且所述第一区域的每个像素点与各个已经摆放的棋子的距离大于第二距离阈值。In the area in the checkerboard image area except the occlusion area, select a partial area as the first area; wherein the distance between each pixel point in the first area and the boundary of the occlusion area is greater than the third area. A distance threshold, and the distance between each pixel in the first area and each placed chess piece is greater than the second distance threshold.
可以理解地,本公开实施例由于可以根据与遮挡区域的边界的距离、以及与各个已经摆放的棋子的距离,在棋盘图像区域中除所述遮挡区域外的区域中,选取部分区域作为第一区域;并且,摆棋过程是根据第一区域的正确放置位置确定的,因此,可以有效地降低棋盘图像区域中遮挡区域和各个已经摆放的棋子对摆棋过程的影响,可以在摆棋过程中,有效地应对人的手臂、机械臂等各种物体对棋盘和棋子的遮挡。It can be understood that in the embodiment of the present disclosure, a partial area can be selected as the third chessboard image area in the area other than the occlusion area based on the distance to the boundary of the occlusion area and the distance to each placed chess piece. One area; and, the chess placement process is determined based on the correct placement of the first area. Therefore, the impact of the occlusion area and each placed chess piece in the chessboard image area on the chess placement process can be effectively reduced. The chess placement process can be In the process, it effectively copes with the obstruction of the chessboard and chess pieces by various objects such as human arms and robotic arms.
在一些实施例中,所述控制部分1001,还配置为在控制所述执行器,执行所述摆棋指令后,重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、以及执行所述摆棋指令的步骤,直至所述第一区域中的每个所述正确放置位置放置有与所述每个正确放置位置对应的棋子。In some embodiments, the control part 1001 is also configured to, after controlling the actuator and executing the chess placement instruction, re-execute the control of the image acquisition device to collect the first image, determine the first area, and generate the The chess placement instruction and the step of executing the chess placement instruction are provided until each correct placement position in the first area has a chess piece corresponding to each correct placement position.
可以看出,本公开实施例通过重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、以及执行所述摆棋指令的步骤,可以将在棋盘图像区域中除所述遮挡区域外的区域中,将第一区域中的每个正确放置位置放置与每个正确放置位置对应的棋子,有利于针对棋盘图像区域中除所述遮挡区域外的区域,实现高效摆棋。It can be seen that in the embodiment of the present disclosure, by re-executing the steps of controlling the image acquisition device to collect the first image, determining the first area, generating the chess placement instruction, and executing the chess placement instruction, the chessboard image area can be In the area except the occlusion area, placing the chess pieces corresponding to each correct placement position in the first area is beneficial to the area in the chessboard image area except the occlusion area. Play chess efficiently.
在一些实施例中,所述控制部分1001,还配置为:In some embodiments, the control part 1001 is also configured to:
响应于所述棋盘图像区域存在遮挡区域,且所述第一区域中的每个所述正确放置位置放置有与所述每个正确放置位置对应的棋子,控制所述执行器移动至所述执行器的初始位置;所述初始位置位于所述棋盘之外的区域;In response to the existence of an occlusion area in the chessboard image area, and each of the correct placement positions in the first area is placed with a chess piece corresponding to each of the correct placement positions, the actuator is controlled to move to the execution The initial position of the chessboard; the initial position is located in an area outside the chessboard;
重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、执行所述摆棋指令、以及控制所述执行器移动至所述初始位置的步骤,直至所述棋盘图像区域不存在遮挡区域,且所述棋盘图像区域中每个正确放置位置放置有所述每个正确放置位置对应的棋子。Re-execute the steps of controlling the image acquisition device to collect the first image, determining the first area, generating the chess placement instruction, executing the chess placement instruction, and controlling the actuator to move to the initial position until the There is no occlusion area in the chessboard image area, and chess pieces corresponding to each correct placement position are placed at each correct placement position in the chessboard image area.
可以看出,在人机互动摆棋场景或单独使用对弈机器人摆棋的场景中,由于可以将执行器移动至棋盘之外,然后重新采集第一图像,并根据重新采集的第一图像实现摆棋,因此,可以在对弈机器人的执行器未形成对棋盘的遮挡的情况下,通过执行器实现高可靠性的摆棋。It can be seen that in the human-computer interaction chess playing scene or the chess playing scene using a chess robot alone, the actuator can be moved outside the chessboard, and then the first image is re-acquired, and the chess playing is realized based on the re-collected first image. Therefore, when the actuator of the chess-playing robot does not block the chessboard, high-reliability chess placement can be achieved through the actuator.
在一些实施例中,所述处理部分1002,配置为根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:In some embodiments, the processing part 1002 is configured to generate a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image, including:
响应于所述第一正确放置位置未放置所述棋子的情况,确定与所述第一正确放置位置对应的第一棋子类别;所述第一正确放置位置为所述至少一个正确放置位置中的正确放置位置;In response to the situation that the chess piece is not placed in the first correct placement position, the first chess piece category corresponding to the first correct placement position is determined; the first correct placement position is the at least one correct placement position. Correct placement;
在所述各棋子中确定所述第一棋子类别的第一待摆放棋子;Determine the first chess piece to be placed of the first chess piece category among each of the chess pieces;
根据所述第一待摆放棋子的实际位置和所述第一正确放置位置,生成针对所述第一 待摆放棋子的所述摆棋指令。According to the actual position of the first chess piece to be placed and the first correct placement position, the chess placement instruction for the first chess piece to be placed is generated.
可以看出,在第一正确放置位置未放置棋子的情况下,可以根据第一待摆放棋子的实际位置和第一正确放置位置,将第一正确放置位置准确放置第一待摆放棋子,符合实际的摆棋需求。It can be seen that when the chess piece is not placed in the first correct placement position, the first chess piece to be placed can be accurately placed in the first correct placement position according to the actual position of the first chess piece to be placed and the first correct placement position. Meet actual chess placement needs.
在一些实施例中,所述处理部分1002,配置为在所述各棋子中确定所述第一棋子类别的第一待摆放棋子,包括:In some embodiments, the processing part 1002 is configured to determine the first chess piece to be placed of the first chess piece category among the chess pieces, including:
在所述各棋子中确定所述第一棋子类别的各棋子;Determine each chess piece of the first chess piece category among the chess pieces;
在所述第一棋子类别的各棋子中,将与所述第一正确放置位置距离最近的棋子确定为所述第一待摆放棋子。Among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position is determined as the first chess piece to be placed.
可以看出,由于可以在第一棋子类别的各棋子中,将与第一正确放置位置距离最近的棋子确定为第一待摆放棋子,并且第一待摆放棋子的移动路径为从第一待摆放棋子的实际位置至第一正确位置,因此,可以提高针对第一待摆放棋子的摆棋效率It can be seen that among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position can be determined as the first chess piece to be placed, and the movement path of the first chess piece to be placed is from the first The actual position of the chess piece to be placed is to the first correct position. Therefore, the efficiency of placing the chess piece for the first chess piece to be placed can be improved.
在一些实施例中,所述处理部分1002,配置为根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:In some embodiments, the processing part 1002 is configured to generate a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image, including:
响应于第一正确放置位置被所述第一正确放置位置对应的第一待摆放棋子占据,且所述第一正确放置位置的中心点与所述第一待摆放棋子的中心点的距离大于第三距离阈值,根据所述第一待摆放棋子的实际位置和所述第一正确放置位置,生成针对所述第一待摆放棋子的所述摆棋指令;所述第一正确放置位置为所述至少一个正确放置位置中的正确放置位置。In response to the first correctly placed position being occupied by the first chess piece to be placed corresponding to the first correctly placed position, and the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed Greater than the third distance threshold, the chess placement instruction for the first chess piece to be placed is generated based on the actual position of the first chess piece to be placed and the first correct placement position; the first correct placement The position is a correct placement position among the at least one correct placement position.
可以看出,响应于第一正确放置位置被第一正确放置位置对应的第一待摆放棋子占据,且第一正确放置位置的中心点与第一待摆放棋子的中心点的距离大于第三距离阈值,可以认为第一待摆放棋子摆放不够准确,在这种情况下,根据第一待摆放棋子的实际位置和第一正确放置位置,可以在第一正确放置位置准确放置第一待摆放棋子。在人机互动摆棋的场景中,人摆的棋子可能不如机械臂精确,会存在一定程度的偏移,通过执行本公开实施例的技术方案,可以针对人摆的不够精确的棋子,在不影响用户体验的情况下进行位置微调,从而符合实际的摆棋需求。It can be seen that in response to the first correctly placed position being occupied by the first chess piece to be placed corresponding to the first correctly placed position, and the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed is greater than the Three distance thresholds, it can be considered that the placement of the first chess piece to be placed is not accurate enough. In this case, according to the actual position of the first chess piece to be placed and the first correct placement position, the second correct chess piece can be accurately placed at the first correct placement position. Once the chess pieces are placed. In the scenario of human-machine interactive chess playing, the chess pieces placed by humans may not be as accurate as the mechanical arms, and there will be a certain degree of offset. By implementing the technical solutions of the embodiments of the present disclosure, chess pieces placed by humans that are not accurate enough can be solved without The position is fine-tuned without affecting the user experience, so as to meet the actual chess placement needs.
在一些实施例中,所述处理部分1002,还配置为按照与所述执行器的距离从近到远的顺序,对所述第一区域中的正确放置位置进行遍历,确定第一正确放置位置。In some embodiments, the processing part 1002 is further configured to traverse the correct placement positions in the first area in order of distance from the actuator to determine the first correct placement position. .
可以理解地,由于第一正确位置是按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历得到的,因此,有利于在摆棋过程中,高效地实现执行器的移动。Understandably, since the first correct position is obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is conducive to efficient implementation during the chess placement process. Movement of the actuator.
在一些实施例中,所述至少一个正确放置位置的数量大于或等于二;所述处理部分1002,配置为根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:In some embodiments, the number of the at least one correctly placed position is greater than or equal to two; the processing part 1002 is configured to determine the actual position of the at least one chess piece in the first image according to the at least one correctly placed position. , generate chess placement instructions, including:
响应于至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,根据所述至少两个待摆放棋子中至少部分棋子的实际位置和所述棋盘之外的预定义区域,生成针对所述至少部分棋子的所述摆棋指令。In response to the situation that at least two correctly placed positions are mutually occupied by at least two chess pieces to be placed, generating a The chess placement instructions for at least some of the chess pieces.
可以理解地,在至少两个正确放置位置被至少两个待摆放棋子互相占据的情况下,由于已经摆放的棋子对待摆放棋子的摆放过程的影响,不能直接将至少两个待摆放棋子中的任意一个棋子移动至正确的位置,通过将至少两个待摆放棋子的至少部分棋子移动至棋盘之外的预定义区域,有利于在下一次摆棋过程中实现至少两个待摆放棋子的正确摆放。It can be understood that when at least two correct placement positions are occupied by at least two chess pieces to be placed, due to the influence of the placed chess pieces on the placement process of the chess pieces to be placed, the at least two chess pieces to be placed cannot be directly placed. Any one of the chess pieces to be placed is moved to the correct position. By moving at least part of the at least two chess pieces to be placed to a predefined area outside the chessboard, it is beneficial to realize at least two chess pieces to be placed in the next chess placement process. Correct placement of chess pieces.
在一些实施例中,所述处理部分1002,还配置为按照与所述执行器的距离从近到远的顺序,对所述第一区域中的正确放置位置进行遍历,确定出所述至少两个正确放置位置。In some embodiments, the processing part 1002 is further configured to traverse the correct placement positions in the first area in order of distance from the actuator to determine the at least two correct placement.
可以理解地,由于至少两个正确位置是按照与执行器的距离从近到远的顺序,对第一区域中的正确放置位置进行遍历得到的,因此,有利于在摆棋过程中,减少执行器的移动距离,高效地实现执行器的移动。Understandably, since at least two correct positions are obtained by traversing the correct placement positions in the first area in order of distance from the actuator from near to far, it is beneficial to reduce execution during the chess placement process. The moving distance of the actuator can be effectively realized.
在一些实施例中,所述处理部分1002,还配置为响应于所述棋盘图像区域不存在遮挡区域,且所述第一图像中的棋子的数量小于第一数量,确定摆棋状态为缺子状态;所述第一数量为根据所述棋子摆放规则确定的棋子总数量。In some embodiments, the processing part 1002 is further configured to determine that the chess placement status is a missing piece in response to the fact that there is no occlusion area in the chessboard image area and the number of chess pieces in the first image is less than the first number. State; the first number is the total number of chess pieces determined according to the chess piece placement rules.
可以理解地,在棋盘图像区域不存在遮挡区域,且第一图像中的棋子的数量小于第一数量,可以认为第一图像中的棋子不足以实现完整的摆棋过程,因此,通过准确地确定摆棋状态为缺子状态,有利于后续根据缺子状态进行针对性地处理。Understandably, there is no occlusion area in the chessboard image area, and the number of chess pieces in the first image is less than the first number. It can be considered that the chess pieces in the first image are not enough to achieve a complete chess placement process. Therefore, by accurately determining The status of the chess piece is a lack of pieces, which is conducive to subsequent targeted processing based on the lack of pieces.
在一些实施例中,所述处理部分1002,还配置为在连续至少两次生成缺子状态的情况下,生成表示缺子的提示信息。In some embodiments, the processing part 1002 is further configured to generate prompt information indicating a missing substate when a missing substate is generated at least twice in a row.
可以看出,由于表示缺子的提示信息,是在连续至少两次生成缺子状态的情况下生成的,因此,在一定程度上可以更加可靠地确定出现缺子的情况。It can be seen that since the prompt information indicating a missing son is generated when the missing son state is generated at least twice in a row, the occurrence of a missing son can be determined more reliably to a certain extent.
以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。在一些实施例中,本公开实施例提供的装置具有的功能或包含的部分可以用于执行上述方法实施例描述的方法,对于本公开装置实施例中未披露的技术细节,请参照本公开方法实施例的描述而理解。The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or parts of the device provided by the embodiments of the present disclosure can be used to perform the methods described in the above method embodiments. For technical details not disclosed in the embodiments of the device of the present disclosure, please refer to the methods of the present disclosure. be understood from the description of the embodiments.
需要说明的是,本公开实施例中,如果以软件功能模块的形式实现上述的摆棋方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本公开各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本公开实施例不限制于任何特定的硬件、软件或固件,或者硬件、软件、固件三者之间的任意结合。It should be noted that in the embodiments of the present disclosure, if the above-mentioned chess placement method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present disclosure can be embodied in the form of software products that are essentially or contribute to related technologies. The software product is stored in a storage medium and includes a number of instructions to enable a A computer device (which may be a personal computer, a server, a network device, etc.) executes all or part of the methods described in various embodiments of the present disclosure. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read Only Memory, ROM), magnetic disk or optical disk and other media that can store program code. In this way, the embodiments of the present disclosure are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.
本公开实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述任意一种摆棋方法中的部分或全部步骤。所述计算机可读存储介质可以是瞬时性的,也可以是非瞬时性的。Embodiments of the present disclosure provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, some or all of the steps in any of the above-mentioned chess-playing methods are implemented. The computer-readable storage medium may be transient or non-transitory.
计算机可读存储介质可以为易失性存储介质或非易失性存储介质。计算机可读存储介质例如可以是电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(Random Access Memory,RAM)、ROM、可擦式可编程只读存储器(Electrical Programmable Read Only Memory,EPROM)、闪存、静态随机存取存储器(Static Random-Access Memory,SRAM)、便携式压缩盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、数字多功能盘(Digital Video Disc,DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其它自由传播的电磁波、通过波导或其它传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)或者通过电线传输的电信号。Computer-readable storage media may be volatile storage media or non-volatile storage media. The computer-readable storage medium may be, for example, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), ROM, electrical programmable read-only memory (Electrical Programmable Read) Only Memory, EPROM), flash memory, Static Random-Access Memory (Static Random-Access Memory, SRAM), Portable Compact Disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM), Digital Multi-Function Disk (Digital Video Disc) , DVD), memory sticks, floppy disks, mechanical encoding devices, such as punched cards or raised-in-groove structures with instructions stored thereon, and any suitable combination of the above. As used herein, computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or transmitted through wires electrical signal.
本公开实施例提供一种计算机程序,包括计算机可读代码,在所述计算机可读代码在计算机设备中运行的情况下,所述计算机设备中的处理器执行用于实现上述任意一种摆棋方法中的部分或全部步骤。Embodiments of the present disclosure provide a computer program, including computer readable code. When the computer readable code is run in a computer device, the processor in the computer device executes for implementing any of the above chess playing. Some or all of the steps in a method.
本公开实施例提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序被计算机读取并执行时,实现上述方法中的部分或全部步骤。该计算机程序产品可以具体通过硬件、软件或其结合的方式 实现。在一些实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一些实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。Embodiments of the present disclosure provide a computer program product. The computer program product includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, some of the above methods are implemented or All steps. The computer program product can be implemented specifically through hardware, software or a combination thereof. In some embodiments, the computer program product is embodied as a computer storage medium. In other embodiments, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) and so on.
这里需要指出的是:上文对各个实施例的描述倾向于强调各个实施例之间的不同之处,其相同或相似之处可以互相参考。以上设备、存储介质、计算机程序及计算机程序产品实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于设备、存储介质、计算机程序及计算机程序产品实施例中未披露的技术细节,请参照本公开方法实施例的描述而理解。It should be noted here that the above description of various embodiments tends to emphasize the differences between the various embodiments, and the similarities or similarities may be referred to each other. The description of the above embodiments of equipment, storage media, computer programs and computer program products is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the embodiments of equipment, storage media, computer programs and computer program products, please refer to the description of the method embodiments of the present disclosure for understanding.
需要说明的是,图11为本公开实施例中电子设备的一种硬件实体示意图,如图11所示,电子设备1100可以包括:存储器1101、处理器1102、图像采集设备1103以及存储在存储器1101上并可在处理器1102上运行的计算机程序;其中,It should be noted that FIG. 11 is a schematic diagram of a hardware entity of an electronic device in an embodiment of the present disclosure. As shown in FIG. 11 , the electronic device 1100 may include: a memory 1101, a processor 1102, an image acquisition device 1103, and images stored in the memory 1101. A computer program executable on processor 1102; wherein,
所述处理器1102用于运行所述计算机程序以执行上述任意一种摆棋方法。The processor 1102 is used to run the computer program to execute any of the above-mentioned chess placing methods.
在实际应用中,上述存储器1101可以是易失性存储器(volatile memory),例如RAM;或者非易失性存储器(non-volatile memory),例如ROM,快闪存储器(flash memory),硬盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD);或者上述种类的存储器的组合,并向处理器1102提供指令和数据。In practical applications, the above-mentioned memory 1101 can be volatile memory (volatile memory), such as RAM; or non-volatile memory (non-volatile memory), such as ROM, flash memory (flash memory), hard disk (Hard Disk) Drive, HDD) or solid-state drive (Solid-State Drive, SSD); or a combination of the above types of memories, and provides instructions and data to the processor 1102.
本公开实施例还提供了一种对弈机器人,该对弈机器人包括用于抓取物体的执行器,还包括上述任意一种摆棋装置或上述任意一种电子设备。An embodiment of the present disclosure also provides a chess-playing robot. The chess-playing robot includes an actuator for grabbing objects, and also includes any of the above-mentioned chess-playing devices or any of the above-mentioned electronic devices.
在一些实施例中,所述执行器为机械臂。In some embodiments, the actuator is a robotic arm.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本公开的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。应理解,在本公开的各种实施例中,上述各步骤/过程的序号的大小并不意味着执行顺序的先后,各步骤/过程的执行顺序应以其功能和内在逻辑确定,而不应对本公开实施例的实施过程构成任何限定。上述本公开实施例序号仅仅为了描述,不代表实施例的优劣。It will be understood that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic associated with the embodiment is included in at least one embodiment of the present disclosure. Thus, the appearances of "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that in various embodiments of the present disclosure, the size of the serial numbers of the above steps/processes does not mean the order of execution. The execution order of each step/process should be determined by its functions and internal logic, and should not be The implementation process of the embodiments of the present disclosure constitutes no limitations. The above serial numbers of the embodiments of the present disclosure are only for description and do not represent the advantages and disadvantages of the embodiments.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this document, the terms "comprising", "comprising" or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device that includes a series of elements not only includes those elements, It also includes other elements not expressly listed or inherent in the process, method, article or apparatus. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or device that includes that element.
在本公开所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components may be combined, or can be integrated into another system, or some features can be ignored, or not implemented. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be electrical, mechanical, or other forms. of.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated; the components shown as units may or may not be physical units; they may be located in one place or distributed to multiple network units; Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本公开各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present disclosure can be all integrated into one processing unit, or each unit can be separately used as a unit, or two or more units can be integrated into one unit; the above-mentioned integration The unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在 执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed through hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the execution includes: The steps of the above method embodiment; and the aforementioned storage media include: mobile storage devices, read-only memory (Read Only Memory, ROM), magnetic disks or optical disks and other various media that can store program codes.
或者,本公开上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本公开各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated units of the present disclosure are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure can be embodied in the form of a software product in essence or that contributes to related technologies. The computer software product is stored in a storage medium and includes a number of instructions to enable a computer. A computer device (which may be a personal computer, a server, a network device, etc.) executes all or part of the methods described in various embodiments of the present disclosure. The aforementioned storage media include: mobile storage devices, ROMs, magnetic disks or optical disks and other media that can store program codes.
以上所述,仅为本公开的实施方式,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本公开的保护范围之内。The above are only embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, and should are covered by the protection scope of this disclosure.

Claims (18)

  1. 一种摆棋方法,所述方法由电子设备执行,所述方法包括:A method of playing chess, the method is executed by an electronic device, the method includes:
    控制图像采集设备采集第一图像,第一图像表示棋盘和各棋子的图像;Control the image acquisition device to acquire a first image, where the first image represents an image of the chessboard and each chess piece;
    响应于所述第一图像中的棋盘图像区域存在遮挡区域,在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域;In response to the presence of an occlusion area in the checkerboard image area in the first image, determining a first area in the area in the checkerboard image area other than the occlusion area;
    响应于所述第一区域中的至少一个正确放置位置未放置与所述至少一个正确放置位置对应的棋子,根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令;所述正确放置位置表示按照棋子摆放规则确定的棋子放置位置;In response to the at least one correct placement position in the first area not placing the chess piece corresponding to the at least one correct placement position, according to the at least one correct placement position and the actual position of the at least one chess piece in the first image , generate a chess placement instruction; the correct placement position represents the placement position of the chess pieces determined according to the chess piece placement rules;
    控制所述对弈机器人的执行器,执行所述摆棋指令。Control the actuator of the chess-playing robot to execute the chess-playing instructions.
  2. 根据权利要求1所述的方法,其中,所述在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域,包括:The method according to claim 1, wherein determining the first area in the area of the checkerboard image area except the occlusion area includes:
    在所述棋盘图像区域中除所述遮挡区域外的区域中,选取部分区域作为所述第一区域;其中,所述第一区域的每个像素点与所述遮挡区域的边界的距离大于第一距离阈值,且所述第一区域的每个像素点与各个已经摆放的棋子的距离大于第二距离阈值。In the area in the checkerboard image area except the occlusion area, select a partial area as the first area; wherein the distance between each pixel point in the first area and the boundary of the occlusion area is greater than the third area. A distance threshold, and the distance between each pixel in the first area and each placed chess piece is greater than the second distance threshold.
  3. 根据权利要求1或2所述的方法,其中,在控制所述执行器,执行所述摆棋指令后,所述方法还包括:The method according to claim 1 or 2, wherein, after controlling the actuator and executing the chess placement instruction, the method further includes:
    重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、以及执行所述摆棋指令的步骤,直至所述第一区域中的每个所述正确放置位置放置有与所述每个正确放置位置对应的棋子。Re-execute the steps of controlling the image acquisition device to collect the first image, determine the first area, generate the chess placement instruction, and execute the chess placement instruction until each correct placement position in the first area is A piece is placed corresponding to each of the correct placements described.
  4. 根据权利要求3所述的方法,其中,所述方法还包括:The method of claim 3, further comprising:
    响应于所述棋盘图像区域存在遮挡区域,且所述第一区域中的每个所述正确放置位置放置有与所述每个正确放置位置对应的棋子,控制所述执行器移动至所述执行器的初始位置;所述初始位置位于所述棋盘之外的区域;In response to the existence of an occlusion area in the chessboard image area, and each of the correct placement positions in the first area is placed with a chess piece corresponding to each of the correct placement positions, the actuator is controlled to move to the execution The initial position of the chessboard; the initial position is located in an area outside the chessboard;
    重新执行控制图像采集设备采集第一图像、确定所述第一区域、生成所述摆棋指令、执行所述摆棋指令、以及控制所述执行器移动至所述初始位置的步骤,直至所述棋盘图像区域不存在遮挡区域,且所述棋盘图像区域中每个正确放置位置放置有所述每个正确放置位置对应的棋子。Re-execute the steps of controlling the image acquisition device to collect the first image, determining the first area, generating the chess placement instruction, executing the chess placement instruction, and controlling the actuator to move to the initial position until the There is no occlusion area in the chessboard image area, and chess pieces corresponding to each correct placement position are placed at each correct placement position in the chessboard image area.
  5. 根据权利要求1至4任一项所述的方法,其中,所述根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:The method according to any one of claims 1 to 4, wherein generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image includes:
    响应于所述第一正确放置位置未放置所述棋子的情况,确定与所述第一正确放置位置对应的第一棋子类别;所述第一正确放置位置为所述至少一个正确放置位置中的正确放置位置;In response to the situation that the chess piece is not placed in the first correct placement position, the first chess piece category corresponding to the first correct placement position is determined; the first correct placement position is the at least one correct placement position. Correct placement;
    在所述各棋子中确定所述第一棋子类别的第一待摆放棋子;Determine the first chess piece to be placed of the first chess piece category among each of the chess pieces;
    根据所述第一待摆放棋子的实际位置和所述第一正确放置位置,生成针对所述第一待摆放棋子的所述摆棋指令。The chess placement instruction for the first chess piece to be placed is generated based on the actual position of the first chess piece to be placed and the first correct placement position.
  6. 根据权利要求5所述的方法,其中,所述在所述各棋子中确定所述第一棋子类别的第一待摆放棋子,包括:The method according to claim 5, wherein determining the first chess piece to be placed of the first chess piece category among the chess pieces includes:
    在所述各棋子中确定所述第一棋子类别的各棋子;Determine each chess piece of the first chess piece category among the chess pieces;
    在所述第一棋子类别的各棋子中,将与所述第一正确放置位置距离最近的棋子确定为所述第一待摆放棋子。Among the chess pieces of the first chess piece category, the chess piece closest to the first correct placement position is determined as the first chess piece to be placed.
  7. 根据权利要求1至6任一项所述的方法,其中,所述根据所述至少一个正确放置位 置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:The method according to any one of claims 1 to 6, wherein generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image includes:
    响应于第一正确放置位置被所述第一正确放置位置对应的第一待摆放棋子占据,且所述第一正确放置位置的中心点与所述第一待摆放棋子的中心点的距离大于第三距离阈值,根据所述第一待摆放棋子的实际位置和所述第一正确放置位置,生成针对所述第一待摆放棋子的所述摆棋指令;所述第一正确放置位置为所述至少一个正确放置位置中的正确放置位置。In response to the first correctly placed position being occupied by the first chess piece to be placed corresponding to the first correctly placed position, and the distance between the center point of the first correctly placed position and the center point of the first chess piece to be placed Greater than the third distance threshold, the chess placement instruction for the first chess piece to be placed is generated based on the actual position of the first chess piece to be placed and the first correct placement position; the first correct placement The position is a correct placement position among the at least one correct placement position.
  8. 根据权利要求5至7任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 5 to 7, wherein the method further includes:
    按照与所述执行器的距离从近到远的顺序,对所述第一区域中的正确放置位置进行遍历,确定第一正确放置位置。In order of distance from the actuator from closest to farthest, the correct placement positions in the first area are traversed to determine the first correct placement position.
  9. 根据权利要求1至8任一项所述的方法,其中,所述至少一个正确放置位置的数量大于或等于二;The method according to any one of claims 1 to 8, wherein the number of the at least one correct placement position is greater than or equal to two;
    所述根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令,包括:Generating a chess placement instruction based on the at least one correct placement position and the actual position of at least one chess piece in the first image includes:
    响应于至少两个正确放置位置被至少两个待摆放棋子互相占据的情况,根据所述至少两个待摆放棋子中至少部分棋子的实际位置和所述棋盘之外的预定义区域,生成针对所述至少部分棋子的所述摆棋指令。In response to the situation that at least two correctly placed positions are mutually occupied by at least two chess pieces to be placed, generating a The chess placement instructions for at least some of the chess pieces.
  10. 根据权利要求9所述的方法,其中,所述方法还包括:The method of claim 9, further comprising:
    按照与所述执行器的距离从近到远的顺序,对所述第一区域中的正确放置位置进行遍历,确定出所述至少两个正确放置位置。In order of distance from the actuator from closest to farthest, the correct placement positions in the first area are traversed to determine the at least two correct placement positions.
  11. 根据权利要求1至10任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 10, wherein the method further includes:
    响应于所述棋盘图像区域不存在遮挡区域,且所述第一图像中的棋子的数量小于第一数量,确定摆棋状态为缺子状态;所述第一数量为根据所述棋子摆放规则确定的棋子总数量。In response to the fact that there is no occlusion area in the chessboard image area and the number of chess pieces in the first image is less than a first number, it is determined that the chess placement state is a missing piece state; the first number is determined according to the chess piece placement rules The total number of chess pieces determined.
  12. 根据权利要求11所述的方法,其中,所述方法还包括:The method of claim 11, wherein the method further includes:
    在连续至少两次生成缺子状态的情况下,生成表示缺子的提示信息。When a missing substate is generated at least twice in a row, a prompt message indicating a missing substate is generated.
  13. 一种摆棋装置,所述装置包括:控制部分和处理部分,A chess playing device, the device includes: a control part and a processing part,
    控制部分,用于控制图像采集设备采集第一图像,第一图像表示棋盘和各棋子的图像;The control part is used to control the image acquisition device to collect the first image, where the first image represents the image of the chessboard and each chess piece;
    处理部分,用于响应于所述第一图像中的棋盘图像区域存在遮挡区域,在所述棋盘图像区域中除所述遮挡区域外的区域中,确定第一区域;响应于所述第一区域中的至少一个正确放置位置未放置与所述至少一个正确放置位置对应的棋子,根据所述至少一个正确放置位置、以及所述第一图像中至少一个棋子的实际位置,生成摆棋指令;所述正确放置位置表示按照棋子摆放规则确定的棋子放置位置;A processing part configured to, in response to the presence of an occlusion area in the chessboard image area in the first image, determine a first area in the chessboard image area other than the occlusion area; in response to the first area The chess piece corresponding to the at least one correct placement position is not placed in at least one correct placement position, and a chess placement instruction is generated based on the at least one correct placement position and the actual position of at least one chess piece in the first image; so The above-mentioned correct placement position means the placement position of the chess pieces determined according to the chess piece placement rules;
    所述控制部分,还用于控制所述对弈机器人的执行器,执行所述摆棋指令。The control part is also used to control the actuator of the chess-playing robot to execute the chess-playing instructions.
  14. 一种电子设备,包括图像采集设备、处理器和用于存储能够在处理器上运行的计算机程序的存储器;其中,所述处理器用于运行所述计算机程序以执行权利要求1至12任一项所述的摆棋方法。An electronic device, including an image acquisition device, a processor and a memory for storing a computer program capable of running on the processor; wherein the processor is used to run the computer program to perform any one of claims 1 to 12 The described chess-playing method.
  15. 一种对弈机器人,包括用于抓取物体的执行器,还包括权利要求13所述的摆棋装置或权利要求14所述的电子设备。A chess-playing robot includes an actuator for grabbing objects, and also includes a chess-playing device according to claim 13 or an electronic device according to claim 14.
  16. 根据权利要求15所述的对弈机器人,所述执行器为机械臂。The game robot according to claim 15, wherein the actuator is a mechanical arm.
  17. 一种计算机存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现权利要求1至12任一项所述的摆棋方法。A computer storage medium on which a computer program is stored. When the computer program is executed by a processor, the chess playing method according to any one of claims 1 to 12 is implemented.
  18. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在电子设备中运行时,所述电子设备中的处理器执行用于实现权利要求1至12任一所述的摆棋方法。A computer program, including computer readable code. When the computer readable code is run in an electronic device, the processor in the electronic device executes the chess playing method according to any one of claims 1 to 12. .
PCT/CN2022/114913 2022-03-23 2022-08-25 Chess placement method and apparatus, electronic device, chess playing robot, storage medium, and program WO2023178920A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210293846.3A CN114734456A (en) 2022-03-23 2022-03-23 Chess playing method, device, electronic equipment, chess playing robot and storage medium
CN202210293846.3 2022-03-23

Publications (1)

Publication Number Publication Date
WO2023178920A1 true WO2023178920A1 (en) 2023-09-28

Family

ID=82276534

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/114913 WO2023178920A1 (en) 2022-03-23 2022-08-25 Chess placement method and apparatus, electronic device, chess playing robot, storage medium, and program

Country Status (2)

Country Link
CN (1) CN114734456A (en)
WO (1) WO2023178920A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114734456A (en) * 2022-03-23 2022-07-12 深圳市商汤科技有限公司 Chess playing method, device, electronic equipment, chess playing robot and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1015151A (en) * 1996-06-28 1998-01-20 Sanyo Electric Co Ltd Extraction device for invalid zone on japanese chess board and recognition device for pieces on the board
US20080237983A1 (en) * 2007-03-29 2008-10-02 Industrial Technology Research Institute Portable robotic board game playing system
CN107301650A (en) * 2017-06-28 2017-10-27 湖南瑞森可机器人科技有限公司 Four connect chess checkerboard image processing method, system and man-machine chess's system
CN108434718A (en) * 2018-05-28 2018-08-24 中电海康集团有限公司 A kind of electric go chessboard
CN108671534A (en) * 2018-05-21 2018-10-19 湖南大学 A kind of robot Chinese chess beginning pendulum chess method and system based on objective contour and framework characteristic
CN110096999A (en) * 2019-04-29 2019-08-06 达闼科技(北京)有限公司 Chessboard recognition methods, chessboard recognition device, electronic equipment and can storage medium
JP2021168088A (en) * 2020-04-13 2021-10-21 富士フイルムビジネスイノベーション株式会社 Information processing apparatus and information processing program
CN113878579A (en) * 2021-09-30 2022-01-04 北京市商汤科技开发有限公司 Chess playing method and device, chess playing robot and computer storage medium
CN114734456A (en) * 2022-03-23 2022-07-12 深圳市商汤科技有限公司 Chess playing method, device, electronic equipment, chess playing robot and storage medium

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB1590442A (en) * 1976-07-09 1981-06-03 Willcocks M E G Apparatus for playing a board game
US4398720A (en) * 1981-01-05 1983-08-16 California R & D Center Robot computer chess game
GB2104874B (en) * 1981-03-27 1985-01-03 Kingsley Royce Hopkins Case for a chess set or other board game
KR20020045627A (en) * 2000-12-09 2002-06-20 구자홍 Apparatus for chess game based on on-line
CN202028163U (en) * 2011-04-02 2011-11-09 北京石油化工学院 Chinese chess opening placing system
CN106730792A (en) * 2017-01-04 2017-05-31 群云时代文化传媒(北京)有限公司 A kind of augmented reality entity numeral table trip auxiliary extension system
CN107480678A (en) * 2017-09-29 2017-12-15 北京深度奇点科技有限公司 A kind of chessboard recognition methods and identifying system
CN108389231B (en) * 2018-03-19 2021-07-13 刘想德 Chess piece positioning and identifying method and system based on chessboard surface image
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
CN109045676B (en) * 2018-07-23 2020-04-10 西安交通大学 Chinese chess recognition learning algorithm and robot intelligent system and method based on algorithm
CN109432759A (en) * 2018-10-31 2019-03-08 中央民族大学 Realize the method and device that eight queens chess piece is put
CN112150534A (en) * 2019-06-28 2020-12-29 深圳市商汤科技有限公司 Method, device and equipment for detecting shielding state of image acquisition equipment and storage medium
CN111136669B (en) * 2020-01-17 2022-09-20 沈阳航空航天大学 Chess playing robot based on global vision and control method thereof
CN112507926B (en) * 2020-12-16 2022-07-01 电子科技大学 Go game repeating method based on video image analysis
CN113967352A (en) * 2021-10-29 2022-01-25 浙江龙蛇网络科技有限公司 Abnormal error processing method for electronic chessboard special for competition

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1015151A (en) * 1996-06-28 1998-01-20 Sanyo Electric Co Ltd Extraction device for invalid zone on japanese chess board and recognition device for pieces on the board
US20080237983A1 (en) * 2007-03-29 2008-10-02 Industrial Technology Research Institute Portable robotic board game playing system
CN107301650A (en) * 2017-06-28 2017-10-27 湖南瑞森可机器人科技有限公司 Four connect chess checkerboard image processing method, system and man-machine chess's system
CN108671534A (en) * 2018-05-21 2018-10-19 湖南大学 A kind of robot Chinese chess beginning pendulum chess method and system based on objective contour and framework characteristic
CN108434718A (en) * 2018-05-28 2018-08-24 中电海康集团有限公司 A kind of electric go chessboard
CN110096999A (en) * 2019-04-29 2019-08-06 达闼科技(北京)有限公司 Chessboard recognition methods, chessboard recognition device, electronic equipment and can storage medium
JP2021168088A (en) * 2020-04-13 2021-10-21 富士フイルムビジネスイノベーション株式会社 Information processing apparatus and information processing program
CN113878579A (en) * 2021-09-30 2022-01-04 北京市商汤科技开发有限公司 Chess playing method and device, chess playing robot and computer storage medium
CN114734456A (en) * 2022-03-23 2022-07-12 深圳市商汤科技有限公司 Chess playing method, device, electronic equipment, chess playing robot and storage medium

Also Published As

Publication number Publication date
CN114734456A (en) 2022-07-12

Similar Documents

Publication Publication Date Title
US9911231B2 (en) Method and computing device for providing augmented reality
WO2023178920A1 (en) Chess placement method and apparatus, electronic device, chess playing robot, storage medium, and program
WO2019219075A1 (en) Ball hitting route recommendation method and device
CN102752509A (en) Image device and program thereof
CN104936664A (en) Dart game device comprising image-capture device for capturing images of dart games
SE538272C2 (en) Improved identification of a gesture
JP2017084055A (en) Information processing apparatus, operation control method, and operation control program
US11861071B2 (en) Local perspective method and device of virtual reality equipment and virtual reality equipment
EP3905204A1 (en) Scene recognition method and apparatus, terminal, and storage medium
CN105915803A (en) Shooting method and system based on sensor
WO2020001016A1 (en) Moving image generation method and apparatus, and electronic device and computer-readable storage medium
JP2023534319A (en) Tabletop game state switching method, apparatus, device, storage medium and computer program
KR20220098311A (en) Manipulation event recognition method and device
CN112381054A (en) Method for detecting working state of camera and related equipment and system
CN109079786B (en) Mechanical arm grabbing self-learning method and equipment
WO2024002395A2 (en) Vehicle charging port positioning method and related device
US20160109938A1 (en) Silhouette-Based Limb Finder Determination
CN108921129B (en) Image processing method, system, medium, and electronic device
CN113878579B (en) Chess playing method, device, chess playing robot and computer storage medium
JP2001179666A (en) Pet type robot and recording medium readable by computer with program recorded
JP2015153040A (en) System, information processing device, information processing method, and information processing program
JP2018190390A5 (en)
CN103984593A (en) Method and device for processing interrupt during game by mobile terminal
US11491372B2 (en) Information processing device, information processing method, and computer program
JP6853163B2 (en) Speaker orientation estimator, speaker orientation estimation method, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22932972

Country of ref document: EP

Kind code of ref document: A1