Concentric circle center positioning method and system, electronic device, and storage medium
By preprocessing the concentric circle image, edge data extraction and elliptical matrix transformation, the problem of insufficient accuracy of concentric circle center positioning is solved, and a higher precision of center coordinate calculation is achieved.
Patent Information
- Application Number
- CN202310019180.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-06
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-01-06
AI Technical Summary
In the prior art, the accuracy of positioning of concentric circles is low. Especially in photogrammetry or camera calibration, the positioning accuracy is insufficient when solving the position of the center of the ellipse formed after projection of a single circle.
By obtaining the initial image of the concentric circle to be measured, image preprocessing is performed, edge data is extracted and connected domain marking is performed, subpixel-level edge detection and ellipse fitting are performed, and the center positioning is calculated using ellipse matrix transformation to avoid directly solving the center coordinates of two ellipse.
The positioning accuracy of the center of a concentric circle is improved, and more accurate determination of the center coordinates is achieved.
Smart Images

Figure CN116051583B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method and system for locating the centers of concentric circles, an electronic device, and a storage medium. Background Art
[0002] At present, in photogrammetry or camera calibration, the center of a circle is usually used as a calibration point, and after the camera imaging, it is an ellipse in the image. The relevant technology is to solve the position of the center of the ellipse formed after the projection of a single circle, and use it as the coordinates after the projection of the center of the circle. However, due to the characteristics of perspective projection, for a circle on a spatial plane, the projection point of the center of the circle after projection is not the center of the ellipse. At the same time, since a single ellipse in the image may correspond to multiple plane circles in space, concentric circles are usually used to determine the coordinates of the center of the circle after projection. The method for locating the center of concentric circles in the related art is usually to determine the coordinates of the center of the concentric circles by solving the coordinates of the centers of two ellipses and taking the average value, but the positioning accuracy of the center of the concentric circles obtained by this method is still relatively low. Summary of the Invention
[0003] The main purpose of the embodiments of the present application is to propose a method and system for locating the centers of concentric circles, an electronic device, and a storage medium, which can improve the positioning accuracy of the centers of concentric circles.
[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application provides a method for locating the centers of concentric circles, the method comprising:
[0005] Acquiring an initial concentric circle image of the concentric circles to be measured, and performing image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image;
[0006] Extracting edge data from the concentric circle preprocessed image to obtain initial concentric circle edge data;
[0007] Performing a connected component labeling process on the concentric circle preprocessed image according to the initial concentric circle edge data to obtain target concentric circle edge data; the target concentric circle edge data includes first edge data and second edge data, and the first edge data and the second edge data belong to different circles respectively;
[0008] Performing sub-pixel edge detection on the target concentric circle edge data to obtain sub-pixel edge data; the sub-pixel edge data includes first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data corresponding to the second edge data;
[0009] performing ellipse fitting according to the sub-pixel edge data to obtain a sub-pixel ellipse function, the sub-pixel ellipse function including a first ellipse function and a second ellipse function, the first ellipse function corresponding to the first sub-pixel edge data, the second ellipse function corresponding to the second sub-pixel edge data, and the first ellipse function and the second ellipse function corresponding to the same concentric circle to be measured;
[0010] Performing function matrix transformation on the first elliptic function and the second elliptic function respectively to obtain a first elliptic matrix corresponding to the first elliptic function and a second elliptic matrix corresponding to the second elliptic function;
[0011] A circle center positioning process is performed according to the first ellipse matrix and the second ellipse matrix to obtain target circle center coordinate data.
[0012] In some embodiments, performing circle center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target circle center coordinate data includes:
[0013] Performing matrix calculation on the first elliptic matrix and the second elliptic matrix according to a preset characteristic function to obtain a target characteristic vector;
[0014] Performing an inverse homogeneous coordinate transformation on the target feature vector to obtain the target circle center coordinate data.
[0015] In some embodiments, the first elliptic matrix is denoted as E1, and the second elliptic matrix is denoted as E2;
[0016] The performing matrix calculation on the first elliptic matrix and the second elliptic matrix according to a preset characteristic function to obtain a target characteristic vector includes:
[0017] According to the preset characteristic function Performing eigenvalue calculation on the first elliptic matrix E1 and the second elliptic matrix E2 to obtain a target eigenvalue, where the target eigenvalue is used to represent the ratio of the squares of the inner and outer radii of the concentric circles to be measured;
[0018] According to the preset characteristic function Performing eigenvector calculation on the target eigenvalue to obtain the target eigenvector.
[0019] In some embodiments, performing image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image includes:
[0020] Performing image filtering on the initial concentric circle image to obtain a concentric circle filtered image;
[0021] Performing morphological gradient processing on the concentric circle filtered image to obtain the concentric circle preprocessed image.
[0022] In some embodiments, performing sub-pixel edge detection based on the target concentric circle edge data to obtain sub-pixel edge data includes:
[0023] Performing pixel-level edge detection on the target concentric circle edge data to obtain target pixel-level edge data;
[0024] Performing pixel-level gradient calculation on the target pixel-level edge data to obtain pixel-level gradient data and pixel-level gradient direction;
[0025] Edge data fitting is performed on the target pixel-level edge data according to the pixel-level gradient direction and the pixel-level gradient data to determine the sub-pixel edge data.
[0026] In some embodiments, performing edge data fitting on the target pixel-level edge data according to the pixel-level gradient direction and the pixel-level gradient data to determine the sub-pixel edge data includes:
[0027] Performing gradient projection processing on the target pixel-level edge data according to the pixel-level gradient direction to obtain first projection data;
[0028] Performing gradient projection processing on the pixel-level gradient data according to the pixel-level gradient direction to obtain second projection data;
[0029] Performing projection fitting based on the first projection data and the second projection data to obtain a pixel-level projection function;
[0030] Performing function calculation on the pixel-level projection function to obtain pixel-level projection offset data;
[0031] Data offset processing is performed on the target pixel-level edge data according to the pixel-level projection offset data to obtain the sub-pixel edge data.
[0032] In some embodiments, performing ellipse fitting according to the sub-pixel edge data to obtain a sub-pixel ellipse function includes:
[0033] Performing function fitting on the sub-pixel edge data according to a random sampling consensus algorithm to obtain a candidate fitting ellipse function;
[0034] Calculating the center of the candidate fitting ellipse function to obtain candidate fitting center data;
[0035] The candidate fitting ellipse function is subjected to ellipse classification according to the candidate fitting circle center data to obtain the sub-pixel ellipse function.
[0036] To achieve the above-mentioned purpose, a second aspect of the embodiments of the present application provides a concentric circle center positioning system, the system comprising:
[0037] An image preprocessing module is used to obtain an initial concentric circle image of the concentric circles to be measured, and perform image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image;
[0038] A first edge detection module is used to perform pixel-level edge detection on the concentric circle preprocessed image to obtain pixel-level edge data;
[0039] a connected domain labeling module, configured to perform connected domain labeling processing on the concentric circle preprocessed image according to the pixel-level edge data to obtain concentric circle edge data; the concentric circle edge data includes first edge data and second edge data, the first edge data and the second edge data respectively belonging to different circles;
[0040] an edge detection module, configured to perform sub-pixel edge detection based on the concentric circle edge data to obtain sub-pixel edge data; the sub-pixel edge data comprising first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data corresponding to the second edge data;
[0041] an ellipse fitting module, configured to perform ellipse fitting according to the sub-pixel edge data to obtain a sub-pixel ellipse function, wherein the sub-pixel ellipse function includes a first ellipse function and a second ellipse function, wherein the first ellipse function corresponds to the first sub-pixel edge data, the second ellipse function corresponds to the second sub-pixel edge data, and the first ellipse function and the second ellipse function correspond to the same concentric circle to be measured;
[0042] a matrix transformation module, configured to perform function matrix transformation on the first elliptic function and the second elliptic function, respectively, to obtain a first elliptic matrix corresponding to the first elliptic function and a second elliptic matrix corresponding to the second elliptic function;
[0043] The circle center positioning module is used to perform circle center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target circle center coordinate data.
[0044] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements any method proposed in the first aspect of the embodiment of the present application.
[0045] To achieve the above-mentioned purpose, the fourth aspect of the embodiments of the present application further proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements any method proposed in the first aspect of the embodiments of the present application.
[0046] The embodiments of the present application propose a concentric circle center positioning method and system, electronic device, and storage medium. The method obtains an initial concentric circle image of the concentric circle to be measured and performs image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image. Then, edge data extraction is performed on the concentric circle preprocessed image to obtain initial concentric circle edge data. Connected domain labeling processing is performed on the concentric circle preprocessed image based on the initial concentric circle edge data to obtain target concentric circle edge data. The target concentric circle edge data includes first edge data and second edge data, and the first edge data and the second edge data belong to different circles respectively. Sub-pixel edge detection is performed on the target concentric circle edge data to obtain sub-pixel edge data. The sub-pixel edge data includes first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data of the second edge data. Afterwards, an ellipse fitting is performed based on the sub-pixel edge data to obtain a sub-pixel ellipse function, which includes a first ellipse function and a second ellipse function, the first ellipse function corresponding to the first sub-pixel edge data, the second ellipse function corresponding to the second sub-pixel edge data, and the first ellipse function and the second ellipse function correspond to the same concentric circle to be measured. Function matrix transformation is performed on the first ellipse function and the second ellipse function respectively to obtain a first ellipse matrix corresponding to the first ellipse function and a second ellipse matrix corresponding to the second ellipse function. Center positioning processing is performed based on the first ellipse matrix and the second ellipse matrix to obtain target center coordinate data. The embodiment of the present application can avoid solving the coordinates of the two ellipse centers, can obtain more accurate target center coordinate data of the concentric circles, and improves the positioning accuracy of the centers of the concentric circles. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is a first flow chart of the concentric circle center positioning method provided in an embodiment of the present application;
[0048] Figure 2 is a schematic diagram of an initial concentric circle image provided in an embodiment of the present application;
[0049] Figure 3 Schematic diagram of concentric circles for pixel-level edge data extraction provided by an embodiment of the present application;
[0050] Figure 4 yes Figure 1 Flowchart of the specific method of step S110;
[0051] Figure 5Schematic diagram of concentric circles after morphological gradient processing provided in the embodiment of the present application;
[0052] Figure 6 yes Figure 1 Flowchart of the specific method of step S140;
[0053] Figure 7 yes Figure 6 Flowchart of the specific method of step S620;
[0054] Figure 8 yes Figure 1 Flowchart of the specific method of step S150;
[0055] Figure 9 yes Figure 1 Flowchart of the specific method of step S170;
[0056] Figure 10 yes Figure 9 Flowchart of the specific method of step S910;
[0057] Figure 11 This is a module structure diagram of the concentric circle center positioning system provided by an embodiment of the present application;
[0058] Figure 12 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0060] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0062] First, let’s analyze some of the terms used in this application:
[0063] Homogeneous coordinates: Homogeneous coordinates represent an n-dimensional vector using an n+1-dimensional vector. It refers to a coordinate system used in projective geometry, which provides an effective method of using matrix operations to transform a point set in two-dimensional, three-dimensional or even high-dimensional space from one coordinate system to another.
[0064] Morphological gradient: Gradient is used to characterize the boundary or edge of the target in the area where the gray level of the image changes dramatically. Morphological gradient can be combined with the original image by dilation or corrosion to enhance the intensity of pixels in the structural element area to highlight the periphery of the highlight area.
[0065] Random Sample Consensus (RANSAC): RANSAC is an algorithm that calculates the mathematical model parameters of the data based on a set of sample data sets containing abnormal data to obtain valid sample data.
[0066] At present, in photogrammetry or camera calibration, the center of a circle is usually used as a calibration point, and after the camera imaging, it is an ellipse in the image. The relevant technology is to solve the position of the center of the ellipse formed after the projection of a single circle, and use it as the coordinates after the projection of the center of the circle. However, due to the characteristics of perspective projection, for a circle on a spatial plane, the projection point of the center of the circle after projection is not the center of the ellipse. At the same time, since a single ellipse in the image may correspond to multiple plane circles in space, concentric circles are usually used to determine the coordinates of the center of the circle after projection. The method for locating the center of concentric circles in the related art is usually to determine the coordinates of the center of the concentric circles by solving the coordinates of the centers of two ellipses and taking the average value, but the positioning accuracy of the center of the concentric circles obtained by this method is still relatively low.
[0067] Based on this, the embodiments of the present application provide a concentric circle center positioning method and system, electronic device, and storage medium, which can improve the positioning accuracy of the concentric circle centers.
[0068] The concentric circle center positioning method provided in the embodiments of the present application can be applied to a terminal, can be applied to a server, and can also be software running on a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, or a smart watch; the server can be an independent server, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms; the software can be an application that implements the concentric circle center positioning method, but is not limited to the above forms.
[0069] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0070] Please refer to Figure 1 , Figure 1 This is an optional flow chart of the concentric circle center positioning method provided in the embodiment of the present application. In some embodiments of the present application, the concentric circle center positioning method of the embodiment of the present application includes but is not limited to steps S110 to S170. Figure 1 These seven steps are introduced in detail.
[0071] Step S110, obtaining an initial concentric circle image of the concentric circles to be measured, and performing image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image;
[0072] Step S120, extracting edge data from the concentric circle preprocessed image to obtain initial concentric circle edge data;
[0073] Step S130, performing connected component labeling processing on the concentric circle preprocessed image according to the initial concentric circle edge data to obtain target concentric circle edge data; the target concentric circle edge data includes first edge data and second edge data, and the first edge data and the second edge data belong to different circles respectively;
[0074] Step S140, performing sub-pixel edge detection based on the concentric circle edge data to obtain sub-pixel edge data; the sub-pixel edge data includes first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data corresponding to the second edge data;
[0075] Step S150, performing ellipse fitting based on the sub-pixel edge data to obtain a sub-pixel ellipse function, the sub-pixel ellipse function including a first ellipse function and a second ellipse function, the first ellipse function corresponding to the first sub-pixel edge data, the second ellipse function corresponding to the second sub-pixel edge data, and the first ellipse function and the second ellipse function corresponding to the same concentric circle to be measured;
[0076] Step S160, performing function matrix transformation on the first elliptic function and the second elliptic function respectively to obtain a first elliptic matrix corresponding to the first elliptic function and a second elliptic matrix corresponding to the second elliptic function;
[0077] Step S170 , performing circle center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target circle center coordinate data.
[0078] In step S110 of some embodiments, a target image is captured using a camera, a video camera, or other related means. The target image includes a plurality of projected concentric circles to be measured. Figure 2 , Figure 2 The initial concentric circle image containing the concentric circles to be measured is extracted, and the key area containing the concentric circles to be measured is obtained to obtain the initial concentric circle image. In addition, since the image captured by the camera contains a large number of noise points, in order to prevent the noise points from affecting the subsequent edge detection, the initial concentric circle image is preprocessed to obtain a concentric circle preprocessed image.
[0079] In step S120 of some embodiments, after obtaining the concentric circle pre-processed image, the Canny operator can be used to extract pixel-level edge data of the ellipse image in the concentric circle pre-processed image to obtain initial concentric circle edge data. Figure 3 , Figure 3 A concentric circle diagram showing how to extract circular pixel-level edge data using the Canny operator.
[0080] In step S130 of some embodiments, to ensure the connectivity of the target ellipses corresponding to the concentric circles to be measured, that is, to determine which initial concentric circle edge data belong to the same circle, a connected domain labeling process is performed on the concentric circle preprocessed image based on the pixel-level initial concentric circle edge data to obtain target concentric circle edge data. The target concentric circle edge data includes first edge data and second edge data, and the first edge data and the second edge data belong to different circles.
[0081] It should be noted that since some noise points in the concentric circle preprocessing image also have gradient changes, they may be mistakenly identified as edge points. At the same time, such edge points are more scattered and much shorter than normal circular edge points. In order to reduce the amount of calculation, after obtaining the target concentric circle edge data, it is determined that the first edge data and the second edge data belong to different circles respectively, and the center of mass of different circles can be roughly located by the thresholding method. Specifically, the edge length threshold can be set in advance, and the target concentric circle edge data of the same circle can be subjected to pixel-level edge detection based on the edge length threshold to filter out these misidentified edge points to update the target concentric circle edge data. Among them, the target concentric circle edge data is used to represent the pixel coordinates of the edge points at the pixel level.
[0082] In step S140 of some embodiments, to more accurately determine the inner and outer ellipses constituting the same concentric circle to be measured, sub-pixel edge detection is performed based on the target concentric circle edge data to obtain sub-pixel edge data. The sub-pixel edge data includes first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data corresponding to the second edge data. That is, the first sub-pixel edge data and the second sub-pixel edge data are sub-pixel edge data for different ellipses, respectively. The sub-pixel edge data represents the sub-pixel pixel coordinates of edge points.
[0083] In step S150 of some embodiments, ellipse fitting is performed based on sub-pixel edge data to determine the equation function of the inner and outer ellipses of the same concentric circle to be measured, that is, the sub-pixel ellipse function. The sub-pixel ellipse function includes a first ellipse function and a second ellipse function, wherein the first ellipse function corresponds to the first sub-pixel edge data, the second ellipse function corresponds to the second sub-pixel edge data, and the first ellipse function and the second ellipse function correspond to the same concentric circle to be measured.
[0084] In step S160 of some embodiments, homogeneous coordinates are a commonly used coordinate representation method in the field of three-dimensional computer vision, and Euclidean, similarity, affine, and projective transformations can be conveniently represented using a single matrix. Specifically, a function matrix transformation is performed on the first elliptic function and the second elliptic function, respectively, to obtain a first elliptic matrix corresponding to the first elliptic function and a second elliptic matrix corresponding to the second elliptic function. The first elliptic matrix and the second elliptic matrix are matrix forms obtained by representing a quadratic curve in a two-dimensional space as homogeneous coordinates.
[0085] It should be noted that, for example, a quadratic curve in two-dimensional space is represented by ax 2 +bxy+cy 2+dx+ey+f=0, x, y are coordinate variables, a, b, c, d, e, f are unused parameters, if the value in (x1, x2, x3) satisfies x1 / x3=x and x2 / x3=y, then the point (x, y) can be equivalently expressed as homogeneous coordinates (x1 / x3, x2 / x3, 1), the quadratic curve can be equivalently expressed as a homogeneous coordinate function Therefore, the matrix form of the homogeneous function can be expressed as shown in formula (1) and formula (2).
[0086]
[0087] x T Cx=0 (2)
[0088] Here, x represents the matrix [x1 x2 x3], and the matrix C is reversible, that is, the rank of the matrix is 3.
[0089] It should be noted that the first elliptic function and the second elliptic function after ellipse fitting are also homogeneous coordinate functions that meet the above conditions. In this case, the first elliptic matrix can be recorded as C1, and the second elliptic matrix can be recorded as C2.
[0090] In step S170 of some embodiments, the center positioning processing is performed based on the first elliptic matrix C1 and the second elliptic matrix C2. Specifically, the eigenvalue calculation is performed on the first elliptic matrix C1 and the second elliptic matrix C2 to obtain the homogeneous coordinates of the target eigenvector after the origin on the original plane is projected and transformed, which is the target center coordinate data. The embodiment of the present application can obtain more accurate homogeneous coordinates of the center of the circle by solving the homogeneous function.
[0091] Please refer to Figure 4 , Figure 4 This is a flowchart of the specific method of step S110 provided in the embodiment of the present application. In some embodiments of the present application, step S110 may specifically include but is not limited to step S410 and step S420. Figure 4 These two steps are introduced in detail.
[0092] Step S410, performing image filtering processing on the initial concentric circle image to obtain a concentric circle filtered image;
[0093] Step S420 , performing morphological gradient processing on the concentric circle filtered image to obtain a concentric circle preprocessed image.
[0094] In step S410 of some embodiments, because the image captured by the camera contains a large amount of noise points, in order to prevent the noise points from affecting subsequent edge detection, the initial concentric circle image captured by the camera is subjected to image filtering processing to obtain a concentric circle filtered image. The image filtering processing can use methods such as Gaussian filtering to remove the impact of image noise on the accuracy of edge data detection.
[0095] In step S420 of some embodiments, in order to enhance the intensity of pixels in the structural element area and highlight the circular edge points of the concentric circles, the embodiment of the present application performs morphological gradient processing on the concentric circle filtered image, that is, a strip area can be generated at the black and white edges, thereby directly obtaining a mask. For example, please refer to Figure 5 , Figure 5 The concentric circle pre-processed image is a concentric circle filtered image subjected to morphological gradient processing. The concentric circle pre-processed image in the embodiment of the present application is used to represent a circular mask containing circular edge points.
[0096] It should be noted that the embodiment of the present application performs connected domain labeling on the concentric circle pre-processed image after morphological gradient processing based on the initial concentric circle edge data. Because some edges in the edge map obtained using the Canny operator may be broken, that is, if the connected domain analysis is performed directly on the Canny map, edges belonging to the same circle may be classified as two edges. In this embodiment of the present application, the connected domain analysis is performed on the circular mask image to accurately mark which initial concentric circle edge data belong to the same circular edge.
[0097] Please refer to Figure 6 , Figure 6 This is a flowchart of the specific method of step S140 provided in the embodiment of the present application. In some embodiments of the present application, step S140 may specifically include but is not limited to steps S610 to S630. Figure 6 These three steps are introduced in detail.
[0098] Step S610, performing pixel-level edge detection on the target concentric circle edge data to obtain target pixel-level edge data;
[0099] Step S620, performing pixel-level gradient calculation on the target pixel-level edge data to obtain pixel-level gradient data and pixel-level gradient direction;
[0100] Step S630 , performing edge data fitting on the target pixel-level edge data according to the pixel-level gradient direction and the pixel-level gradient data, and determining sub-pixel edge data.
[0101] In steps S610 to S630 of some embodiments, first, pixel-level edge detection is performed on the target concentric circle edge data to obtain target pixel-level edge data, which is used to characterize the complete pixel-level edge point coordinates of a single circle, and pixel-level gradient calculation is performed on the target pixel-level edge data. Specifically, the pixel-level gradient data and pixel-level gradient direction of the area surrounding the pixel point of each target pixel-level edge data are calculated. Thereafter, edge data fitting, i.e., quadratic fitting, is performed on the target pixel-level edge data based on the pixel-level gradient direction and pixel-level gradient data to determine the sub-pixel edge point pixel coordinates.
[0102] It should be noted that the gradient of the edge data of each target pixel in the image is calculated When , the Sobel operator can be used to first calculate the x-direction gradient G(x) and the y-direction gradient G(y), then the pixel-level gradient amplitude and pixel-level gradient direction of each concentric circle edge data are expressed by the following formula (3) and formula (4), respectively.
[0103]
[0104] θ(x)=arctan(G(y) / G(x)) (4)
[0105] Where A(x) represents the pixel-level gradient amplitude of the concentric circle edge data, and θ(x) represents the angle of the pixel-level gradient direction.
[0106] Please refer to Figure 7 , Figure 7 This is a flowchart of the specific method of step S620 provided in the embodiment of the present application. In some embodiments of the present application, step S620 may specifically include but is not limited to steps S710 to S750. Figure 7 These five steps are introduced in detail.
[0107] Step S710, performing gradient projection processing on target pixel-level edge data according to the pixel-level gradient direction to obtain first projection data;
[0108] Step S720, performing gradient projection processing on the pixel-level gradient data according to the pixel-level gradient direction to obtain second projection data;
[0109] Step S730, performing projection fitting based on the first projection data and the second projection data to obtain a pixel-level projection function;
[0110] Step S740, performing function calculation on the pixel-level projection function to obtain pixel-level projection offset data;
[0111] Step S750 , performing data offset processing on the target pixel-level edge data according to the pixel-level projection offset data to obtain sub-pixel edge data.
[0112] In some embodiments, in steps S710 to S750, the pixel-level gradient data at the edge point neighborhood pixel is converted to the pixel-level gradient data at the edge point neighborhood pixel. Pixel-level gradient direction projected to the current point Specifically, the target pixel-level edge data is subjected to gradient projection processing according to the pixel-level gradient direction, that is, the pixel point projection coordinates are projected in the gradient direction. As x variable, that is, the first projection data. Project the gradient magnitude The pixel-level projection function is then obtained by parabola fitting based on the first and second projection data. The pixel-level projection function is then calculated, and the extreme point is taken as the offset of the sub-pixel edge point in the gradient direction, thereby obtaining pixel-level projection offset data. Based on the pixel-level projection offset data, data offset processing is performed on the target pixel-level edge data. That is, the coordinates of the target pixel-level edge data are added to the pixel-level projection offset data to obtain the sub-pixel edge data.
[0113] Please refer to Figure 8 , Figure 8 This is a flowchart of the specific method of step 150 provided in the embodiment of the present application. In some embodiments of the present application, step S150 may specifically include but is not limited to steps S810 to S830. Figure 8 These three steps are introduced in detail.
[0114] Step S810, performing function fitting on the sub-pixel edge data according to a random sampling consensus algorithm to obtain a candidate fitting ellipse function;
[0115] Step S820, calculating the ellipse center of the candidate fitting ellipse function to obtain candidate fitting center data;
[0116] Step S830 , performing ellipse classification on the candidate fitting ellipse function according to the candidate fitting circle center data to obtain a sub-pixel ellipse function.
[0117] In steps S810 to S830 of some embodiments, a RANSAC algorithm is used to perform function fitting on the sub-pixel edge data to remove the influence of outlier edge points and obtain a candidate fitted ellipse function. Since a concentric circle corresponds to two inner and outer circles, the ellipses can be classified according to the degree of proximity of the centers of the ellipses, that is, the ellipse centers are calculated for the candidate fitted ellipse functions to obtain candidate fitted circle center data. The candidate fitted ellipse functions are classified according to the candidate fitted circle center data, that is, the similarity of any two candidate fitted circle center data is calculated to obtain circle center similarity data. If the circle center similarity data is less than the preset ellipse center distance threshold, the inner and outer sub-pixel ellipse functions belonging to the same concentric circle to be measured are obtained.
[0118] Please refer to Figure 9 , Figure 9 This is a flowchart of the specific method of step S170 provided in the embodiment of the present application. In some embodiments of the present application, step S170 may specifically include but is not limited to step S910 and step S920. Figure 9 These two steps are introduced in detail.
[0119] Step S910, performing matrix calculation on the first elliptic matrix and the second elliptic matrix according to a preset characteristic function to obtain a target characteristic vector;
[0120] Step S920: Perform an inverse homogeneous coordinate transformation on the target feature vector to obtain target circle center coordinate data.
[0121] In steps S910 and S920 of some embodiments, the present invention performs matrix calculations on the first and second elliptic matrices based on a preset characteristic function to determine target eigenvectors corresponding to the homogeneous coordinates of the centers of the concentric circles after the projective transformation. The target eigenvectors are then subjected to an inverse homogeneous coordinate transformation to obtain target center coordinate data, which can then be used to accurately determine the centers of the concentric circles of the present invention.
[0122] Please refer to Figure 10 , Figure 10 This is a flowchart of the specific method of step S910 provided in the embodiment of the present application. In some embodiments of the present application, step S910 may specifically include but is not limited to step S1010 and step S1020. Figure 10 These two steps are introduced in detail.
[0123] Step S1010, calculating eigenvalues of the first elliptic matrix and the second elliptic matrix according to a preset characteristic function to obtain target eigenvalues, which are used to represent the ratio of the squares of the inner and outer radii of the concentric circles to be measured;
[0124] Step S1020 , performing eigenvector calculation on the target eigenvalue according to a preset eigenfunction to obtain a target eigenvector.
[0125] It should be noted that for concentric circles on the space plane Its matrix form can be expressed as shown in formula (5).
[0126]
[0127] According to the preset parameter matrix H as shown in formula (6), the equation of the ellipse formed by the concentric circles on the spatial plane on the image plane can be expressed as shown in formula (7).
[0128]
[0129]
[0130] Where r is the radius variable.
[0131] In step S1010 of some embodiments, the eigenvalues of the first elliptic matrix and the second elliptic matrix are calculated according to a preset eigenfunction to obtain a target eigenvalue. Specifically, the first elliptic matrix is recorded as E1, and the second elliptic matrix is recorded as E2. The preset eigenfunction Among them, when the matrix representation of the quadratic curve is homogeneous, if the pixel point x in the two-dimensional space belongs to a plane orthogonal to p3, then E1x=sE2x. Taking the two basis vectors of the plane, we can get E1x1=sE2x1 and E1x2=sE2x2, then these two basis vectors are matrices The eigenvectors of , and their corresponding eigenvalues are all s; if x is orthogonal to the plane formed by p1 and p2, then At this time the vector is The eigenvector of Therefore, according to H -T It can be seen that the above three eigenvectors are linearly independent, and these three vectors are All eigenvectors.
[0132] It should be noted that the eigenvalue is calculated based on the preset eigenvalue function, that is, There are three eigenvalues λ1, λ2, λ3, whose ratio Among them, the target eigenvector corresponding to λ3 is the homogeneous coordinate of the origin on the original plane after projection transformation, that is, the target eigenvalue is λ3, which is used to represent the ratio of the squares of the inner and outer radii of the concentric circles to be measured, that is, the target circle center coordinate data.
[0133] In step S1020 of some embodiments, according to the preset characteristic function The target eigenvalue λ3 is subjected to eigenvector calculation to obtain the target eigenvector, and the target eigenvector is subjected to inverse homogeneous coordinate transformation to obtain accurate target circle center coordinate data.
[0134] The embodiment of the present application calculates the homogeneous coordinates of the pixel points on the original plane after the projection transformation, that is, the sub-pixel elliptic function equation is fitted according to the sub-pixel edge points of the concentric circles, and obtains the matrix form of its sub-pixel elliptic function. According to the relationship between the three eigenvalues corresponding to the matrix form, the accurate homogeneous coordinates of the center of the concentric circles are obtained, thereby simply and effectively improving the positioning accuracy of the center of the concentric circles.
[0135] Please refer to Figure 11 , Figure 11 11 is a schematic diagram of the module structure of the concentric circle center positioning system provided in an embodiment of the present application. In some embodiments of the present application, the concentric circle center positioning system includes an image preprocessing module 1110, an edge data extraction module 1120, a connected domain labeling module 1130, an edge detection module 1140, an ellipse fitting module 1150, a matrix transformation module 1160, and a circle center positioning module 1170.
[0136] The image preprocessing module 1110 is used to obtain an initial concentric circle image of the concentric circles to be measured, and perform image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image;
[0137] An edge data extraction module 1120 is configured to extract edge data from the concentric circle preprocessed image to obtain initial concentric circle edge data;
[0138] a connected component labeling module 1130 configured to perform connected component labeling processing on the concentric circle preprocessed image based on the initial concentric circle edge data to obtain target concentric circle edge data; the target concentric circle edge data includes first edge data and second edge data, the first edge data and the second edge data respectively belonging to different circles;
[0139] An edge detection module 1140 is configured to perform sub-pixel edge detection based on the target concentric circle edge data to obtain sub-pixel edge data; the sub-pixel edge data includes first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data corresponding to the second edge data;
[0140] an ellipse fitting module 1150 for performing ellipse fitting based on the sub-pixel edge data to obtain a sub-pixel ellipse function, wherein the sub-pixel ellipse function includes a first ellipse function and a second ellipse function, wherein the first ellipse function corresponds to the first sub-pixel edge data, the second ellipse function corresponds to the second sub-pixel edge data, and the first ellipse function and the second ellipse function correspond to the same concentric circle to be measured;
[0141] A matrix transformation module 1160 is configured to perform function matrix transformation on the first elliptic function and the second elliptic function, respectively, to obtain a first elliptic matrix corresponding to the first elliptic function and a second elliptic matrix corresponding to the second elliptic function;
[0142] The circle center positioning module 1170 is used to perform circle center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target circle center coordinate data.
[0143] It should be noted that the concentric circle center positioning system of the embodiment of the present application is used to execute the above-mentioned concentric circle center positioning method, and the concentric circle center positioning system of the embodiment of the present application corresponds to the above-mentioned concentric circle center positioning method. Please refer to the above-mentioned concentric circle center positioning method for the specific training process, which will not be elaborated here.
[0144] An embodiment of the present application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the concentric circle center positioning method of the above-mentioned embodiment of the present application is implemented.
[0145] The electronic device may be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a car computer, etc.
[0146] The following combination Figure 12 The electronic device according to the embodiment of the present application is introduced in detail.
[0147] Please refer to Figure 12 , Figure 12 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0148] The processor 1210 can be implemented using a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0149] The memory 1220 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1220 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1220 and is called by the processor 1210 to execute the concentric circle center positioning method of the embodiments of this application;
[0150] Input / output interface 1230, used for information input and output;
[0151] Communication interface 1240, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, Wi-Fi, Bluetooth, etc.);
[0152] bus 1250 , which transmits information between various components of the device (e.g., processor 1210 , memory 1220 , input / output interface 1230 , and communication interface 1240 );
[0153] The processor 1210 , the memory 1220 , the input / output interface 1230 , and the communication interface 1240 are communicatively connected to each other within the device via a bus 1250 .
[0154] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the concentric circle center positioning method of the embodiment of the present application is implemented.
[0155] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0156] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0157] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0158] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0159] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0160] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0161] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0162] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0163] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0164] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0165] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0166] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A method for locating the center of concentric circles, characterized in that: The method comprises: Acquiring an initial concentric circle image of the concentric circles to be measured, and performing image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image; Extracting edge data from the concentric circle preprocessed image to obtain initial concentric circle edge data; Performing a connected component labeling process on the concentric circle preprocessed image according to the initial concentric circle edge data to obtain target concentric circle edge data; the target concentric circle edge data includes first edge data and second edge data, and the first edge data and the second edge data belong to different circles respectively; Performing sub-pixel edge detection on the target concentric circle edge data to obtain sub-pixel edge data; the sub-pixel edge data includes first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data corresponding to the second edge data; performing ellipse fitting according to the sub-pixel edge data to obtain a sub-pixel ellipse function, the sub-pixel ellipse function including a first ellipse function and a second ellipse function, the first ellipse function corresponding to the first sub-pixel edge data, the second ellipse function corresponding to the second sub-pixel edge data, and the first ellipse function and the second ellipse function corresponding to the same concentric circle to be measured; Performing function matrix transformation on the first elliptic function and the second elliptic function respectively to obtain a first elliptic matrix corresponding to the first elliptic function and a second elliptic matrix corresponding to the second elliptic function; Performing circle center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target circle center coordinate data; performing circle center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target circle center coordinate data, including: recording the first ellipse matrix as , the second elliptic matrix is recorded as , according to the preset characteristic function For the first elliptic matrix and the second elliptic matrix Calculate the characteristic value to obtain the target characteristic value, which is used to characterize the ratio of the square of the inner and outer radii of the concentric circles to be measured; according to the preset characteristic function Performing eigenvector calculation on the target eigenvalue to obtain a target eigenvector; performing inverse homogeneous coordinate transformation on the target eigenvector to obtain the target circle center coordinate data.
2. The method according to claim 1, characterized in that The performing image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image includes: Performing image filtering on the initial concentric circle image to obtain a concentric circle filtered image; Performing morphological gradient processing on the concentric circle filtered image to obtain the concentric circle preprocessed image.
3. The method according to claim 1, characterized in that The performing sub-pixel edge detection based on the target concentric circle edge data to obtain sub-pixel edge data includes: Performing pixel-level edge detection on the target concentric circle edge data to obtain target pixel-level edge data; Performing pixel-level gradient calculation on the target pixel-level edge data to obtain pixel-level gradient data and pixel-level gradient direction; Edge data fitting is performed on the target pixel-level edge data according to the pixel-level gradient direction and the pixel-level gradient data to determine the sub-pixel edge data.
4. The method according to claim 3, characterized in that The performing edge data fitting on the target pixel-level edge data according to the pixel-level gradient direction and the pixel-level gradient data to determine the sub-pixel edge data includes: Performing gradient projection processing on the target pixel-level edge data according to the pixel-level gradient direction to obtain first projection data; Performing gradient projection processing on the pixel-level gradient data according to the pixel-level gradient direction to obtain second projection data; Performing projection fitting based on the first projection data and the second projection data to obtain a pixel-level projection function; Performing function calculation on the pixel-level projection function to obtain pixel-level projection offset data; Data offset processing is performed on the target pixel-level edge data according to the pixel-level projection offset data to obtain the sub-pixel edge data.
5. The method according to any one of claims 1 to 4, characterized in that The performing ellipse fitting according to the sub-pixel edge data to obtain a sub-pixel ellipse function includes: Performing function fitting on the sub-pixel edge data according to a random sampling consensus algorithm to obtain a candidate fitting ellipse function; Calculating the center of the candidate fitting ellipse function to obtain candidate fitting center data; The candidate fitting ellipse function is subjected to ellipse classification according to the candidate fitting circle center data to obtain the sub-pixel ellipse function.
6. A concentric circle center positioning system, characterized in that: The system comprises: An image preprocessing module is used to obtain an initial concentric circle image of the concentric circles to be measured, and perform image preprocessing on the initial concentric circle image to obtain a concentric circle preprocessed image; An edge data extraction module is used to extract edge data from the concentric circle preprocessed image to obtain initial concentric circle edge data; a connected domain labeling module, configured to perform connected domain labeling processing on the concentric circle preprocessed image according to the initial concentric circle edge data to obtain target concentric circle edge data; the target concentric circle edge data includes first edge data and second edge data, the first edge data and the second edge data respectively belonging to different circles; an edge detection module, configured to perform sub-pixel edge detection based on the target concentric circle edge data to obtain sub-pixel edge data; the sub-pixel edge data includes first sub-pixel edge data corresponding to the first edge data and second sub-pixel edge data corresponding to the second edge data; an ellipse fitting module, configured to perform ellipse fitting according to the sub-pixel edge data to obtain a sub-pixel ellipse function, wherein the sub-pixel ellipse function includes a first ellipse function and a second ellipse function, wherein the first ellipse function corresponds to the first sub-pixel edge data, the second ellipse function corresponds to the second sub-pixel edge data, and the first ellipse function and the second ellipse function correspond to the same concentric circle to be measured; a matrix transformation module, configured to perform function matrix transformation on the first elliptic function and the second elliptic function, respectively, to obtain a first elliptic matrix corresponding to the first elliptic function and a second elliptic matrix corresponding to the second elliptic function; The center positioning module is used to perform center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target center coordinate data; the center positioning processing according to the first ellipse matrix and the second ellipse matrix to obtain target center coordinate data includes: recording the first ellipse matrix as , the second elliptic matrix is recorded as , according to the preset characteristic function For the first elliptic matrix and the second elliptic matrix Calculate the characteristic value to obtain the target characteristic value, which is used to characterize the ratio of the square of the inner and outer radii of the concentric circles to be measured; according to the preset characteristic function Performing eigenvector calculation on the target eigenvalue to obtain a target eigenvector; performing inverse homogeneous coordinate transformation on the target eigenvector to obtain the target circle center coordinate data.
7. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Circular target circular center positioning method
CN101334263A
Accurate positioning method of center projection point in target image
CN104318555A