Chessboard corner positioning method and device, storage medium and electronic equipment

CN117522963BActive Publication Date: 2026-08-18KYLAND TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311482960.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-08
Publication Date
2026-08-18
Estimated Expiration
2043-11-08

AI Technical Summary

Technical Problem

[0003]现有的相机标定大多是借助标定板完成,相机标定板有多种类型,棋盘格是其中最常用的标定板,但是现有的一些基于棋盘格的相机标定方法无法准确寻找棋盘格的各角点,角点定位误差较大,进而在基于角点位置进行相机标定时,标定准确度较低

Benefits of technology

[0079] The checkerboard corner location method, apparatus, storage medium, and electronic device provided in this application obtain a binary image corresponding to a checkerboard image (the checkerboard image is obtained by taking a picture of the checkerboard with a camera); determine multiple connected components in the binary image based on the pixel values; determine a vertex set from the pixels of the corresponding connected component based on the binary image and the pixel coordinates of the pixels in each connected component; and determine the world coordinates and pixel coordinates of the corner point in the checkerboard based on the pixel coordinates of the vertices in each vertex set to locate the corner point. This eliminates the need to calculate pixel gradients to locate the corner points of the checkerboard, avoiding the problem of coarse checkerboard boundaries and incorrect corner point location in boundary pixels due to pixel errors in gradient calculation. This effectively improves the accuracy of checkerboard corner point location, and the method is simple, easy to implement, and robust.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117522963B_ABST
    Figure CN117522963B_ABST
Patent Text Reader

Abstract

The application discloses a chessboard corner point positioning method and device, a storage medium and an electronic device. The method comprises the following steps: acquiring a binary image corresponding to a chessboard image, wherein the chessboard image is obtained by shooting a chessboard by using a camera; determining a plurality of connected domains in the binary image according to the values of the pixel points in the binary image; determining a vertex set from the pixel points in the corresponding connected domain according to the pixel coordinates of the pixel points in the binary image and each connected domain; and determining the world coordinates and the pixel coordinates of the corner points in the chessboard according to the pixel coordinates of the vertices in each vertex set. Therefore, the positions of the corner points of the chessboard can be positioned without calculating the pixel gradient, and the problem that the positioning of the corner points of the chessboard is incorrect due to pixel errors in the gradient calculation is avoided, and the positioning accuracy of the corner points of the chessboard is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of camera calibration technology, and in particular relates to a method, device, storage medium and electronic device for locating corner points of a checkerboard pattern. Background Technology

[0002] The imaging process of a camera is essentially a coordinate system transformation process. First, points in space are transformed from the world coordinate system to the camera coordinate system. Then, they are projected onto the imaging plane to obtain the image coordinate system. Finally, the image coordinate system on the imaging plane is transformed back to the pixel coordinate system. The camera calibration process is essentially a process of solving for transformation parameters, which mainly include intrinsic and extrinsic parameter matrices and distortion parameters.

[0003] Most existing camera calibration methods rely on calibration boards, which come in various types. The checkerboard pattern is the most commonly used. However, some existing checkerboard-based camera calibration methods cannot accurately locate the corner points of the checkerboard, resulting in large corner point positioning errors. Consequently, the calibration accuracy is low when calibrating the camera based on the corner point positions. Summary of the Invention

[0004] This application aims to at least solve one of the technical problems existing in the prior art. To this end, this application proposes a method, device, storage medium, and electronic device for locating the corner points of a chessboard, which can accurately locate each corner point of the chessboard.

[0005] Firstly, this application provides a method for locating the corner points of a chessboard, including:

[0006] Obtain the binarized image corresponding to the chessboard image, wherein the chessboard image is obtained by taking a picture of the chessboard with a camera;

[0007] Based on the pixel values ​​in the binarized image, multiple connected components in the binarized image are determined;

[0008] Based on the binarized image and the pixel coordinates of the pixels in each connected component, a set of vertices is determined from the pixels of the corresponding connected component;

[0009] Based on the pixel coordinates of vertices in each vertex set, the world coordinates and pixel coordinates of the corner points in the chessboard are determined to locate the corner points.

[0010] In some embodiments, obtaining the binarized image corresponding to the checkerboard image includes:

[0011] Binarize the chessboard image;

[0012] The binarized chessboard image is dilated.

[0013] In some embodiments, determining the vertex set from the pixels of the corresponding connected component based on the binarized image and the pixel coordinates of the pixels in each connected component includes:

[0014] Based on the pixel coordinates of the pixels in each connected component, the starting pixel is determined from the pixels of the corresponding connected component;

[0015] Based on the starting pixel and the binarized image, multiple boundary points are searched from the pixels of the corresponding connected components to obtain a set of boundary points, and each connected component corresponds to a set of boundary points.

[0016] Based on the pixel coordinates of the boundary points in the boundary point set, the Douglas-Puk algorithm is used to determine the vertex set from the corresponding boundary point set.

[0017] In some embodiments, the step of searching for multiple boundary points from the pixels of the corresponding connected components based on the starting pixel and the binarized image includes:

[0018] Determine the eight first pixels in the binarized image that are adjacent to the starting pixel;

[0019] Starting from the top left corner of the eight first pixels, search for the first first pixel with a first preset value from the eight first pixels in a clockwise direction, and use it as the current boundary point;

[0020] Determine eight second pixels in the binarized image that are adjacent to the current boundary point, and from the previous search path, determine the second pixel with a value of a second preset value that is located in the previous neighboring position of the current boundary point, and use it as the updated current boundary point. Then return to execute the step of determining eight second pixels in the binarized image that are adjacent to the current boundary point, until the starting pixel point is found.

[0021] In some embodiments, determining the vertex set from the corresponding boundary point set using the Douglas-Puk algorithm based on the pixel coordinates of the boundary points in the boundary point set includes:

[0022] Based on the pixel coordinates of the boundary points, find the two boundary points that are farthest apart from the set of boundary points and use them as the two starting vertices;

[0023] Determine the connecting line between any two adjacent vertices among all the current vertices;

[0024] From the set of boundary points, determine the boundary point that is farthest from the connecting line (excluding the vertex) as a candidate boundary point, with each connecting line corresponding to one candidate boundary point;

[0025] When the distance between the candidate boundary point and the corresponding connecting line is greater than a preset threshold, the candidate boundary point is treated as a vertex, and the process returns to the step of determining the connecting line between any two adjacent vertices among all the current vertices.

[0026] When the distance between the candidate boundary point and the corresponding connecting line is less than or equal to the preset threshold, all the current vertices are taken as the vertex set of the corresponding connected component.

[0027] In some embodiments, determining the world coordinates and pixel coordinates of the corner points in the chessboard grid based on the pixel coordinates of vertices in each vertex set includes:

[0028] Based on the pixel coordinates of vertices in each vertex set, determine multiple target connected components from all the connected components;

[0029] Based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component, determine the corner points of the chessboard, the pixel coordinates of the corner points, and the origin of the world coordinate system;

[0030] The world coordinates of the corner point are determined based on the origin and the preset vertex interval distance.

[0031] In some embodiments, determining multiple target connected components from all the connected components based on the pixel coordinates of vertices in each vertex set includes:

[0032] Connect the vertices in each vertex set sequentially in a clockwise or counterclockwise direction to obtain the polygons corresponding to the connected components.

[0033] Obtain the polygon whose interior angle sums to 360° and whose shape is quadrilateral as candidate polygons, and obtain the candidate polygon whose vertices are all adjacent to other candidate polygons as target polygons;

[0034] The connected component corresponding to the target polygon is taken as the target connected component.

[0035] In some embodiments, determining the corner points of the chessboard, the pixel coordinates of the corner points, and the origin of the world coordinate system based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component includes:

[0036] The midpoint between the two vertices with the smallest distance between two adjacent target connected components is determined as the corner point of the chessboard, and the average pixel coordinate of the corresponding two vertices is used as the pixel coordinate of the corner point.

[0037] The vertex located at the top left corner of the vertex set of all the target connected domains is determined as the origin of the world coordinate system.

[0038] In some embodiments, it also includes:

[0039] Based on the world coordinates and pixel coordinates of the corner points, determine the intrinsic and extrinsic parameter matrices of the camera;

[0040] Using a fisheye camera model and a global optimization loss function, the distortion parameters of the camera are determined based on the world coordinates of the corner points, the pixel coordinates, the intrinsic parameter matrix, and the extrinsic parameter matrix, in order to calibrate the camera.

[0041] Secondly, this application provides a corner positioning device for a chessboard grid, comprising:

[0042] The acquisition module is used to acquire the binarized image corresponding to the chessboard image, wherein the chessboard image is obtained by taking a picture of the chessboard using a camera;

[0043] The first determining module is used to determine multiple connected components in the binarized image based on the values ​​of pixels in the binarized image;

[0044] The second determining module is used to determine a set of vertices from the pixels of the corresponding connected component based on the binarized image and the pixel coordinates of the pixels in each connected component.

[0045] The third determining module is used to determine the world coordinates and pixel coordinates of the corner points in the chessboard grid based on the pixel coordinates of the vertices in each vertex set, so as to locate the corner points.

[0046] In some embodiments, the acquisition module is specifically used for:

[0047] Binarize the chessboard image;

[0048] The binarized chessboard image is dilated.

[0049] In some embodiments, the second determining module is specifically used for:

[0050] Based on the pixel coordinates of the pixels in each connected component, the starting pixel is determined from the pixels of the corresponding connected component;

[0051] Based on the starting pixel and the binarized image, multiple boundary points are searched from the pixels of the corresponding connected components to obtain a set of boundary points, and each connected component corresponds to a set of boundary points.

[0052] Based on the pixel coordinates of the boundary points in the boundary point set, the Douglas-Puk algorithm is used to determine the vertex set from the corresponding boundary point set.

[0053] In some embodiments, the second determining module is specifically used for:

[0054] Determine the eight first pixels in the binarized image that are adjacent to the starting pixel;

[0055] Starting from the top left corner of the eight first pixels, search for the first first pixel with a first preset value from the eight first pixels in a clockwise direction, and use it as the current boundary point;

[0056] Determine eight second pixels in the binarized image that are adjacent to the current boundary point, and from the previous search path, determine the second pixel with a value of a second preset value that is located in the previous neighboring position of the current boundary point, and use it as the updated current boundary point. Then return to execute the step of determining eight second pixels in the binarized image that are adjacent to the current boundary point, until the starting pixel point is found.

[0057] In some embodiments, the second determining module is specifically used for:

[0058] Based on the pixel coordinates of the boundary points, find the two boundary points that are farthest apart from the set of boundary points and use them as the two starting vertices;

[0059] Determine the connecting line between any two adjacent vertices among all the current vertices;

[0060] From the set of boundary points, determine the boundary point that is farthest from the connecting line (excluding the vertex) as a candidate boundary point, with each connecting line corresponding to one candidate boundary point;

[0061] When the distance between the candidate boundary point and the corresponding connecting line is greater than a preset threshold, the candidate boundary point is treated as a vertex, and the process returns to the step of determining the connecting line between any two adjacent vertices among all the current vertices.

[0062] When the distance between the candidate boundary point and the corresponding connecting line is less than or equal to the preset threshold, all the current vertices are taken as the vertex set of the corresponding connected component.

[0063] In some embodiments, the third determining module is specifically used for:

[0064] Based on the pixel coordinates of vertices in each vertex set, determine multiple target connected components from all the connected components;

[0065] Based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component, determine the corner points of the chessboard, the pixel coordinates of the corner points, and the origin of the world coordinate system;

[0066] The world coordinates of the corner point are determined based on the origin and the preset vertex interval distance.

[0067] In some embodiments, the third determining module is specifically used for:

[0068] Connect the vertices in each vertex set sequentially in a clockwise or counterclockwise direction to obtain the polygons corresponding to the connected components.

[0069] Obtain the polygon whose interior angle sums to 360° and whose shape is quadrilateral as candidate polygons, and obtain the candidate polygon whose vertices are all adjacent to other candidate polygons as target polygons;

[0070] The connected component corresponding to the target polygon is taken as the target connected component.

[0071] In some embodiments, the third determining module is specifically used for:

[0072] The midpoint between the two vertices with the smallest distance between two adjacent target connected components is determined as the corner point of the chessboard, and the average pixel coordinate of the corresponding two vertices is used as the pixel coordinate of the corner point.

[0073] The vertex located at the top left corner of the vertex set of all the target connected domains is determined as the origin of the world coordinate system.

[0074] In some embodiments, a calibration module is further included, the calibration module being specifically used for:

[0075] Based on the world coordinates and pixel coordinates of the corner points, determine the intrinsic and extrinsic parameter matrices of the camera;

[0076] Using a fisheye camera model and a global optimization loss function, the distortion parameters of the camera are determined based on the world coordinates of the corner points, the pixel coordinates, the intrinsic parameter matrix, and the extrinsic parameter matrix, in order to calibrate the camera.

[0077] Thirdly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the corner positioning method of any of the above claims for a chessboard.

[0078] Fourthly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the corner point positioning method of any of the above claims.

[0079] The checkerboard corner location method, apparatus, storage medium, and electronic device provided in this application obtain a binary image corresponding to a checkerboard image (the checkerboard image is obtained by taking a picture of the checkerboard with a camera); determine multiple connected components in the binary image based on the pixel values; determine a vertex set from the pixels of the corresponding connected component based on the binary image and the pixel coordinates of the pixels in each connected component; and determine the world coordinates and pixel coordinates of the corner point in the checkerboard based on the pixel coordinates of the vertices in each vertex set to locate the corner point. This eliminates the need to calculate pixel gradients to locate the corner points of the checkerboard, avoiding the problem of coarse checkerboard boundaries and incorrect corner point location in boundary pixels due to pixel errors in gradient calculation. This effectively improves the accuracy of checkerboard corner point location, and the method is simple, easy to implement, and robust. Attached Figure Description

[0080] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0081] Figure 1 This is a flowchart illustrating the corner point positioning method for a chessboard grid provided in an embodiment of this application;

[0082] Figure 2 This is a schematic diagram illustrating the chessboard pattern provided in an embodiment of this application;

[0083] Figure 3 This is another flowchart illustrating the corner point positioning method for a chessboard provided in this application embodiment;

[0084] Figure 4 This is a schematic diagram illustrating a local region in a binarized image provided in an embodiment of this application;

[0085] Figure 5 This is a schematic diagram of the corner positioning device for a chessboard grid provided in an embodiment of this application;

[0086] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;

[0087] Figure 7 This is another structural schematic diagram of the electronic device provided in the embodiments of this application. Detailed Implementation

[0088] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0089] This application provides a method, apparatus, storage medium, and electronic device for locating corner points of a chessboard.

[0090] Please see Figure 1 , Figure 1 This is a flowchart illustrating a method for locating corner points of a chessboard grid according to an embodiment of this application. This method is applied to electronic devices, including but not limited to smartphones, tablets, laptops, and desktop computers. The method includes the following steps 101-104:

[0091] 101. Obtain the binarized image corresponding to the chessboard image, which is obtained by taking a picture of the chessboard with a camera.

[0092] The checkerboard pattern consists of several black and white squares, each with equal sides and overlapping edges. When photographing the checkerboard, it can be tilted at a certain angle. When the checkerboard is captured as an image, the overlapping edges of adjacent squares create noticeable corner points. These corner points can be used to calculate the camera's intrinsic and extrinsic parameter matrices for camera calibration. For example, please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram illustrating the checkerboard pattern provided in this application embodiment. The corner points are the intersections between black squares or white squares. The pixel values ​​in the binarized image can include a first preset value representing black and a second preset value representing white. The first and second preset values ​​are manually set, for example, 1 and 0 respectively. The checkerboard image can be a color image or a grayscale image. When it is a color image, it needs to be converted to a grayscale image first, and then the grayscale image is binarized and dilated to make the entire image present a clear visual effect of only black and white.

[0093] It needs to be explained that when the checkerboard is photographed, the entire image is at the same focal length, and the resulting images have the same circle of confusion. Therefore, during image binarization, the edges of the checkerboard squares will maintain the same change, the shape will not change to different degrees, and it will not affect the relative positions between the corner points.

[0094] In some embodiments, step 101 above may specifically include:

[0095] Binarize the chessboard image;

[0096] Dilatation is performed on the binarized chessboard image.

[0097] Image binarization can be performed using methods such as simple binarization, averaging, and bimodal methods. Binarization significantly reduces the amount of image data, highlighting the outline of the target (chessboard). Dilation is one of the most basic morphological operations in image processing. Dilation expands the boundary points of a binarized object, merging all background points in contact with the object into the object, thus expanding the boundary outward. In this scheme, dilation completely breaks the connection between adjacent black squares, which can be achieved by dilating the binarized chessboard image twice.

[0098] 102. Based on the pixel values ​​in the binarized image, determine multiple connected components in the binarized image.

[0099] In a binary image, a connected component generally refers to an image region consisting of adjacent foreground pixels (with a value of 1). All connected components in a binary image can be determined using the Two-Pass algorithm, which assigns the same label to points within the same connected component by performing only two passes through the image. The connected components corresponding to a checkerboard image can include the connected components of the black squares in the checkerboard and the connected components corresponding to objects in the background. During the process of determining connected components using the Two-Pass algorithm, for example, in the first pass, each pixel is labeled with a minimum (label) value. n(x,y) This refers to the smallest label among the pixels in the neighborhood (e.g., 8-neighborhood) of this pixel. If different labels appear in the neighborhood, these labels are merged into a set S. i In the middle, that is, the same connected component C i The labels are in the same set, label(x, y)∈S i , (x, y)∈C i Then, in the second iteration, the label of each pixel is updated to the smallest label in the corresponding set, label(x, y) = min(S). i ), (x, y)∈C i (x, y) represents the pixel point, C i Let i be the i-th connected component.

[0100] 103. Based on the binarized image and the pixel coordinates of the pixels in each connected component, determine the vertex set from the pixels of the corresponding connected component.

[0101] Pixel coordinates are coordinates in the pixel coordinate system, which coincides with the imaging plane and is a two-dimensional coordinate system. The origin is the upper left corner of the imaging plane, and the x-axis and y-axis are parallel to the two sides of the imaging plane, respectively. The unit length is the physical size of a single pixel.

[0102] In some embodiments, see Figure 3 , Figure 3 This is another flowchart illustrating the corner point positioning method provided in this application embodiment. Step 103 above may specifically include the following steps 1031-1033, wherein:

[0103] 1031. Determine the starting pixel from the pixels in the corresponding connected component based on the pixel coordinates of the pixels in each connected component.

[0104] For example, one can follow a top-down, left-to-right pattern to find the starting point of each connected component, as shown in [reference needed]. Figure 4 , Figure 4 This is a schematic diagram illustrating a local region in a binarized image provided in this application embodiment. In the image, pixels with a value of 1 form a connected component. At this time, the pixel on the top left side of the connected component can be used as the starting pixel.

[0105] 1032. Based on the starting pixel and the binarized image, search for multiple boundary points from the pixels of the corresponding connected components to obtain a set of boundary points. Each connected component corresponds to one such set of boundary points.

[0106] Here, the boundary point set is the set of pixels on the boundaries of the corresponding connected components. The boundary point search can begin from the starting pixel and proceed sequentially. During the search, the first boundary point is the starting pixel, and subsequent boundary points are obtained based on the eight pixels surrounding the previous boundary point. That is, step 1032 above can specifically include:

[0107] Identify the eight first pixels adjacent to the starting pixel in the binarized image;

[0108] Starting from the top left corner of the eight first pixels, search for the first first pixel with a value of the first preset value from the eight first pixels in a clockwise direction, and use it as the current boundary point;

[0109] The process involves identifying eight second pixels in the binarized image that are adjacent to the current boundary point, and then identifying the second pixel with a value of a second preset value that is located in the previous neighboring position of the current boundary point from the previous search path. This second pixel is then used as the updated current boundary point. The process continues until the starting pixel is found.

[0110] In the process of searching for boundary points, the starting pixel is the first boundary point. If the current pixel is the starting pixel (the first boundary point), then starting from the top left corner of the 8 pixels surrounding the starting pixel (that is, the first pixel mentioned above), the remaining 7 pixels are searched in a clockwise direction until the first pixel with a value of the first preset value (e.g., 1) is found, which is then used as the second boundary point. For example, if in a clockwise direction, ABCDEFGH are the 8 pixels (8-neighborhood) surrounding the starting pixel, and A is the top left pixel, and the values ​​of A, B, E, and H among these 8 pixels are the second preset value (e.g., 0), while the values ​​of the rest are the first preset value (e.g., 1), then starting from A, the first pixel with a value of the first preset value found in a clockwise direction is C, which is the second boundary point.

[0111] For example, please continue to see Figure 4 The first preset value is 1, and the second preset value is 0. Figure 4 The process begins by identifying a pixel with a value of 1 located slightly to the right of the top of the connected component within the 8 pixels surrounding the starting pixel. This pixel is then used as the second boundary point found during the search. Next, the process determines the 8 pixels surrounding this second boundary point (i.e., the aforementioned second pixel) and finds the pixel preceding the second boundary point in the previous search path. For example... Figure 4 Starting from the pixel with a value of 0 directly above the second boundary point, search clockwise through the remaining pixels within those 8 pixels until you find the first pixel with a value of 1. For example... Figure 4 The pixel with a value of 1 found is the rightmost pixel in the second row of the connected component. This pixel is then used as the third boundary point found during the search process. The search for the third boundary point is repeated until all boundary points on the connected component are found, that is, until the starting pixel (the first boundary point) is found. At this point, the search for the boundary points of the current connected component can be ended, and the search for the boundary points of the next connected component can be performed in the same way until the search for all connected components is completed.

[0112] 1033. Based on the pixel coordinates of the boundary points in the boundary point set, use the Douglas-Puk algorithm to determine the vertex set from the corresponding boundary point set.

[0113] The Douglas-Peucker algorithm is one such algorithm. The vertex set includes multiple vertices, and the lines connecting these vertices determine the outline shape of the connected components. When calibrating the camera, it is necessary to find the connected components corresponding to the checkerboard pattern.

[0114] In some embodiments, step 1033 above may specifically include:

[0115] Based on the pixel coordinates of the boundary point, find the two boundary points that are farthest apart from each other in the set of boundary points, and use them as the two starting vertices;

[0116] Determine the connecting line between any two adjacent vertices among all the current vertices;

[0117] From the set of boundary points, determine the boundary point that is farthest from the connecting line (excluding the vertex) as a candidate boundary point, and each connecting line corresponds to one candidate boundary point;

[0118] When the distance between the candidate boundary point and the corresponding connecting line is greater than a preset threshold, the candidate boundary point is treated as a vertex, and the process returns to the step of determining the connecting line between any two adjacent vertices among all the current vertices.

[0119] When the distance between the candidate boundary point and the corresponding connecting line is less than or equal to the preset threshold, all current vertices are taken as the vertex set of the corresponding connected component.

[0120] For each connected component, its outline shape needs to be determined first. First, find the two farthest boundary points in the boundary point set as the starting two vertices, and connect these two points with a connecting line. Next, calculate the distances from all other boundary points in the boundary point set to the connecting line, and find the boundary point with the farthest distance. Compare the distance of this boundary point with a preset threshold. If it is greater than the preset threshold, then this boundary point is taken as a new vertex, and the connecting line between this new vertex and the existing vertex is redrawn as a new connecting line. Repeat the above steps, that is, redetermine the distances from other boundary points to the new connecting line, and determine new connecting points based on this distance, until the distances from all boundary points to the corresponding line segments are less than the preset threshold.

[0121] 104. Based on the pixel coordinates of the vertices in each vertex set, determine the world coordinates and pixel coordinates of the corner points in the chessboard grid to locate the corner points.

[0122] World coordinates and pixel coordinates use different coordinate systems, typically with different origins, unit lengths, and axes. World coordinates are coordinates within a user-defined 3D coordinate system used to describe the positions of objects and cameras in the real world. In this scheme, the world coordinate system uses the plane containing the checkerboard pattern as the xy-plane, with the direction perpendicular to this plane as the z-axis. The x-axis can be the direction of the longer side of the checkerboard pattern, and the y-axis can be the direction of the shorter side. The origin of the world coordinate system depends on the vertex positions of the checkerboard pattern, and the unit length depends on the size of the squares within the checkerboard pattern.

[0123] In some embodiments, please continue to see Figure 3 Step 104 above may specifically include steps 1041-1043, wherein:

[0124] 1041. Based on the pixel coordinates of vertices in each vertex set, determine multiple target connected components from all connected components.

[0125] In some embodiments, step 1041 above may specifically include:

[0126] Connect the vertices in each vertex set sequentially in a clockwise or counterclockwise direction to obtain the polygons corresponding to the connected components.

[0127] Obtain the polygon whose interior angle sums to 360° and whose shape is quadrilateral as a candidate polygon, and obtain the candidate polygon whose multiple vertices are adjacent to other candidate polygons as the target polygon;

[0128] The connected component corresponding to the target polygon is taken as the target connected component.

[0129] The target connected component is the connected component corresponding to the black squares in the chessboard. Before dilation, the shape of the chessboard image is consistent with the actual shape of the chessboard, with squares sharing edges and each square being a square. After dilation, the squares are deformed, the spacing between adjacent squares increases, white and black squares remain adjacent, white squares become more connected to each other, and black squares become completely disconnected, taking on a convex quadrilateral shape. Each black square is adjacent to other black squares. For example, for a black square not on the edge of the chessboard, each vertex is adjacent to another black square, while for a black square on the edge of the chessboard, two vertices are adjacent to another black square. Therefore, to select the target connected component corresponding to the black squares in the chessboard, it is necessary to determine whether the shape formed by the vertices of each connected component is a convex quadrilateral, and whether multiple vertices of this convex quadrilateral are adjacent to other convex quadrilaterals. Only when these two conditions are met is it considered a target connected component. Generally, a quadrilateral is a convex quadrilateral when the sum of its interior angles is 360°.

[0130] 1042. Based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component, determine the corner point of the chessboard, the pixel coordinates of the corner point, and the origin of the world coordinate system.

[0131] In some embodiments, step 1042 may specifically include:

[0132] Determine the midpoint between the two vertices with the smallest distance between two adjacent connected components of the target, and take it as the corner point of the chessboard. Then, take the average of the pixel coordinates of the two corresponding vertices as the pixel coordinates of the corner point.

[0133] Determine the vertex located at the top left corner of the set of vertices of the target connected domain, and use it as the origin of the world coordinate system.

[0134] Before the checkerboard image is expanded, there is a common corner point between two adjacent black squares. After the checkerboard image is expanded, the image parts corresponding to the black squares are completely disconnected from each other, and the image parts of each black square undergo the same deformation. Therefore, the midpoint of the line connecting the two closest vertices between two adjacent black squares after expansion can be taken as the corner point of the checkerboard. The pixel coordinates of this corner point are also the arithmetic mean of the pixel coordinates of the two vertices. Following the rule of top to bottom and left to right, the first vertex of the first target connected component (the vertex located in the upper left corner) is taken as the origin of the world coordinate system.

[0135] 1043. Determine the world coordinates of the corner point based on the distance between the origin and the preset vertex.

[0136] The preset vertex spacing, also known as the unit length of the world coordinate system, depends on the size of the checkerboard, primarily the size of the checkerboard squares. For example, if the checkerboard square itself is 1×1cm, then the preset vertex spacing is 1cm. In this case, starting from the origin, the world coordinates of several vertices in a clockwise direction are (1,0), (1,1), and (0,1), respectively. The world coordinates of the corner points are calculated based on the world coordinates of the corresponding vertices. Furthermore, after locating the corner points of the checkerboard, the camera can be further calibrated, that is, calibrated based on the world coordinates and pixel coordinates of the corner point.

[0137] The camera imaging process can be understood as a three-stage transformation of the coordinate system space. Under ideal conditions, neglecting distortion, the transformation process can sequentially include: transformation from the world coordinate system to the camera coordinate system, from the camera coordinate system to the image coordinate system, and from the image coordinate system to the pixel coordinate system. The world and pixel coordinate systems have already been introduced. The image coordinate system, similar to the pixel coordinate system, is also a two-dimensional coordinate system, coinciding with the imaging plane, with its origin at the center of the imaging plane. The x-axis and y-axis are parallel to the two sides of the imaging plane, respectively. The camera coordinate system, similar to the world coordinate system, is a three-dimensional coordinate system, with its origin at the camera's optical center. Its x-axis and y-axis are parallel to the x-axis and y-axis of the image coordinate system, and the z-axis is the camera's optical axis. Camera calibration mainly refers to determining the transformation relationship between the pixel coordinate system and the world coordinate system. Through calibration, the parameters of the camera's imaging geometry model can be obtained, that is, the correspondence between points in three-dimensional space and points in the two-dimensional image.

[0138] In some embodiments, please continue to see Figure 3The corner point location method may further include the following steps 105 and 106, wherein:

[0139] 105. Based on the world coordinates and pixel coordinates of the corner point, determine the intrinsic and extrinsic parameter matrices of the camera.

[0140] Among them, the intrinsic parameter matrix A and the extrinsic parameter matrix (including the rotation matrix R and the translation matrix T) can be calculated based on the world coordinates and pixel coordinates of these corner points using some existing world coordinate and pixel coordinate transformation methods. The intrinsic parameter matrix depends on the camera's internal parameters, and the extrinsic parameter matrix depends on the position of the camera coordinate system and the world coordinate system.

[0141] 106. Using a fisheye camera model and a global optimization loss function, determine the camera's distortion parameters based on the world coordinates, pixel coordinates, intrinsic parameter matrix, and extrinsic parameter matrix of the corner point, in order to calibrate the camera.

[0142] In particular, considering that the shape of the camera lens will cause certain distortions in the captured image, such as turning a straight line in the real environment into a curve in the image, it is also necessary to determine the distortion parameters (such as k1 and k2) during calibration. This can be achieved by using some existing methods for determining camera distortion parameters. Therefore, during the camera calibration process, it is necessary to determine these parameters (A, k1, k2, R, T).

[0143] Specifically, the fisheye camera model is the Kannala-Brandt model, and its formula is as follows:

[0144]

[0145]

[0146] in, Here, x and y are the distorted coordinates of the corner point, x and y are the undistorted coordinates of the corner point, and r is the distance r from the point to the optical center. 2 =x 2 +y 2 ,

[0147] Transforming the equation above, we get:

[0148]

[0149] Distorted coordinates The distortion-free coordinates x and y can be obtained by multiplying the inverse of the intrinsic parameter matrix with the pixel coordinates of the corner point. The distortion-free coordinates x and y can be obtained by multiplying the world coordinates of the corner point with the extrinsic parameter matrix. Here, the distortion parameters k1 and k2 are estimated based on the distorted coordinates, which results in a large error in the initial values. If a step-by-step optimization is adopted, the effect is poor, which can easily reduce the convergence speed and get stuck in local optima. Therefore, a global optimization loss function J(θ) is defined.

[0150]

[0151] Among them, θ=(α,β,u0,v0,f,k1,k2,r 11 ,r 12 ,r 21 ,r 22 ,r 31 ,r 32 ,t1,t2,t3),u * ,v * Here, u0 and v0 are the measured pixel coordinates (i.e., the pixel coordinates obtained in step 104 above), u0 and v0 are offsets, u and v are the calculated pixel coordinates, f is the radius (focal length) of the imaging plane, and r is the calculated pixel coordinates. 11 ,r 12 ,r 21 ,r 22 ,r 31 ,r 32 t1, t2, t3 are the values ​​in the extrinsic parameter matrix R, and t1, t2, t3 are the values ​​in the extrinsic parameter matrix T.

[0152] The parameter iteration formula for gradient descent is as follows:

[0153]

[0154] in, The Jacobi matrix is ​​formed by taking the partial derivative of each term with respect to a parameter. The multivariate composite function rule is used to find the partial derivatives, expanding u and v into world coordinates (X, Y, V). w ,Y w Z w ) T Related composite functions,

[0155]

[0156]

[0157]

[0158] by Take the partial derivative as an example.

[0159]

[0160]

[0161]

[0162]

[0163]

[0164] As described above, the checkerboard corner localization method provided in this application obtains a binarized image corresponding to the checkerboard image, which is obtained by taking a picture of the checkerboard with a camera; determines multiple connected components in the binarized image based on the pixel values; determines a vertex set from the pixels of the corresponding connected component based on the binarized image and the pixel coordinates of the pixels in each connected component; and determines the world coordinates and pixel coordinates of the corner points in the checkerboard based on the pixel coordinates of the vertices in each vertex set, thereby locating the corner points. This eliminates the need to calculate pixel gradients to locate the corner points of the checkerboard, avoiding the problem of coarse checkerboard boundaries and incorrect corner point localization in boundary pixels caused by pixel errors in gradient calculation. This effectively improves the accuracy of checkerboard corner point localization, which in turn improves the accuracy of subsequent camera calibration. The method is simple, easy to implement, and robust.

[0165] Based on the embodiments of the above-described checkerboard corner positioning method, this application also provides a checkerboard corner positioning device. Please refer to... Figure 5 , Figure 5 This is a schematic diagram of the corner point positioning device for a chessboard pattern provided in an embodiment of this application. The camera calibration device 200 includes an acquisition module 201, a first determination module 202, a second determination module 203, and a third determination module 204, wherein:

[0166] The acquisition module 201 is used to acquire the binarized image corresponding to the chessboard image, which is obtained by taking a picture of the chessboard using a camera;

[0167] The first determining module 202 is used to determine multiple connected components in the binarized image based on the values ​​of the pixels in the binarized image;

[0168] The second determining module 203 is used to determine the vertex set from the pixels of the corresponding connected component based on the binarized image and the pixel coordinates of the pixels in each connected component.

[0169] The third determining module 204 is used to determine the world coordinates and pixel coordinates of the corner point in the chessboard grid based on the pixel coordinates of the vertices in each vertex set, so as to locate the corner point.

[0170] In some embodiments, the acquisition module 201 is specifically used for:

[0171] Binarize the chessboard image;

[0172] Dilatation is performed on the binarized chessboard image.

[0173] In some embodiments, the second determining module 203 is specifically used for:

[0174] Determine the starting pixel from the pixels in the corresponding connected component based on the pixel coordinates of the pixels in each connected component.

[0175] Based on the starting pixel and the binarized image, multiple boundary points are searched from the pixels of the corresponding connected components to obtain a set of boundary points. Each connected component corresponds to one such set of boundary points.

[0176] Based on the pixel coordinates of the boundary points in the boundary point set, the Douglas-Puk algorithm is used to determine the vertex set from the corresponding boundary point set.

[0177] In some embodiments, the second determining module 203 is specifically used for:

[0178] Identify the eight first pixels adjacent to the starting pixel in the binarized image;

[0179] Starting from the top left corner of the eight first pixels, search for the first first pixel with a value of the first preset value from the eight first pixels in a clockwise direction, and use it as the current boundary point;

[0180] The process involves identifying eight second pixels in the binarized image that are adjacent to the current boundary point, and then identifying the second pixel with a value of a second preset value that is located in the previous neighboring position of the current boundary point from the previous search path. This second pixel is then used as the updated current boundary point. The process continues until the starting pixel is found.

[0181] In some embodiments, the second determining module 203 is specifically used for:

[0182] Based on the pixel coordinates of the boundary point, find the two boundary points that are farthest apart from each other in the set of boundary points, and use them as the two starting vertices;

[0183] Determine the connecting line between any two adjacent vertices among all the current vertices;

[0184] From the set of boundary points, determine the boundary point that is farthest from the connecting line (excluding the vertex) as a candidate boundary point, and each connecting line corresponds to one candidate boundary point;

[0185] When the distance between the candidate boundary point and the corresponding connecting line is greater than a preset threshold, the candidate boundary point is treated as a vertex, and the process returns to the step of determining the connecting line between any two adjacent vertices among all the current vertices.

[0186] When the distance between the candidate boundary point and the corresponding connecting line is less than or equal to the preset threshold, all current vertices are taken as the vertex set of the corresponding connected component.

[0187] In some embodiments, the third determining module 204 is specifically used for:

[0188] Based on the pixel coordinates of vertices in each vertex set, determine multiple target connected components from all connected components;

[0189] Based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component, determine the corner point of the chessboard, the pixel coordinates of the corner point, and the origin of the world coordinate system;

[0190] The world coordinates of the corner point are determined based on the origin and the preset vertex interval distance.

[0191] In some embodiments, the third determining module 204 is specifically used for:

[0192] Connect the vertices in each vertex set sequentially in a clockwise or counterclockwise direction to obtain the polygons corresponding to the connected components.

[0193] Obtain the polygon whose interior angle sums to 360° and whose shape is quadrilateral as a candidate polygon, and obtain the candidate polygon whose multiple vertices are adjacent to other candidate polygons as the target polygon;

[0194] The connected component corresponding to the target polygon is taken as the target connected component.

[0195] In some embodiments, the third determining module 204 is specifically used for:

[0196] Determine the midpoint between the two vertices with the smallest distance between two adjacent connected components of the target, and take it as the corner point of the chessboard. Then, take the average of the pixel coordinates of the two corresponding vertices as the pixel coordinates of the corner point.

[0197] Determine the vertex located at the top left corner of the set of vertices of the target connected domain, and use it as the origin of the world coordinate system.

[0198] In some embodiments, a calibration module is further included, which is specifically used for:

[0199] Based on the world coordinates and pixel coordinates of the corner point, determine the intrinsic and extrinsic parameter matrices of the camera;

[0200] Using a fisheye camera model and a global optimization loss function, the distortion parameters of the camera are determined based on the world coordinates, pixel coordinates, intrinsic parameter matrix, and extrinsic parameter matrix of the corner point, in order to calibrate the camera.

[0201] It should be noted that the specific details of each module unit in the corner positioning device 200 of the chessboard grid have been described in detail in the embodiment of corner positioning of the chessboard grid, and will not be repeated here.

[0202] In some embodiments, the connection relationship updating device in this application can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal device. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application does not specifically limit the device.

[0203] In some embodiments, such as Figure 6 As shown, this application embodiment also provides an electronic device 300, including a processor 301, a memory 302, and a computer program stored in the memory 302 and executable on the processor 301. When the program is executed by the processor 301, it implements the various processes of the above-described chessboard corner positioning embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0204] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0205] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0206] The electronic device 400 includes, but is not limited to, components such as: radio frequency unit 401, network module 402, audio output unit 403, input unit 404, sensor 405, display unit 406, user input unit 407, interface unit 408, memory 409, and processor 410.

[0207] Those skilled in the art will understand that the electronic device 400 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 410 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0208] It should be understood that, in this embodiment, the input unit 404 may include a graphics processing unit (GPU) 4041 and a microphone 4042. The GPU 4041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 406 may include a display panel 4061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 407 includes at least one of a touch panel 4071 and other input devices 4072. The touch panel 4071 is also called a touch screen. The touch panel 4071 may include a touch detection device and a touch controller. Other input devices 4072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0209] The memory 409 can be used to store software programs and various data. The memory 409 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 409 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 409 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0210] Processor 410 may include one or more processing units; processor 410 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 410.

[0211] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described chessboard corner positioning embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0212] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0213] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the corner point positioning of the chessboard grid described above.

[0214] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0215] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0216] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0217] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0218] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0219] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0220] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A method for locating corner points of a chessboard, characterized in that, include: Obtain the binarized image corresponding to the chessboard image, wherein the chessboard image is obtained by taking a picture of the chessboard with a camera; Based on the pixel values ​​in the binarized image, multiple connected components in the binarized image are determined; Based on the binarized image and the pixel coordinates of the pixels in each connected component, a set of vertices is determined from the pixels of the corresponding connected component; Based on the pixel coordinates of the vertices in each vertex set, the world coordinates and pixel coordinates of the corner points in the chessboard are determined to locate the corner points; The step of determining the vertex set from the pixels of the corresponding connected component based on the binarized image and the pixel coordinates of the pixels in each connected component includes: Based on the pixel coordinates of the pixels in each connected component, the starting pixel is determined from the pixels of the corresponding connected component; Based on the starting pixel and the binarized image, multiple boundary points are searched from the pixels of the corresponding connected components to obtain a set of boundary points, and each connected component corresponds to a set of boundary points. Based on the pixel coordinates of the boundary points in the boundary point set, the Douglas-Puk algorithm is used to determine the vertex set from the corresponding boundary point set; The step of determining the vertex set from the corresponding boundary point set using the Douglas-Puk algorithm based on the pixel coordinates of the boundary points in the boundary point set includes: Based on the pixel coordinates of the boundary points, find the two boundary points that are farthest apart from the set of boundary points and use them as the two starting vertices; Determine the connecting line between any two adjacent vertices among all the current vertices; From the set of boundary points, determine the boundary point that is farthest from the connecting line (excluding the vertex) as a candidate boundary point, with each connecting line corresponding to one candidate boundary point; When the distance between the candidate boundary point and the corresponding connecting line is greater than a preset threshold, the candidate boundary point is treated as a vertex, and the process returns to the step of determining the connecting line between any two adjacent vertices among all the current vertices. When the distance between the candidate boundary point and the corresponding connecting line is less than or equal to the preset threshold, all the current vertices are taken as the vertex set of the corresponding connected component.

2. The corner point positioning method according to claim 1, characterized in that, The step of obtaining the binarized image corresponding to the chessboard image includes: Binarize the chessboard image; The binarized chessboard image is dilated.

3. The corner point positioning method according to claim 1, characterized in that, The step of searching for multiple boundary points from the pixels of the corresponding connected components based on the starting pixel and the binarized image includes: Determine the eight first pixels in the binarized image that are adjacent to the starting pixel; Starting from the top left corner of the eight first pixels, search for the first first pixel with a first preset value from the eight first pixels in a clockwise direction, and use it as the current boundary point; Determine eight second pixels in the binarized image that are adjacent to the current boundary point, and from the previous search path, determine the second pixel with a value of a second preset value that is located in the previous neighboring position of the current boundary point, and use it as the updated current boundary point. Then return to execute the step of determining eight second pixels in the binarized image that are adjacent to the current boundary point, until the starting pixel point is found.

4. The corner point positioning method according to claim 1, characterized in that, The step of determining the world coordinates and pixel coordinates of the corner points in the chessboard grid based on the pixel coordinates of the vertices in each vertex set includes: Based on the pixel coordinates of vertices in each vertex set, determine multiple target connected components from all the connected components; Based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component, determine the corner points of the chessboard, the pixel coordinates of the corner points, and the origin of the world coordinate system; The world coordinates of the corner point are determined based on the origin and the preset vertex interval distance.

5. The corner point positioning method according to claim 4, characterized in that, The step of determining multiple target connected components from all the connected components based on the pixel coordinates of vertices in each vertex set includes: Connect the vertices in each vertex set sequentially in a clockwise or counterclockwise direction to obtain the polygons corresponding to the connected components. Obtain the polygon whose interior angle sums to 360° and whose shape is quadrilateral, and use it as a candidate polygon. At the same time, obtain the candidate polygon whose vertices are all adjacent to other candidate polygons, and use it as the target polygon. The connected component corresponding to the target polygon is taken as the target connected component.

6. The method according to claim 4, characterized in that, The step of determining the corner points of the chessboard, the pixel coordinates of the corner points, and the origin of the world coordinate system based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component includes: The midpoint between the two vertices with the smallest distance between two adjacent target connected components is determined and used as the corner point of the chessboard. At the same time, the average pixel coordinates of the corresponding two vertices are used as the pixel coordinates of the corner point. Identify the vertex located in the top left corner of the vertex set of all the target connected domains, and use it as the origin of the world coordinate system.

7. The method according to claim 1, characterized in that, Also includes: Based on the world coordinates and pixel coordinates of the corner points, determine the intrinsic and extrinsic parameter matrices of the camera; Using a fisheye camera model and a global optimization loss function, the distortion parameters of the camera are determined based on the world coordinates of the corner points, the pixel coordinates, the intrinsic parameter matrix, and the extrinsic parameter matrix, in order to calibrate the camera.

8. A corner point positioning device for a chessboard grid, characterized in that, include: The acquisition module is used to acquire the binarized image corresponding to the chessboard image, wherein the chessboard image is obtained by taking a picture of the chessboard using a camera; The first determining module is used to determine multiple connected components in the binarized image based on the values ​​of pixels in the binarized image; The second determining module is used to determine a set of vertices from the pixels of the corresponding connected component based on the binarized image and the pixel coordinates of the pixels in each connected component. The third determining module is used to determine the world coordinates and pixel coordinates of the corner points in the chessboard grid based on the pixel coordinates of the vertices in each vertex set, so as to locate the corner points; The second determining module is specifically used for: Based on the pixel coordinates of the pixels in each connected component, the starting pixel is determined from the pixels of the corresponding connected component; Based on the starting pixel and the binarized image, multiple boundary points are searched from the pixels of the corresponding connected components to obtain a set of boundary points, and each connected component corresponds to a set of boundary points. Based on the pixel coordinates of the boundary points in the boundary point set, the Douglas-Puk algorithm is used to determine the vertex set from the corresponding boundary point set; The step of determining the vertex set from the corresponding boundary point set using the Douglas-Puk algorithm based on the pixel coordinates of the boundary points in the boundary point set includes: Based on the pixel coordinates of the boundary points, find the two boundary points that are farthest apart from the set of boundary points and use them as the two starting vertices; Determine the connecting line between any two adjacent vertices among all the current vertices; From the set of boundary points, determine the boundary point that is farthest from the connecting line (excluding the vertex) as a candidate boundary point, with each connecting line corresponding to one candidate boundary point; When the distance between the candidate boundary point and the corresponding connecting line is greater than a preset threshold, the candidate boundary point is treated as a vertex, and the process returns to the step of determining the connecting line between any two adjacent vertices among all the current vertices. When the distance between the candidate boundary point and the corresponding connecting line is less than or equal to the preset threshold, all the current vertices are taken as the vertex set of the corresponding connected component.

9. The apparatus according to claim 8, characterized in that, The second determining module is specifically used for: Determine the eight first pixels in the binarized image that are adjacent to the starting pixel; Starting from the top left corner of the eight first pixels, search for the first first pixel with a first preset value from the eight first pixels in a clockwise direction, and use it as the current boundary point; Determine eight second pixels in the binarized image that are adjacent to the current boundary point, and from the previous search path, determine the second pixel with a value of a second preset value that is located in the previous neighboring position of the current boundary point, and use it as the updated current boundary point. Then return to execute the step of determining eight second pixels in the binarized image that are adjacent to the current boundary point, until the starting pixel point is found.

10. The apparatus according to claim 8, characterized in that, The third determining module is specifically used for: Based on the pixel coordinates of vertices in each vertex set, determine multiple target connected components from all the connected components; Based on the pixel coordinates of the vertices in the vertex set corresponding to the target connected component, determine the corner points of the chessboard, the pixel coordinates of the corner points, and the origin of the world coordinate system; The world coordinates of the corner point are determined based on the origin and the preset vertex interval distance.

11. The apparatus according to claim 10, characterized in that, The third determining module is specifically used for: Connect the vertices in each vertex set sequentially in a clockwise or counterclockwise direction to obtain the polygons corresponding to the connected components. Obtain the polygon whose interior angle sums to 360° and whose shape is quadrilateral, and use it as a candidate polygon. At the same time, obtain the candidate polygon whose vertices are all adjacent to other candidate polygons, and use it as the target polygon. The connected component corresponding to the target polygon is taken as the target connected component.

12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the corner point positioning method of the chessboard as described in any one of claims 1-7.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the corner point positioning method of the chessboard as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Quick checkerboard image feature matching algorithm based on connected domain segmentation

    CN104091324A

  • Geofence data extraction method, device and equipment

    CN110659343A