WO2019080229A1 - Chess piece positioning method and system based on machine vision, storage medium, and robot - Google Patents

Chess piece positioning method and system based on machine vision, storage medium, and robot

Info

Publication number
WO2019080229A1
WO2019080229A1 PCT/CN2017/112210 CN2017112210W WO2019080229A1 WO 2019080229 A1 WO2019080229 A1 WO 2019080229A1 CN 2017112210 W CN2017112210 W CN 2017112210W WO 2019080229 A1 WO2019080229 A1 WO 2019080229A1
Authority
WO
WIPO (PCT)
Prior art keywords
identifier
piece
coordinates
camera
coordinate system
Prior art date
Application number
PCT/CN2017/112210
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 WO2019080229A1 publication Critical patent/WO2019080229A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • G06T7/85Stereo camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/245Aligning, centring, orientation detection or correction of the image by locating a pattern; Special marks for positioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/62Text, e.g. of license plates, overlay texts or captions on TV images

Definitions

  • the invention relates to the field of robots, in particular to a machine vision based chess piece positioning method, system, storage medium and robot.
  • the invention patents of the application Nos. 201310554765.5 and 201621069461.5, 201310159264.7 all disclose a physical chessboard man-machine game system.
  • This type of invention uses a special physical chessboard to sense the position of the chess piece relative to the board through the corresponding sensor, and then sends the piece position information to the robot device.
  • the invention is capable of accurately obtaining the exact position of the piece on a particular board.
  • Application No. 201610967421.0 discloses an image-based chess piece positioning and recognition method capable of locating the position of a chess piece relative to a chessboard.
  • the invention is to binarize the image by the threshold method and then detect the boundary of the board. Position the pieces.
  • this boundary extraction method is very unstable, and it is difficult to correctly segment the true checkerboard boundary.
  • the present invention provides a machine vision based chess piece positioning method and system, a storage medium and a robot for accurately locating a specific position of a chess piece on a chessboard.
  • the invention discloses a machine vision-based chess piece positioning method, which is applied to positioning a chess piece on a chessboard provided with a planar identifier, the chess piece positioning method comprising:
  • S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
  • S200 performs image processing on the video image frame to identify the plane identifier
  • S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
  • the solution is to further position the piece by setting a plane marker on the board and then visually recognizing the plane marker by machine vision.
  • This solution does not require the placement of circuitry at the bottom of the board, so no complicated arrangements are required. And because of the establishment of the planar marker, the position of the pawn is accurately identified even in a complicated background.
  • the method before the capturing of the video stream by the camera in the step S100, and before acquiring the video image frame from the video stream, the method further includes:
  • S010 calibrates the camera to obtain an internal reference matrix of the camera.
  • the camera calibration calculates the internal parameters of the camera, that is, determines the geometric model of the camera imaging, so that the images captured by the ray are used later to calculate the three-dimensional position.
  • the step S200 performs image processing on the video image frame, and the identifying the planar identifier is specifically:
  • S210 performs binary segmentation on the video image frame, and extracts a contour from the segmented binarized image
  • S220 selecting, according to a common feature of the pre-stored contour identifiers of the plane identifiers, an outline contour having the common features as an alternative contour from the extracted contour contours;
  • the video image frame is processed, the video image frame is binary-divided, and the contour is extracted from the segmented image.
  • the binarization processing method is adopted to facilitate the extraction of information in the image, and the binary image can increase the recognition efficiency when performing computer recognition.
  • binarization can easily and quickly process image features, simplify post processing, and increase processing speed.
  • the image is subdivided on the binarized image, and the different regions of the image have special meanings. These regions are mutually disjoint, and each region satisfies the consistency of a particular region. Then, the contour image is extracted and recognized, which can reduce the difficulty of recognition and speed up the recognition efficiency.
  • the planar identifier is a square, and the common feature of the outline corresponding to the planar identifier pre-stored in the above step S220 is a quadrilateral.
  • the common features of the corresponding outlines will be different.
  • a flat marker we should try to select a marker that is easy to identify and has obvious feature points. For example, a square with four vertices and four sides are equal in length, which is convenient for later calculations.
  • the square identifier is selected as the planar identifier, the corresponding contour common feature is a quadrilateral.
  • the step S230 obtains a front view of the candidate contour, which is specifically:
  • S232 defines a pixel coordinate of the four vertices after the candidate profile is subjected to projective transformation into a front view as pixel coordinates of four pre-existing front views of the planar marker;
  • X is the homogeneous pixel coordinate of the candidate silhouette vertex
  • the non-homogeneous pixel coordinates are X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
  • S234 performs projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H, and obtains a front view corresponding to the region included in the candidate contour.
  • the solution is based on the selection of a square planar identifier.
  • the contour of the square planar identifier must be a quadrilateral, and the quadrilateral has four vertices. Therefore, the pixel coordinates of the four vertices and the defined quadrilateral front view can be utilized.
  • the pixel coordinates are calculated to obtain the projective transformation matrix H, so that all pixels in the quadrilateral contour are subjected to projective transformation to obtain a corresponding front view for subsequent comparison.
  • the step S300 calculates the position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, so that the position of the piece is specifically:
  • S310 calculating, according to the plane identifier and the pre-acquired internal reference matrix of the camera, a homography matrix of a current field of view of the camera;
  • S330 identifies a piece in the video image frame, reads pixel coordinates of the piece, and acquires coordinates of the piece in the plane identifier coordinate system according to the homography matrix;
  • S340 obtains the position of the chess piece on the chessboard according to the coordinates of the chess piece and the four corner points of the chessboard in the plane identifier coordinate system, combined with the grid length feature of the chessboard.
  • the chess piece can be positioned according to the planar identifier and the internal reference matrix of the camera. The most important thing is to obtain the current field of view of the camera according to the planar identifier and the internal reference matrix of the camera. Sexual matrix. After obtaining the homography matrix, the position of the chessboard and the chess piece in the plane coordinate coordinate system is determined. Finally, the position of the chess piece on the chessboard can be calculated by combining the length characteristics of the checkerboard mesh.
  • the chess piece in the video image frame is identified in step S330 in the solution, the chess piece
  • the recognition can be performed according to the feature of the pre-extracted chess piece, which is similar to the previous planar marker recognition, and the image processing frame is subjected to image processing and recognition, which will not be described here.
  • the scheme is simple in calculation and strong in implementation.
  • the step S310 calculates the homography matrix of the current field of view of the camera according to the plane identifier and the internal parameter matrix of the camera obtained in advance:
  • S311 selects the plane identifier coordinate system as a world coordinate system
  • (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any vertex in the plane image in the image coordinate system of the camera
  • (X, Y, Z, 1) indicates that the vertex is in the world coordinate system
  • the homogeneous coordinates in the middle are reduced to (X, Y, 0, 1)
  • s is the introduced arbitrary scale proportional parameter
  • M is the camera internal reference matrix
  • r1, r2, r3 respectively represent the planar marker coordinate system relative to the camera.
  • Three column vectors in the rotation matrix of the coordinate system, t is the translation vector.
  • This scheme specifies the homography matrix of the current field of view of the camera.
  • This homography matrix is the rotation matrix R and the translation vector t of the planar marker coordinate system with respect to the camera coordinate system.
  • the following formula exists because the pixel coordinates of the vertex of the planar identifier on the image and the coordinates of the vertex in the corresponding world coordinate system:
  • the above passes the identifier of a vertex pixel coordinate and its corresponding coordinate in the coordinate system of the marker. Obtain an equation, the identifier corresponds to four vertices, then you can write four corresponding equations correspondingly, and then solve the r1, r2, r3, t in the homography matrix through the equations.
  • the method further includes:
  • S335 determines, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, that the pieces are in a quadrilateral area composed of four corner points of the board.
  • step S320 the coordinates of the four corner points of the checkerboard in the plane identifier coordinate system can be determined, and the quadrilateral area composed of the four corner points is the checkerboard area, which can be determined through step S330.
  • the coordinates of the identified pieces in the plane coordinate system are determined. Therefore, step S335 is to determine that the identified pieces are on the board. Because only the pieces on the board need to be further positioned on the board, if they are not on the board, they can choose not to go to the tube, which can reduce the workload of the positioning of the pieces, and also facilitate the calculation of the position of the subsequent pieces on the board.
  • the method further includes:
  • S325 obtaining pixel coordinates of four corner points of the checkboard according to coordinates of the four corner points of the checkerboard in the plane identifier coordinate system and a homography matrix of the current field of view of the camera;
  • S326 selecting, according to pixel coordinates of the four corner points of the checkerboard, a quadrilateral region composed of four corner points of the checkerboard as a target area in the video image frame;
  • the step S330 identifies the pieces in the video image frame, and reads the pixel coordinates of the piece, and acquires the coordinates of the piece in the plane identifier coordinate system according to the homography matrix:
  • S331 identifies a piece in a target area in the video image frame, and reads pixel coordinates of the piece;
  • S332 Acquire coordinates of the chess piece in the plane identifier coordinate system according to the pixel coordinates of the chess piece and the homography matrix.
  • the position area of the board in the video image frame is determined, and the position area composed of the four corner points is used as the target area, and in the video image frame.
  • the pieces in the target area are the pieces on the board that need to be positioned, and the images in the target area, we can not identify them, that is, only identify the pieces in the target area, which greatly reduces the number of pieces.
  • the amount of calculation speeds up the positioning of the pieces.
  • the invention also discloses a machine vision-based chess piece positioning system, which is applied to positioning a chess piece on a chessboard provided with a plane identifier
  • the machine vision-based chess piece positioning system comprising: a camera acquisition module, For acquiring a video stream, and collecting a video image frame from the video stream; and an image recognition module, configured to perform image processing on the video image frame collected by the camera acquisition module, thereby identifying the image in the video image frame a plane identifier; a positioning module, configured to calculate a position of the piece on the board relative to the identifier according to the plane identifier and an internal parameter matrix of the camera acquired in advance, thereby locating the position of the piece.
  • the machine vision-based piece positioning system further comprises: a calibration module, configured to calibrate the camera to obtain an internal parameter matrix of the camera.
  • the image recognition module includes: a binary segmentation sub-module for performing binary segmentation on the video image frame; and a shape extraction sub-module for extracting a contour from the segmented binarized image; storing a sub-module, configured to store a common feature of the outer shape corresponding to the planar marker, the planar identifier template, and a determining processing sub-module, configured to correspond to the planar identifier stored in the storage sub-module a common feature of the outline of the profile, selecting a profile having the common feature as an alternative profile from the profile extracted by the profile extraction sub-module; a front view acquisition sub-module for obtaining a front view of the candidate profile An identification sub-module, configured to identify an image corresponding to the candidate contour as an image of the planar identifier when a front view of the candidate contour is consistent with the planar identifier template prestored by the storage sub-module .
  • the planar identifier is a square, and the common feature of the outline corresponding to the planar identifier stored by the storage sub-module is a quadrilateral;
  • the front view obtaining sub-module includes: a reading unit for reading Taking pixel coordinates of four vertices of the candidate contour; defining a unit for defining pixel coordinates of the four vertices after the candidate contour is subjected to projective transformation into a front view as pre-stored a pixel coordinate of four vertices of a front view of the face marker; a calculation unit for calculating four vertex pixel coordinates read by the reading unit and four vertex pixel coordinates defined by the defining unit, by using the following equation , to obtain the projective transformation matrix H,
  • X is the homogeneous pixel coordinate of the candidate silhouette vertex
  • the non-homogeneous pixel coordinates are X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
  • a transforming unit configured to perform a projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H obtained by the calculating unit, to obtain a front view corresponding to the region included in the candidate contour Figure.
  • the image recognition module is further configured to perform image processing on the video image frame to identify a pawn in the video image frame;
  • the positioning module includes: a homography matrix acquisition submodule, configured to: Calculating a homography matrix of a current field of view of the camera according to the plane identifier and an internal parameter matrix of the camera obtained in advance; a corner point coordinate obtaining sub-module for using a plane reference object according to a preset reference point on the chessboard The known coordinates in the coordinate system and the position of the row and the row on the board, combined with the grid length feature of the board, acquire coordinates of the four corner points of the board in the plane identifier coordinate system; the chess piece coordinate acquisition a module, configured to read a pixel of the piece according to the piece recognized by the image recognition module, and acquire coordinates of the piece in the coordinate system of the plane identifier according to the homography matrix; a positioning sub-module for combining the coordinates of the four corner points of the chess piece and the checkerboard
  • the homography matrix acquisition sub-module includes: a coordinate system determining unit, configured to select the plane identifier coordinate system as a world coordinate system; and a vertex coordinate reading unit, configured to read the plane label a pixel coordinate of the four vertices of the object; an operation unit for using the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system, the pixel coordinates of the four vertices of the planar identifier, and
  • the internal parameters of the camera obtained in advance are substituted into the following formulas:
  • (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any corner point in the visual positioning identifier in the image coordinate system of the camera
  • (X, Y, Z, 1) indicates that the vertex is in the world coordinate system.
  • the homogeneous coordinates are reduced to (X, Y, 0, 1)
  • s is the introduced arbitrary scale proportional parameter
  • M is the camera internal reference matrix
  • r1, r2, and r3 respectively represent the rotation of the visual positioning identification coordinate system relative to the camera coordinate system.
  • Three column vectors in the matrix, t is the translation vector.
  • the positioning module further includes: a determining submodule, configured to determine, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, that the piece is on the board Inside the quadrilateral area consisting of four corner points.
  • a determining submodule configured to determine, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, that the piece is on the board Inside the quadrilateral area consisting of four corner points.
  • the positioning module further includes: a target area determining sub-module, configured to: coordinate according to the four corner points of the checkerboard in the plane identifier coordinate system, and homography of the current field of view of the camera a matrix, obtaining pixel coordinates of the four corner points of the checkerboard; and selecting a quadrilateral region composed of four corner points of the checkerboard as a target area in the video image frame;
  • the chess piece coordinate acquisition sub-module includes: a chess piece pixel coordinate a reading unit, configured to: after the image recognition module recognizes a piece in the target area in the video image frame, read pixel coordinates of the piece; the piece coordinate calculation unit is configured to perform pixel coordinates according to the piece And the homography matrix, acquiring coordinates of the chess piece in the plane identifier coordinate system.
  • the present invention also discloses a storage medium storing a plurality of instructions executed by one or more processors to implement the machine vision-based pieces of the present invention. The steps of the positioning method.
  • the storage medium in the solution can be used to store software programs and modules, such as the machine vision based chess piece positioning method of the present invention and the program instructions/modules corresponding to the system. These program instructions/modules can be executed by the processor to implement the machine vision based piece positioning method/device described above.
  • the present invention further discloses a robot, comprising: a processor, configured to implement each instruction; a storage medium, configured to store a plurality of instructions; wherein: the processor is configured to execute an instruction stored by the storage medium, The steps of implementing the machine vision based piece positioning method of the present invention.
  • the processor in the robot executes the instructions stored in the storage medium of the present invention provided in the robot to implement the machine vision-based piece positioning method of the present invention.
  • the robot of the invention can position the pieces by machine vision, facilitates subsequent simulation of real people playing chess, and enhances the user's interactive experience.
  • the invention only needs to place a plane marker on the plane where the chessboard is located, by which the chess piece can be visually and accurately positioned.
  • the invention does not require a special circuit implementation of the board, and no data communication is required between the board and the robot, which is more convenient to arrange.
  • due to the identification of the planar marker even if the planar marker can be accurately identified in a complicated scene, it will not be interfered by complicated scenes.
  • FIG. 1 is a flow chart of an embodiment of a machine vision based chess piece positioning method according to the present invention
  • FIG. 3 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention.
  • FIG. 4 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention.
  • FIG. 5 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention.
  • FIG. 6 is a schematic diagram of a system composition of another embodiment of a chess piece positioning method based on machine vision according to the present invention.
  • FIG. 7 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention.
  • FIG. 8 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention.
  • Figure 9a is a schematic diagram of a calibration template of Zhang Zhengyou's plane calibration method
  • Figure 9b is a schematic diagram of the detection feature points in the Zhang Zhengyou plane calibration method
  • FIG. 10 is a front view of a quadrilateral contour after rotation in another embodiment of a machine vision based chess piece positioning method according to the present invention.
  • FIG. 11 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention.
  • FIG. 12 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention.
  • FIG. 13 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention.
  • FIG. 14 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention.
  • FIG. 15 is a block diagram of another embodiment of a machine vision based chess piece positioning system of the present invention.
  • Figure 16 is a block diagram showing the structure of an embodiment of the robot of the present invention.
  • Machine vision is a branch of artificial intelligence that is rapidly evolving. Simply put, machine vision is to use the machine instead of the human eye to make measurements and judgments.
  • Machine vision system is through machine vision products (ie images).
  • the ingesting device converts the ingested object into an image signal and transmits it to an image processing system to obtain a shape information of the object to be captured, and converts it into a digitized signal according to information such as pixel distribution, brightness, color, and the like;
  • the image system performs various operations on these signals to extract features of the target, and then controls the action of the device on the spot according to the result of the discrimination.
  • the invention provides a chess piece positioning method based on machine vision, which is applied to position a piece on a board provided with a plane identifier. As shown in FIG. 1 , the piece positioning method comprises:
  • S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
  • S200 performs image processing on the video image frame to identify the plane identifier
  • S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
  • planar markers enable accurate identification in complex scenes without interference from complex scenes.
  • the camera for collecting the video stream needs to be calibrated. Specifically, by calibrating the camera, the internal reference matrix of the camera is obtained, that is, the geometric model of the imaging of the camera is determined.
  • Zhang Zhengyou calibration method with the help of the machine vision calibration plate, the feature circle on the calibration plate is distributed in display, with a spacing of 30mm; the board size is 300X300mm.
  • the four large circles mark the circle, and the big ring mark determines the direction.
  • Calibration is performed using the center coordinates of the feature circle.
  • the method of extracting the center coordinates of the feature circle obtaining four mark circle coordinates, using the affine transformation to adjust the coordinates of the feature circle, and then sorting them to determine the coordinates of the corresponding feature circle image.
  • K is the internal reference matrix of the camera
  • [X Y 1] T is the homogeneous coordinate of the point on the template plane
  • [u v 1] T is the homogeneous coordinate of the point on the template plane projected onto the corresponding point on the image plane
  • [r1 r2 R3] and t are the rotation matrix and translation vector of the camera coordinate system relative to the world coordinate system, respectively.
  • K can be solved linearly and uniquely, that is, the internal reference matrix of the camera can be solved.
  • step S100 acquires a video stream by using a camera, and collects a video image frame collected in the video image frame from the video stream as a key frame, and the key frame can reflect a change of the chess piece on the chessboard. .
  • FIG. 3 Another embodiment of the method of the present invention, as shown in FIG. 3, includes:
  • S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
  • S210 performs binary segmentation on the video image frame, and extracts a contour from the segmented binarized image
  • S220 selecting, according to a common feature of the pre-stored contour identifiers of the plane identifiers, an outline contour having the common features as an alternative contour from the extracted contour contours;
  • S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
  • S210 performs binary separation on the video image frame, and binarization can be regarded as setting the gray value of the pixel on the image to 0 or 255, that is, presenting the entire image with obvious black and white vision. effect.
  • Image segmentation is to separate different regions of a particular meaning in an image. These regions are mutually disjoint, and each region satisfies the consistency of a particular region. Image segmentation is an important issue in image processing and a classic problem in computer vision research. Image understanding in computer vision, including object detection, feature extraction, and target recognition, depends on the quality of the segmentation.
  • the threshold method is a simple and effective segmentation method. Its biggest feature is that the calculation is simple and thus widely used.
  • the planar identifier on the captured video frame does not have to be the front view. Then, it is necessary to extract the planar marker photographed from various angles, and perform edge detection on the planar marker to obtain the common features of the contour of the planar marker, and then store the common feature in advance to facilitate the video capture.
  • the planar identifier is identified after the frame. Specifically, after the video frame image is binary-divided, the contours of the divided images are extracted, and the candidate contours are searched according to the common features of the contours of the planar identifiers.
  • the common feature of the outline can be quadrilateral, then we can exclude those non-convex polygons from the extracted outline, and Not a quadrilateral outline, etc.
  • the extracted outline has a side smaller than the other side ( The shape is relatively long and thin, the contour perimeter or the area is too small, etc., and the remaining eligible contours are the alternative contours that the planar markers may correspond to.
  • the next step is to obtain a front view of each candidate contour, that is, to change the candidate contour image area corresponding to the plane identifier into a front view, thereby further determining whether the candidate contour region is a plane identifier.
  • the image corresponding to the object Specifically, by comparing the front view of each candidate contour with the pre-stored planar identifier template, when the alignment is consistent, it can be determined that the candidate contour is the shape of the planar identifier.
  • the contour, the image corresponding to this alternative contour is the image of the planar marker, and thus the planar marker is identified.
  • the planar identifier disposed on the chessboard is a square
  • step S220 of the above embodiment is based on the pre-existing pre-existing common features of the contour profile corresponding to the pre-stored planar identifier.
  • a common feature of the contour corresponding to the planar identifier is that the contour of the planar identifier corresponds to a quadrilateral. If the set markers are different, then the common features of the corresponding outlines will be different. When selecting a flat marker, we should try to select a marker that is easy to identify and has obvious feature points.
  • the chess piece positioning method of the present invention is applied to positioning a piece on a board provided with a square plane identifier, and specifically includes:
  • S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
  • S210 performs binary segmentation on the video image frame, and extracts a contour from the segmented binarized image
  • S221 is a quadrilateral according to a common feature of the pre-stored contour identifier corresponding to the plane identifier, and selecting a quadrilateral contour contour from the extracted contour contour as an alternative contour;
  • S232 defines a pixel coordinate of the four vertices after the candidate profile is subjected to projective transformation into a front view as pixel coordinates of four pre-existing front views of the planar marker;
  • S233 Calculate the photographic transformation matrix H according to the pixel coordinates of the vertices of the four sets of the candidate contours obtained by the above-mentioned acquired and the defined candidate contours, and obtain the photographic transformation matrix H;
  • the pixel coordinates of the vertices of the four sets of the candidate contours and the pixel coordinates of the vertices after the defined candidate contours are converted into the front view are respectively substituted into the following equations to obtain the projective transformation matrix H:
  • X is the homogeneous pixel coordinate of the candidate silhouette vertex
  • the non-homogeneous pixel coordinates are X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
  • S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
  • a square planar marker is taken as an example, and steps S231-S234 specifically explain how to obtain a front view of the extracted candidate contour.
  • steps S231-S234 specifically explain how to obtain a front view of the extracted candidate contour.
  • the square characteristics of the square plane identifier for example, we can define the pixel coordinates of the four vertices after the candidate contour is transformed into the front view by the projective transformation.
  • the four vertex pixel coordinates of the square plane identifier front view are respectively (0) , 0), (0,200), (200,200), (200,0), then the four vertex coordinates can be used as the pixel coordinates of the four vertices of the quadrilateral candidate contour, in addition, the quadrilateral candidate contour
  • the pixel coordinates of the original image can be read from the image, and the projective transformation matrix H can be obtained by using the above-described projective transformation equation.
  • the quadrilateral candidate contour region can be subjected to projective transformation, and a front view corresponding to the region of the quadrilateral candidate contour can be obtained, and then the front view and the pre-stored planar identifier template are obtained.
  • the quadrilateral contour is the outline of the planar marker, and the planar marker is recognized.
  • the front view is selected for comparison because the image of the marker photographed by the camera from various angles is different. If the camera is directly above the marker, the image of the marker is also a rectangle. If the camera is tilted, the rectangle is rectangular. The image of the marker is an irregular quadrilateral.
  • the purpose of obtaining the front view for comparison is that the front view of the planar marker is an image viewed from directly above, regardless of the angle from which the camera is viewed. Identification of objects.
  • the chess piece on the chessboard can be located according to the planar identifier combined with the pre-acquired camera internal reference matrix. As shown in Figure 5, including:
  • S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
  • S200 performs image processing on the video image frame to identify the plane identifier
  • S310 calculating, according to the plane identifier and the pre-acquired internal reference matrix of the camera, a homography matrix of a current field of view of the camera;
  • S330 identifies a piece in the video image frame, reads pixel coordinates of the piece, and acquires coordinates of the piece in the plane identifier coordinate system according to the homography matrix;
  • S340 obtains the position of the chess piece on the chessboard according to the coordinates of the chess piece and the four corner points of the chessboard in the plane identifier coordinate system, combined with the grid length feature of the chessboard.
  • step S310 calculates a homography matrix of the current field of view of the camera according to the plane identifier and the internal parameter matrix of the camera that is acquired in advance:
  • S311 selects the plane identifier coordinate system as a world coordinate system
  • (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any vertex in the plane image in the image coordinate system of the camera
  • (X, Y, Z, 1) indicates that the vertex is in the world coordinate system
  • the homogeneous coordinates in the middle are reduced to (X, Y, 0, 1)
  • s is the scale parameter of any scale introduced
  • M is the camera.
  • the internal reference matrix, r1, r2, and r3 respectively represent three column vectors in the rotation matrix of the plane identifier coordinate system with respect to the camera coordinate system
  • t is a translation vector.
  • the above can write an equation by the coordinates of a vertex pixel of the marker and the coordinates of the corresponding marker coordinate system; the four vertices of the identifier can write four equations, then four unknowns r1, r2 can be obtained.
  • R3 and t specifically, through the direct forward transform (DLT) algorithm of the equations, r1, r2, r3 and t can be obtained, that is, the homography matrix of the camera in the current field of view.
  • DLT direct forward transform
  • the next step is to determine the chessboard.
  • a reference point is set in advance on the chessboard according to the coordinates of the reference point in the plane coordinate system (ie, the world coordinate system).
  • the coordinates of the four vertices of the board in the plane coordinate system can be expressed by the value of the reference point and the length of the grid. Therefore, the board can be obtained.
  • the coordinates of the four corner points in the plane marker coordinate system that is, the position area of the checkerboard in the plane marker coordinate system.
  • the preset reference point on the board is known because the coordinates are known, and the length of the grid on the board is known.
  • the four corners of the board are obtained in the plane marker.
  • the coordinates in the coordinate system Preferably, when the reference point is set on the board, one of the four corner points is directly selected as the preset reference point, or the center point of the board, for example, the center point of the board is selected, and the center point is in the world coordinate system (equivalent The coordinates in the plane marker coordinate system are (X1, Y1).
  • the side length of the board is L
  • the coordinates of the four vertices of the board in the world coordinate system are (X1- L/2, Y1+L/2), (X1-L/2, Y1-L/2), (X1+L/2, Y1+L/2), (X1+L/2, Y1-L/ 2)
  • the coordinates of the four corner points in the plane marker coordinate system are obtained.
  • step S330 After determining the coordinate position of the board in the plane identifier coordinate system, it is also necessary to determine the coordinates of the piece in the plane identifier coordinate system.
  • the pieces in the video image frame are identified, and we can use the previous plane identifier.
  • a similar method is to binarize the video image frame and then identify the pieces from it. Specifically, the contour recognition can be performed according to the characteristics of the chess piece, for example, a black circular chess piece is selected, and the thickness of the chess piece can be neglected, then the video image frame after binarization is selected.
  • the image of the chess piece is a circular or elliptical contour
  • the contour in the binary image is judged as a piece according to the circumference, the area, the second-order center distance, and the like of the contour, and the center of the contour is the pixel coordinate of the piece.
  • the pixel coordinates of the pieces can be read directly from the video image frame.
  • the coordinates of the piece in the plane coordinate coordinate system (that is, the world coordinate system) can be obtained by using the homography matrix of the current field of view of the camera obtained before.
  • step S340 we can obtain the specific position of the piece on the board based on the previously determined pieces of the chess piece, the coordinates of the board in the plane coordinate coordinate system, and the grid length feature of the board. If the coordinates of the four corner points of the board in the plane marker have been determined, then we can select any one of the corner points as the comparison point for the calculation of the position of the board. For example, the corner point in the upper left corner is selected as the comparison point. Since the coordinates of the upper left corner vertex A as the comparison point in the plane identifier coordinate system are known, the position of the piece in the checkerboard grid can be found (ie, The first few grids). The method of obtaining is shown in Figure 6:
  • (1,1) the position of the checkerboard reference point A in the checkerboard grid is (0, 0).
  • the method further includes: S335, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, It is determined that the piece is in a quadrilateral region composed of four corner points of the board.
  • the quadrilateral region composed of the four corner points of the chess piece includes the checkerboard boundary line itself, and the chess piece is on the checkerboard boundary line and belongs to the chessboard. That is to say, if the piece is on either side of the quadrilateral composed of four corner points, it is also considered to be in the quadrilateral area (on the board). Of course, a piece outside the quadrilateral area consisting of corner points indicates that the piece is not on the board, so there is no need to further locate it.
  • FIG. 7 Another embodiment of the method of the present invention is applied to positioning a chess piece on a board provided with a planar identifier.
  • the chess piece positioning method is as shown in FIG. 7 and includes:
  • S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
  • S200 performs image processing on the video image frame to identify the plane identifier
  • S310 calculating, according to the plane identifier and the pre-acquired internal reference matrix of the camera, a homography matrix of a current field of view of the camera;
  • S325 obtaining pixel coordinates of four corner points of the checkboard according to coordinates of the four corner points of the checkerboard in the plane identifier coordinate system and a homography matrix of the current field of view of the camera;
  • S326 selecting, according to pixel coordinates of the four corner points of the checkerboard, a quadrilateral region composed of four corner points of the checkerboard as a target area in the video image frame;
  • S331 identifies a piece in a target area in the video image frame, and reads pixel coordinates of the piece;
  • S332 acquiring, according to the pixel coordinates of the piece and the homography matrix, coordinates of the piece in the coordinate system of the plane identifier;
  • S340 obtains the position of the chess piece on the chessboard according to the coordinates of the chess piece and the four corner points of the chessboard in the plane identifier coordinate system, combined with the grid length feature of the chessboard.
  • the present embodiment determines the identified target area before identifying the piece, that is, first determines the area where the board is located in the video image frame. In this way, it is only necessary to identify the pieces in the target area, and the parts outside the target area need not be identified, so that the range of the piece recognition can be reduced, and the pieces identified in the target area are definitely on the board. In this way, the workload of image processing can be reduced, the recognition range can be narrowed, and the recognition speed can be accelerated. In addition, the image outside the board can be ignored when detecting the pieces and calculating the position of the pieces, thereby increasing system robustness.
  • FIG. 6 Another embodiment of the method of the present invention is shown in Figure 6 as a schematic diagram of the system composition:
  • a specially designed checkerboard has a plane marker in the upper left corner of the board.
  • the center O1 of the plane marker is used as the origin of the entire checkerboard coordinate system.
  • Point A is the vertex of the checkerboard grid closest to the plane identifier, and the two sides of the checkerboard grid are respectively parallel to the X and Y axes of the checkerboard coordinate system.
  • the coordinates of vertex A in the checkerboard coordinate system are known as (Ax, Ay, 0), and B is the piece placed at the intersection of the checkerboard grid.
  • c.O2 is the origin of the coordinate system of the robot camera.
  • the chess piece needs to be calibrated before positioning, and the subsequent chess piece recognition is performed after the camera is calibrated, as shown in FIG. 8 , including: planar marker recognition (acquisition video stream ⁇ image binarization ⁇ quadrilateral detection ⁇ acquisition) Front view ⁇ template matching ⁇ matching success), chess piece positioning (calculation R and t ⁇ chess piece positioning).
  • planar marker recognition acquisition video stream ⁇ image binarization ⁇ quadrilateral detection ⁇ acquisition
  • Front view ⁇ template matching ⁇ matching success
  • chess piece positioning (calculation R and t ⁇ chess piece positioning).
  • the camera calibration calculates the internal parameters of the camera, determines the geometric model of the camera image, and then uses the image captured by the camera to calculate the position of the three-dimensional space.
  • the invention uses Zhang Zhengyou's plane calibration method to calculate the internal parameter matrix M of the camera.
  • the process of the plane calibration method is as follows:
  • This step is used to identify a specific planar marker in the image and determine the four corner points of the planar marker.
  • the specific process is as follows:
  • the process detects a quadrilateral contour that the planar marker in the image may correspond to.
  • the image obtained by the camera is binarized by the adaptive threshold method, and then the contour is extracted from the binary image obtained above. Polygon fitting the contours, discarding those non-convex polygons, and those that are not quadrilateral.
  • Some additional constraints are used to eliminate quadrilateral contours that are not likely to be planar marker images, such as the quadrilateral side being significantly smaller than the remaining edges (the shape is relatively elongated), the contour perimeter or area being too small.
  • the remaining eligible contours are the alternative contours that the planar markers may correspond to.
  • the process is used to change the quadrilateral image area corresponding to the planar marker into a front view, thereby further determining whether the quadrilateral region is an image corresponding to the planar marker.
  • the four vertex pixel coordinates after the quadrilateral contour is converted into a front view by projective transformation are (0, 0), (0, 100), (100, 100), (100, 0).
  • the four vertex pixel coordinates of the quadrilateral outline are known in the original image. For each set of points corresponding to the following plane projective transformation equation is established:
  • X is the homogeneous coordinate of the quadrilateral vertices in the original image
  • the non-homogeneous pixel coordinates are
  • X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
  • the simultaneous equations can be solved to solve the projective transformation matrix H, the original image All of the pixels perform a projective transformation H, and a front view corresponding to the quadrilateral contour area is obtained, and the front view is a square planar identification image.
  • the image of the marker taken by the camera from various angles is different, if the camera is directly above the marker, the image of the marker is also a rectangle; if the camera is tilted, the image of the rectangular marker is not Regular quadrilateral.
  • the purpose of obtaining the front view in this step is that no matter which angle the camera looks from, the obtained front view is an image viewed from directly above. It facilitates the subsequent identification of the marker ID, that is, the normalization of the image.
  • the front view image of the acquired plane mark is rotated by 90°, 180°, and 270° in sequence to finally obtain four images, as shown in FIG. 10 .
  • the four images obtained above are respectively matched with the image templates of the planar markers.
  • the quadrilateral contour corresponds to the planar identifier.
  • This step calculates the position of the pawn on the board relative to the marker by the above identified planar marker and its four corner points.
  • the position of the piece in the checkerboard grid is finally calculated by the coordinates of the known checkerboard vertex A.
  • the specific process is as follows:
  • the coordinate system of the plane marker is the world coordinate system, and its center O1 is the origin of the world coordinate system, and the point Z coordinate of the point on the plane where the marker is located is 0.
  • the plane marker has a side length of 80 mm, and the coordinates of its four vertices in the world coordinate system are (-40, -40, 0), (40, -40, 0), (40, 40, 0), (-40,40,0).
  • the pixel coordinates of the vertex of the plane identifier on the image and the coordinates of the vertex in the corresponding world coordinate system have the following equation:
  • (x, y, 1) indicates that any corner point in the visual positioning identifier is in the image coordinate system of the camera
  • the homogeneous coordinates of the pixel coordinates, (X, Y, Z, 1) represent the homogeneous coordinates of the corner points in the world coordinate system, that is, simplified to (X, Y, 0, 1), and s is an arbitrary introduction.
  • the scale ratio parameter, M is the internal parameter matrix of the camera, and r1, r2, and r3 respectively represent three column vectors in the rotation matrix of the visual positioning identification coordinate system with respect to the camera coordinate system, and t is a translation vector.
  • the above equation can be written by a vertex pixel coordinate of the marker and its corresponding coordinate in the marker coordinate system.
  • the four vertices of the marker can be written to correspond to the four equations, and the direct linear transformation (DLT) algorithm of the equations is used to obtain r1, r2, r3 and t.
  • DLT direct linear transformation
  • the coordinates of the checkerboard origin A in the plane identifier coordinate system O1 are known as (Ax, Ay, 0), and the side length of the checkerboard is L, and the coordinates of the other three vertices of the checkerboard in the plane identifier coordinate system are (Ax+L, Ay, 0), (Ax+L, Ay+L, 0), (Ax, Ay+L, 0).
  • the rotation matrix matrix and the translation vector of the current plane identifier coordinate system with respect to the camera coordinate system have been obtained.
  • the pixel coordinate values of the four vertices of the board can be obtained.
  • This program uses black round pieces, the thickness of the pieces is relatively thin and can be ignored.
  • the image of the chess piece is a circular or elliptical outline. According to the perimeter, the area and the second-order center distance of the contour, it is judged whether the contour in the binary image is a chess piece, and the center of the contour is the pixel coordinate of the chess piece. Verify that the piece is in the quadrilateral area of the four vertices of the board, and if so, the piece is on the board.
  • the invention only needs to place a plane marker on the plane where the chessboard is located, and the robot passes the standard
  • the object can be visually and accurately positioned on the pieces.
  • the invention does not require a special circuit implementation of the board, and no data communication is required between the board and the robot, which is more convenient to arrange.
  • the template of the planar marker is specifically designed, and the robot can accurately recognize the planar marker in a complicated scene without being disturbed by a complicated scene.
  • the present invention also discloses a machine vision-based chess piece positioning system, which is applied to position a chess piece on a chessboard provided with a planar identifier.
  • the machine-based machine The visual chess piece positioning system includes: a camera acquisition module 100, configured to acquire a video stream, and collect a video image frame from the video stream; and an image recognition module 200, configured to perform video image frames collected by the camera acquisition module 100 An image processing to identify the planar identifier in the video image frame; the positioning module 300 is configured to calculate a chess piece on the chessboard relative to the plane according to the planar identifier and the pre-acquired internal reference matrix of the camera Describe the location of the marker to position the piece.
  • the system embodiment of the present invention can be integrated into the robot so that the robot can accurately position the pieces in a complex background, so that the subsequent chess strategy can be laid out according to the position of the pieces on the board. Only let the robot understand the real chess board, increase the anthropomorphic characteristics of the robot, and let the user get a better sense of substitution, so that the user has a better interactive experience.
  • the machine vision-based chess piece positioning system further includes: a calibration module 400, configured to calibrate the camera, and acquire an internal parameter matrix of the camera.
  • Zhang Zhengyou's plane calibration method There are many methods for camera calibration. The more common one is Zhang Zhengyou's plane calibration method. For details, please refer to the description of Zhang Zhengyou's calibration method in the previous method embodiment.
  • the image recognition module 200 includes: a binary segmentation sub-module 210, configured to perform the video image frame. Binary segmentation; a shape extraction sub-module 220, configured to extract a contour from the segmented binarized image; a storage sub-module 230, configured to store a common feature of the contour corresponding to the planar marker, the plane a identifier template; a determination processing sub-module 240, configured to store according to the storage sub-module 230
  • the common feature of the contour corresponding to the planar identifier selects the contour having the common feature from the contour extracted by the shape extraction sub-module 220 as an alternative contour; the front view acquisition sub-module 250, Obtaining a front view of the candidate profile; the identification sub-module 260 is configured to identify the candidate when the front view of the candidate profile is consistent with the planar identifier template prestored by the storage sub
  • the image recognition module is described in detail. After the video image frame is acquired, the image recognition module performs image processing and recognition on the video image frame, and the binary segmentation sub-module is used to perform binarization segmentation. Processing, and then extracting the outline of the segmented image through the shape extraction sub-module, and then identifying by the image recognition module to see if it is the outline of the planar marker.
  • the image recognition module performs image processing and recognition on the video image frame, and the binary segmentation sub-module is used to perform binarization segmentation. Processing, and then extracting the outline of the segmented image through the shape extraction sub-module, and then identifying by the image recognition module to see if it is the outline of the planar marker.
  • the image recognition module performs image processing and recognition on the video image frame, and the binary segmentation sub-module is used to perform binarization segmentation. Processing, and then extracting the outline of the segmented image through the shape extraction sub-module, and then identifying by the image recognition module to see if
  • the culling is further performed by a preset constraint condition, and the outline of the planar marker is further excluded, and the subsequent comparison range is reduced.
  • the front view acquisition sub-modules are required to obtain the front view of the candidate contours, and the comparison sub-module performs the front view of the candidate contours one by one with the pre-stored template of the planar identifiers.
  • the template of the planar marker here can directly select the front view image of the planar marker. Only if the comparison is consistent, the candidate contour can be judged as the outline of the planar marker.
  • the planar identifier is a square, and the common feature of the contour corresponding to the planar identifier stored by the storage sub-module is that the contour corresponding to the planar identifier is a quadrilateral.
  • the difference in the selection of the planar markers, the difficulty of the calculations will be more or less different, but the basic ideas are the same, all need to identify the markers first, and then according to the identified markers and the previous calibration
  • the internal reference matrix of the camera is used to position the pieces. Only the selection of the planar marker directly determines the difficulty of identifying the planar marker. We generally use easy to identify, with outstanding
  • the shape of the feature point is used as a marker. For example, selecting a square as a planar marker facilitates subsequent calculation and recognition.
  • the front view obtaining submodule includes: a reading unit, configured to read pixel coordinates of four vertices of the candidate contour; and a defining unit, a pixel coordinate for defining four vertices of the candidate contour after being projectively transformed into a front view is a pixel coordinate of four pre-existing front views of the plane marker; a calculating unit for reading according to the Taking the four vertex pixel coordinates read by the unit and the four vertex pixel coordinates defined by the defining unit, the projective transformation matrix H is obtained by the following equation,
  • X is the homogeneous pixel coordinate of the candidate silhouette vertex
  • the non-homogeneous pixel coordinates are X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
  • a transforming unit configured to perform a projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H obtained by the calculating unit, to obtain a front view corresponding to the region included in the candidate contour Figure.
  • the image recognition module is further configured to perform image processing on the video image frame to identify a pawn in the video image frame.
  • the positioning module 300 includes: a homography matrix acquisition sub-module 310, configured to calculate a current field of view of the camera according to the plane identifier and an internal parameter matrix of the camera acquired in advance.
  • corner coordinate acquisition sub-module 320 for pre-setting reference based on the board Obtaining the coordinates of the four corner points of the checkerboard in the plane identifier coordinate system by combining the known coordinates in the plane identifier coordinate system and the row and column positions on the checkerboard in combination with the grid length feature of the checkerboard a piece coordinate acquisition sub-module 330, configured to read a pixel of the piece according to the piece recognized by the image recognition module 200, and acquire the piece of the piece in the plane identifier according to the homography matrix a coordinate in the coordinate system; a chess piece locating sub-module 340, configured to acquire, according to the coordinates of the four corner points of the chess piece and the checkerboard in the plane identifier coordinate system, combined with the grid length feature of the checkerboard The position of the piece on the board.
  • the homography matrix acquisition sub-module includes: a coordinate system determining unit, configured to select the plane identifier coordinate system as the world coordinate a vertex coordinate reading unit for reading pixel coordinates of four vertices of the plane identifier, and an operation unit for using the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system,
  • the pixel coordinates of the four vertices of the planar identifier and the internal parameters of the pre-obtained camera are respectively substituted into the following formula:
  • (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any corner point in the visual positioning identifier in the image coordinate system of the camera
  • (X, Y, Z, 1) indicates that the vertex is in the world coordinate system.
  • the homogeneous coordinates are reduced to (X, Y, 0, 1)
  • s is the introduced arbitrary scale proportional parameter
  • M is the camera internal reference matrix
  • r1, r2, and r3 respectively represent the rotation of the visual positioning identification coordinate system relative to the camera coordinate system.
  • Three column vectors in the matrix, t is the translation vector.
  • the corner point coordinate obtaining sub-module acquires the chessboard according to the known coordinates of the preset reference point on the checkerboard in the plane identifier coordinate system and the position of the row on the board, combined with the grid length feature of the checkerboard
  • the chess piece positioning sub-module can be obtained according to the position coordinates of the chessboard in the plane marker coordinate system (world coordinate system), the position coordinates of the chess piece in the plane marker coordinate system, and the mesh length feature of the checkerboard.
  • the position of the pieces in the checkerboard grid ie, the grid of the horizontal and vertical.
  • the positioning module 300 further includes: a determining sub-module 350, configured to coordinate the four corner points of the chess piece and the checkerboard in the plane identifier coordinate system, It is determined that the piece is in a quadrilateral region composed of four corner points of the board.
  • a determining sub-module 350 configured to coordinate the four corner points of the chess piece and the checkerboard in the plane identifier coordinate system, It is determined that the piece is in a quadrilateral region composed of four corner points of the board.
  • the judging sub-module obtains the coordinates of the four corner points of the board acquired by the sub-module in the plane identifier coordinate system and the pieces obtained by the sub-module acquisition sub-module in the plane identifier according to the corner point coordinate before the piece positioning sub-module performs positioning.
  • the coordinates in the coordinate system determine whether the piece is on the board. If it is determined that the piece is on the board, the piece positioning sub-module performs subsequent calculations to obtain the position of the piece on the board. If it is not on the board, no subsequent positioning calculations are required.
  • the positioning module 300 further includes: a target area determining sub-module 360 for using four corners of the board Obtaining a coordinate in the plane identifier coordinate system and a homography matrix of the current field of view of the camera, obtaining pixel coordinates of the four corner points of the checkerboard; and selecting a quadrilateral composed of four corner points of the checkerboard a region as a target region in the video image frame;
  • the pawn coordinate acquisition sub-module 330 includes: a pawn pixel coordinate reading unit 331 for the image recognition module 200 to identify within a target region in the video image frame After the piece is played, the pixel coordinates of the piece are read;
  • the piece coordinate calculation unit 332 is configured to acquire the piece of the piece in the coordinate system of the plane according to the pixel coordinate of the piece and the homography matrix. coordinate.
  • the target area determining sub-module is according to the four corner points of the checkboard.
  • the coordinates in the plane identifier coordinate system and the homography matrix of the current field of view of the camera Depicting pixel coordinates of four corner points of the board; and selecting a quadrilateral area composed of four corner points of the board as a target area in the video image frame; the image recognition module can narrow the image recognition range to the target area, The pieces recognized by the image recognition module in the target area are definitely on the board, which is the target piece that we need to accurately locate. When detecting the pieces and calculating the position of the pieces, the images outside the board can be ignored, thereby increasing the robustness of the system and improving the positioning efficiency.
  • system embodiment of the present invention corresponds to the method embodiment of the present invention, and the technical details of the method embodiment of the present invention are also applicable to the system embodiment of the present invention. Therefore, the system embodiment of the present invention can also refer to the method of the present invention. For the embodiments, the two can be referred to each other.
  • the invention also discloses a storage medium storing a plurality of instructions, the plurality of instructions being executed by one or more processors to implement the following steps:
  • S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
  • S200 performs image processing on the video image frame to identify the plane identifier
  • S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
  • the storage medium stores a plurality of instructions, and the plurality of instructions are executed by one or more processors to implement any of the present inventions.
  • the steps of the embodiment of the machine vision based chess piece positioning method are executed by one or more processors to implement any of the present inventions.
  • the present invention also discloses a robot, comprising: a processor for implementing each instruction; a storage medium for storing a plurality of instructions; wherein: the processor is configured to execute an instruction stored by the storage medium to implement The steps of the embodiment of the machine vision based chess piece positioning method of the present invention.
  • another embodiment of the robot of the present invention includes: a memory 1001, one or more (only one shown in the figure) processor 1002, a peripheral interface 1003, a camera module 1004, and a sound.
  • the frequency module 1005 and the touch screen 1006. communicate with one another via one or more communication buses 1007/signal lines.
  • FIG. 16 is merely illustrative and does not limit the structure of the robot.
  • the robot may also include more or less components than those shown in FIG. 16, or have different devices than those shown in FIG.
  • the components shown in FIG. 16 can be implemented in hardware, software, or a combination thereof.
  • the memory can be used to store software programs and modules, such as the machine vision-based chess piece positioning method and the program instructions/modules corresponding to the system embodiments in the embodiment of the present invention, and the processor executes by allowing software programs/modules stored in the memory.
  • software programs and modules such as the machine vision-based chess piece positioning method and the program instructions/modules corresponding to the system embodiments in the embodiment of the present invention
  • the processor executes by allowing software programs/modules stored in the memory.
  • Various functional applications and data processing that is, the above-described machine vision-based chess piece positioning method/system is implemented.
  • the memory can include high speed random access memory and can also include non-volatile memory such as one or more magnetic storage devices, flash memory or other non-volatile solid state memory.
  • the storage medium may be a magnetic disk, an optical disk, a read only memory (ROM), a random access memory (RAM), or the like.
  • the peripheral interface couples various input/output devices to the CPU level one memory.
  • the processor runs various software in the memory, commands various functions of the robot, and performs data processing.
  • the camera module is used to capture video, which is equivalent to the eyes of a robot, such as a CCD camera.
  • An audio module for receiving or transmitting a sound signal which may include one or more microphones, one or more speakers, and an audio circuit. It is convenient for the robot to capture sound signals from the environment and to communicate with people through a microphone or speaker.
  • the touch screen provides an output and input interface between the robot and the person.
  • the touch screen displays video output to a person, and the content of the video output may include text, graphics, video, and any combination thereof. Some input results are corresponding to some users decrypting the object.
  • the touch screen also receives human gestures such as clicks, slides, and the like. Specific embodiments of touch screens include, but are not limited to, liquid crystal displays or light emitting polymer displays.
  • the machine vision-based chess piece positioning method and system, the storage medium and the robot belong to the same concept, and on the robot, the instructions stored in the storage medium are executed by the processor, and the corresponding office can be operated.
  • the method provided in the embodiment of the machine-based chess piece positioning method is described in detail in the previous embodiment of the machine vision-based chess piece positioning method, and details are not described herein again.
  • a general tester in the art can understand that all or part of the process of implementing the machine vision-based piece positioning method according to the embodiment of the present invention can be completed by controlling a related hardware by a computer program.
  • Stored in a computer readable storage medium such as in a memory of the robot, and executed by at least one processor within the robot, and may include, as described, a machine vision based chess piece positioning method embodiment Process.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

A chess piece positioning method based on machine vision, used for positioning chess pieces on a chess board provided with flat markers, the method comprising: acquiring a video stream by means of a camera and collecting video image frames from the video stream (S100); performing image processing on the video image frames to identify flat markers (S200); and, on the basis of the flat markers and a pre-acquired internal reference matrix of the camera, calculating the position of a chess piece on the chess board relative to the markers, and thereby locating the position of the chess piece (S300). Also provided are a chess piece positioning system based on machine vision, a storage medium, and a robot. The system using the chess piece positioning method can be implemented without the need for a special circuit in the chess board, and there is also no need for data communication between the chessboard and the robot, so that arrangement is more convenient. The arrangement of the flat markers enables the robot to accurately identify the flat markers in a complex scene without suffering interference from the complex scene.

Description

基于机器视觉的棋子定位方法、系统、存储介质及机器人Chess positioning method, system, storage medium and robot based on machine vision
本申请要求2017年10月25日提交的申请号为:201711006222.4、发明名称为“基于机器视觉的棋子定位方法、系统、存储介质及机器人”的中国专利申请的优先权,其全部内容合并在此。The present application claims priority to Chinese Patent Application No. 201711006222.4, entitled "Machine Vision-Based Chess Positioning Method, System, Storage Medium, and Robot", the entire contents of which are incorporated herein by reference. .
技术领域Technical field
本发明涉及机器人领域,尤其涉及基于机器视觉的棋子定位方法、系统、存储介质及机器人。The invention relates to the field of robots, in particular to a machine vision based chess piece positioning method, system, storage medium and robot.
背景技术Background technique
在机器人技术越来越普及的今天,人们希望与机器人进行像真人一样的交互,感受人工智能的强大。如今下棋成了一种与机器人很重要的交互活动。虽然在有些机器人的交互屏幕上也能进行下棋,但是该种方式缺乏吸引力,用户感受不到是在和机器人下棋。所以,为了营造一种更好的人机交互体验,需要让机器人理解真实存在的棋盘,并和现实中真人一样进行下棋。这样能够使用户获得更好的带入感,增加机器人的拟人化特征,使用户得到更好的交互体验。机器人像人一样下棋,需要识别棋盘上棋子的准确位置。Today, with the increasing popularity of robotics, people want to interact with robots like real people and feel the power of artificial intelligence. Playing chess now becomes an important interaction with robots. Although it is possible to play chess on the interactive screen of some robots, this method is not attractive, and the user does not feel that he is playing chess with the robot. Therefore, in order to create a better human-computer interaction experience, it is necessary to let the robot understand the real chess board and play chess in the same way as real people. This can enable the user to get a better sense of bringing in, increase the anthropomorphic characteristics of the robot, and enable the user to have a better interactive experience. The robot plays chess like a human and needs to recognize the exact position of the pieces on the board.
申请号为201310554765.5及201621069461.5,201310159264.7的发明专利都公开了一种实物棋盘人机对弈系统。该类型发明都是采用特制的物理棋盘,通过相应的传感器感应棋子相对棋盘的位置,然后将棋子位置信息发送给机器人装置。该发明能够准确获得棋子在特定棋盘上的准确位置。The invention patents of the application Nos. 201310554765.5 and 201621069461.5, 201310159264.7 all disclose a physical chessboard man-machine game system. This type of invention uses a special physical chessboard to sense the position of the chess piece relative to the board through the corresponding sensor, and then sends the piece position information to the robot device. The invention is capable of accurately obtaining the exact position of the piece on a particular board.
但是,该方案需要特定的棋盘硬件电路进行实现,且棋盘与机器人需要进行数据通信,实现起来比较复杂,且现场布置及调试安装比较繁琐。However, the scheme requires a specific chessboard hardware circuit to be implemented, and the chessboard and the robot need to perform data communication, which is complicated to implement, and the site layout and debugging installation are relatively cumbersome.
申请号为201610967421.0公开了一种基于图像的象棋棋子定位及识别方法,该发明能够定位出象棋棋子相对于棋盘的位置。Application No. 201610967421.0 discloses an image-based chess piece positioning and recognition method capable of locating the position of a chess piece relative to a chessboard.
但是,该发明是通过阈值法对图像二值化,然后检测棋盘的边界进行 定位棋子。当图像有复杂的背景,这种边界提取方法非常的不稳定,很难正确分割出真正的棋盘边界。图像中的一些具有矩形边界的物体如板凳面等,很容易被误认为是棋盘。However, the invention is to binarize the image by the threshold method and then detect the boundary of the board. Position the pieces. When the image has a complex background, this boundary extraction method is very unstable, and it is difficult to correctly segment the true checkerboard boundary. Some objects in the image with rectangular boundaries, such as the bench surface, are easily mistaken for the board.
发明内容Summary of the invention
针对上述现有技术的不足,本发明提供一种基于机器视觉的棋子定位方法及系统、存储介质和机器人,用以准确定位棋盘上的棋子的具体位置。In view of the above deficiencies of the prior art, the present invention provides a machine vision based chess piece positioning method and system, a storage medium and a robot for accurately locating a specific position of a chess piece on a chessboard.
第一方面,本发明公开了一种基于机器视觉的棋子定位方法,应用于对设有平面标识物的棋盘上的棋子进行定位,所述棋子定位方法包括:In a first aspect, the invention discloses a machine vision-based chess piece positioning method, which is applied to positioning a chess piece on a chessboard provided with a planar identifier, the chess piece positioning method comprising:
S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
S200对所述视频图像帧进行图像处理,识别所述平面标识物;S200 performs image processing on the video image frame to identify the plane identifier;
S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
本方案是通过在棋盘上设置一个平面标识物,然后通过机器视觉识别该平面标识物后进一步定位棋子。该方案不需要在棋盘底部设置电路,因此不需要复杂的布置。且由于平面标识物的设立,使得即使在复杂的背景下准确的识别定位出棋子的位置。The solution is to further position the piece by setting a plane marker on the board and then visually recognizing the plane marker by machine vision. This solution does not require the placement of circuitry at the bottom of the board, so no complicated arrangements are required. And because of the establishment of the planar marker, the position of the pawn is accurately identified even in a complicated background.
优选的,在所述步骤S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧之前还包括:Preferably, before the capturing of the video stream by the camera in the step S100, and before acquiring the video image frame from the video stream, the method further includes:
S010对所述摄像头进行标定,获取所述摄像头的内参矩阵。S010 calibrates the camera to obtain an internal reference matrix of the camera.
在对棋子进行定位之前,需要做的一个准备工作便是需要对摄像头进行标定。摄像机标定即计算摄像机内部参数,即确定摄像机成像的几何模型,从而后期利用射线几所拍摄到的图像来进行三维空间位置的计算。Before you can position the pieces, one of the preparations you need to do is to calibrate the camera. The camera calibration calculates the internal parameters of the camera, that is, determines the geometric model of the camera imaging, so that the images captured by the ray are used later to calculate the three-dimensional position.
优选的,所述步骤S200对所述视频图像帧进行图像处理,识别所述平面标识物具体为:Preferably, the step S200 performs image processing on the video image frame, and the identifying the planar identifier is specifically:
S210对所述视频图像帧进行二值分割,并从分割后的二值化图像中提取外形轮廓;S210 performs binary segmentation on the video image frame, and extracts a contour from the segmented binarized image;
S220根据预存的所述平面标识物所对应的外形轮廓的共性特征,从提取的外形轮廓中选取具有所述共性特征的外形轮廓作为备选轮廓; S220: selecting, according to a common feature of the pre-stored contour identifiers of the plane identifiers, an outline contour having the common features as an alternative contour from the extracted contour contours;
S230获取所述备选轮廓的正视图;S230 acquires a front view of the candidate contour;
S240当所述备选轮廓的正视图与预存的所述平面标识物模板一致时,识别所述备选轮廓对应的图像为所述平面标识物的图像。S240: When the front view of the candidate contour is consistent with the pre-stored planar identifier template, the image corresponding to the candidate contour is identified as an image of the planar identifier.
本方案中对视频图像帧进行处理,对视频图像帧进行二值分割,并从分割后的图像中提取外形轮廓。采用二值化的处理方法,方便提取图像中的信息,二值图像在进行计算机识别时可以增加识别效率。此外,二值化可以简单且迅速处理图像特征,简化后期的处理,提高处理的速度。在二值化的图像上再分割图像,把图像中具有特殊涵义的不同区域分开来,这些区域是互不相交的,每个区域都满足特定区域的一致性。然后再对分割的图像进行轮廓提取与识别,这样可以降低识别的难度,加快识别效率。In this solution, the video image frame is processed, the video image frame is binary-divided, and the contour is extracted from the segmented image. The binarization processing method is adopted to facilitate the extraction of information in the image, and the binary image can increase the recognition efficiency when performing computer recognition. In addition, binarization can easily and quickly process image features, simplify post processing, and increase processing speed. The image is subdivided on the binarized image, and the different regions of the image have special meanings. These regions are mutually disjoint, and each region satisfies the consistency of a particular region. Then, the contour image is extracted and recognized, which can reduce the difficulty of recognition and speed up the recognition efficiency.
优选的,所述平面标识物为正方形,上述步骤S220中预存的所述平面标识物所对应的外形轮廓的共性特征为四边形。Preferably, the planar identifier is a square, and the common feature of the outline corresponding to the planar identifier pre-stored in the above step S220 is a quadrilateral.
设置的标识物不同,那么对应的外形轮廓的共性特征也会不同。我们在选取平面标识物时尽量选取易于辨识的,特征点比较明显的标识物为佳。比如正方形,具有四个顶点,且四个边长相等,这可以方便后面的计算。选取正方形标识物作为平面标识物,那么其对应的外形轮廓共性特征是四边形。选取了正方形平面标识物后,所述步骤S230获取所述备选轮廓的正视图具体为:If the set markers are different, then the common features of the corresponding outlines will be different. When selecting a flat marker, we should try to select a marker that is easy to identify and has obvious feature points. For example, a square with four vertices and four sides are equal in length, which is convenient for later calculations. When the square identifier is selected as the planar identifier, the corresponding contour common feature is a quadrilateral. After the square plane identifier is selected, the step S230 obtains a front view of the candidate contour, which is specifically:
S231读取所述备选轮廓的四个顶点的像素坐标;S231 reading pixel coordinates of four vertices of the candidate contour;
S232定义所述备选轮廓经过射影变换为正视图后的四个顶点的像素坐标为预存的所述平面标志物的正视图的四个顶点的像素坐标;S232 defines a pixel coordinate of the four vertices after the candidate profile is subjected to projective transformation into a front view as pixel coordinates of four pre-existing front views of the planar marker;
S233将上述获取的四组所述备选轮廓的顶点的像素坐标及所述定义的备选轮廓转换为正视图后的顶点的像素坐标分别代入下述方程,求取射影变换矩阵H:S233, the pixel coordinates of the vertices of the four sets of the candidate contours obtained by the above-mentioned acquired candidate contours and the pixel coordinates of the vertices after the definition of the candidate contour are converted into the following equations, and the projection transformation matrix H is obtained:
Figure PCTCN2017112210-appb-000001
Figure PCTCN2017112210-appb-000001
其中,X为备选轮廓顶点的齐次像素坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000002
Figure PCTCN2017112210-appb-000003
X'为射影变换后顶点的齐次坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000004
Where X is the homogeneous pixel coordinate of the candidate silhouette vertex, and the non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000002
Figure PCTCN2017112210-appb-000003
X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000004
S234根据所述射影变换矩阵H,对所述备选轮廓对应的二值化图像的所有像素都执行射影变换,获得所述备选轮廓包含的区域对应的正视图。S234 performs projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H, and obtains a front view corresponding to the region included in the candidate contour.
本方案是基于选取正方形平面标识物而言的,正方形平面标识物对应的外形轮廓一定是四边形,而四边形有四个顶点,因此,可以利用这四个顶点的像素坐标及定义的该四边形正视图的像素坐标进行运算,获得射影变换矩阵H,从而使得四边形轮廓内的所有像素都进行射影变换,获得其对应的正视图,便于后续比较。The solution is based on the selection of a square planar identifier. The contour of the square planar identifier must be a quadrilateral, and the quadrilateral has four vertices. Therefore, the pixel coordinates of the four vertices and the defined quadrilateral front view can be utilized. The pixel coordinates are calculated to obtain the projective transformation matrix H, so that all pixels in the quadrilateral contour are subjected to projective transformation to obtain a corresponding front view for subsequent comparison.
优选的,所述步骤S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置具体为:Preferably, the step S300 calculates the position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, so that the position of the piece is specifically:
S310根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵;S310: calculating, according to the plane identifier and the pre-acquired internal reference matrix of the camera, a homography matrix of a current field of view of the camera;
S320根据棋盘上预设参考点在平面标识物坐标系中的已知坐标及在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在所述平面标识物坐标系中的坐标;S320: according to the known coordinates of the preset reference point on the checkerboard in the plane identifier coordinate system and the rank position on the checkerboard, combined with the grid length feature of the checkerboard, acquiring the four corner points of the checkerboard in the plane The coordinates in the marker coordinate system;
S330识别所述视频图像帧中的棋子,读取所述棋子的像素坐标,并根据所述单应性矩阵获取所述棋子在所述平面标识物坐标系中的坐标;S330 identifies a piece in the video image frame, reads pixel coordinates of the piece, and acquires coordinates of the piece in the plane identifier coordinate system according to the homography matrix;
S340根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,结合所述棋盘的网格长度特征,获取所述棋子在棋盘上的位置。S340 obtains the position of the chess piece on the chessboard according to the coordinates of the chess piece and the four corner points of the chessboard in the plane identifier coordinate system, combined with the grid length feature of the chessboard.
平面标识物被识别出来后,便可根据该平面标识物及摄像头的内参矩阵来定位棋子了,其中,最重要的便是根据该平面标识物和摄像头的内参矩阵获取摄像头当前视场的单应性矩阵。获得了单应性矩阵后,再确定棋盘、棋子在平面标识物坐标系中的位置,最后结合棋盘网格长度特征便可计算出棋子在棋盘上的位置了。其中,本方案中步骤S330中识别所述视频图像帧中的棋子,棋子 的识别可根据预先提取棋子的特征来进行识别,与前面的平面标识物识别较为类似,对视频图像帧进行图像处理识别,这里不再细叙。本方案计算简单,可实施性强。After the planar marker is identified, the chess piece can be positioned according to the planar identifier and the internal reference matrix of the camera. The most important thing is to obtain the current field of view of the camera according to the planar identifier and the internal reference matrix of the camera. Sexual matrix. After obtaining the homography matrix, the position of the chessboard and the chess piece in the plane coordinate coordinate system is determined. Finally, the position of the chess piece on the chessboard can be calculated by combining the length characteristics of the checkerboard mesh. Wherein, the chess piece in the video image frame is identified in step S330 in the solution, the chess piece The recognition can be performed according to the feature of the pre-extracted chess piece, which is similar to the previous planar marker recognition, and the image processing frame is subjected to image processing and recognition, which will not be described here. The scheme is simple in calculation and strong in implementation.
优选的,所述步骤S310根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵具体为:Preferably, the step S310 calculates the homography matrix of the current field of view of the camera according to the plane identifier and the internal parameter matrix of the camera obtained in advance:
S311选取所述平面标识物坐标系为世界坐标系;S311 selects the plane identifier coordinate system as a world coordinate system;
S312读取所述平面标识物的四个顶点的像素坐标;S312 reading pixel coordinates of four vertices of the planar identifier;
S313将已知的所述平面标识物的四个顶点在世界坐标系的坐标、所述平面标识物的四个顶点的像素坐标,及所述预先获取的所述摄像头的内部参数分别代入下述公式:S313 substituting the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system, the pixel coordinates of the four vertices of the planar identifier, and the internal parameters of the camera obtained in advance into the following formula:
Figure PCTCN2017112210-appb-000005
Figure PCTCN2017112210-appb-000005
计算出当前视场的单应性矩阵H=M[r1,r2,r3,t];Calculate the homography matrix H=M[r1,r2,r3,t] of the current field of view;
其中,(x,y,1)表示所述平面标识物中任一顶点在摄像机的图像坐标系中像素坐标的齐次坐标,(X,Y,Z,1)表示所述顶点在世界坐标系中的齐次坐标,简化为(X,Y,0,1),s为引入的任意尺度比例参数,M为摄像机内参矩阵,r1、r2、r3分别表示所述平面标识物坐标系相对于摄像机坐标系的旋转矩阵中的三个列向量,t为平移向量。Where (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any vertex in the plane image in the image coordinate system of the camera, and (X, Y, Z, 1) indicates that the vertex is in the world coordinate system The homogeneous coordinates in the middle are reduced to (X, Y, 0, 1), s is the introduced arbitrary scale proportional parameter, M is the camera internal reference matrix, and r1, r2, r3 respectively represent the planar marker coordinate system relative to the camera. Three column vectors in the rotation matrix of the coordinate system, t is the translation vector.
本方案具体阐述了摄像头当前视场的单应性矩阵。这个单应性矩阵便是平面标识物坐标系相对于摄像头坐标系的旋转矩阵R及平移向量t。由于图像上平面标识物顶点的像素坐标与对应的世界坐标系中顶点的坐标存在下述公式:This scheme specifies the homography matrix of the current field of view of the camera. This homography matrix is the rotation matrix R and the translation vector t of the planar marker coordinate system with respect to the camera coordinate system. The following formula exists because the pixel coordinates of the vertex of the planar identifier on the image and the coordinates of the vertex in the corresponding world coordinate system:
Figure PCTCN2017112210-appb-000006
Figure PCTCN2017112210-appb-000006
以上通过标识物一个顶点像素坐标及其对应的标识物坐标系中坐标便可 获得一个方程,标识物对应了四个顶点,便可对应写出四个对应的方程,然后通过方程组求解出单应性矩阵中r1,r2,r3,t。The above passes the identifier of a vertex pixel coordinate and its corresponding coordinate in the coordinate system of the marker. Obtain an equation, the identifier corresponds to four vertices, then you can write four corresponding equations correspondingly, and then solve the r1, r2, r3, t in the homography matrix through the equations.
优选的,在所述步骤S330之后、所述步骤S340之前,还包括:Preferably, after the step S330 and before the step S340, the method further includes:
S335根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,确定所述棋子处于所述棋盘的四个角点组成的四边形区域内。S335 determines, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, that the pieces are in a quadrilateral area composed of four corner points of the board.
本方案中,经过了前面的步骤S320便可以确定出棋盘的四个角点在平面标识物坐标系中的坐标,而这四个角点组成的四边形区域为棋盘区域,经过步骤S330则可以确定识别出的棋子在平面坐标系中的坐标,因此,步骤S335则是确定识别出的棋子处于棋盘上了。因为只有处于棋盘上的棋子才需要后面进一步在棋盘上的定位,如果不处于棋盘上则可以选择不用去管,这样可以减少棋子定位的工作量,也便于后续棋子在棋盘上的位置计算。In this solution, after the previous step S320, the coordinates of the four corner points of the checkerboard in the plane identifier coordinate system can be determined, and the quadrilateral area composed of the four corner points is the checkerboard area, which can be determined through step S330. The coordinates of the identified pieces in the plane coordinate system are determined. Therefore, step S335 is to determine that the identified pieces are on the board. Because only the pieces on the board need to be further positioned on the board, if they are not on the board, they can choose not to go to the tube, which can reduce the workload of the positioning of the pieces, and also facilitate the calculation of the position of the subsequent pieces on the board.
优选的,在所述步骤S320之后、所述步骤S330之前,还包括:Preferably, after the step S320 and before the step S330, the method further includes:
S325根据所述棋盘的四个角点在所述平面标识物坐标系中的坐标、及所述摄像头当前视场的单应性矩阵,获得所述棋盘四个角点的像素坐标;S325: obtaining pixel coordinates of four corner points of the checkboard according to coordinates of the four corner points of the checkerboard in the plane identifier coordinate system and a homography matrix of the current field of view of the camera;
S326根据所述棋盘四个角点的像素坐标,选取所述棋盘四个角点组成的四边形区域作为所述视频图像帧中的目标区域;S326: selecting, according to pixel coordinates of the four corner points of the checkerboard, a quadrilateral region composed of four corner points of the checkerboard as a target area in the video image frame;
所述步骤S330识别所述视频图像帧中的棋子,并读取所述棋子的像素坐标,并根据所述单应性矩阵获取所述棋子在所述平面标识物坐标系中的坐标具体为:The step S330 identifies the pieces in the video image frame, and reads the pixel coordinates of the piece, and acquires the coordinates of the piece in the plane identifier coordinate system according to the homography matrix:
S331在所述视频图像帧中的目标区域内识别棋子,并读取所述棋子的像素坐标;S331 identifies a piece in a target area in the video image frame, and reads pixel coordinates of the piece;
S332根据所述棋子的像素坐标及所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标。S332: Acquire coordinates of the chess piece in the plane identifier coordinate system according to the pixel coordinates of the chess piece and the homography matrix.
本方案中,通过获取棋盘四个角点的像素坐标,确定了棋盘在视频图像帧中的位置区域,这个四个角点组成的位置区域作为目标区域,而在视频图像帧 中,只有在目标区域内的棋子才是需要定位的棋盘上的棋子,而不在目标区域内的图像,我们都可以不用去识别,也就是说只识别目标区域内的棋子,这样大大减小了计算量,加快了棋子定位的速度。In this solution, by obtaining the pixel coordinates of the four corner points of the board, the position area of the board in the video image frame is determined, and the position area composed of the four corner points is used as the target area, and in the video image frame. Among them, only the pieces in the target area are the pieces on the board that need to be positioned, and the images in the target area, we can not identify them, that is, only identify the pieces in the target area, which greatly reduces the number of pieces. The amount of calculation speeds up the positioning of the pieces.
第二方面,本发明还公开了一种基于机器视觉的棋子定位系统,应用于对设有平面标识物的棋盘上的棋子进行定位,所述基于机器视觉的棋子定位系统包括:摄像采集模块,用于获取视频流,并从所述视频流中采集视频图像帧;图像识别模块,用于对所述摄像采集模块采集的视频图像帧进行图像处理,从而在所述视频图像帧中识别出所述平面标识物;定位模块,用于根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。In a second aspect, the invention also discloses a machine vision-based chess piece positioning system, which is applied to positioning a chess piece on a chessboard provided with a plane identifier, the machine vision-based chess piece positioning system comprising: a camera acquisition module, For acquiring a video stream, and collecting a video image frame from the video stream; and an image recognition module, configured to perform image processing on the video image frame collected by the camera acquisition module, thereby identifying the image in the video image frame a plane identifier; a positioning module, configured to calculate a position of the piece on the board relative to the identifier according to the plane identifier and an internal parameter matrix of the camera acquired in advance, thereby locating the position of the piece.
优选的,所述基于机器视觉的棋子定位系统还包括:标定模块,用于对所述摄像头进行标定,获取所述摄像头的内参矩阵。Preferably, the machine vision-based piece positioning system further comprises: a calibration module, configured to calibrate the camera to obtain an internal parameter matrix of the camera.
优选的,所述图像识别模块包括:二值分割子模块,用于对所述视频图像帧进行二值分割;外形提取子模块,用于从分割后的二值化图像中提取外形轮廓;存储子模块,用于存储所述平面标志物所对应的外形轮廓的共性特征、所述平面标识物模板;判断处理子模块,用于根据所述存储子模块中存储的所述平面标识物所对应的外形轮廓的共性特征,从所述外形提取子模块提取的外形轮廓中选取具有所述共性特征的外形轮廓作为备选轮廓;正视图获取子模块,用于获取所述备选轮廓的正视图;识别子模块,用于当所述备选轮廓的正视图与所述存储子模块预存的所述平面标识物模板一致时,识别所述备选轮廓对应的图像为所述平面标识物的图像。Preferably, the image recognition module includes: a binary segmentation sub-module for performing binary segmentation on the video image frame; and a shape extraction sub-module for extracting a contour from the segmented binarized image; storing a sub-module, configured to store a common feature of the outer shape corresponding to the planar marker, the planar identifier template, and a determining processing sub-module, configured to correspond to the planar identifier stored in the storage sub-module a common feature of the outline of the profile, selecting a profile having the common feature as an alternative profile from the profile extracted by the profile extraction sub-module; a front view acquisition sub-module for obtaining a front view of the candidate profile An identification sub-module, configured to identify an image corresponding to the candidate contour as an image of the planar identifier when a front view of the candidate contour is consistent with the planar identifier template prestored by the storage sub-module .
优选的,所述平面标识物为正方形,所述存储子模块存储的所述平面标识物所对应的外形轮廓的共性特征为四边形;所述正视图获取子模块包括:读取单元,用于读取所述备选轮廓的四个顶点的像素坐标;定义单元,用于定义所述备选轮廓经过射影变换为正视图后的四个顶点的像素坐标为预存的所述平 面标志物的正视图的四个顶点的像素坐标;计算单元,用于根据所述读取单元读取的四个顶点像素坐标及所述定义单元定义的四个顶点像素坐标,通过下述方程,求取射影变换矩阵H,Preferably, the planar identifier is a square, and the common feature of the outline corresponding to the planar identifier stored by the storage sub-module is a quadrilateral; the front view obtaining sub-module includes: a reading unit for reading Taking pixel coordinates of four vertices of the candidate contour; defining a unit for defining pixel coordinates of the four vertices after the candidate contour is subjected to projective transformation into a front view as pre-stored a pixel coordinate of four vertices of a front view of the face marker; a calculation unit for calculating four vertex pixel coordinates read by the reading unit and four vertex pixel coordinates defined by the defining unit, by using the following equation , to obtain the projective transformation matrix H,
Figure PCTCN2017112210-appb-000007
Figure PCTCN2017112210-appb-000007
其中,X为备选轮廓顶点的齐次像素坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000008
Figure PCTCN2017112210-appb-000009
X'为射影变换后顶点的齐次坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000010
Where X is the homogeneous pixel coordinate of the candidate silhouette vertex, and the non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000008
Figure PCTCN2017112210-appb-000009
X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000010
变换单元,用于根据所述计算单元求取的射影变换矩阵H,对所述备选轮廓对应的二值化图像的所有像素都执行射影变换,获得所述备选轮廓包含的区域对应的正视图。a transforming unit, configured to perform a projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H obtained by the calculating unit, to obtain a front view corresponding to the region included in the candidate contour Figure.
优选的,所述图像识别模块,还用于对所述视频图像帧进行图像处理,从而在所述视频图像帧中识别出棋子;所述定位模块包括:单应性矩阵获取子模块,用于根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵;角点坐标获取子模块,用于根据棋盘上预设参考点在平面标识物坐标系中的已知坐标及在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在所述平面标识物坐标系中的坐标;棋子坐标获取子模块,用于根据所述图像识别模块识别出的棋子,读取所述棋子的像素坐标,并根据所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标;棋子定位子模块,用于根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,结合所述棋盘的网格长度特征,获取所述棋子在棋盘上的位置。Preferably, the image recognition module is further configured to perform image processing on the video image frame to identify a pawn in the video image frame; the positioning module includes: a homography matrix acquisition submodule, configured to: Calculating a homography matrix of a current field of view of the camera according to the plane identifier and an internal parameter matrix of the camera obtained in advance; a corner point coordinate obtaining sub-module for using a plane reference object according to a preset reference point on the chessboard The known coordinates in the coordinate system and the position of the row and the row on the board, combined with the grid length feature of the board, acquire coordinates of the four corner points of the board in the plane identifier coordinate system; the chess piece coordinate acquisition a module, configured to read a pixel of the piece according to the piece recognized by the image recognition module, and acquire coordinates of the piece in the coordinate system of the plane identifier according to the homography matrix; a positioning sub-module for combining the coordinates of the four corner points of the chess piece and the checkerboard in the plane identifier coordinate system with the grid length feature of the checkerboard, Taking the position of the pieces on the board.
优选的,所述单应性矩阵获取子模块包括:坐标系确定单元,用于选取所述平面标识物坐标系为世界坐标系;顶点坐标读取单元,用于读取所述平面标 识物的四个顶点的像素坐标;运算单元,用于将已知的所述平面标识物的四个顶点在世界坐标系的坐标、所述平面标识物的四个顶点的像素坐标,及所述预先获取的所述摄像头的内部参数分别代入下述公式:Preferably, the homography matrix acquisition sub-module includes: a coordinate system determining unit, configured to select the plane identifier coordinate system as a world coordinate system; and a vertex coordinate reading unit, configured to read the plane label a pixel coordinate of the four vertices of the object; an operation unit for using the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system, the pixel coordinates of the four vertices of the planar identifier, and The internal parameters of the camera obtained in advance are substituted into the following formulas:
Figure PCTCN2017112210-appb-000011
Figure PCTCN2017112210-appb-000011
计算出当前视场的单应性矩阵H=M[r1,r2,r3,t];Calculate the homography matrix H=M[r1,r2,r3,t] of the current field of view;
其中,(x,y,1)表示视觉定位标识中任一角点在摄像机的图像坐标系中像素坐标的齐次坐标,(X,Y,Z,1)表示所述顶点在世界坐标系中的齐次坐标,简化为(X,Y,0,1),s为引入的任意尺度比例参数,M为摄像机内参矩阵,r1、r2、r3分别表示视觉定位标识坐标系相对于摄像机坐标系的旋转矩阵中的三个列向量,t为平移向量。Where (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any corner point in the visual positioning identifier in the image coordinate system of the camera, and (X, Y, Z, 1) indicates that the vertex is in the world coordinate system. The homogeneous coordinates are reduced to (X, Y, 0, 1), s is the introduced arbitrary scale proportional parameter, M is the camera internal reference matrix, and r1, r2, and r3 respectively represent the rotation of the visual positioning identification coordinate system relative to the camera coordinate system. Three column vectors in the matrix, t is the translation vector.
优选的,所述定位模块还包括:判断子模块,用于根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,确定所述棋子处于所述棋盘的四个角点组成的四边形区域内。Preferably, the positioning module further includes: a determining submodule, configured to determine, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, that the piece is on the board Inside the quadrilateral area consisting of four corner points.
优选的,所述定位模块还包括:目标区域确定子模块,用于根据所述棋盘的四个角点在所述平面标识物坐标系中的坐标、及所述摄像头当前视场的单应性矩阵,获得所述棋盘四个角点的像素坐标;并选取所述棋盘四个角点组成的四边形区域作为所述视频图像帧中的目标区域;所述棋子坐标获取子模块包括:棋子像素坐标读取单元,用于所述图像识别模块在所述视频图像帧中的目标区域内识别出棋子后,读取所述棋子的像素坐标;棋子坐标计算单元,用于根据所述棋子的像素坐标及所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标。Preferably, the positioning module further includes: a target area determining sub-module, configured to: coordinate according to the four corner points of the checkerboard in the plane identifier coordinate system, and homography of the current field of view of the camera a matrix, obtaining pixel coordinates of the four corner points of the checkerboard; and selecting a quadrilateral region composed of four corner points of the checkerboard as a target area in the video image frame; the chess piece coordinate acquisition sub-module includes: a chess piece pixel coordinate a reading unit, configured to: after the image recognition module recognizes a piece in the target area in the video image frame, read pixel coordinates of the piece; the piece coordinate calculation unit is configured to perform pixel coordinates according to the piece And the homography matrix, acquiring coordinates of the chess piece in the plane identifier coordinate system.
第三方面,本发明还公开了一种存储介质,所述存储介质存储有多条指令,所述多条指令被一个或者多个处理器执行,以实现本发明所述的基于机器视觉的棋子定位方法的步骤。 In a third aspect, the present invention also discloses a storage medium storing a plurality of instructions executed by one or more processors to implement the machine vision-based pieces of the present invention. The steps of the positioning method.
本方案中的存储介质可用于存储软件程序及模块,比如本发明的基于机器视觉的棋子定位方法及系统对应的程序指令/模块。这些程序指令/模块可被处理器执行,实现上述的基于机器视觉的棋子定位方法/装置。The storage medium in the solution can be used to store software programs and modules, such as the machine vision based chess piece positioning method of the present invention and the program instructions/modules corresponding to the system. These program instructions/modules can be executed by the processor to implement the machine vision based piece positioning method/device described above.
第四方面,本发明还公开了一种机器人,包括:处理器,用于实现各指令;存储介质,用于存储多条指令;其中:所述处理器用于执行所述存储介质存储的指令,以实现本发明所述的基于机器视觉的棋子定位方法的步骤。In a fourth aspect, the present invention further discloses a robot, comprising: a processor, configured to implement each instruction; a storage medium, configured to store a plurality of instructions; wherein: the processor is configured to execute an instruction stored by the storage medium, The steps of implementing the machine vision based piece positioning method of the present invention.
本方案中,机器人中的处理器执行设置在机器人中的本发明的存储介质中存储的指令,实现本发明的基于机器视觉的棋子定位方法。本发明的机器人可以通过机器视觉定位棋子的位置,便于后续模拟真人下棋,增强了用户的交互体验。In the present solution, the processor in the robot executes the instructions stored in the storage medium of the present invention provided in the robot to implement the machine vision-based piece positioning method of the present invention. The robot of the invention can position the pieces by machine vision, facilitates subsequent simulation of real people playing chess, and enhances the user's interactive experience.
本发明仅仅需要在棋盘所处平面上放置一个平面标志物,通过该标志物即可对棋子进行视觉精确定位。本发明不需要棋盘进行特别的电路实现,且棋盘与机器人之间不需要进行数据通信,更加便于布置。此外,由于平面标识物的标识性,即使在复杂场景中能够准确的识别出该平面标志物,不会受到复杂场景的干扰。The invention only needs to place a plane marker on the plane where the chessboard is located, by which the chess piece can be visually and accurately positioned. The invention does not require a special circuit implementation of the board, and no data communication is required between the board and the robot, which is more convenient to arrange. In addition, due to the identification of the planar marker, even if the planar marker can be accurately identified in a complicated scene, it will not be interfered by complicated scenes.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention, Those skilled in the art can also obtain other drawings based on these drawings without paying for inventive labor.
图1为本发明基于机器视觉的棋子定位方法实施例的流程图;1 is a flow chart of an embodiment of a machine vision based chess piece positioning method according to the present invention;
图2为张正友平面标定方法的原理示意图;2 is a schematic diagram of the principle of Zhang Zhengyou's plane calibration method;
图3为本发明基于机器视觉的棋子定位方法另一实施例的流程图;3 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention;
图4为本发明基于机器视觉的棋子定位方法另一实施例的流程图;4 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention;
图5为本发明基于机器视觉的棋子定位方法另一实施例的流程图; 5 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention;
图6为本发明基于机器视觉的棋子定位方法另一实施例中系统组成示意图;6 is a schematic diagram of a system composition of another embodiment of a chess piece positioning method based on machine vision according to the present invention;
图7为本发明基于机器视觉的棋子定位方法另一实施例的流程图;7 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention;
图8为本发明基于机器视觉的棋子定位方法另一实施例的流程图;8 is a flow chart of another embodiment of a machine vision based chess piece positioning method according to the present invention;
图9a为张正友平面标定方法的标定模板示意图;Figure 9a is a schematic diagram of a calibration template of Zhang Zhengyou's plane calibration method;
图9b为张正友平面标定方法中检测特征点示意图;Figure 9b is a schematic diagram of the detection feature points in the Zhang Zhengyou plane calibration method;
图10为本发明基于机器视觉的棋子定位方法另一实施例中旋转后的四边形轮廓正视图;10 is a front view of a quadrilateral contour after rotation in another embodiment of a machine vision based chess piece positioning method according to the present invention;
图11为本发明基于机器视觉的棋子定位系统另一实施例的框图;11 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention;
图12为本发明基于机器视觉的棋子定位系统另一实施例的框图;12 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention;
图13为本发明基于机器视觉的棋子定位系统另一实施例的框图;13 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention;
图14为本发明基于机器视觉的棋子定位系统另一实施例的框图;14 is a block diagram of another embodiment of a machine vision based chess piece positioning system according to the present invention;
图15为本发明基于机器视觉的棋子定位系统另一实施例的框图;15 is a block diagram of another embodiment of a machine vision based chess piece positioning system of the present invention;
图16为本发明机器人实施例的结构框图。Figure 16 is a block diagram showing the structure of an embodiment of the robot of the present invention.
附图标记:Reference mark:
1001--存储器;1002--处理器;1003--外设接口;1004--摄像模块;1005--音频模块;1006--触控屏幕;1007--总线。1001--memory; 1002--processor; 1003--peripheral interface; 1004--camera module; 1005--audio module; 1006--touch screen; 1007--bus.
具体实施方式Detailed ways
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部份实施例,而不是全部的实施例。一种基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。The present invention will be further described in detail with reference to the accompanying drawings, in which . All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
机器视觉是人工智能正在快速发展的一个分支。简单说来,机器视觉就是用机器代替人眼来做测量和判断。机器视觉系统是通过机器视觉产品(即图像 摄取装置,分CMOS和CCD两种)将被摄取目标转换成图像信号,传送给专用的图像处理系统,得到被摄目标的形态信息,根据像素分布和亮度、颜色等信息,转变成数字化信号;图像系统对这些信号进行各种运算来抽取目标的特征,进而根据判别的结果来控制现场的设备动作。本发明提供了一种基于机器视觉的棋子定位方法,应用于对设有平面标识物的棋盘上的棋子进行定位,如图1所示,所述棋子定位方法包括:Machine vision is a branch of artificial intelligence that is rapidly evolving. Simply put, machine vision is to use the machine instead of the human eye to make measurements and judgments. Machine vision system is through machine vision products (ie images The ingesting device converts the ingested object into an image signal and transmits it to an image processing system to obtain a shape information of the object to be captured, and converts it into a digitized signal according to information such as pixel distribution, brightness, color, and the like; The image system performs various operations on these signals to extract features of the target, and then controls the action of the device on the spot according to the result of the discrimination. The invention provides a chess piece positioning method based on machine vision, which is applied to position a piece on a board provided with a plane identifier. As shown in FIG. 1 , the piece positioning method comprises:
S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
S200对所述视频图像帧进行图像处理,识别所述平面标识物;S200 performs image processing on the video image frame to identify the plane identifier;
S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
本实施例仅需要在棋盘所处平面上放置一个平面标识物,通过该标识物即可对棋子进行视觉精确定位,且本发明不需要棋盘进行特别的电路实现。这里的平面标识物使得在复杂的场景中也能够准确的识别出来,不会受到复杂场景的干扰。In this embodiment, only a plane identifier is placed on the plane where the board is located, and the board can be visually and accurately positioned by the identifier, and the present invention does not require a special circuit implementation of the board. The planar markers here enable accurate identification in complex scenes without interference from complex scenes.
在采用上述方法定位棋子之前,还需要对用来采集视频流的摄像头进行标定,具体的,通过对所述摄像头进行标定,获取所述摄像头的内参矩阵,即确定所述摄像头成像的几何模型。Before the method is used to locate the chess piece, the camera for collecting the video stream needs to be calibrated. Specifically, by calibrating the camera, the internal reference matrix of the camera is obtained, that is, the geometric model of the imaging of the camera is determined.
利用摄像机所拍摄到的图像来还原空间中的物体。在这里,不妨假设摄像机所拍摄到的图像与三维空间中的物体之间存在以下一种简单的线性关系:[像]=M[物],这里,矩阵M可以看成是摄像机成像的几何模型。M中的参数就是摄像机参数。通常,这些参数是要通过实验与计算来得到的。这个求解参数的过程就称为摄像机标定。比较常用的方法是张正友平面标定方法。简单介绍而言,就是在图像测量过程以及机器视觉应用中,常常会涉及到这样一个概念,那就是利用摄像机所拍摄到的图像来还原空间中的物体。在这里,不妨假设摄像机所拍摄到的图像与三维空间中的物体之间存在以下一种简单的线性关系: [像]=M[物]。Use the image captured by the camera to restore objects in space. Here, it is assumed that there is a simple linear relationship between the image captured by the camera and the object in the three-dimensional space: [image]=M[object], where the matrix M can be regarded as the geometric model of the camera imaging. . The parameters in M are camera parameters. Usually, these parameters are obtained through experiments and calculations. This process of solving parameters is called camera calibration. The more common method is Zhang Zhengyou's plane calibration method. For the sake of simplicity, in the image measurement process and machine vision applications, it is often the case that the image captured by the camera is used to restore objects in space. Here, let's assume that there is a simple linear relationship between the image captured by the camera and the object in three-dimensional space: [like]=M[object].
张正友标定方法,借助了机器视觉标定板,标定板上特征圆成陈列分布,间距30mm;板子尺寸为300X300mm。4个大圆为标志圆,大圆环标志确定方向。用特征圆的圆心坐标进行标定。特征圆的圆心坐标提取方法:获得4个标志圆坐标,利用仿射变换将特征圆的坐标调正,然后对其进行排序,确定相应特征圆图像坐标。Zhang Zhengyou calibration method, with the help of the machine vision calibration plate, the feature circle on the calibration plate is distributed in display, with a spacing of 30mm; the board size is 300X300mm. The four large circles mark the circle, and the big ring mark determines the direction. Calibration is performed using the center coordinates of the feature circle. The method of extracting the center coordinates of the feature circle: obtaining four mark circle coordinates, using the affine transformation to adjust the coordinates of the feature circle, and then sorting them to determine the coordinates of the corresponding feature circle image.
在这里假定模板平面在世界坐标系Z=0的平面上。示意图如图2所示,基本原理如下:It is assumed here that the template plane is on the plane of the world coordinate system Z=0. The schematic diagram is shown in Figure 2. The basic principle is as follows:
Figure PCTCN2017112210-appb-000012
Figure PCTCN2017112210-appb-000012
其中,K为摄像机的内参矩阵,[X Y 1]T为模板平面上点的齐次坐标,[u v 1]T为模板平面上点投影到图象平面上对应点的齐次坐标,[r1 r2 r3]和t分别是摄像机坐标系相对于世界坐标系的旋转矩阵和平移向量。Where K is the internal reference matrix of the camera, [X Y 1] T is the homogeneous coordinate of the point on the template plane, [u v 1] T is the homogeneous coordinate of the point on the template plane projected onto the corresponding point on the image plane, [r1 r2 R3] and t are the rotation matrix and translation vector of the camera coordinate system relative to the world coordinate system, respectively.
Figure PCTCN2017112210-appb-000013
Figure PCTCN2017112210-appb-000013
根据旋转矩阵的性质,即r1Tr2=0和||r1||=||r2||=1,每幅图象可以获得以下两个对内参矩阵的基本约束According to the nature of the rotation matrix, ie r1 T r2=0 and ||r1||=||r2||=1, the following two basic constraints on the internal reference matrix can be obtained for each image.
Figure PCTCN2017112210-appb-000014
Figure PCTCN2017112210-appb-000014
由于摄像机有5个未知内参数,所以当所摄取得的图像数目大于等于3时,就可以线性唯一求解出K,也就是可以求解出摄像机的内参矩阵。Since the camera has 5 unknown internal parameters, when the number of captured images is greater than or equal to 3, K can be solved linearly and uniquely, that is, the internal reference matrix of the camera can be solved.
张正友平面标定算法可描述为:Zhang Zhengyou's plane calibration algorithm can be described as:
1、打印一张模板并贴在一个平面上;1. Print a template and attach it to a flat surface;
2、从不同角度拍摄若干张模板图像;2. Shooting several template images from different angles;
3、检测出图像中的特征点; 3. detecting feature points in the image;
4、求出摄像机的内参数、外参数、畸变系数。4. Find the internal parameters, external parameters, and distortion coefficients of the camera.
在上述实施例中,较佳的,步骤S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧中采集的视频图像帧为关键帧,关键帧可以体现出棋盘上的棋子的变化。In the above embodiment, preferably, step S100 acquires a video stream by using a camera, and collects a video image frame collected in the video image frame from the video stream as a key frame, and the key frame can reflect a change of the chess piece on the chessboard. .
本发明方法的另一实施例,如图3所示,包括:Another embodiment of the method of the present invention, as shown in FIG. 3, includes:
S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
S210对所述视频图像帧进行二值分割,并从分割后的二值化图像中提取外形轮廓;S210 performs binary segmentation on the video image frame, and extracts a contour from the segmented binarized image;
S220根据预存的所述平面标识物所对应的外形轮廓的共性特征,从提取的外形轮廓中选取具有所述共性特征的外形轮廓作为备选轮廓;S220: selecting, according to a common feature of the pre-stored contour identifiers of the plane identifiers, an outline contour having the common features as an alternative contour from the extracted contour contours;
S230获取所述备选轮廓的正视图;S230 acquires a front view of the candidate contour;
S240当所述备选轮廓的正视图与预存的所述平面标识物模板一致时,识别所述备选轮廓对应的图像为所述平面标识物的图像;S240, when the front view of the candidate contour is consistent with the pre-stored planar identifier template, identifying an image corresponding to the candidate contour as an image of the planar identifier;
S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
上述实施例中,S210对所述视频图像帧进行二值分割,二值化可以视为将图像上的像素点的灰度值设置为0或255,也就是将整个图像呈现出明显的黑白视觉效果。图像分割就是把图像中具有特殊涵义的不同区域分开来,这些区域是互不相交的,每个区域都满足特定区域的一致性。图像分割是图像处理中的重要问题,也是计算机视觉研究中的一个经典难题。计算机视觉中的图像理解包括目标检测、特征提取和目标识别等,都依赖于分割的质量。In the above embodiment, S210 performs binary separation on the video image frame, and binarization can be regarded as setting the gray value of the pixel on the image to 0 or 255, that is, presenting the entire image with obvious black and white vision. effect. Image segmentation is to separate different regions of a particular meaning in an image. These regions are mutually disjoint, and each region satisfies the consistency of a particular region. Image segmentation is an important issue in image processing and a classic problem in computer vision research. Image understanding in computer vision, including object detection, feature extraction, and target recognition, depends on the quality of the segmentation.
当然,我们可以采用自适应阈值法对摄像头获取的视频图像帧进行二值分割,阈值法是一种简单有效的分割方法,其最大特点就是计算简单,因而应用广泛。Of course, we can use the adaptive threshold method to binary segment the video image frames obtained by the camera. The threshold method is a simple and effective segmentation method. Its biggest feature is that the calculation is simple and thus widely used.
图像分割后,需要识别出屏幕标识物,由于摄像头可能从不同角度拍摄了 视频流,因此,采集的视频帧上的平面标识物并不一定是正视图的样子。那么需要先提取出从各个角度拍摄出的平面标识物,并对该平面标识物进行边缘检测,获取该平面标识物的外形轮廓的共性特征,再将这个共性特征预先进行存储,便于在采集视频帧后对该平面标识物进行识别。具体的,在对视频帧图像进行二值分割后,提取分割后的各图像的外形轮廓,根据平面标识物外形轮廓的共性特征,查找出备选的外形轮廓。比如,如果我们选择的屏幕标识物是正方形,那么经过边缘检测后可获得其外形轮廓的共性特征为四边形,那么我们便据此,从提取出的外形轮廓中,排除那些非凸多边形的,以及不是四边形的轮廓等。After the image is segmented, you need to identify the screen marker, because the camera may have taken pictures from different angles. The video stream, therefore, the planar identifier on the captured video frame does not have to be the front view. Then, it is necessary to extract the planar marker photographed from various angles, and perform edge detection on the planar marker to obtain the common features of the contour of the planar marker, and then store the common feature in advance to facilitate the video capture. The planar identifier is identified after the frame. Specifically, after the video frame image is binary-divided, the contours of the divided images are extracted, and the candidate contours are searched according to the common features of the contours of the planar identifiers. For example, if the screen identifier we selected is a square, then after the edge detection, the common feature of the outline can be quadrilateral, then we can exclude those non-convex polygons from the extracted outline, and Not a quadrilateral outline, etc.
较佳的,我们还可以设置一些限制条件,用来进一步排除不可能是平面标识物的外形轮廓,还是以平面标识物为正方形为例,比如提取的外形轮廓中四边形一边明显小于其余的边(形状比较瘦长),轮廓周长或者面积过小等等,剩下的符合条件的轮廓就是平面标识物可能对应的备选轮廓了。Preferably, we can also set some restrictions to further exclude the outline of the plane marker, or the square of the plane marker, for example, the extracted outline has a side smaller than the other side ( The shape is relatively long and thin, the contour perimeter or the area is too small, etc., and the remaining eligible contours are the alternative contours that the planar markers may correspond to.
获得备选轮廓后,下一步就是获取各个备选轮廓的正视图,也就是说将平面标识物可能对应的备选轮廓图像区域变为正视图,从而进一步判断该备选轮廓区域是否为平面标识物对应的图像。具体的,通过将每个备选轮廓的正视图与预先存储的该平面标识物模板进行比对,当出现有比对一致的情况下便可判断出这个备选轮廓即为平面标识物的外形轮廓,这个备选轮廓对应的图像就是平面标识物的图像,至此,平面标识物被识别出来了。After the candidate contour is obtained, the next step is to obtain a front view of each candidate contour, that is, to change the candidate contour image area corresponding to the plane identifier into a front view, thereby further determining whether the candidate contour region is a plane identifier. The image corresponding to the object. Specifically, by comparing the front view of each candidate contour with the pre-stored planar identifier template, when the alignment is consistent, it can be determined that the candidate contour is the shape of the planar identifier. The contour, the image corresponding to this alternative contour is the image of the planar marker, and thus the planar marker is identified.
较佳的,在上述实施例的基础上,设置在棋盘上的平面标识物为正方形,上述实施例的步骤S220根据预存的所述平面标识物所对应的外形轮廓的共性特征中预存的所述平面标识物所对应的外形轮廓的共性特征是所述平面标识物所对应的外形轮廓为四边形。设置的标识物不同,那么对应的外形轮廓的共性特征也会不同。我们在选取平面标识物时尽量选取易于辨识的,特征点比较明显的标识物为佳。比如正方形,具有四个顶点,当然,为了与棋盘上的棋格 区分开,可以在正方形内设置花纹等其它形状,便于后续的辨识,正方形的四个边长一致,加上四个顶点比较有利于后续的定位运算,使得运算起来也更为简单。Preferably, on the basis of the above embodiment, the planar identifier disposed on the chessboard is a square, and step S220 of the above embodiment is based on the pre-existing pre-existing common features of the contour profile corresponding to the pre-stored planar identifier. A common feature of the contour corresponding to the planar identifier is that the contour of the planar identifier corresponds to a quadrilateral. If the set markers are different, then the common features of the corresponding outlines will be different. When selecting a flat marker, we should try to select a marker that is easy to identify and has obvious feature points. Like a square, with four vertices, of course, in order to match the chessboard Separate, other shapes such as patterns can be set in the square to facilitate subsequent recognition. The four sides of the square are consistent in length, and the four vertices are more favorable for subsequent positioning operations, which makes the calculation more simple.
本发明的另一实施例,如图4所示,本发明的棋子定位方法应用于对设有正方形平面标识物的棋盘上的棋子进行定位,具体包括:In another embodiment of the present invention, as shown in FIG. 4, the chess piece positioning method of the present invention is applied to positioning a piece on a board provided with a square plane identifier, and specifically includes:
S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
S210对所述视频图像帧进行二值分割,并从分割后的二值化图像中提取外形轮廓;S210 performs binary segmentation on the video image frame, and extracts a contour from the segmented binarized image;
S221根据预存的所述平面标识物所对应的外形轮廓的共性特征为四边形,从提取的外形轮廓中选取四边形的外形轮廓作为备选轮廓;S221 is a quadrilateral according to a common feature of the pre-stored contour identifier corresponding to the plane identifier, and selecting a quadrilateral contour contour from the extracted contour contour as an alternative contour;
S231读取所述备选轮廓的四个顶点的像素坐标;S231 reading pixel coordinates of four vertices of the candidate contour;
S232定义所述备选轮廓经过射影变换为正视图后的四个顶点的像素坐标为预存的所述平面标志物的正视图的四个顶点的像素坐标;S232 defines a pixel coordinate of the four vertices after the candidate profile is subjected to projective transformation into a front view as pixel coordinates of four pre-existing front views of the planar marker;
S233根据上述获取的四组所述备选轮廓的顶点的像素坐标及所述定义的备选轮廓转换为正视图后的顶点的像素坐标,求取摄影变换矩阵H;具体的,将上述获取的四组所述备选轮廓的顶点的像素坐标及所述定义的备选轮廓转换为正视图后的顶点的像素坐标分别代入下述方程,求取射影变换矩阵H:S233: Calculate the photographic transformation matrix H according to the pixel coordinates of the vertices of the four sets of the candidate contours obtained by the above-mentioned acquired and the defined candidate contours, and obtain the photographic transformation matrix H; The pixel coordinates of the vertices of the four sets of the candidate contours and the pixel coordinates of the vertices after the defined candidate contours are converted into the front view are respectively substituted into the following equations to obtain the projective transformation matrix H:
Figure PCTCN2017112210-appb-000015
Figure PCTCN2017112210-appb-000015
其中,X为备选轮廓顶点的齐次像素坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000016
Figure PCTCN2017112210-appb-000017
X'为射影变换后顶点的齐次坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000018
Where X is the homogeneous pixel coordinate of the candidate silhouette vertex, and the non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000016
Figure PCTCN2017112210-appb-000017
X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000018
S234根据所述射影变换矩阵H,对所述备选轮廓对应的二值化图像的所有像素都执行射影变换,获得所述备选轮廓包含的区域对应的正视图; S234 performing, according to the projective transformation matrix H, performing projective transformation on all pixels of the binarized image corresponding to the candidate contour, and obtaining a front view corresponding to the region included in the candidate contour;
S240当所述备选轮廓的正视图与预存的所述平面标识物模板一致时,识别所述备选轮廓对应的图像为所述平面标识物的图像;S240, when the front view of the candidate contour is consistent with the pre-stored planar identifier template, identifying an image corresponding to the candidate contour as an image of the planar identifier;
S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
上述实施例中以正方形平面标识物为例,步骤S231-S234具体阐述了如何获取提取的备选轮廓的正视图。根据正方形平面标识物的正方形特性,比如,我们可以定义备选轮廓经过射影变换转换为正视图后的四个顶点的像素坐标,比如正方形平面标识物正视图的四个顶点像素坐标分别为(0,0),(0,200),(200,200),(200,0),那么可以将这四个顶点坐标作为四边形备选轮廓的四个顶点的像素坐标,此外,四边形备选轮廓的原图像的像素坐标可从图像中读取出来,再利用上述的射影变换方程便可获取射影变换矩阵H。利用该射影变换矩阵H便可以将四边形备选轮廓区域的所有像素都执行射影变换,即可得到该四边形备选轮廓的区域对应的正视图,然后将该正视图与预存的该平面标识物模板进行对比,看是否一致,一致的话则说明这个四边形轮廓就是该平面标识物的轮廓,那么平面标识物便被识别出来了。这里选用正视图来对比是因为摄像头从各个角度拍摄出的标识物的图像是不同的,如果摄像头处在标识物的正上方,则标识物的图像也是一个矩形,如果摄像头斜着看,那么矩形标识物的图像是一个不规则四边形,获取正视图进行对比的目的就是,不管摄像头从那个角度看,平面标识物的正视图都是一种从正上方往下看的图像,如此,便于平面标识物的识别。In the above embodiment, a square planar marker is taken as an example, and steps S231-S234 specifically explain how to obtain a front view of the extracted candidate contour. According to the square characteristics of the square plane identifier, for example, we can define the pixel coordinates of the four vertices after the candidate contour is transformed into the front view by the projective transformation. For example, the four vertex pixel coordinates of the square plane identifier front view are respectively (0) , 0), (0,200), (200,200), (200,0), then the four vertex coordinates can be used as the pixel coordinates of the four vertices of the quadrilateral candidate contour, in addition, the quadrilateral candidate contour The pixel coordinates of the original image can be read from the image, and the projective transformation matrix H can be obtained by using the above-described projective transformation equation. By using the projective transformation matrix H, all the pixels of the quadrilateral candidate contour region can be subjected to projective transformation, and a front view corresponding to the region of the quadrilateral candidate contour can be obtained, and then the front view and the pre-stored planar identifier template are obtained. For comparison, see if it is consistent. If it is consistent, the quadrilateral contour is the outline of the planar marker, and the planar marker is recognized. Here, the front view is selected for comparison because the image of the marker photographed by the camera from various angles is different. If the camera is directly above the marker, the image of the marker is also a rectangle. If the camera is tilted, the rectangle is rectangular. The image of the marker is an irregular quadrilateral. The purpose of obtaining the front view for comparison is that the front view of the planar marker is an image viewed from directly above, regardless of the angle from which the camera is viewed. Identification of objects.
本发明方法的另一实施例,在上述任一实施例的基础上,识别出了平面标识物后,便可根据平面标识物结合预先获取的摄像头内参矩阵,便可定位棋盘上的棋子,具体的,如图5所示,包括:According to another embodiment of the method of the present invention, on the basis of any of the foregoing embodiments, after the planar identifier is identified, the chess piece on the chessboard can be located according to the planar identifier combined with the pre-acquired camera internal reference matrix. As shown in Figure 5, including:
S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
S200对所述视频图像帧进行图像处理,识别所述平面标识物; S200 performs image processing on the video image frame to identify the plane identifier;
S310根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵;S310: calculating, according to the plane identifier and the pre-acquired internal reference matrix of the camera, a homography matrix of a current field of view of the camera;
S320根据棋盘上预设参考点在平面标识物坐标系中的已知坐标及在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在所述平面标识物坐标系中的坐标;S320: according to the known coordinates of the preset reference point on the checkerboard in the plane identifier coordinate system and the rank position on the checkerboard, combined with the grid length feature of the checkerboard, acquiring the four corner points of the checkerboard in the plane The coordinates in the marker coordinate system;
S330识别所述视频图像帧中的棋子,读取所述棋子的像素坐标,并根据所述单应性矩阵获取所述棋子在所述平面标识物坐标系中的坐标;S330 identifies a piece in the video image frame, reads pixel coordinates of the piece, and acquires coordinates of the piece in the plane identifier coordinate system according to the homography matrix;
S340根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,结合所述棋盘的网格长度特征,获取所述棋子在棋盘上的位置。S340 obtains the position of the chess piece on the chessboard according to the coordinates of the chess piece and the four corner points of the chessboard in the plane identifier coordinate system, combined with the grid length feature of the chessboard.
上述实施例中的单应性矩阵,即平面标识物坐标系相对于摄像机坐标系的旋转矩阵R及平移向量t。这里的摄像机坐标系指的就是像素坐标所用的坐标系,是摄像机的图像坐标系。具体的上述实施例中,步骤S310根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵包括:The homography matrix in the above embodiment, that is, the rotation matrix R and the translation vector t of the plane identifier coordinate system with respect to the camera coordinate system. The camera coordinate system here refers to the coordinate system used for the pixel coordinates and is the image coordinate system of the camera. In the foregoing embodiment, step S310 calculates a homography matrix of the current field of view of the camera according to the plane identifier and the internal parameter matrix of the camera that is acquired in advance:
S311选取所述平面标识物坐标系为世界坐标系;S311 selects the plane identifier coordinate system as a world coordinate system;
S312读取所述平面标识物的四个顶点的像素坐标;S312 reading pixel coordinates of four vertices of the planar identifier;
S313将已知的所述平面标识物的四个顶点在世界坐标系的坐标、所述平面标识物的四个顶点的像素坐标,及所述预先获取的所述摄像头的内部参数分别代入下述公式:S313 substituting the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system, the pixel coordinates of the four vertices of the planar identifier, and the internal parameters of the camera obtained in advance into the following formula:
Figure PCTCN2017112210-appb-000019
Figure PCTCN2017112210-appb-000019
计算出当前视场的单应性矩阵H=M[r1,r2,r3,t];Calculate the homography matrix H=M[r1,r2,r3,t] of the current field of view;
其中,(x,y,1)表示所述平面标识物中任一顶点在摄像机的图像坐标系中像素坐标的齐次坐标,(X,Y,Z,1)表示所述顶点在世界坐标系中的齐次坐标,简化为(X,Y,0,1),s为引入的任意尺度比例参数,M为摄像 机内参矩阵,r1、r2、r3分别表示所述平面标识物坐标系相对于摄像机坐标系的旋转矩阵中的三个列向量,t为平移向量。Where (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any vertex in the plane image in the image coordinate system of the camera, and (X, Y, Z, 1) indicates that the vertex is in the world coordinate system The homogeneous coordinates in the middle are reduced to (X, Y, 0, 1), s is the scale parameter of any scale introduced, and M is the camera. The internal reference matrix, r1, r2, and r3 respectively represent three column vectors in the rotation matrix of the plane identifier coordinate system with respect to the camera coordinate system, and t is a translation vector.
以上通过标识物的一个顶点像素坐标及其对应的标识物坐标系中坐标可写出一个方程;标识物四个顶点对应可写出四个方程组,那么可以求出四个未知数r1、r2、r3与t;具体的,通过方程组的直接先行变换(DLT)算法,从而可求出r1、r2、r3与t,也就是摄像头在当前视场下的单应性矩阵。The above can write an equation by the coordinates of a vertex pixel of the marker and the coordinates of the corresponding marker coordinate system; the four vertices of the identifier can write four equations, then four unknowns r1, r2 can be obtained. R3 and t; specifically, through the direct forward transform (DLT) algorithm of the equations, r1, r2, r3 and t can be obtained, that is, the homography matrix of the camera in the current field of view.
获取了单应性矩阵后,下一步便是要确定棋盘了,上述步骤S320中,预先在棋盘上设置了一个参考点,根据该参考点在平面坐标系(即世界坐标系)中的坐标,再利用其在棋盘上的位置和棋盘的网格长度关系,可以让棋盘的四个顶点在平面坐标系中的坐标用该参考点与网格长度的值来表示出来,因此,可获得该棋盘四个角点在平面标识物坐标系中的坐标,即得到了棋盘在平面标识物坐标系中的位置区域。棋盘上预设的参考点由于坐标已知,而棋盘上网格的长度已知,那么便可以根据参考点在棋盘上的行列位置,结合棋盘网格长度,获得棋盘四个角点在平面标识物坐标系中的坐标。较佳的,在棋盘上设置参考点时,直接选取四个角点中的一个作为预设的参考点,或者棋盘的中心点,比如选用棋盘的中心点,其中心点在世界坐标系(等同于平面标识物坐标系)中的坐标为(X1,Y1),根据棋盘的网格长度特征,比如棋盘的边长是L,那么棋盘的四个顶点在世界坐标系中的坐标为(X1-L/2,Y1+L/2),(X1-L/2,Y1-L/2),(X1+L/2,Y1+L/2),(X1+L/2,Y1-L/2),即获得了这四个角点在平面标识物坐标系(世界坐标系)中的坐标。After obtaining the homography matrix, the next step is to determine the chessboard. In the above step S320, a reference point is set in advance on the chessboard according to the coordinates of the reference point in the plane coordinate system (ie, the world coordinate system). By using its position on the board and the grid length relationship of the board, the coordinates of the four vertices of the board in the plane coordinate system can be expressed by the value of the reference point and the length of the grid. Therefore, the board can be obtained. The coordinates of the four corner points in the plane marker coordinate system, that is, the position area of the checkerboard in the plane marker coordinate system. The preset reference point on the board is known because the coordinates are known, and the length of the grid on the board is known. Then, according to the position of the reference point on the board, combined with the length of the checkerboard grid, the four corners of the board are obtained in the plane marker. The coordinates in the coordinate system. Preferably, when the reference point is set on the board, one of the four corner points is directly selected as the preset reference point, or the center point of the board, for example, the center point of the board is selected, and the center point is in the world coordinate system (equivalent The coordinates in the plane marker coordinate system are (X1, Y1). According to the grid length feature of the board, for example, the side length of the board is L, then the coordinates of the four vertices of the board in the world coordinate system are (X1- L/2, Y1+L/2), (X1-L/2, Y1-L/2), (X1+L/2, Y1+L/2), (X1+L/2, Y1-L/ 2), the coordinates of the four corner points in the plane marker coordinate system (world coordinate system) are obtained.
确定好棋盘在平面标识物坐标系中的坐标位置之后,还需要确定棋子在平面标识物坐标系中的坐标,上述步骤S330中识别所述视频图像帧中的棋子,我们可采用与之前平面标识物类似的方法,将视频图像帧进行二值化,然后从中识别出棋子。具体的,可根据棋子的特征来进行轮廓识别等,比如选用的是黑色的圆形棋子,棋子的厚度我们可以忽略不计,那么在二值化后的视频图像帧 中,棋子的图像是圆形或者椭圆形轮廓,然后再根据轮廓的周长、面积及二阶中心距等判断二值图像中的轮廓是否为棋子,该轮廓的中心则为棋子的像素坐标。识别出棋子后,便可直接从该视频图像帧中读取棋子的像素坐标。获取到棋子的像素坐标后,再利用之前获取的摄像头当前视场的单应性矩阵,便可获取棋子在平面标识物坐标系(也就是世界坐标系)中的坐标。After determining the coordinate position of the board in the plane identifier coordinate system, it is also necessary to determine the coordinates of the piece in the plane identifier coordinate system. In the above step S330, the pieces in the video image frame are identified, and we can use the previous plane identifier. A similar method is to binarize the video image frame and then identify the pieces from it. Specifically, the contour recognition can be performed according to the characteristics of the chess piece, for example, a black circular chess piece is selected, and the thickness of the chess piece can be neglected, then the video image frame after binarization is selected. In the middle, the image of the chess piece is a circular or elliptical contour, and then the contour in the binary image is judged as a piece according to the circumference, the area, the second-order center distance, and the like of the contour, and the center of the contour is the pixel coordinate of the piece. After the pieces are identified, the pixel coordinates of the pieces can be read directly from the video image frame. After the pixel coordinates of the piece are obtained, the coordinates of the piece in the plane coordinate coordinate system (that is, the world coordinate system) can be obtained by using the homography matrix of the current field of view of the camera obtained before.
最后,步骤S340即我们便可根据前面确定的棋子、棋盘在平面标识物坐标系中的坐标,再结合棋盘的网格长度特征,便可获取棋子在棋盘上的具体位置了。棋盘的四个角点在平面标识物中的坐标已确定的话,那么,我们可以选取其中任一个角点作为棋子行列位置计算的比较点。比如,选取左上角的角点作为比较点,由于作为比较点的棋盘网格左上角顶点A在平面标识物坐标系中的坐标已知,所以可以求出棋子在棋盘网格中的位置(即横竖第几个网格)。该求取方法如图6所示:Finally, in step S340, we can obtain the specific position of the piece on the board based on the previously determined pieces of the chess piece, the coordinates of the board in the plane coordinate coordinate system, and the grid length feature of the board. If the coordinates of the four corner points of the board in the plane marker have been determined, then we can select any one of the corner points as the comparison point for the calculation of the position of the board. For example, the corner point in the upper left corner is selected as the comparison point. Since the coordinates of the upper left corner vertex A as the comparison point in the plane identifier coordinate system are known, the position of the piece in the checkerboard grid can be found (ie, The first few grids). The method of obtaining is shown in Figure 6:
1.已知A点在世界坐标系O1中坐标为(6,6,0),棋盘网格横向竖向间距均为5。1. It is known that the coordinates of point A in the world coordinate system O1 are (6, 6, 0), and the horizontal and vertical spacing of the checkerboard grid are both 5.
2.假如计算得到棋子在世界坐标系O1中坐标为(11,11,0)。则棋子B在棋盘网格中位置的计算为:横向位置=(11-6)/5=1;竖向位置=(11-6)/5=1;即棋子B在棋盘网格中行列位置为(1,1),棋盘参考点A在棋盘网格中的行列位置为(0,0)。2. If the calculated piece is in the world coordinate system O1, the coordinates are (11, 11, 0). Then the position of the pawn B in the checkerboard grid is calculated as: lateral position = (11-6)/5=1; vertical position = (11-6)/5=1; that is, the position of the pawn B in the checkerboard grid For (1,1), the position of the checkerboard reference point A in the checkerboard grid is (0, 0).
较佳的,在上述实施例的基础上,在步骤S330之后,步骤S340之前,还包括:S335根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,确定所述棋子处于所述棋盘的四个角点组成的四边形区域内。Preferably, on the basis of the foregoing embodiment, after step S330, before step S340, the method further includes: S335, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, It is determined that the piece is in a quadrilateral region composed of four corner points of the board.
只有处于棋盘上的棋子才需要定位,而本身不处于棋盘上的棋子则可以不用管,无需定位。在获取到棋盘的四个角点在平面标识物坐标系中的坐标,则相当于确定了棋盘在平面标识物坐标系中的区域(四个角点组成的四边形区域),那么在获取到棋子在平面标识物坐标系中的坐标后,便可判断该棋子是 否处于棋盘上,只有确定处于棋盘上的棋子才需要进一步定位,才会进入到后面棋盘上行列位置的计算。需要说明的是,棋子的四个角点组成的四边形区域,包含了棋盘边界线本身,棋子处于棋盘边界线上也属于位于棋盘上。也就是说如果棋子处于四个角点组成的四边形的任一边上,也视为处于四边形区域内(棋盘上)。当然,位于角点组成的四边形区域之外的棋子,则说明该棋子不在棋盘上,那么就可以不用再进一步定位了。Only the pieces on the board need to be positioned, and the pieces that are not on the board can be left without the need for positioning. Obtaining the coordinates of the four corner points of the board in the plane identifier coordinate system is equivalent to determining the area of the board in the plane identifier coordinate system (the quadrilateral area composed of four corner points), then the piece is obtained. After the coordinates in the plane marker coordinate system, you can judge that the piece is No on the board, only the pieces that are determined to be on the board need further positioning before they enter the calculation of the position of the upper row of the board. It should be noted that the quadrilateral region composed of the four corner points of the chess piece includes the checkerboard boundary line itself, and the chess piece is on the checkerboard boundary line and belongs to the chessboard. That is to say, if the piece is on either side of the quadrilateral composed of four corner points, it is also considered to be in the quadrilateral area (on the board). Of course, a piece outside the quadrilateral area consisting of corner points indicates that the piece is not on the board, so there is no need to further locate it.
本发明方法的另一实施例,应用于对设有平面标识物的棋盘上的棋子进行定位,所述棋子定位方法如图7所示,包括:Another embodiment of the method of the present invention is applied to positioning a chess piece on a board provided with a planar identifier. The chess piece positioning method is as shown in FIG. 7 and includes:
S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
S200对所述视频图像帧进行图像处理,识别所述平面标识物;S200 performs image processing on the video image frame to identify the plane identifier;
S310根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵;S310: calculating, according to the plane identifier and the pre-acquired internal reference matrix of the camera, a homography matrix of a current field of view of the camera;
S320根据棋盘上预设参考点在平面标识物坐标系中的已知坐标及在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在所述平面标识物坐标系中的坐标;S320: according to the known coordinates of the preset reference point on the checkerboard in the plane identifier coordinate system and the rank position on the checkerboard, combined with the grid length feature of the checkerboard, acquiring the four corner points of the checkerboard in the plane The coordinates in the marker coordinate system;
S325根据所述棋盘的四个角点在所述平面标识物坐标系中的坐标、及所述摄像头当前视场的单应性矩阵,获得所述棋盘四个角点的像素坐标;S325: obtaining pixel coordinates of four corner points of the checkboard according to coordinates of the four corner points of the checkerboard in the plane identifier coordinate system and a homography matrix of the current field of view of the camera;
S326根据所述棋盘四个角点的像素坐标,选取所述棋盘四个角点组成的四边形区域作为所述视频图像帧中的目标区域;S326: selecting, according to pixel coordinates of the four corner points of the checkerboard, a quadrilateral region composed of four corner points of the checkerboard as a target area in the video image frame;
S331在所述视频图像帧中的目标区域内识别棋子,并读取所述棋子的像素坐标;S331 identifies a piece in a target area in the video image frame, and reads pixel coordinates of the piece;
S332根据所述棋子的像素坐标及所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标;S332: acquiring, according to the pixel coordinates of the piece and the homography matrix, coordinates of the piece in the coordinate system of the plane identifier;
S340根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,结合所述棋盘的网格长度特征,获取所述棋子在棋盘上的位置。 S340 obtains the position of the chess piece on the chessboard according to the coordinates of the chess piece and the four corner points of the chessboard in the plane identifier coordinate system, combined with the grid length feature of the chessboard.
本实施例在上述实施例的基础上,在识别棋子之前,先确定识别的目标区域,也就是说先在视频图像帧中确定出棋盘所在的区域。这样只需在这个目标区域内识别棋子即可,目标区域之外的地方不用去识别,这样可以缩小棋子识别的范围,而在目标区域内识别出来的棋子也肯定在棋盘上。如此,可以减小图像处理的工作量,缩小识别范围,加快识别速度。此外,在检测棋子及计算棋子位置时可以不用关注棋盘之外的图像,从而增加了系统鲁棒性。On the basis of the above embodiment, the present embodiment determines the identified target area before identifying the piece, that is, first determines the area where the board is located in the video image frame. In this way, it is only necessary to identify the pieces in the target area, and the parts outside the target area need not be identified, so that the range of the piece recognition can be reduced, and the pieces identified in the target area are definitely on the board. In this way, the workload of image processing can be reduced, the recognition range can be narrowed, and the recognition speed can be accelerated. In addition, the image outside the board can be ignored when detecting the pieces and calculating the position of the pieces, thereby increasing system robustness.
本发明方法的另一实施例,如图6所示为系统组成示意图:Another embodiment of the method of the present invention is shown in Figure 6 as a schematic diagram of the system composition:
a.如图所示为特殊设计的棋盘,棋盘的左上角有平面标志物,以平面标志物的中心O1作为整个棋盘坐标系的原点。a. As shown in the figure, a specially designed checkerboard has a plane marker in the upper left corner of the board. The center O1 of the plane marker is used as the origin of the entire checkerboard coordinate system.
b.点A为棋盘网格离平面标识物最近的顶点,该棋盘网格的两边分别与棋盘坐标系的X、Y轴平行。顶点A在棋盘坐标系中的坐标已知为(Ax,Ay,0),B为放置在棋盘网格交叉点上的棋子。b. Point A is the vertex of the checkerboard grid closest to the plane identifier, and the two sides of the checkerboard grid are respectively parallel to the X and Y axes of the checkerboard coordinate system. The coordinates of vertex A in the checkerboard coordinate system are known as (Ax, Ay, 0), and B is the piece placed at the intersection of the checkerboard grid.
c.O2为机器人摄像头的坐标系原点。c.O2 is the origin of the coordinate system of the robot camera.
具体的,棋子在定位之前需要对摄像机进行标定,摄像机标定完后再进行后续的棋子识别,如图8所示,包括:平面标志物识别(获取视频流→图像二值化→四边形检测→获取正视图→模板匹配→匹配成功),棋子定位(计算R及t→棋子定位)。详细过程如下:Specifically, the chess piece needs to be calibrated before positioning, and the subsequent chess piece recognition is performed after the camera is calibrated, as shown in FIG. 8 , including: planar marker recognition (acquisition video stream → image binarization → quadrilateral detection → acquisition) Front view → template matching → matching success), chess piece positioning (calculation R and t → chess piece positioning). The detailed process is as follows:
步骤一.摄像机标定Step 1. Camera calibration
摄像机标定即计算摄像机的内部参数,确定摄像机成像的几何模型,从而后期利用摄像机所拍摄到的图像来进行三维空间位置的计算。本发明使用张正友的平面标定方法计算摄像机的内部参数矩阵M,该平面标定法的过程如下:The camera calibration calculates the internal parameters of the camera, determines the geometric model of the camera image, and then uses the image captured by the camera to calculate the position of the three-dimensional space. The invention uses Zhang Zhengyou's plane calibration method to calculate the internal parameter matrix M of the camera. The process of the plane calibration method is as follows:
①打印一张平面标定的模板并贴在一个平面上,示意图如图9a所示;1 print a plane-calibrated template and affix it to a plane, as shown in Figure 9a;
②从不同角度拍摄若干张模板图像;2 taking several template images from different angles;
③检测出图像中的特征点;示意图如图9b所示;3 detecting feature points in the image; a schematic diagram is shown in Figure 9b;
④根据特征点在世界坐标系中坐标位置及其在图像中对应的像素坐标, 联立方程组求出摄像机的内参数、外参数及畸变系数。4 according to the coordinate position of the feature point in the world coordinate system and its corresponding pixel coordinates in the image, The simultaneous equations are used to find the internal parameters, external parameters and distortion coefficients of the camera.
步骤二.平面标识物识别Step 2. Flat marker identification
该步骤用于在图像中识别特定的平面标识物,并确定平面标志物的四个角点,具体过程如下:This step is used to identify a specific planar marker in the image and determine the four corner points of the planar marker. The specific process is as follows:
①四边形轮廓检测1 quadrilateral contour detection
该过程检测出图像中平面标识物可能对应的四边形轮廓。利用自适应性阈值法对摄像头获取的图像进行二值分割,然后从以上获取的二值图像中提取外形轮廓。对轮廓进行多边形拟合,舍弃那些非凸多边形的,以及那些不是四边形的轮廓。使用了一些额外的限制条件来剔除那些不可能是平面标志物图像的四边形轮廓,如四边形一边明显小于其余的边(形状比较瘦长),轮廓周长或面积过小等。剩下的符合条件的轮廓即为平面标志物可能对应的备选轮廓。The process detects a quadrilateral contour that the planar marker in the image may correspond to. The image obtained by the camera is binarized by the adaptive threshold method, and then the contour is extracted from the binary image obtained above. Polygon fitting the contours, discarding those non-convex polygons, and those that are not quadrilateral. Some additional constraints are used to eliminate quadrilateral contours that are not likely to be planar marker images, such as the quadrilateral side being significantly smaller than the remaining edges (the shape is relatively elongated), the contour perimeter or area being too small. The remaining eligible contours are the alternative contours that the planar markers may correspond to.
②获取四边形轮廓区域的正视图2Get a front view of the quadrilateral outline area
该过程用于将平面标志物可能对应的四边形图像区域变为正视图,从而进一步判断该四边形区域是否为平面标志物对应的图像。定义四边形轮廓经过射影变换转换为正视图后的四个顶点像素坐标分别为(0,0),(0,100),(100,100),(100,0)。在原图像中四边形轮廓的四个顶点像素坐标已知。对于每一组点对应有如下平面射影变换方程成立:The process is used to change the quadrilateral image area corresponding to the planar marker into a front view, thereby further determining whether the quadrilateral region is an image corresponding to the planar marker. The four vertex pixel coordinates after the quadrilateral contour is converted into a front view by projective transformation are (0, 0), (0, 100), (100, 100), (100, 0). The four vertex pixel coordinates of the quadrilateral outline are known in the original image. For each set of points corresponding to the following plane projective transformation equation is established:
Figure PCTCN2017112210-appb-000020
Figure PCTCN2017112210-appb-000020
其中,X为原图像中四边形顶点的齐次坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000021
X'为射影变换后顶点的齐次坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000022
Figure PCTCN2017112210-appb-000023
Where X is the homogeneous coordinate of the quadrilateral vertices in the original image, and the non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000021
X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000022
Figure PCTCN2017112210-appb-000023
通过四组顶点对应关系,可联立方程组求解出射影变换矩阵H,对原图像 的所有像素都执行射影变换H,即可得到该四边形轮廓区域对应的正视图,该正视图为正方形的平面标识图像。Through the four sets of vertex correspondences, the simultaneous equations can be solved to solve the projective transformation matrix H, the original image All of the pixels perform a projective transformation H, and a front view corresponding to the quadrilateral contour area is obtained, and the front view is a square planar identification image.
因为摄像头从各个角度拍摄出的标识物的图像是不同的,如果摄像头处在标志物的正上方,则标志物的图像也是一个矩形;如果摄像头斜着看,那么矩形标识物的图像是一个不规则四边形。本步骤中获取正视图的目的就是:不管摄像头从哪个角度看,得到的正视图都是一种从正上方往下看的图像。便于后续的标志物ID识别,即图像的归一化。Because the image of the marker taken by the camera from various angles is different, if the camera is directly above the marker, the image of the marker is also a rectangle; if the camera is tilted, the image of the rectangular marker is not Regular quadrilateral. The purpose of obtaining the front view in this step is that no matter which angle the camera looks from, the obtained front view is an image viewed from directly above. It facilitates the subsequent identification of the marker ID, that is, the normalization of the image.
③判断四边形是否对应平面矩形标识3 Determine whether the quadrilateral corresponds to the plane rectangle identifier
如下图所示将获取的平面标识的正视图图像依次旋转90°,180°,270°从而最终得到四幅图像,如图10所示。As shown in the figure below, the front view image of the acquired plane mark is rotated by 90°, 180°, and 270° in sequence to finally obtain four images, as shown in FIG. 10 .
将以上获取的四幅图像分别与平面标志物的图像模板进行匹配。当与任一副图像匹配成功时,该四边形轮廓即对应的是该平面标识物。The four images obtained above are respectively matched with the image templates of the planar markers. When the matching with any of the sub-images is successful, the quadrilateral contour corresponds to the planar identifier.
步骤三.棋子位置计算Step 3. Chess position calculation
该步骤通过以上识别到的平面标志物及其四个角点,计算出棋盘上的棋子相对于标志物的位置。通过已知的棋盘网格顶点A的坐标,最终计算出棋子在棋盘网格中的位置,具体过程如下:This step calculates the position of the pawn on the board relative to the marker by the above identified planar marker and its four corner points. The position of the piece in the checkerboard grid is finally calculated by the coordinates of the known checkerboard vertex A. The specific process is as follows:
①计算平面标志物坐标系相对于摄像机坐标系的旋转矩阵R及平移向量t1 Calculate the rotation matrix R and translation vector t of the plane marker coordinate system relative to the camera coordinate system
以平面标志物的坐标系为世界坐标系,其的中心O1为世界坐标系的原点,则在标志物所在的平面上的点Z轴坐标都为0。平面标志物的边长为80mm,则其四个顶点在世界坐标系中的坐标分别为(-40,-40,0),(40,-40,0),(40,40,0),(-40,40,0)。图像上平面标识物顶点的像素坐标与对应的世界坐标系中顶点的坐标存在以下方程:The coordinate system of the plane marker is the world coordinate system, and its center O1 is the origin of the world coordinate system, and the point Z coordinate of the point on the plane where the marker is located is 0. The plane marker has a side length of 80 mm, and the coordinates of its four vertices in the world coordinate system are (-40, -40, 0), (40, -40, 0), (40, 40, 0), (-40,40,0). The pixel coordinates of the vertex of the plane identifier on the image and the coordinates of the vertex in the corresponding world coordinate system have the following equation:
Figure PCTCN2017112210-appb-000024
Figure PCTCN2017112210-appb-000024
其中,(x,y,1)表示视觉定位标识中任一角点在摄像机的图像坐标系 中像素坐标的齐次坐标,(X,Y,Z,1)表示所述角点在世界坐标系中的齐次坐标,即简化为(X,Y,0,1),s为引入的任意尺度比例参数,M为摄像机内部参数矩阵,r1、r2、r3分别表示视觉定位标识坐标系相对于摄像机坐标系的旋转矩阵中的三个列向量,t为平移向量。Where (x, y, 1) indicates that any corner point in the visual positioning identifier is in the image coordinate system of the camera The homogeneous coordinates of the pixel coordinates, (X, Y, Z, 1) represent the homogeneous coordinates of the corner points in the world coordinate system, that is, simplified to (X, Y, 0, 1), and s is an arbitrary introduction. The scale ratio parameter, M is the internal parameter matrix of the camera, and r1, r2, and r3 respectively represent three column vectors in the rotation matrix of the visual positioning identification coordinate system with respect to the camera coordinate system, and t is a translation vector.
以上通过标识物的一个顶点像素坐标及其对应的标志物坐标系中坐标可写出一个方程。标志物四个顶点对应可写出四个方程组对应,通过方程组的直接线性变换(DLT)算法,从而求出r1、r2、r3与t。The above equation can be written by a vertex pixel coordinate of the marker and its corresponding coordinate in the marker coordinate system. The four vertices of the marker can be written to correspond to the four equations, and the direct linear transformation (DLT) algorithm of the equations is used to obtain r1, r2, r3 and t.
②获取棋盘的四个角点像素坐标2 Get the four corner pixel coordinates of the board
已知棋盘原点A在平面标识物坐标系O1中的坐标已知为(Ax,Ay,0),棋盘的边长为L,则棋盘的另外三个顶点在平面标识物坐标系中的坐标为(Ax+L,Ay,0),(Ax+L,Ay+L,0),(Ax,Ay+L,0)。根据由于上述步骤e已经求出当前平面标识物坐标系相对于摄像机坐标系的旋转矩阵矩阵及平移向量。将棋盘四个顶点在世界坐标系中的坐标代入公式1.1,即可得到棋盘四个顶点的像素坐标值。It is known that the coordinates of the checkerboard origin A in the plane identifier coordinate system O1 are known as (Ax, Ay, 0), and the side length of the checkerboard is L, and the coordinates of the other three vertices of the checkerboard in the plane identifier coordinate system are (Ax+L, Ay, 0), (Ax+L, Ay+L, 0), (Ax, Ay+L, 0). According to the above step e, the rotation matrix matrix and the translation vector of the current plane identifier coordinate system with respect to the camera coordinate system have been obtained. Substituting the coordinates of the four vertices of the board in the world coordinate system into the formula 1.1, the pixel coordinate values of the four vertices of the board can be obtained.
③获取棋子在原图像中的像素坐标3 Get the pixel coordinates of the piece in the original image
本方案采用的是黑色的圆形棋子,棋子的厚度比较薄,可以忽略不计。在原图像的二值图像中,棋子的图像是圆形或者椭圆形的轮廓。根据轮廓的周长,面积及二阶中心距等判断二值图像中的轮廓是否为棋子,该轮廓的中心则为棋子的像素坐标。验证该棋子是否在棋盘四个顶点组成的四边形区域内,若在则该棋子处在棋盘上。This program uses black round pieces, the thickness of the pieces is relatively thin and can be ignored. In the binary image of the original image, the image of the chess piece is a circular or elliptical outline. According to the perimeter, the area and the second-order center distance of the contour, it is judged whether the contour in the binary image is a chess piece, and the center of the contour is the pixel coordinate of the chess piece. Verify that the piece is in the quadrilateral area of the four vertices of the board, and if so, the piece is on the board.
④获取棋子在棋盘上的位置4 Get the position of the piece on the board
将棋子的像素坐标代入以上公式1.1,求解方程可得棋子在世界坐标系下的坐标B(Bx,By,0)。已知棋盘每一小格的边长为a,则棋子所处棋盘上的行列位置可以通过row=(By-Ay)/a,col=(Bx-Ax)/a进行计算。Substituting the pixel coordinates of the chess piece into the above formula 1.1, solving the equation can obtain the coordinate B (Bx, By, 0) of the chess piece in the world coordinate system. It is known that the side length of each cell of the board is a, and the position of the row on the board where the piece is placed can be calculated by row=(By-Ay)/a, col=(Bx-Ax)/a.
本发明仅仅需要在棋盘所处平面上放置一个平面标志物,机器人通过该标 志物即可对棋子进行视觉精确定位。本发明不需要棋盘进行特别的电路实现,且棋盘与机器人之间不需要进行数据通信,更加便于布置。该平面标志物的模板是特定设计的,机器人在复杂场景中能够准确的识别出该平面标志物,不会受到复杂场景的干扰。The invention only needs to place a plane marker on the plane where the chessboard is located, and the robot passes the standard The object can be visually and accurately positioned on the pieces. The invention does not require a special circuit implementation of the board, and no data communication is required between the board and the robot, which is more convenient to arrange. The template of the planar marker is specifically designed, and the robot can accurately recognize the planar marker in a complicated scene without being disturbed by a complicated scene.
基于相同的技术构思,本发明还公开了一种基于机器视觉的棋子定位系统,应用于对设有平面标识物的棋盘上的棋子进行定位,具体的,如图11所示,所述基于机器视觉的棋子定位系统包括:摄像采集模块100,用于获取视频流,并从所述视频流中采集视频图像帧;图像识别模块200,用于对所述摄像采集模块100采集的视频图像帧进行图像处理,从而在所述视频图像帧中识别出所述平面标识物;定位模块300,用于根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。Based on the same technical concept, the present invention also discloses a machine vision-based chess piece positioning system, which is applied to position a chess piece on a chessboard provided with a planar identifier. Specifically, as shown in FIG. 11, the machine-based machine The visual chess piece positioning system includes: a camera acquisition module 100, configured to acquire a video stream, and collect a video image frame from the video stream; and an image recognition module 200, configured to perform video image frames collected by the camera acquisition module 100 An image processing to identify the planar identifier in the video image frame; the positioning module 300 is configured to calculate a chess piece on the chessboard relative to the plane according to the planar identifier and the pre-acquired internal reference matrix of the camera Describe the location of the marker to position the piece.
本发明的系统实施例可集成在机器人内,使得机器人能在复杂的背景下准确的定位棋子的位置,便于后续根据棋盘上棋子的位置来布局后续的下棋策略。只有让机器人理解了真实存在的棋盘,增加机器人的拟人化特征,让用户获得更好的代入感,使得用户有更好的交互体验。The system embodiment of the present invention can be integrated into the robot so that the robot can accurately position the pieces in a complex background, so that the subsequent chess strategy can be laid out according to the position of the pieces on the board. Only let the robot understand the real chess board, increase the anthropomorphic characteristics of the robot, and let the user get a better sense of substitution, so that the user has a better interactive experience.
在上述系统实施例的基础上,如图12所示,所述基于机器视觉的棋子定位系统还包括:标定模块400,用于对所述摄像头进行标定,获取所述摄像头的内参矩阵。On the basis of the foregoing system embodiment, as shown in FIG. 12, the machine vision-based chess piece positioning system further includes: a calibration module 400, configured to calibrate the camera, and acquire an internal parameter matrix of the camera.
摄像头标定的方法有很多,较为常用的是张正友平面标定法,具体可参见前面方法实施例中对张正友标定法的描述。There are many methods for camera calibration. The more common one is Zhang Zhengyou's plane calibration method. For details, please refer to the description of Zhang Zhengyou's calibration method in the previous method embodiment.
本发明系统的另一实施例,在上述任一系统实施例的基础上,如图13所示,所述图像识别模块200包括:二值分割子模块210,用于对所述视频图像帧进行二值分割;外形提取子模块220,用于从分割后的二值化图像中提取外形轮廓;存储子模块230,用于存储所述平面标志物所对应的外形轮廓的共性特征、所述平面标识物模板;判断处理子模块240,用于根据所述存储子模块230中存储 的所述平面标识物所对应的外形轮廓的共性特征,从所述外形提取子模块220提取的外形轮廓中选取具有所述共性特征的外形轮廓作为备选轮廓;正视图获取子模块250,用于获取所述备选轮廓的正视图;识别子模块260,用于当所述备选轮廓的正视图与所述存储子模块230预存的所述平面标识物模板一致时,识别所述备选轮廓对应的图像为所述平面标识物的图像。According to another embodiment of the system of the present invention, on the basis of any of the foregoing system embodiments, as shown in FIG. 13, the image recognition module 200 includes: a binary segmentation sub-module 210, configured to perform the video image frame. Binary segmentation; a shape extraction sub-module 220, configured to extract a contour from the segmented binarized image; a storage sub-module 230, configured to store a common feature of the contour corresponding to the planar marker, the plane a identifier template; a determination processing sub-module 240, configured to store according to the storage sub-module 230 The common feature of the contour corresponding to the planar identifier, selects the contour having the common feature from the contour extracted by the shape extraction sub-module 220 as an alternative contour; the front view acquisition sub-module 250, Obtaining a front view of the candidate profile; the identification sub-module 260 is configured to identify the candidate when the front view of the candidate profile is consistent with the planar identifier template prestored by the storage sub-module 230 The image corresponding to the contour is an image of the planar marker.
上述实施例,对图像识别模块进行了细叙,在采集了视频图像帧后,通过图像识别模块对该视频图像帧进行图像处理识别,具体的通过二值分割子模块将其进行二值化分割处理,然后通过外形提取子模块提取出分割后图像的外形轮廓,再通过图像识别模块来进行识别,看是否是平面标识物的轮廓。这里我们就需要提前获取到该平面标识物外形轮廓的共性特征,并预先存储在图像识别模块中的存储子模块中,便于图像识别模块中的判断处理子模块在选取备选轮廓的时候作为判断标准。较佳的,还可以在选取的备选轮廓中,通过预设的限制条件来进一步进行剔除,将不可能是平面标识物的外形轮廓进一步排除掉,缩小后续的比对范围。在选取好了备选轮廓后,需要通过正视图获取子模块来获取这些备选轮廓的正视图,再由比对子模块将这些备选轮廓的正视图一一与预存的平面标识物的模板进行比较,这里的平面标识物的模板便可直接选用平面标识物的正视图图像。只有比对一致的情况下,方可判断其备选轮廓为平面标识物的轮廓。此外,在比对过程中,可能需要将备选轮廓的正视图进行平面旋转,从不同旋转角度进行比对,以便于比对正确。In the above embodiment, the image recognition module is described in detail. After the video image frame is acquired, the image recognition module performs image processing and recognition on the video image frame, and the binary segmentation sub-module is used to perform binarization segmentation. Processing, and then extracting the outline of the segmented image through the shape extraction sub-module, and then identifying by the image recognition module to see if it is the outline of the planar marker. Here we need to obtain the common features of the outline of the plane identifier in advance, and store it in the storage sub-module in the image recognition module in advance, so that the judgment processing sub-module in the image recognition module can be judged when selecting the candidate contour. standard. Preferably, in the selected candidate contours, the culling is further performed by a preset constraint condition, and the outline of the planar marker is further excluded, and the subsequent comparison range is reduced. After the candidate contours are selected, the front view acquisition sub-modules are required to obtain the front view of the candidate contours, and the comparison sub-module performs the front view of the candidate contours one by one with the pre-stored template of the planar identifiers. In comparison, the template of the planar marker here can directly select the front view image of the planar marker. Only if the comparison is consistent, the candidate contour can be judged as the outline of the planar marker. In addition, during the alignment process, it may be necessary to planarly rotate the front view of the candidate contours from different rotation angles so that the alignment is correct.
较佳的,所述平面标识物为正方形,所述存储子模块存储的所述平面标识物所对应的外形轮廓的共性特征是所述平面标识物所对应的外形轮廓为四边形。Preferably, the planar identifier is a square, and the common feature of the contour corresponding to the planar identifier stored by the storage sub-module is that the contour corresponding to the planar identifier is a quadrilateral.
平面标识物选取的不同,后面计算的难度也会或多或少存在不同,但基本的思想都是一样的,都是需要先对标识物进行识别,然后根据识别的标识物及之前标定获取的摄像头的内参矩阵来定位棋子。只是平面标识物的选取直接决定了后面该平面标识物识别的难易程度。我们一般选用便于识别的,具备突出 特征点的形状作为标识物,比如选取正方形作为平面标识物便可方便后续的计算识别。The difference in the selection of the planar markers, the difficulty of the calculations will be more or less different, but the basic ideas are the same, all need to identify the markers first, and then according to the identified markers and the previous calibration The internal reference matrix of the camera is used to position the pieces. Only the selection of the planar marker directly determines the difficulty of identifying the planar marker. We generally use easy to identify, with outstanding The shape of the feature point is used as a marker. For example, selecting a square as a planar marker facilitates subsequent calculation and recognition.
本发明系统的另一实施例,在上述实施例的基础上,所述正视图获取子模块包括:读取单元,用于读取所述备选轮廓的四个顶点的像素坐标;定义单元,用于定义所述备选轮廓经过射影变换为正视图后的四个顶点的像素坐标为预存的所述平面标志物的正视图的四个顶点的像素坐标;计算单元,用于根据所述读取单元读取的四个顶点像素坐标及所述定义单元定义的四个顶点像素坐标,通过下述方程,求取射影变换矩阵H,According to another embodiment of the system of the present invention, the front view obtaining submodule includes: a reading unit, configured to read pixel coordinates of four vertices of the candidate contour; and a defining unit, a pixel coordinate for defining four vertices of the candidate contour after being projectively transformed into a front view is a pixel coordinate of four pre-existing front views of the plane marker; a calculating unit for reading according to the Taking the four vertex pixel coordinates read by the unit and the four vertex pixel coordinates defined by the defining unit, the projective transformation matrix H is obtained by the following equation,
Figure PCTCN2017112210-appb-000025
Figure PCTCN2017112210-appb-000025
其中,X为备选轮廓顶点的齐次像素坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000026
Figure PCTCN2017112210-appb-000027
X'为射影变换后顶点的齐次坐标,其非齐次像素坐标为
Figure PCTCN2017112210-appb-000028
Where X is the homogeneous pixel coordinate of the candidate silhouette vertex, and the non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000026
Figure PCTCN2017112210-appb-000027
X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
Figure PCTCN2017112210-appb-000028
变换单元,用于根据所述计算单元求取的射影变换矩阵H,对所述备选轮廓对应的二值化图像的所有像素都执行射影变换,获得所述备选轮廓包含的区域对应的正视图。a transforming unit, configured to perform a projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H obtained by the calculating unit, to obtain a front view corresponding to the region included in the candidate contour Figure.
通过读取备选轮廓的四个顶点的像素坐标及定义的变换为正视图后四个顶点的像素坐标,通过射影变换矩阵的公式方程,可获得四组方程式,从而求取出射影变换矩阵H。然后再根据该射影变换矩阵获取该备选轮廓内部区域的所有像素的正视图,便于与平面标识物模板进行比对。By reading the pixel coordinates of the four vertices of the candidate contour and the defined transformation into the pixel coordinates of the four vertices after the front view, four sets of equations can be obtained by the formula equation of the projective transformation matrix, thereby obtaining the projective transformation matrix H. Then, a front view of all pixels of the inner region of the candidate contour is obtained according to the projective transformation matrix, so as to be easily compared with the planar identifier template.
本发明系统的另一实施例,在上述任一实施例的基础上,所述图像识别模块,还用于对所述视频图像帧进行图像处理,从而在所述视频图像帧中识别出棋子;如图13所示,所述定位模块300包括:单应性矩阵获取子模块310,用于根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵;角点坐标获取子模块320,用于根据棋盘上预设参考 点在平面标识物坐标系中的已知坐标及在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在所述平面标识物坐标系中的坐标;棋子坐标获取子模块330,用于根据所述图像识别模块200识别出的棋子,读取所述棋子的像素坐标,并根据所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标;棋子定位子模块340,用于根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,结合所述棋盘的网格长度特征,获取所述棋子在棋盘上的位置。According to another embodiment of the present invention, the image recognition module is further configured to perform image processing on the video image frame to identify a pawn in the video image frame. As shown in FIG. 13 , the positioning module 300 includes: a homography matrix acquisition sub-module 310, configured to calculate a current field of view of the camera according to the plane identifier and an internal parameter matrix of the camera acquired in advance. Responsive matrix; corner coordinate acquisition sub-module 320 for pre-setting reference based on the board Obtaining the coordinates of the four corner points of the checkerboard in the plane identifier coordinate system by combining the known coordinates in the plane identifier coordinate system and the row and column positions on the checkerboard in combination with the grid length feature of the checkerboard a piece coordinate acquisition sub-module 330, configured to read a pixel of the piece according to the piece recognized by the image recognition module 200, and acquire the piece of the piece in the plane identifier according to the homography matrix a coordinate in the coordinate system; a chess piece locating sub-module 340, configured to acquire, according to the coordinates of the four corner points of the chess piece and the checkerboard in the plane identifier coordinate system, combined with the grid length feature of the checkerboard The position of the piece on the board.
上述装置实施例中,单应性矩阵获取子模块,在上述实施例基础上,所述单应性矩阵获取子模块包括:坐标系确定单元,用于选取所述平面标识物坐标系为世界坐标系;顶点坐标读取单元,用于读取所述平面标识物的四个顶点的像素坐标;运算单元,用于将已知的所述平面标识物的四个顶点在世界坐标系的坐标、所述平面标识物的四个顶点的像素坐标,及所述预先获取的所述摄像头的内部参数分别代入下述公式:In the foregoing device embodiment, the homography matrix acquisition sub-module, on the basis of the foregoing embodiment, the homography matrix acquisition sub-module includes: a coordinate system determining unit, configured to select the plane identifier coordinate system as the world coordinate a vertex coordinate reading unit for reading pixel coordinates of four vertices of the plane identifier, and an operation unit for using the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system, The pixel coordinates of the four vertices of the planar identifier and the internal parameters of the pre-obtained camera are respectively substituted into the following formula:
Figure PCTCN2017112210-appb-000029
Figure PCTCN2017112210-appb-000029
计算出当前视场的单应性矩阵H=M[r1,r2,r3,t];Calculate the homography matrix H=M[r1,r2,r3,t] of the current field of view;
其中,(x,y,1)表示视觉定位标识中任一角点在摄像机的图像坐标系中像素坐标的齐次坐标,(X,Y,Z,1)表示所述顶点在世界坐标系中的齐次坐标,简化为(X,Y,0,1),s为引入的任意尺度比例参数,M为摄像机内参矩阵,r1、r2、r3分别表示视觉定位标识坐标系相对于摄像机坐标系的旋转矩阵中的三个列向量,t为平移向量。Where (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any corner point in the visual positioning identifier in the image coordinate system of the camera, and (X, Y, Z, 1) indicates that the vertex is in the world coordinate system. The homogeneous coordinates are reduced to (X, Y, 0, 1), s is the introduced arbitrary scale proportional parameter, M is the camera internal reference matrix, and r1, r2, and r3 respectively represent the rotation of the visual positioning identification coordinate system relative to the camera coordinate system. Three column vectors in the matrix, t is the translation vector.
所述角点坐标获取子模块,根据棋盘上预设参考点在平面标识物坐标系中的已知坐标及其在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在平面标识物坐标系中的坐标;所述棋子坐标获取子模块,首先通过图像识别模块识别棋盘中的棋子,从而使得所述棋子坐标获取子模块 获取到棋子的像素坐标;然后,通过所述单应性矩阵获取子模块获取的当前视场的单应性矩阵确定棋子在平面标志物坐标系(世界坐标系)中的坐标。最后,所述棋子定位子模块,根据棋盘在平面标识物坐标系(世界坐标系)中的位置坐标、棋子在平面标识物坐标系中的位置坐标,结合棋盘的网格长度特征,便可以求出棋子在棋盘网格中的位置(即横竖第几个网格)。The corner point coordinate obtaining sub-module acquires the chessboard according to the known coordinates of the preset reference point on the checkerboard in the plane identifier coordinate system and the position of the row on the board, combined with the grid length feature of the checkerboard The coordinates of the four corner points in the plane identifier coordinate system; the chess piece coordinate acquisition sub-module, first identifying the pieces in the board by the image recognition module, so that the piece coordinates acquisition sub-module Obtaining the pixel coordinates of the piece; then, obtaining the coordinates of the piece in the plane marker coordinate system (world coordinate system) by the homography matrix of the current field of view acquired by the homography matrix acquisition sub-module. Finally, the chess piece positioning sub-module can be obtained according to the position coordinates of the chessboard in the plane marker coordinate system (world coordinate system), the position coordinates of the chess piece in the plane marker coordinate system, and the mesh length feature of the checkerboard. The position of the pieces in the checkerboard grid (ie, the grid of the horizontal and vertical).
较佳的,如图14所示,所述定位模块300还包括:判断子模块350,用于根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,确定所述棋子处于所述棋盘的四个角点组成的四边形区域内。Preferably, as shown in FIG. 14, the positioning module 300 further includes: a determining sub-module 350, configured to coordinate the four corner points of the chess piece and the checkerboard in the plane identifier coordinate system, It is determined that the piece is in a quadrilateral region composed of four corner points of the board.
上述判断子模块在棋子定位子模块进行定位之前根据角点坐标获取子模块获取的棋盘的四个角点在平面标识物坐标系中的坐标、及棋子坐标获取子模块获取的棋子在平面标识物坐标系中的坐标,判断棋子是否在棋盘上,如果确定了该棋子处于棋盘上的话,则棋子定位子模块再进行后续的计算,获得棋子在棋盘上的行列位置。如果不在棋盘上,则无需进行后续的定位计算。The judging sub-module obtains the coordinates of the four corner points of the board acquired by the sub-module in the plane identifier coordinate system and the pieces obtained by the sub-module acquisition sub-module in the plane identifier according to the corner point coordinate before the piece positioning sub-module performs positioning. The coordinates in the coordinate system determine whether the piece is on the board. If it is determined that the piece is on the board, the piece positioning sub-module performs subsequent calculations to obtain the position of the piece on the board. If it is not on the board, no subsequent positioning calculations are required.
本发明装置的另一实施例,如图15所示,在上述任一实施例的基础上,所述定位模块300还包括:目标区域确定子模块360,用于根据所述棋盘的四个角点在所述平面标识物坐标系中的坐标、及所述摄像头当前视场的单应性矩阵,获得所述棋盘四个角点的像素坐标;并选取所述棋盘四个角点组成的四边形区域作为所述视频图像帧中的目标区域;所述棋子坐标获取子模块330包括:棋子像素坐标读取单元331,用于所述图像识别模块200在所述视频图像帧中的目标区域内识别出棋子后,读取所述棋子的像素坐标;棋子坐标计算单元332,用于根据所述棋子的像素坐标及所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标。According to another embodiment of the apparatus of the present invention, as shown in FIG. 15, on the basis of any of the above embodiments, the positioning module 300 further includes: a target area determining sub-module 360 for using four corners of the board Obtaining a coordinate in the plane identifier coordinate system and a homography matrix of the current field of view of the camera, obtaining pixel coordinates of the four corner points of the checkerboard; and selecting a quadrilateral composed of four corner points of the checkerboard a region as a target region in the video image frame; the pawn coordinate acquisition sub-module 330 includes: a pawn pixel coordinate reading unit 331 for the image recognition module 200 to identify within a target region in the video image frame After the piece is played, the pixel coordinates of the piece are read; the piece coordinate calculation unit 332 is configured to acquire the piece of the piece in the coordinate system of the plane according to the pixel coordinate of the piece and the homography matrix. coordinate.
本装置实施例中,在角点坐标获取子模块获取到棋盘的四个角点在平面标识物坐标系中的坐标后,目标区域确定子模块便根据所述棋盘的四个角点在所述平面标识物坐标系中的坐标、及所述摄像头当前视场的单应性矩阵,获得所 述棋盘四个角点的像素坐标;并选取所述棋盘四个角点组成的四边形区域作为所述视频图像帧中的目标区域;图像识别模块便可以将图像识别的范围缩小到目标区域内,图像识别模块在该目标区域内识别到的棋子肯定处于棋盘上,是我们需要进行精确定位的目标棋子。在检测棋子及计算棋子位置时可以不用关注棋盘之外的图像,从而增加了系统鲁棒性,提高了定位效率。In the embodiment of the device, after the corner coordinate acquisition sub-module acquires the coordinates of the four corner points of the checkerboard in the plane identifier coordinate system, the target area determining sub-module is according to the four corner points of the checkboard. The coordinates in the plane identifier coordinate system and the homography matrix of the current field of view of the camera Depicting pixel coordinates of four corner points of the board; and selecting a quadrilateral area composed of four corner points of the board as a target area in the video image frame; the image recognition module can narrow the image recognition range to the target area, The pieces recognized by the image recognition module in the target area are definitely on the board, which is the target piece that we need to accurately locate. When detecting the pieces and calculating the position of the pieces, the images outside the board can be ignored, thereby increasing the robustness of the system and improving the positioning efficiency.
本发明的系统实施例与本发明的方法实施例对应,本发明的方法实施例的技术细节同样也适用于本发明的系统实施例,因此,本发明的系统实施例也可以参考本发明的方法实施例,两者可相互参考说明。The system embodiment of the present invention corresponds to the method embodiment of the present invention, and the technical details of the method embodiment of the present invention are also applicable to the system embodiment of the present invention. Therefore, the system embodiment of the present invention can also refer to the method of the present invention. For the embodiments, the two can be referred to each other.
本发明还公开了一种存储介质,所述存储介质存储有多条指令,所述多条指令被一个或者多个处理器执行,以实现下述步骤:The invention also discloses a storage medium storing a plurality of instructions, the plurality of instructions being executed by one or more processors to implement the following steps:
S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
S200对所述视频图像帧进行图像处理,识别所述平面标识物;S200 performs image processing on the video image frame to identify the plane identifier;
S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
较佳的,在上述基础上,本发明存储介质的另一实施例,所述存储介质存储有多条指令,所述多条指令被一个或者多个处理器执行,以实现任一本发明所述的基于机器视觉的棋子定位方法实施例的步骤。Preferably, on the basis of the above, another embodiment of the storage medium of the present invention, the storage medium stores a plurality of instructions, and the plurality of instructions are executed by one or more processors to implement any of the present inventions. The steps of the embodiment of the machine vision based chess piece positioning method.
本发明所述的基于机器视觉的棋子定位方法的步骤可参见前面的方法实施例部分,为减少重复,此处不再赘叙。The steps of the machine vision-based chess piece positioning method of the present invention can be referred to the previous method embodiment part, and the repetition is not repeated here.
最后,本发明还公开了一种机器人,包括:处理器,用于实现各指令;存储介质,用于存储多条指令;其中:所述处理器用于执行所述存储介质存储的指令,以实现本发明所述的基于机器视觉的棋子定位方法实施例的步骤。Finally, the present invention also discloses a robot, comprising: a processor for implementing each instruction; a storage medium for storing a plurality of instructions; wherein: the processor is configured to execute an instruction stored by the storage medium to implement The steps of the embodiment of the machine vision based chess piece positioning method of the present invention.
如图16所示,本发明的机器人另一实施例,机器人包括:存储器1001、一个或多个(图中仅示出一个)处理器1002、外设接口1003、摄像模块1004、音 频模块1005以及触控屏幕1006。这些组件通过一条或多条通讯总线1007/信号线相互通讯。As shown in FIG. 16, another embodiment of the robot of the present invention includes: a memory 1001, one or more (only one shown in the figure) processor 1002, a peripheral interface 1003, a camera module 1004, and a sound. The frequency module 1005 and the touch screen 1006. These components communicate with one another via one or more communication buses 1007/signal lines.
可以理解,图16所示的结构仅仅为示意,并不是对机器人的结构造成限定,机器人还可以包括比图16所示更多或者更少的组件,或者具有与图16所示不同的装置。图16所示的各组件可以采用硬件、软件或其组合实现。It will be understood that the structure shown in FIG. 16 is merely illustrative and does not limit the structure of the robot. The robot may also include more or less components than those shown in FIG. 16, or have different devices than those shown in FIG. The components shown in FIG. 16 can be implemented in hardware, software, or a combination thereof.
存储器可用于存储软件程序以及模块,如本发明实施例中的基于机器视觉的棋子定位方法及系统实施例对应的程序指令/模块,处理器通过允许存储在存储器内的软件程序/模块,从而执行各种功能应用以及数据处理,即实现上述的基于机器视觉的棋子定位方法/系统。The memory can be used to store software programs and modules, such as the machine vision-based chess piece positioning method and the program instructions/modules corresponding to the system embodiments in the embodiment of the present invention, and the processor executes by allowing software programs/modules stored in the memory. Various functional applications and data processing, that is, the above-described machine vision-based chess piece positioning method/system is implemented.
存储器可包括高速随机存储器,还可包括非易失性存储器,比如一个或多个磁性存储装置、闪存或者其他非易失性固态存储器。所述的存储介质可为磁碟、光盘、只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)等。The memory can include high speed random access memory and can also include non-volatile memory such as one or more magnetic storage devices, flash memory or other non-volatile solid state memory. The storage medium may be a magnetic disk, an optical disk, a read only memory (ROM), a random access memory (RAM), or the like.
外设接口将各种输入/输出装置耦合至CPU一级存储器。处理器运行存储器内的各种软件、指令一致性机器人的各种功能以及进行数据处理。The peripheral interface couples various input/output devices to the CPU level one memory. The processor runs various software in the memory, commands various functions of the robot, and performs data processing.
摄像模块用于拍摄视频,相当于是机器人的眼睛,比如采用CCD摄像头等。The camera module is used to capture video, which is equivalent to the eyes of a robot, such as a CCD camera.
音频模块,用于接收或发送声音信号,可包含一个或多个麦克风、一个或多个扬声器以及音频电路。便于机器人从环境捕捉声音信号,以及将通过麦克风或扬声器与人进行交流。An audio module for receiving or transmitting a sound signal, which may include one or more microphones, one or more speakers, and an audio circuit. It is convenient for the robot to capture sound signals from the environment and to communicate with people through a microphone or speaker.
触控屏幕在机器人与人之间同时提供一个输出及输入界面。具体的,触控屏幕向人显示视频输出,这些视频输出的内容可包括文字、图形、视频及其任意组合。一些输入结果是对应与一些用户解密对象。触控屏幕还接收人类的点击、滑动等手势操作。触控屏幕的具体实施例包括但不限于液晶显示器或发光聚合物显示器。 The touch screen provides an output and input interface between the robot and the person. Specifically, the touch screen displays video output to a person, and the content of the video output may include text, graphics, video, and any combination thereof. Some input results are corresponding to some users decrypting the object. The touch screen also receives human gestures such as clicks, slides, and the like. Specific embodiments of touch screens include, but are not limited to, liquid crystal displays or light emitting polymer displays.
本发明实施例中,所述基于机器视觉的棋子定位方法及系统、存储介质与机器人属于同一构思,在所述机器人上,通过处理器执行所述存储介质中存储的指令,可以运行相应的所述基于机器视觉的棋子定位方法实施例中提供的方法,其具体实现过程详见前面的基于机器视觉的棋子定位方法实施例,此处不再赘述。In the embodiment of the present invention, the machine vision-based chess piece positioning method and system, the storage medium and the robot belong to the same concept, and on the robot, the instructions stored in the storage medium are executed by the processor, and the corresponding office can be operated. The method provided in the embodiment of the machine-based chess piece positioning method is described in detail in the previous embodiment of the machine vision-based chess piece positioning method, and details are not described herein again.
需要说明的是,本领域普通测试人员可以理解实现本发明实施例所述基于机器视觉的棋子定位方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,所述计算机程序可存储于一计算机可读取存储介质中,如存储在机器人的存储器中,并被该机器人内的至少一个处理器执行,在执行过程中可包括如所述基于机器视觉的棋子定位方法实施例的流程。It should be noted that a general tester in the art can understand that all or part of the process of implementing the machine vision-based piece positioning method according to the embodiment of the present invention can be completed by controlling a related hardware by a computer program. Stored in a computer readable storage medium, such as in a memory of the robot, and executed by at least one processor within the robot, and may include, as described, a machine vision based chess piece positioning method embodiment Process.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While the preferred embodiment of the invention has been described, it will be understood that Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。 It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims (18)

  1. 一种基于机器视觉的棋子定位方法,其特征在于,应用于对设有平面标识物的棋盘上的棋子进行定位,所述棋子定位方法包括:A machine vision-based chess piece positioning method is characterized in that it is applied to positioning a chess piece on a chessboard provided with a planar identifier, the chess piece positioning method comprising:
    S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧;S100 acquires a video stream by using a camera, and collects a video image frame from the video stream;
    S200对所述视频图像帧进行图像处理,识别所述平面标识物;S200 performs image processing on the video image frame to identify the plane identifier;
    S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。S300 calculates a position of the piece on the board relative to the identifier according to the plane identifier and the internal parameter matrix of the camera acquired in advance, thereby positioning the position of the piece.
  2. 根据权利要求1所述的一种基于机器视觉的棋子定位方法,其特征在于,在所述步骤S100通过摄像头获取视频流,并从所述视频流中采集视频图像帧之前还包括:The machine vision-based piece positioning method according to claim 1, wherein the capturing of the video stream by the camera in the step S100 and the capturing of the video image frame from the video stream further comprises:
    S010对所述摄像头进行标定,获取所述摄像头的内参矩阵。S010 calibrates the camera to obtain an internal reference matrix of the camera.
  3. 根据权利要求1所述的一种基于机器视觉的棋子定位方法,其特征在于,所述步骤S200对所述视频图像帧进行图像处理,识别所述平面标识物具体为:The machine vision-based chess piece locating method according to claim 1, wherein the step S200 performs image processing on the video image frame, and the identifying the planar identifier is specifically:
    S210对所述视频图像帧进行二值分割,并从分割后的二值化图像中提取外形轮廓;S210 performs binary segmentation on the video image frame, and extracts a contour from the segmented binarized image;
    S220根据预存的所述平面标识物所对应的外形轮廓的共性特征,从提取的外形轮廓中选取具有所述共性特征的外形轮廓作为备选轮廓;S220: selecting, according to a common feature of the pre-stored contour identifiers of the plane identifiers, an outline contour having the common features as an alternative contour from the extracted contour contours;
    S230获取所述备选轮廓的正视图;S230 acquires a front view of the candidate contour;
    S240当所述备选轮廓的正视图与预存的所述平面标识物模板一致时,识别所述备选轮廓对应的图像为所述平面标识物的图像。S240: When the front view of the candidate contour is consistent with the pre-stored planar identifier template, the image corresponding to the candidate contour is identified as an image of the planar identifier.
  4. 根据权利要求3所述的一种基于机器视觉的棋子定位方法,其特征在于,所述平面标识物为正方形,所述步骤S220中预存的所述平面标识物所对 应的外形轮廓的共性特征为四边形;The machine vision-based piece positioning method according to claim 3, wherein the plane identifier is a square, and the plane identifier pre-stored in the step S220 is The common feature of the shape profile is quadrilateral;
    所述步骤S230获取所述备选轮廓的正视图具体为:The step S230 obtains a front view of the candidate contour, which is specifically:
    S231读取所述备选轮廓的四个顶点的像素坐标;S231 reading pixel coordinates of four vertices of the candidate contour;
    S232定义所述备选轮廓经过射影变换为正视图后的四个顶点的像素坐标为预存的所述平面标志物的正视图的四个顶点的像素坐标;S232 defines a pixel coordinate of the four vertices after the candidate profile is subjected to projective transformation into a front view as pixel coordinates of four pre-existing front views of the planar marker;
    S233将上述获取的四组所述备选轮廓的顶点的像素坐标及所述定义的备选轮廓转换为正视图后的顶点的像素坐标分别代入下述方程,求取射影变换矩阵H:S233, the pixel coordinates of the vertices of the four sets of the candidate contours obtained by the above-mentioned acquired candidate contours and the pixel coordinates of the vertices after the definition of the candidate contour are converted into the following equations, and the projection transformation matrix H is obtained:
    Figure PCTCN2017112210-appb-100001
    Figure PCTCN2017112210-appb-100001
    其中,X为备选轮廓顶点的齐次像素坐标,其非齐次像素坐标为
    Figure PCTCN2017112210-appb-100002
    Figure PCTCN2017112210-appb-100003
    X'为射影变换后顶点的齐次坐标,其非齐次像素坐标为
    Figure PCTCN2017112210-appb-100004
    Figure PCTCN2017112210-appb-100005
    Where X is the homogeneous pixel coordinate of the candidate silhouette vertex, and the non-homogeneous pixel coordinates are
    Figure PCTCN2017112210-appb-100002
    Figure PCTCN2017112210-appb-100003
    X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
    Figure PCTCN2017112210-appb-100004
    Figure PCTCN2017112210-appb-100005
    S234根据所述射影变换矩阵H,对所述备选轮廓对应的二值化图像的所有像素都执行射影变换,获得所述备选轮廓包含的区域对应的正视图。S234 performs projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H, and obtains a front view corresponding to the region included in the candidate contour.
  5. 根据权利要求1-4任一项所述的一种基于机器视觉的棋子定位方法,其特征在于,所述步骤S300根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置具体为:The machine vision-based chess piece positioning method according to any one of claims 1 to 4, wherein the step S300 calculates the chessboard based on the plane identifier and the pre-acquired internal parameter matrix of the camera. The position of the piece relative to the marker, thereby locating the position of the piece is specifically:
    S310根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵; S310: calculating, according to the plane identifier and the pre-acquired internal reference matrix of the camera, a homography matrix of a current field of view of the camera;
    S320根据棋盘上预设参考点在平面标识物坐标系中的已知坐标及在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在所述平面标识物坐标系中的坐标;S320: according to the known coordinates of the preset reference point on the checkerboard in the plane identifier coordinate system and the rank position on the checkerboard, combined with the grid length feature of the checkerboard, acquiring the four corner points of the checkerboard in the plane The coordinates in the marker coordinate system;
    S330识别所述视频图像帧中的棋子,读取所述棋子的像素坐标,并根据所述单应性矩阵获取所述棋子在所述平面标识物坐标系中的坐标;S330 identifies a piece in the video image frame, reads pixel coordinates of the piece, and acquires coordinates of the piece in the plane identifier coordinate system according to the homography matrix;
    S340根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,结合所述棋盘的网格长度特征,获取所述棋子在棋盘上的位置。S340 obtains the position of the chess piece on the chessboard according to the coordinates of the chess piece and the four corner points of the chessboard in the plane identifier coordinate system, combined with the grid length feature of the chessboard.
  6. 根据权利要求5所述的一种基于机器视觉的棋子定位方法,其特征在于,所述步骤S310根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵具体为:The machine vision-based chess piece positioning method according to claim 5, wherein the step S310 calculates the current field of view of the camera according to the plane identifier and the internal parameter matrix of the camera acquired in advance. The homography matrix is specifically:
    S311选取所述平面标识物坐标系为世界坐标系;S311 selects the plane identifier coordinate system as a world coordinate system;
    S312读取所述平面标识物的四个顶点的像素坐标;S312 reading pixel coordinates of four vertices of the planar identifier;
    S313将已知的所述平面标识物的四个顶点在世界坐标系的坐标、所述平面标识物的四个顶点的像素坐标,及所述预先获取的所述摄像头的内部参数分别代入下述公式:S313 substituting the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system, the pixel coordinates of the four vertices of the planar identifier, and the internal parameters of the camera obtained in advance into the following formula:
    Figure PCTCN2017112210-appb-100006
    Figure PCTCN2017112210-appb-100006
    计算出当前视场的单应性矩阵H=M[r1,r2,r3,t];Calculate the homography matrix H=M[r1,r2,r3,t] of the current field of view;
    其中,(x,y,1)表示所述平面标识物中任一顶点在摄像机的图像坐标系中像素坐标的齐次坐标,(X,Y,Z,1)表示所述顶点在世界坐标系中的齐次坐标,简化为(X,Y,0,1),s为引入的任意尺度比例参数,M为摄像机内参矩阵,r1、r2、r3分别表示所述平面标识物坐标系相对于摄像机坐标系的旋转矩阵中的三个列向量,t为平移向量。 Where (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any vertex in the plane image in the image coordinate system of the camera, and (X, Y, Z, 1) indicates that the vertex is in the world coordinate system The homogeneous coordinates in the middle are reduced to (X, Y, 0, 1), s is the introduced arbitrary scale proportional parameter, M is the camera internal reference matrix, and r1, r2, r3 respectively represent the planar marker coordinate system relative to the camera. Three column vectors in the rotation matrix of the coordinate system, t is the translation vector.
  7. 根据权利要求5所述的一种基于机器视觉的棋子定位方法,其特征在于,在所述步骤S330之后、所述步骤S340之前,还包括:The machine vision-based chess piece locating method according to claim 5, wherein after the step S330 and before the step S340, the method further comprises:
    S335根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,确定所述棋子处于所述棋盘的四个角点组成的四边形区域内。S335 determines, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, that the pieces are in a quadrilateral area composed of four corner points of the board.
  8. 根据权利要求5所述的一种基于机器视觉的棋子定位方法,其特征在于,在所述步骤S320之后、所述步骤S330之前,还包括:The machine vision-based chess piece locating method according to claim 5, wherein after the step S320 and before the step S330, the method further comprises:
    S325根据所述棋盘的四个角点在所述平面标识物坐标系中的坐标、及所述摄像头当前视场的单应性矩阵,获得所述棋盘四个角点的像素坐标;S325: obtaining pixel coordinates of four corner points of the checkboard according to coordinates of the four corner points of the checkerboard in the plane identifier coordinate system and a homography matrix of the current field of view of the camera;
    S326根据所述棋盘四个角点的像素坐标,选取所述棋盘四个角点组成的四边形区域作为所述视频图像帧中的目标区域;S326: selecting, according to pixel coordinates of the four corner points of the checkerboard, a quadrilateral region composed of four corner points of the checkerboard as a target area in the video image frame;
    所述步骤S330识别所述视频图像帧中的棋子,并读取所述棋子的像素坐标,并根据所述单应性矩阵获取所述棋子在所述平面标识物坐标系中的坐标具体为:The step S330 identifies the pieces in the video image frame, and reads the pixel coordinates of the piece, and acquires the coordinates of the piece in the plane identifier coordinate system according to the homography matrix:
    S331在所述视频图像帧中的目标区域内识别棋子,并读取所述棋子的像素坐标;S331 identifies a piece in a target area in the video image frame, and reads pixel coordinates of the piece;
    S332根据所述棋子的像素坐标及所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标。S332: Acquire coordinates of the chess piece in the plane identifier coordinate system according to the pixel coordinates of the chess piece and the homography matrix.
  9. 一种基于机器视觉的棋子定位系统,其特征在于,应用于对设有平面标识物的棋盘上的棋子进行定位,所述基于机器视觉的棋子定位系统包括:A machine vision-based chess piece positioning system is characterized in that it is applied to positioning a chess piece on a chessboard provided with a plane identifier, the machine vision-based chess piece positioning system comprising:
    摄像采集模块,用于获取视频流,并从所述视频流中采集视频图像帧;a camera acquisition module, configured to acquire a video stream, and collect a video image frame from the video stream;
    图像识别模块,用于对所述摄像采集模块采集的视频图像帧进行图像处理,从而在所述视频图像帧中识别出所述平面标识物;An image recognition module, configured to perform image processing on a video image frame acquired by the camera acquisition module, to identify the planar identifier in the video image frame;
    定位模块,用于根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算棋盘上的棋子相对于所述标识物的位置,从而定位棋子的位置。 And a positioning module, configured to calculate a position of the piece on the board relative to the identifier according to the plane identifier and an internal parameter matrix of the camera acquired in advance, thereby locating the position of the piece.
  10. 根据权利要求9所述的一种基于机器视觉的棋子定位系统,其特征在于,还包括:A machine vision-based chess piece positioning system according to claim 9, further comprising:
    标定模块,用于对所述摄像头进行标定,获取所述摄像头的内参矩阵。The calibration module is configured to calibrate the camera to obtain an internal parameter matrix of the camera.
  11. 根据权利要求9所述的一种基于机器视觉的棋子定位系统,其特征在于,A machine vision based chess piece positioning system according to claim 9, wherein
    所述图像识别模块包括:The image recognition module includes:
    二值分割子模块,用于对所述视频图像帧进行二值分割;a binary segmentation submodule, configured to perform binary segmentation on the video image frame;
    外形提取子模块,用于从分割后的二值化图像中提取外形轮廓;a shape extraction sub-module for extracting a contour from the segmented binarized image;
    存储子模块,用于存储所述平面标志物所对应的外形轮廓的共性特征、所述平面标识物模板;a storage submodule, configured to store a common feature of the outline corresponding to the planar marker, and the planar identifier template;
    判断处理子模块,用于根据所述存储子模块中存储的所述平面标识物所对应的外形轮廓的共性特征,从所述外形提取子模块提取的外形轮廓中选取具有所述共性特征的外形轮廓作为备选轮廓;a judging processing module, configured to select, according to a common feature of the contour contour corresponding to the plane identifier stored in the storage submodule, an outer shape extracted from the outer shape extracting submodule The contour is used as an alternative contour;
    正视图获取子模块,用于获取所述备选轮廓的正视图;a front view obtaining submodule for obtaining a front view of the candidate contour;
    识别子模块,用于当所述备选轮廓的正视图与所述存储子模块预存的所述平面标识物模板一致时,识别所述备选轮廓对应的图像为所述平面标识物的图像。And an identifying sub-module, configured to identify, when the front view of the candidate contour is consistent with the planar identifier template pre-stored by the storage sub-module, an image corresponding to the candidate contour as an image of the planar identifier.
  12. 根据权利要求11所述的一种基于机器视觉的棋子定位系统,其特征在于,所述平面标识物为正方形,所述存储子模块存储的所述平面标识物所对应的外形轮廓的共性特征为四边形;The machine vision-based chess piece positioning system according to claim 11, wherein the planar identifier is a square, and the common feature of the outline corresponding to the planar identifier stored by the storage sub-module is quadrilateral;
    所述正视图获取子模块包括:The front view obtaining submodule includes:
    读取单元,用于读取所述备选轮廓的四个顶点的像素坐标;a reading unit, configured to read pixel coordinates of four vertices of the candidate contour;
    定义单元,用于定义所述备选轮廓经过射影变换为正视图后的四个顶点 的像素坐标为预存的所述平面标志物的正视图的四个顶点的像素坐标;Defining a unit for defining four vertices after the candidate contour is projectively transformed into a front view The pixel coordinates are the pixel coordinates of the four vertices of the front view of the pre-stored planar marker;
    计算单元,用于根据所述读取单元读取的四个顶点像素坐标及所述定义单元定义的四个顶点像素坐标,通过下述方程,求取射影变换矩阵H,a calculating unit, configured to obtain a projective transformation matrix H according to four vertex pixel coordinates read by the reading unit and four vertex pixel coordinates defined by the defining unit, by using an equation
    Figure PCTCN2017112210-appb-100007
    Figure PCTCN2017112210-appb-100007
    其中,X为备选轮廓顶点的齐次像素坐标,其非齐次像素坐标为
    Figure PCTCN2017112210-appb-100008
    Figure PCTCN2017112210-appb-100009
    X'为射影变换后顶点的齐次坐标,其非齐次像素坐标为
    Figure PCTCN2017112210-appb-100010
    Figure PCTCN2017112210-appb-100011
    Where X is the homogeneous pixel coordinate of the candidate silhouette vertex, and the non-homogeneous pixel coordinates are
    Figure PCTCN2017112210-appb-100008
    Figure PCTCN2017112210-appb-100009
    X' is the homogeneous coordinate of the vertex after the projective transformation, and its non-homogeneous pixel coordinates are
    Figure PCTCN2017112210-appb-100010
    Figure PCTCN2017112210-appb-100011
    变换单元,用于根据所述计算单元求取的射影变换矩阵H,对所述备选轮廓对应的二值化图像的所有像素都执行射影变换,获得所述备选轮廓包含的区域对应的正视图。a transforming unit, configured to perform a projective transformation on all pixels of the binarized image corresponding to the candidate contour according to the projective transformation matrix H obtained by the calculating unit, to obtain a front view corresponding to the region included in the candidate contour Figure.
  13. 根据权利要求9-12任一项所述的一种基于机器视觉的棋子定位系统,其特征在于,所述图像识别模块,还用于对所述视频图像帧进行图像处理,从而在所述视频图像帧中识别出棋子;A machine vision-based piece positioning system according to any one of claims 9 to 12, wherein the image recognition module is further configured to perform image processing on the video image frame, thereby The pieces are identified in the image frame;
    所述定位模块包括:The positioning module includes:
    单应性矩阵获取子模块,用于根据所述平面标识物及预先获取的所述摄像头的内参矩阵,计算所述摄像头当前视场的单应性矩阵;a homography matrix acquisition sub-module, configured to calculate a homography matrix of a current field of view of the camera according to the plane identifier and an internal parameter matrix of the camera acquired in advance;
    角点坐标获取子模块,用于根据棋盘上预设参考点在平面标识物坐标系中的已知坐标及在棋盘上的行列位置,结合所述棋盘的网格长度特征,获取所述棋盘的四个角点在所述平面标识物坐标系中的坐标;a corner coordinate acquisition sub-module, configured to acquire the checkerboard according to a known coordinate of a preset reference point on the checkerboard in a plane identifier coordinate system and a rank position on the checkerboard, combined with a grid length feature of the checkerboard The coordinates of the four corner points in the plane identifier coordinate system;
    棋子坐标获取子模块,用于根据所述图像识别模块识别出的棋子,读取所述棋子的像素坐标,并根据所述单应性矩阵,获取所述棋子在所述平面标 识物坐标系中的坐标;a piece coordinate acquisition sub-module, configured to read a pixel coordinate of the piece according to the piece recognized by the image recognition module, and obtain the piece of the piece in the plane mark according to the homography matrix The coordinates in the object coordinate system;
    棋子定位子模块,用于根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,结合所述棋盘的网格长度特征,获取所述棋子在棋盘上的位置。a piece positioning sub-module, configured to acquire the piece of the piece on the chessboard according to the coordinates of the piece and the four corner points of the board in the plane identifier coordinate system, combined with the grid length feature of the board position.
  14. 根据权利要求13所述的一种基于机器视觉的棋子定位系统,其特征在于,所述单应性矩阵获取子模块包括:The machine vision-based chess piece positioning system according to claim 13, wherein the homography matrix acquisition sub-module comprises:
    坐标系确定单元,用于选取所述平面标识物坐标系为世界坐标系;a coordinate system determining unit, configured to select the plane identifier coordinate system as a world coordinate system;
    顶点坐标读取单元,用于读取所述平面标识物的四个顶点的像素坐标;a vertex coordinate reading unit, configured to read pixel coordinates of four vertices of the plane identifier;
    运算单元,用于将已知的所述平面标识物的四个顶点在世界坐标系的坐标、所述平面标识物的四个顶点的像素坐标,及所述预先获取的所述摄像头的内部参数分别代入下述公式:An operation unit, configured to use the coordinates of the four vertices of the known planar identifier in the coordinates of the world coordinate system, the pixel coordinates of the four vertices of the planar identifier, and the pre-acquired internal parameters of the camera Substituting the following formulas:
    Figure PCTCN2017112210-appb-100012
    Figure PCTCN2017112210-appb-100012
    计算出当前视场的单应性矩阵H=M[r1,r2,r3,t];Calculate the homography matrix H=M[r1,r2,r3,t] of the current field of view;
    其中,(x,y,1)表示视觉定位标识中任一角点在摄像机的图像坐标系中像素坐标的齐次坐标,(X,Y,Z,1)表示所述顶点在世界坐标系中的齐次坐标,简化为(X,Y,0,1),s为引入的任意尺度比例参数,M为摄像机内参矩阵,r1、r2、r3分别表示视觉定位标识坐标系相对于摄像机坐标系的旋转矩阵中的三个列向量,t为平移向量。Where (x, y, 1) represents the homogeneous coordinate of the pixel coordinates of any corner point in the visual positioning identifier in the image coordinate system of the camera, and (X, Y, Z, 1) indicates that the vertex is in the world coordinate system. The homogeneous coordinates are reduced to (X, Y, 0, 1), s is the introduced arbitrary scale proportional parameter, M is the camera internal reference matrix, and r1, r2, and r3 respectively represent the rotation of the visual positioning identification coordinate system relative to the camera coordinate system. Three column vectors in the matrix, t is the translation vector.
  15. 根据权利要求13所述的一种基于机器视觉的棋子定位系统,其特征在于,所述定位模块还包括:The machine vision-based chess piece positioning system according to claim 13, wherein the positioning module further comprises:
    判断子模块,用于根据所述棋子及所述棋盘的四个角点在所述平面标识物坐标系中的坐标,确定所述棋子处于所述棋盘的四个角点组成的四边形区 域内。a judging sub-module, configured to determine, according to the coordinates of the pieces and the four corner points of the board in the plane identifier coordinate system, that the pieces are in a quadrilateral area composed of four corner points of the board Within the domain.
  16. 根据权利要求13所述的一种基于机器视觉的棋子定位系统,其特征在于,所述定位模块还包括:The machine vision-based chess piece positioning system according to claim 13, wherein the positioning module further comprises:
    目标区域确定子模块,用于根据所述棋盘的四个角点在所述平面标识物坐标系中的坐标、及所述摄像头当前视场的单应性矩阵,获得所述棋盘四个角点的像素坐标;并选取所述棋盘四个角点组成的四边形区域作为所述视频图像帧中的目标区域;a target area determining submodule, configured to obtain four corner points of the checkboard according to coordinates of the four corner points of the checkerboard in the plane identifier coordinate system and a homography matrix of a current field of view of the camera Pixel coordinates; and selecting a quadrilateral region composed of four corner points of the checkerboard as a target region in the video image frame;
    所述棋子坐标获取子模块包括:The chess piece coordinate acquisition sub-module includes:
    棋子像素坐标读取单元,用于所述图像识别模块在所述视频图像帧中的目标区域内识别出棋子后,读取所述棋子的像素坐标;a chess piece pixel coordinate reading unit, configured to: after the image recognition module recognizes a piece in the target area in the video image frame, read pixel coordinates of the piece;
    棋子坐标计算单元,用于根据所述棋子的像素坐标及所述单应性矩阵,获取所述棋子在所述平面标识物坐标系中的坐标。The piece coordinate calculation unit is configured to acquire coordinates of the piece in the plane identifier coordinate system according to the pixel coordinates of the piece and the homography matrix.
  17. 一种存储介质,其特征在于,所述存储介质存储有多条指令,所述多条指令被一个或者多个处理器执行,以实现权利要求1-8中任一项所述的基于机器视觉的棋子定位方法的步骤。A storage medium, characterized in that the storage medium stores a plurality of instructions, the plurality of instructions being executed by one or more processors to implement the machine vision according to any one of claims 1-8 The steps of the chess piece positioning method.
  18. 一种机器人,其特征在于,包括:A robot characterized by comprising:
    处理器,用于实现各指令;a processor for implementing each instruction;
    存储介质,用于存储多条指令;a storage medium for storing a plurality of instructions;
    其中:所述处理器用于执行所述存储介质存储的指令,以实现权利要求1-8任一项所述的基于机器视觉的棋子定位方法的步骤。 Wherein: the processor is configured to execute the instructions stored in the storage medium to implement the steps of the machine vision based piece positioning method according to any one of claims 1-8.
PCT/CN2017/112210 2017-10-25 2017-11-21 Chess piece positioning method and system based on machine vision, storage medium, and robot WO2019080229A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711006222.4 2017-10-25
CN201711006222.4A CN107766855B (en) 2017-10-25 2017-10-25 Chessman positioning method and system based on machine vision, storage medium and robot

Publications (1)

Publication Number Publication Date
WO2019080229A1 true WO2019080229A1 (en) 2019-05-02

Family

ID=61271298

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/112210 WO2019080229A1 (en) 2017-10-25 2017-11-21 Chess piece positioning method and system based on machine vision, storage medium, and robot

Country Status (2)

Country Link
CN (1) CN107766855B (en)
WO (1) WO2019080229A1 (en)

Cited By (36)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110211183A (en) * 2019-06-13 2019-09-06 广州番禺职业技术学院 The multi-target positioning system and method for big visual field LED lens attachment are imaged based on single
CN110260866A (en) * 2019-07-19 2019-09-20 闪电(昆山)智能科技有限公司 A kind of robot localization and barrier-avoiding method of view-based access control model sensor
CN110472625A (en) * 2019-08-05 2019-11-19 浙江大学 A kind of pieces of chess visual identity method based on Fourier descriptor
CN111136669A (en) * 2020-01-17 2020-05-12 沈阳航空航天大学 Chess playing robot based on global vision and control method thereof
CN111177673A (en) * 2019-12-30 2020-05-19 四川云盾光电科技有限公司 Equipment safety controller based on vision
CN111369614A (en) * 2020-02-26 2020-07-03 辽宁中新自动控制集团股份有限公司 Intelligent vehicle and method for automatically tracking and recording go chess manual
CN111429530A (en) * 2020-04-10 2020-07-17 浙江大华技术股份有限公司 Coordinate calibration method and related device
CN111627070A (en) * 2020-04-30 2020-09-04 贝壳技术有限公司 Method and device for calibrating rotating shaft and storage medium
CN111680685A (en) * 2020-04-14 2020-09-18 上海高仙自动化科技发展有限公司 Image-based positioning method and device, electronic equipment and storage medium
CN111798511A (en) * 2020-05-21 2020-10-20 扬州哈工科创机器人研究院有限公司 Chessboard and chessman positioning method and device
CN112001945A (en) * 2020-07-13 2020-11-27 西安理工大学 Multi-robot monitoring method suitable for production line operation
CN112037281A (en) * 2020-08-18 2020-12-04 重庆大学 Visual system for guiding automatic hair follicle harvesting machine
CN112184831A (en) * 2020-09-23 2021-01-05 深兰自动驾驶研究院(山东)有限公司 Automatic corresponding calibration method, system and device for RGB image and IR image
CN112288751A (en) * 2020-10-12 2021-01-29 董宇青 Automatic floor sweeping device and control algorithm
CN112308933A (en) * 2020-11-06 2021-02-02 歌尔光学科技有限公司 Method and device for calibrating camera internal reference and computer storage medium
CN112465916A (en) * 2020-11-27 2021-03-09 浙江光珀智能科技有限公司 RGBD binocular calibration method and system based on full-view-field plane calibration plate
CN112507926A (en) * 2020-12-16 2021-03-16 电子科技大学 Go game repeating method based on video image analysis
CN112614193A (en) * 2020-12-25 2021-04-06 中国农业大学 Intelligent calibration method for wheat green turning period spray interested region based on machine vision
CN112686959A (en) * 2019-10-18 2021-04-20 菜鸟智能物流控股有限公司 Method and device for correcting image to be recognized
CN112907506A (en) * 2021-01-11 2021-06-04 昆明理工大学 Water gauge color information-based indefinite-length water gauge water level detection method and device and storage medium
CN113128499A (en) * 2021-03-23 2021-07-16 苏州华兴源创科技股份有限公司 Vibration testing method of visual imaging device, computer device and storage medium
CN113192123A (en) * 2020-01-14 2021-07-30 杭州海康威视数字技术股份有限公司 Image processing method, device and equipment
CN113421307A (en) * 2021-06-22 2021-09-21 恒睿(重庆)人工智能技术研究院有限公司 Target positioning method and device, computer equipment and storage medium
CN113450414A (en) * 2020-03-24 2021-09-28 阿里巴巴集团控股有限公司 Camera calibration method, device, system and storage medium
CN113743492A (en) * 2021-08-30 2021-12-03 许继集团有限公司 Method and device for sequencing row positions and column positions of pressing plates
CN113808195A (en) * 2021-08-26 2021-12-17 领翌技术(横琴)有限公司 Visual positioning method, device and storage medium
CN113838149A (en) * 2021-10-09 2021-12-24 智道网联科技(北京)有限公司 Camera internal reference calibration method, server and system for automatic driving vehicle
CN113888558A (en) * 2021-09-26 2022-01-04 武汉钢铁有限公司 Ladle slag surface image correction method
CN114001674A (en) * 2021-09-30 2022-02-01 西北工业大学 Machine vision measurement method for wire harness bending radius under free visual angle
CN114399507A (en) * 2022-03-25 2022-04-26 季华实验室 Mobile phone appearance quality detection method and device, electronic equipment and storage medium
CN114693708A (en) * 2022-04-20 2022-07-01 太原理工大学 Anchor mesh same-row central point matching method and system
CN114882124A (en) * 2022-07-06 2022-08-09 季华实验室 Calibration device, calibration method, calibration device, electronic apparatus, and storage medium
CN115026828A (en) * 2022-06-23 2022-09-09 池州市安安新材科技有限公司 Robot arm grabbing control method and system
CN115797467A (en) * 2023-02-02 2023-03-14 深圳市德驰微视技术有限公司 Method, device and equipment for detecting calibration result of vehicle camera and storage medium
CN116499456A (en) * 2023-06-28 2023-07-28 苏州中德睿博智能科技有限公司 Automatic positioning device and method for mobile robot and positioning system for unmanned mower
WO2023169186A1 (en) * 2022-03-10 2023-09-14 华为技术有限公司 Positioning method and related device

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110310334B (en) * 2018-03-20 2023-05-16 深圳市华大智造软件技术有限公司 Biochip positioning method, gene sequencer, system and storage medium
CN108627092A (en) * 2018-04-17 2018-10-09 南京阿凡达机器人科技有限公司 A kind of measurement method, system, storage medium and the mobile terminal of package volume
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
CN108986163A (en) * 2018-06-29 2018-12-11 南京睿悦信息技术有限公司 Augmented reality location algorithm based on more mark identifications
CN110660186B (en) * 2018-06-29 2022-03-01 杭州海康威视数字技术股份有限公司 Method and device for identifying target object in video image based on radar signal
CN109084953B (en) * 2018-08-28 2020-03-31 水利部交通运输部国家能源局南京水利科学研究院 Device and method for acquiring wave characteristic parameters in water tank
CN109445455B (en) * 2018-09-21 2022-09-30 深圳供电局有限公司 Unmanned aerial vehicle autonomous landing method and control system thereof
CN109448045B (en) * 2018-10-23 2021-02-12 南京华捷艾米软件科技有限公司 SLAM-based planar polygon measurement method and machine-readable storage medium
CN109815758A (en) * 2019-01-17 2019-05-28 柳州康云互联科技有限公司 A kind of characteristics of image acquisition method based on two dimensional code
CN109829454A (en) * 2019-01-17 2019-05-31 柳州康云互联科技有限公司 A kind of characteristics of image acquisition method based on pre-training mark
CN109886278A (en) * 2019-01-17 2019-06-14 柳州康云互联科技有限公司 A kind of characteristics of image acquisition method based on ARMarker
CN110322508B (en) * 2019-06-19 2023-05-05 四川阿泰因机器人智能装备有限公司 Auxiliary positioning method based on computer vision
CN112215884A (en) * 2019-07-09 2021-01-12 北京地平线机器人技术研发有限公司 Pose determination method and device for plane marker
CN111340891B (en) * 2020-02-25 2021-02-19 卡莱特(深圳)云科技有限公司 Method and system for calibrating camera by using LED screen
CN111781113B (en) * 2020-07-08 2021-03-09 湖南九九智能环保股份有限公司 Dust grid positioning method and dust grid monitoring method
CN112270330A (en) * 2020-11-05 2021-01-26 国网甘肃省电力公司电力科学研究院 Intelligent detection method for concerned target based on Mask R-CNN neural network
CN112529097B (en) * 2020-12-23 2024-03-26 北京百度网讯科技有限公司 Sample image generation method and device and electronic equipment
CN113628273B (en) * 2021-07-23 2023-12-15 深圳市优必选科技股份有限公司 Map positioning method, map positioning device, computer readable storage medium and terminal equipment
CN114544052B (en) * 2022-01-19 2023-03-28 清华大学 Touch sensor, robot, method and device for achieving touch information acquisition

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106529531A (en) * 2016-10-31 2017-03-22 华南理工大学 Chinese chess identification system and method based on image processing
WO2017077217A1 (en) * 2015-11-04 2017-05-11 Smart Pixels 3-d calibration of a video mapping system
CN106920261A (en) * 2017-03-02 2017-07-04 江南大学 A kind of Robot Hand-eye static demarcating method
CN106924961A (en) * 2017-04-01 2017-07-07 哈尔滨工业大学 A kind of intelligent Chinese chess is played chess control method and system
CN107230234A (en) * 2017-05-08 2017-10-03 上海工程技术大学 A kind of camera plane scaling method based on three wire configuration light

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2003900861A0 (en) * 2003-02-26 2003-03-13 Silverbrook Research Pty Ltd Methods,systems and apparatus (NPS042)
CN201374082Y (en) * 2009-03-24 2009-12-30 上海水晶石信息技术有限公司 Augmented reality system based on image unique point extraction and random tree classification
CN101850178B (en) * 2010-04-22 2012-05-23 北京联合大学生物化学工程学院 Image identification based go set implement capable of automatic timing and notation
CN201744156U (en) * 2010-04-22 2011-02-16 北京联合大学生物化学工程学院 Automatic timing and manual-recording I-go chess set based on image recognition
KR20150135005A (en) * 2014-05-23 2015-12-02 (주)도울정보기술 Smart janggi robot
CN106484081A (en) * 2015-08-24 2017-03-08 吕广兴 A kind of solution of the quintet game man-machine chess based on computer vision
CN106110648A (en) * 2016-08-25 2016-11-16 张选琪 AGV Chinese chess system
CN106327534B (en) * 2016-08-31 2019-05-21 杭州沃朴物联科技有限公司 A kind of tire inner wall Texture Recognition based on locating piece
CN106548519A (en) * 2016-11-04 2017-03-29 上海玄彩美科网络科技有限公司 Augmented reality method based on ORB SLAM and the sense of reality of depth camera

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017077217A1 (en) * 2015-11-04 2017-05-11 Smart Pixels 3-d calibration of a video mapping system
CN106529531A (en) * 2016-10-31 2017-03-22 华南理工大学 Chinese chess identification system and method based on image processing
CN106920261A (en) * 2017-03-02 2017-07-04 江南大学 A kind of Robot Hand-eye static demarcating method
CN106924961A (en) * 2017-04-01 2017-07-07 哈尔滨工业大学 A kind of intelligent Chinese chess is played chess control method and system
CN107230234A (en) * 2017-05-08 2017-10-03 上海工程技术大学 A kind of camera plane scaling method based on three wire configuration light

Cited By (61)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110211183B (en) * 2019-06-13 2022-10-21 广州番禺职业技术学院 Multi-target positioning system based on single-imaging large-view-field LED lens mounting
CN110211183A (en) * 2019-06-13 2019-09-06 广州番禺职业技术学院 The multi-target positioning system and method for big visual field LED lens attachment are imaged based on single
CN110260866A (en) * 2019-07-19 2019-09-20 闪电(昆山)智能科技有限公司 A kind of robot localization and barrier-avoiding method of view-based access control model sensor
CN110472625A (en) * 2019-08-05 2019-11-19 浙江大学 A kind of pieces of chess visual identity method based on Fourier descriptor
CN110472625B (en) * 2019-08-05 2022-12-20 浙江大学 Chinese chess piece visual identification method based on Fourier descriptor
CN112686959A (en) * 2019-10-18 2021-04-20 菜鸟智能物流控股有限公司 Method and device for correcting image to be recognized
CN111177673B (en) * 2019-12-30 2023-07-14 四川云盾光电科技有限公司 Equipment safety controller based on vision
CN111177673A (en) * 2019-12-30 2020-05-19 四川云盾光电科技有限公司 Equipment safety controller based on vision
CN113192123B (en) * 2020-01-14 2024-05-24 杭州海康威视数字技术股份有限公司 Image processing method, device and equipment
CN113192123A (en) * 2020-01-14 2021-07-30 杭州海康威视数字技术股份有限公司 Image processing method, device and equipment
CN111136669B (en) * 2020-01-17 2022-09-20 沈阳航空航天大学 Chess playing robot based on global vision and control method thereof
CN111136669A (en) * 2020-01-17 2020-05-12 沈阳航空航天大学 Chess playing robot based on global vision and control method thereof
CN111369614A (en) * 2020-02-26 2020-07-03 辽宁中新自动控制集团股份有限公司 Intelligent vehicle and method for automatically tracking and recording go chess manual
CN113450414A (en) * 2020-03-24 2021-09-28 阿里巴巴集团控股有限公司 Camera calibration method, device, system and storage medium
CN111429530B (en) * 2020-04-10 2023-06-02 浙江大华技术股份有限公司 Coordinate calibration method and related device
CN111429530A (en) * 2020-04-10 2020-07-17 浙江大华技术股份有限公司 Coordinate calibration method and related device
CN111680685B (en) * 2020-04-14 2023-06-06 上海高仙自动化科技发展有限公司 Positioning method and device based on image, electronic equipment and storage medium
CN111680685A (en) * 2020-04-14 2020-09-18 上海高仙自动化科技发展有限公司 Image-based positioning method and device, electronic equipment and storage medium
CN111627070A (en) * 2020-04-30 2020-09-04 贝壳技术有限公司 Method and device for calibrating rotating shaft and storage medium
CN111627070B (en) * 2020-04-30 2024-01-19 如你所视(北京)科技有限公司 Method, device and storage medium for calibrating rotation shaft
CN111798511A (en) * 2020-05-21 2020-10-20 扬州哈工科创机器人研究院有限公司 Chessboard and chessman positioning method and device
CN112001945B (en) * 2020-07-13 2023-04-07 西安理工大学 Multi-robot monitoring method suitable for production line operation
CN112001945A (en) * 2020-07-13 2020-11-27 西安理工大学 Multi-robot monitoring method suitable for production line operation
CN112037281A (en) * 2020-08-18 2020-12-04 重庆大学 Visual system for guiding automatic hair follicle harvesting machine
CN112037281B (en) * 2020-08-18 2022-09-23 重庆大学 Visual system for guiding automatic hair follicle harvesting machine
CN112184831B (en) * 2020-09-23 2023-06-16 深兰自动驾驶研究院(山东)有限公司 Automatic corresponding calibration method, system and device for RGB image and IR image
CN112184831A (en) * 2020-09-23 2021-01-05 深兰自动驾驶研究院(山东)有限公司 Automatic corresponding calibration method, system and device for RGB image and IR image
CN112288751A (en) * 2020-10-12 2021-01-29 董宇青 Automatic floor sweeping device and control algorithm
CN112308933A (en) * 2020-11-06 2021-02-02 歌尔光学科技有限公司 Method and device for calibrating camera internal reference and computer storage medium
CN112308933B (en) * 2020-11-06 2023-01-20 歌尔光学科技有限公司 Method and device for calibrating camera internal reference and computer storage medium
CN112465916A (en) * 2020-11-27 2021-03-09 浙江光珀智能科技有限公司 RGBD binocular calibration method and system based on full-view-field plane calibration plate
CN112507926A (en) * 2020-12-16 2021-03-16 电子科技大学 Go game repeating method based on video image analysis
CN112507926B (en) * 2020-12-16 2022-07-01 电子科技大学 Go game repeating method based on video image analysis
CN112614193B (en) * 2020-12-25 2024-03-22 中国农业大学 Intelligent calibration method for wheat green-turning stage spraying region of interest based on machine vision
CN112614193A (en) * 2020-12-25 2021-04-06 中国农业大学 Intelligent calibration method for wheat green turning period spray interested region based on machine vision
CN112907506A (en) * 2021-01-11 2021-06-04 昆明理工大学 Water gauge color information-based indefinite-length water gauge water level detection method and device and storage medium
CN112907506B (en) * 2021-01-11 2023-07-07 昆明理工大学 Water gauge color information-based variable-length water gauge water level detection method, device and storage medium
CN113128499A (en) * 2021-03-23 2021-07-16 苏州华兴源创科技股份有限公司 Vibration testing method of visual imaging device, computer device and storage medium
CN113128499B (en) * 2021-03-23 2024-02-20 苏州华兴源创科技股份有限公司 Vibration testing method for visual imaging device, computer device and storage medium
CN113421307B (en) * 2021-06-22 2022-11-22 恒睿(重庆)人工智能技术研究院有限公司 Target positioning method and device, computer equipment and storage medium
CN113421307A (en) * 2021-06-22 2021-09-21 恒睿(重庆)人工智能技术研究院有限公司 Target positioning method and device, computer equipment and storage medium
CN113808195B (en) * 2021-08-26 2024-04-12 领翌技术(横琴)有限公司 Visual positioning method, device and storage medium
CN113808195A (en) * 2021-08-26 2021-12-17 领翌技术(横琴)有限公司 Visual positioning method, device and storage medium
CN113743492A (en) * 2021-08-30 2021-12-03 许继集团有限公司 Method and device for sequencing row positions and column positions of pressing plates
CN113743492B (en) * 2021-08-30 2024-04-19 许继集团有限公司 Method and device for ordering positions of rows and columns of pressing plates
CN113888558B (en) * 2021-09-26 2024-05-28 武汉钢铁有限公司 Ladle slag surface image correction method
CN113888558A (en) * 2021-09-26 2022-01-04 武汉钢铁有限公司 Ladle slag surface image correction method
CN114001674B (en) * 2021-09-30 2023-07-04 西北工业大学 Machine vision measuring method for bending radius of wire harness under free view angle
CN114001674A (en) * 2021-09-30 2022-02-01 西北工业大学 Machine vision measurement method for wire harness bending radius under free visual angle
CN113838149B (en) * 2021-10-09 2023-08-18 智道网联科技(北京)有限公司 Camera internal parameter calibration method, server and system for automatic driving vehicle
CN113838149A (en) * 2021-10-09 2021-12-24 智道网联科技(北京)有限公司 Camera internal reference calibration method, server and system for automatic driving vehicle
WO2023169186A1 (en) * 2022-03-10 2023-09-14 华为技术有限公司 Positioning method and related device
CN114399507A (en) * 2022-03-25 2022-04-26 季华实验室 Mobile phone appearance quality detection method and device, electronic equipment and storage medium
CN114693708B (en) * 2022-04-20 2024-04-02 太原理工大学 Anchor mesh same-row center point matching method and system
CN114693708A (en) * 2022-04-20 2022-07-01 太原理工大学 Anchor mesh same-row central point matching method and system
CN115026828A (en) * 2022-06-23 2022-09-09 池州市安安新材科技有限公司 Robot arm grabbing control method and system
CN114882124B (en) * 2022-07-06 2022-09-30 季华实验室 Calibration device, calibration method, calibration device, electronic apparatus, and storage medium
CN114882124A (en) * 2022-07-06 2022-08-09 季华实验室 Calibration device, calibration method, calibration device, electronic apparatus, and storage medium
CN115797467A (en) * 2023-02-02 2023-03-14 深圳市德驰微视技术有限公司 Method, device and equipment for detecting calibration result of vehicle camera and storage medium
CN116499456B (en) * 2023-06-28 2023-09-05 苏州中德睿博智能科技有限公司 Automatic positioning device and method for mobile robot and positioning system for unmanned mower
CN116499456A (en) * 2023-06-28 2023-07-28 苏州中德睿博智能科技有限公司 Automatic positioning device and method for mobile robot and positioning system for unmanned mower

Also Published As

Publication number Publication date
CN107766855A (en) 2018-03-06
CN107766855B (en) 2021-09-07

Similar Documents

Publication Publication Date Title
WO2019080229A1 (en) Chess piece positioning method and system based on machine vision, storage medium, and robot
WO2019200837A1 (en) Method and system for measuring volume of parcel, and storage medium and mobile terminal
CN110675487B (en) Three-dimensional face modeling and recognition method and device based on multi-angle two-dimensional face
TWI485650B (en) Method and arrangement for multi-camera calibration
US9519968B2 (en) Calibrating visual sensors using homography operators
US10269175B2 (en) Three dimensional content generating apparatus and three dimensional content generating method thereof
EP3067861A2 (en) Determination of a coordinate conversion parameter
US9305206B2 (en) Method for enhancing depth maps
CN110189322B (en) Flatness detection method, device, equipment, storage medium and system
JP5778967B2 (en) Information processing program, information processing method, information processing apparatus, and information processing system
CN106249881A (en) Augmented reality view field space and virtual three-dimensional target dynamic method for registering
JP2001524228A (en) Machine vision calibration target and method for determining position and orientation of target in image
CN111307039A (en) Object length identification method and device, terminal equipment and storage medium
WO2019128495A1 (en) Method and apparatus for detecting image resolution, storage medium, and electronic device
Yan et al. Joint camera intrinsic and lidar-camera extrinsic calibration
CN107590444A (en) Detection method, device and the storage medium of static-obstacle thing
JP6942566B2 (en) Information processing equipment, information processing methods and computer programs
Karbasi et al. Real-time hands detection in depth image by using distance with Kinect camera
AU2020449440B2 (en) Overlooking-type golf ball detection method, system and storage medium
CN101980299B (en) Chessboard calibration-based camera mapping method
JP2015206654A (en) Information processing apparatus, information processing method, and program
WO2019218878A1 (en) Photography restoration method and apparatus, storage medium and terminal device
CN116125489A (en) Indoor object three-dimensional detection method, computer equipment and storage medium
US11205064B1 (en) Measuring quality of depth images in real time
CN110674817B (en) License plate anti-counterfeiting method and device based on binocular camera

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: 17929783

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17929783

Country of ref document: EP

Kind code of ref document: A1