Edge detection method and device for circular structure in image, equipment and medium

By using Hessian matrix and edge detection algorithm to determine candidate edge points and centers in natural shooting images, the problem of unsatisfactory edge detection effect in natural shooting images is solved, and efficient and accurate edge detection of circular structures is achieved. in embedded devices.

CN119477950APending Publication Date: 2025-02-18XIAN WANXIANG ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411509913.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The prior art has not been ideal for edge detection of circular structures in natural images, especially when the light is greatly affected, and the effect detected by the traditional method is not ideal.

Method used

By obtaining the Hessian matrix corresponding to each pixel point in the image to be detected, the candidate edge point is determined based on the Hessian matrix and the preset area range, the straight line equation of the normal direction of the candidate edge point is obtained, and the circle shape is determined based on the position information and the straight line equation is determined. The center and radius of the structure finally result in the edge of the circular structure.

Benefits of technology

It has achieved a significant improvement in the edge detection effect of circular structures in natural-captured images, and can accurately detect circular contours in images. It has low development costs and low computing power requirements. It is suitable for embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119477950A_ABST
    Figure CN119477950A_ABST
Patent Text Reader

Abstract

The invention discloses an edge detection method and device for a circular structure in an image, equipment and a medium, relates to the technical field of image detection, and can improve the detection effect of edge detection of the circular structure in a naturally shot image. According to the specific scheme, the method comprises the steps of obtaining a Hessian matrix corresponding to each pixel point in a to-be-detected image, wherein two feature values corresponding to the Hessian matrix are used for indicating the edge intensity of the pixel point in the corresponding direction; determining candidate edge points of the circular structure based on each Hessian matrix and a preset region range; obtaining a linear equation of the normal direction of each candidate edge point; determining the circle center and the radius of the circular structure according to the position information of each candidate edge point and the corresponding linear equation; obtaining the edge of the circular structure according to the circle center and the radius.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image detection technology, and in particular to a method, device, equipment and medium for detecting an edge of a circular structure in an image. Background Art

[0002] Edge detection and diameter measurement of circular images or nearly circular figures in images have a wide range of uses in industry and life. For example, in ophthalmological clinical testing, the surface of the eye is imaged by a camera, and the center position and diameter of the pupil are determined by image processing methods, and the edge of the iris is detected to determine the white-to-white distance and center position.

[0003] At present, there are detection methods based on edge detection operators and Hough detection methods. Among them, detection methods based on edge detection operators include: Sobel operator and Laplace operator, and Hough detection methods include Hough line detection, Hough circle detection, etc. However, these methods are only suitable for ideal situations, such as computer-generated images. For photos taken naturally, the detection effect of this detection method is not ideal. Summary of the invention

[0004] The present application provides a method, device, equipment and medium for edge detection of circular structures in an image, which can improve the detection effect of edge detection of circular structures in natural captured images.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect of an embodiment of the present application, a method for detecting an edge of a circular structure in an image is provided, the method comprising:

[0007] Obtaining the Hessian matrix corresponding to each pixel in the image to be detected, wherein the two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength in the direction corresponding to the pixel;

[0008] Determine candidate edge points of the circular structure based on each of the Hessian matrices and a preset region range;

[0009] Obtaining a straight line equation of the normal direction of each candidate edge point;

[0010] Determining the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation;

[0011] The edge of the circular structure is obtained according to the center of the circle and the radius.

[0012] As a possible implementation manner, before obtaining the Hessian matrix corresponding to each pixel in the image to be detected, the method further includes:

[0013] Obtaining an initial image to be detected;

[0014] Preprocessing the initial image to obtain a target image, wherein the preprocessing includes: grayscale conversion, normalization, image downsampling and Gaussian filtering;

[0015] The obtaining of the Hessian matrix corresponding to each pixel in the image to be detected includes:

[0016] Get the Hessian matrix corresponding to each pixel in the target image.

[0017] As a possible implementation manner, the determining of candidate edge points of the circular structure based on each of the Hessian matrices and a preset area range includes:

[0018] Determining the edge strength of each pixel point according to the two eigenvalues ​​corresponding to each of the Hessian matrices;

[0019] Determine the pixel points whose edge strength is greater than a first threshold as initial candidate edge points;

[0020] For the initial candidate edge points, the initial candidate edge points located within the region are determined as the candidate edge points.

[0021] As a possible implementation manner, obtaining the straight line equation of the normal direction of each candidate edge point includes:

[0022] Determining the edge direction of each candidate edge point according to two eigenvectors of the Hessian matrix of each candidate edge point;

[0023] The equations of the straight lines are determined according to the position information of the candidate edge points and the vertical direction of the corresponding edge direction.

[0024] As a possible implementation manner, determining the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation includes:

[0025] Determine a first coordinate range in a first direction and a second coordinate range in a second direction according to the position information of each of the candidate edge points, wherein the first coordinate range and the second coordinate range include a plurality of discrete points;

[0026] For each target discrete point among the plurality of discrete points, the first direction coordinate of the target discrete point is substituted into each of the straight line equations to obtain a plurality of corresponding second direction coordinates;

[0027] Determine the number of hits of the target discrete point according to the number of overlaps between the test pixel point formed by the first direction coordinate and the corresponding second direction coordinate and the discrete point;

[0028] The center of the circle and the radius are determined according to the number of hits of each discrete point, the position information of the candidate edge point and a preset neighborhood range.

[0029] As a possible implementation manner, determining the center and the radius according to the number of hits of each discrete point, the position information of the candidate edge point, and a preset neighborhood range includes:

[0030] Selecting a first center point and multiple second center points from the multiple discrete points according to the hit count, wherein the first center point is the discrete point with the largest hit count, and the second center point is the discrete point with a hit count greater than a second threshold;

[0031] Taking the first circle center point as the center, taking the second circle center point within the neighborhood as a candidate circle center point;

[0032] The center point and the radius are determined according to the position of the candidate center point, the number of times the candidate center point is hit, and the candidate edge points that hit the candidate center point.

[0033] As a possible implementation manner, determining the center point and the radius according to the position of the candidate center point, the number of hits of the candidate center point, and the candidate edge points that hit the candidate center point includes:

[0034] Get the sum of the hit counts of all candidate circle center points;

[0035] According to the sum of the hit counts and the hit count of each candidate center point, weighted averaging is performed on the position information of the plurality of candidate points to obtain the center point;

[0036] Determine the distance between each candidate circle center point and the candidate edge point of the candidate circle center point to obtain multiple candidate distances;

[0037] According to the sum of the hit times and the hit times of each candidate center point, a weighted average is performed on the multiple candidate distances to obtain the radius.

[0038] In a second aspect of an embodiment of the present application, a device for detecting an edge of a circular structure in an image is provided, the device comprising:

[0039] A first acquisition module is used to obtain a Hessian matrix corresponding to each pixel in the image to be detected, wherein two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength in the direction corresponding to the pixel;

[0040] A first determination module, used to determine candidate edge points of a circular structure based on each of the Hessian matrices and a preset area range;

[0041] A second acquisition module is used to obtain the straight line equation of the normal direction of each candidate edge point;

[0042] A second determination module is used to determine the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation;

[0043] A processing module is used to obtain the edge of the circular structure according to the center of the circle and the radius.

[0044] According to a third aspect of an embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, a method for detecting an edge of a circular structure in an image according to the first aspect of an embodiment of the present application is implemented.

[0045] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for detecting an edge of a circular structure in an image according to the first aspect of the embodiments of the present application is implemented.

[0046] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0047] The edge detection method of the circular structure in the image provided by the embodiment of the present application obtains the Hessian matrix corresponding to each pixel point in the image to be detected, wherein the two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength of the corresponding direction of the pixel point, and then determines the candidate edge points of the circular structure based on each Hessian matrix and a preset area range, and obtains the straight line equation of the normal direction of each candidate edge point, and then determines the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation, and finally obtains the edge of the circular structure according to the center and radius. The method can accurately detect the circular contour in the image and has high real-time performance, and has low development cost and low computing power requirements, and can be applied to embedded devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 The edge detection method of a circular structure in an image provided by the embodiment of the present application is as follows: Figure 1 ;

[0049] Figure 2 The edge detection method of a circular structure in an image provided by the embodiment of the present application is as follows: Figure 2 ;

[0050] Figure 3 The edge detection method of a circular structure in an image provided by the embodiment of the present application is as follows: Figure 3 ;

[0051] Figure 4 A structural diagram of a device for detecting an edge of a circular structure in an image provided by an embodiment of the present application;

[0052] Figure 5 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality" means two or more.

[0055] Additionally, the use of “based on” or “according to” is meant to be open and inclusive, as a process, step, calculation, or other action “based on” or “according to” one or more conditions or values ​​may, in practice, be based on additional conditions or beyond values.

[0056] Edge detection and diameter measurement of circular images or nearly circular figures in images have a wide range of uses in industry and life. For example, in ophthalmological clinical testing, the surface of the eye is imaged by a camera, and the center position and diameter of the pupil are determined by image processing methods, and the edge of the iris is detected to determine the white-to-white distance and center position.

[0057] At present, the detection methods include detection methods based on edge detection operators and Hough detection methods. Among them, detection methods based on edge detection operators include: Sobel operator and Laplace operator, and Hough detection methods include Hough line detection, Hough circle detection, etc. However, these methods are only suitable for ideal conditions, such as computer-generated images. If it is a picture taken naturally, due to the influence of lighting, even if the camera and the photographed object remain still, the pictures taken each time cannot be the same pixel by pixel, and traditional methods involve more parameters, especially edge detection. These preset parameters have a great influence on the final result of the algorithm. Therefore, for edge detection of natural images, the detection effect of traditional edge detection methods is not ideal.

[0058] As for the more popular deep learning method, although it has high accuracy, its development cycle is long and requires a series of processes such as image annotation, model building, training, and parameter adjustment, which is time-consuming and labor-intensive. In addition, the algorithm generally runs on a server or high-performance PC, which requires high computing power, making it difficult to apply deep learning models to embedded devices.

[0059] To solve the above problems, the present invention provides a method for edge detection of circular structures in an image. Figure 1 As shown, the method comprises the following steps:

[0060] Step 101: Obtain a Hessian matrix corresponding to each pixel in the image to be detected, wherein two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength in the direction corresponding to the pixel.

[0061] Among them, each pixel in the image corresponds to a second-order Hessian matrix. The two eigenvectors of the Hessian matrix represent the direction of the edge, and the two vectors are perpendicular to each other. The eigenvalues ​​corresponding to the two eigenvectors are the edge strengths in the corresponding directions.

[0062] It can be understood that obtaining the Hessian matrix corresponding to each pixel in the image to be detected can be to calculate the Hessian matrix corresponding to the coordinates of each pixel in the image to be detected. The Hessian matrix is ​​a second-order symmetric matrix, and the main diagonal of the Hessian matrix is ​​the second-order partial derivative of the coordinates x and y of the pixel point, and the secondary diagonal is the joint partial derivative of x and y.

[0063] Step 102: Determine candidate edge points of the circular structure based on each of the Hessian matrices and a preset region range.

[0064] The preset area range may be a predetermined initial range of the circular structure, and the initial range is an approximate area range of the circular structure, such as the left side range of the image, or the area range of the upper left corner.

[0065] Step 103: Obtain the straight line equation of the normal direction of each candidate edge point.

[0066] Step 104: Determine the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation.

[0067] Step 105: Obtain the edge of the circular structure according to the center of the circle and the radius.

[0068] The edge detection method of the circular structure in the image provided by the embodiment of the present application obtains the Hessian matrix corresponding to each pixel point in the image to be detected, wherein the two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength of the corresponding direction of the pixel point, and then determines the candidate edge points of the circular structure based on each of the Hessian matrices and a preset area range, and obtains the straight line equation of the normal direction of each of the candidate edge points, and then determines the center and radius of the circular structure according to the position information of each of the candidate edge points and the corresponding straight line equation, and finally obtains the edge of the circular structure according to the center and the radius. The method can accurately detect the circular contour in the image, has low development cost, does not require high computing power, and can be applied to embedded devices.

[0069] Optionally, before executing the above step 101 to obtain the Hessian matrix corresponding to each pixel in the image to be detected, the method further includes the following steps:

[0070] Get the initial image to be detected.

[0071] The target image is obtained by preprocessing the initial image, wherein the preprocessing includes: grayscale conversion, normalization, image downsampling and Gaussian filtering.

[0072] Correspondingly, obtaining the Hessian matrix corresponding to each pixel point in the image to be detected includes: obtaining the Hessian matrix corresponding to each pixel point in the target image.

[0073] It can be understood that the amount of calculation of the Hessian matrix corresponding to the pixel points can be greatly reduced by performing grayscale conversion, normalization, image downsampling and Gaussian filtering preprocessing on the initial image to be detected.

[0074] Specifically, the calculation of the Hessian matrix corresponding to the coordinates of a target pixel point in the target image is as follows:

[0075]

[0076] Where D(x, y) is the second-order Hessian matrix of the target pixel, F(x, y) is the target pixel in the image after Gaussian filtering, I(x, y) is the target pixel in the image before filtering, G(x, y) is a two-dimensional Gaussian function, and * is a convolution operation.

[0077] like Figure 2 As shown, the process of determining the candidate edge points of the circular structure based on each of the Hessian matrices and the preset area range in step 102 may include the following steps:

[0078] Step 201: Determine the edge strength of each pixel point according to the two eigenvalues ​​corresponding to each of the Hessian matrices.

[0079] For example, as shown in formula (2), D 1 and D 2 are the two eigenvalues ​​of a Hessian matrix respectively, then D is the edge intensity of the pixel corresponding to the Hessian matrix.

[0080]

[0081] Step 202: Determine the pixel points whose edge strength is greater than a first threshold as initial candidate edge points.

[0082] The first threshold may be determined according to the maximum edge intensity among the edge intensity of each pixel point. For example, the first threshold may be the maximum edge intensity multiplied by a first coefficient, and the first coefficient may be 0.6.

[0083] Step 203: For the initial candidate edge points, determine the initial candidate edge points within the region as the candidate edge points.

[0084] By determining the initial candidate edge points within the region as the candidate edge points, edge points of non-circular contours can be filtered out.

[0085] It can be understood that, through the above process, candidate edge points of the circular structure can be firstly screened out from all the pixels in the image, and then the center and radius of the circular structure can be determined based on these candidate edge points.

[0086] Optionally, the process of obtaining the straight line equation of the normal direction of each candidate edge point in step 103 may be:

[0087] The edge direction of each candidate edge point is determined according to two eigenvectors of the Hessian matrix of each candidate edge point, and then the straight line equation is determined according to the position information of each candidate edge point and the corresponding vertical direction of the edge direction.

[0088] For example, as shown in formula (3), α 1 and α 2 are the eigenvectors of a Hessian matrix, D e It is the edge direction of the candidate edge point corresponding to the Hessian matrix.

[0089]

[0090] That is to say, after determining the edge direction of the candidate edge point, since the normal direction of the candidate edge point is perpendicular to the edge direction, the normal direction of the candidate edge point can be obtained according to the edge direction, and finally, the straight line equation of the normal direction of each candidate edge point can be determined according to the position information and normal direction of each candidate edge point.

[0091] like Figure 3 As shown, the process of determining the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation in step 104 may include the following steps:

[0092] Step 301: Determine a first coordinate range in a first direction and a second coordinate range in a second direction according to the position information of each candidate edge point, wherein the first coordinate range and the second coordinate range include a plurality of discrete points.

[0093] The first direction may be the x-axis direction in the image coordinate system xy, and the second direction may be the y-axis direction.

[0094] Optionally, the first coordinate range can be obtained according to the minimum coordinate value and the maximum coordinate value of the first direction of each candidate edge point, and the second coordinate range can be obtained according to the minimum coordinate value and the maximum coordinate value of the second direction of each candidate edge point. The first coordinate range and the second coordinate range include multiple discrete points.

[0095] Step 302: for each target discrete point among the plurality of discrete points, substitute the first direction coordinate of the target discrete point into each of the straight line equations to obtain a plurality of corresponding second direction coordinates;

[0096] Step 303: Determine the number of hits of the target discrete point according to the number of overlaps between the test pixel point formed by the first direction coordinate and the corresponding second direction coordinate and the discrete point;

[0097] Step 304: Determine the center of the circle and the radius according to the number of hits of each discrete point, the position information of the candidate edge point, and a preset neighborhood range.

[0098] For example, Table 1 is a table of the number of hits of discrete points. As shown in Table 1, discrete points can be represented by (x, y), where x 0 is the minimum x coordinate of the candidate edge points, x n is the maximum value of the x coordinate among the candidate edge points; y 0 is the minimum value of the y coordinate among the candidate edge points, y n is the maximum value of the y coordinate among the candidate sample points. The interval between two adjacent x coordinates or y coordinates is 1 pixel. The number of hits can be represented by M. The initial values ​​in the table are all 0, and the corresponding value increases by 1 each time a hit occurs.

[0099] Table 1. Number of hits of discrete points

[0100] <![CDATA[x 0 ]]> <![CDATA[x 1 ]]> <![CDATA[x 2 ]]> …… <![CDATA[x 3 ]]> <![CDATA[y 0 ]]> <![CDATA[M 00 ]]> <![CDATA[M 01 ]]> <![CDATA[M 02 ]]> <![CDATA[M 0n ]]> <![CDATA[y 1 ]]> <![CDATA[M 10 ]]> <![CDATA[M 11 ]]> <![CDATA[M 12 ]]> <![CDATA[M 1n ]]> <![CDATA[y 2 ]]> <![CDATA[M 20 ]]> <![CDATA[M 21 ]]> <![CDATA[M 22 ]]> <![CDATA[M 2n ]]> …… <![CDATA[y n ]]> <![CDATA[M n0 ]]> <![CDATA[M n1 ]]> <![CDATA[M n2 ]]> <![CDATA[M nn ]]>

[0101] The position of the candidate edge point can be used (E x , E y ) means that x 0 ,x 1 ,...,x n Substitute the straight line equations of the candidate edge points respectively and find the corresponding y values, then x 0 ,x 1 ,...,x n And the corresponding y value obtained constitutes a test pixel point. If the test pixel point coincides with a discrete point once, the hit number of the discrete point is increased by 1, and the hit number of each discrete point is finally obtained. Finally, the center of the circle and the radius are determined according to the hit number of each discrete point, the position information of the candidate edge point and the preset neighborhood range.

[0102] Specifically, the process of determining the center and the radius of the circle according to the hit count of each discrete point, the position information of the candidate edge point and the preset neighborhood range in step 304 may be:

[0103] Selecting a first center point and multiple second center points from the multiple discrete points according to the hit count, wherein the first center point is the discrete point with the largest hit count, and the second center point is the discrete point with a hit count greater than a second threshold; wherein the second threshold may be determined by multiplying the highest hit count by a coefficient;

[0104] Taking the first circle center point as the center, taking the second circle center point within the neighborhood as a candidate circle center point;

[0105] The center point and the radius are determined according to the position of the candidate center point, the number of times the candidate center point is hit, and the candidate edge points that hit the candidate center point.

[0106] Specifically, the process of determining the center point and the radius according to the position of the candidate center point, the number of hits of the candidate center point, and the candidate edge points that hit the candidate center point may be:

[0107] Get the sum of the hit counts of all candidate circle center points;

[0108] According to the sum of the hit counts and the hit count of each candidate center point, weighted averaging is performed on the position information of the plurality of candidate points to obtain the center point;

[0109] Determine the distance between each candidate circle center point and the candidate edge point of the candidate circle center point to obtain multiple candidate distances;

[0110] According to the sum of the hit times and the hit times of each candidate center point, a weighted average is performed on the multiple candidate distances to obtain the radius.

[0111] It is understandable that the more hits a discrete point has, the more likely it is to be the center of the circle. However, due to the shooting angle and the influence of lighting, the circle captured cannot be a 100% standard circle. In addition, the floating point number calculated by the algorithm causes errors, and there may be more hits near the point with the most hits. Therefore, we need to use the weighted average method to further adjust the center position.

[0112] In the actual execution process, the point corresponding to the maximum number of hits is taken as the first circle center point, and the weighted average of the candidate circle center points in the neighborhood (such as 3x3) is taken, see formulas (4)-(6), x c ,y c are the x and y coordinates of the center of the circle finally calculated; n t is the sum of the hit times of all candidate points of the circle center in the neighborhood, x i, y i is a candidate point of the circle center in the neighborhood, n i is the corresponding number of hits; n c is the number of candidate points for the circle center in the neighborhood.

[0113]

[0114] Similarly, we also need to use the weighted average method to calculate the radius of the circle, see formula (7)-(8), r is the final radius of the circle, r i is the radius corresponding to a candidate center point.

[0115]

[0116]

[0117] In addition, if we know from prior knowledge that there is only one circular object, then our algorithm process ends here. If there is more than one circular object detected, then we also need to clear the hit count of the candidate center found previously to 0, and then repeat the above step 304 to determine the center and radius process. In addition, we also need to set a minimum hit count threshold. When the maximum hit count in Table 1 is less than the minimum hit count threshold or the number of circles we detected is equal to the expected number of circle contours, the algorithm ends.

[0118] like Figure 4 As shown, an embodiment of the present application provides an edge detection device for a circular structure in an image, the device comprising:

[0119] A first acquisition module 11 is used to acquire a Hessian matrix corresponding to each pixel in the image to be detected, wherein two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength in the direction corresponding to the pixel;

[0120] A first determination module 12, configured to determine candidate edge points of a circular structure based on each of the Hessian matrices and a preset region range;

[0121] A second acquisition module 13 is used to obtain a straight line equation of a normal direction of each candidate edge point;

[0122] A second determination module 14 is used to determine the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation;

[0123] The processing module 15 is used to obtain the edge of the circular structure according to the center of the circle and the radius.

[0124] In one embodiment, the processing module 15 is further used to: obtain an initial image to be detected; obtain a target image after preprocessing the initial image, wherein the preprocessing includes: grayscale conversion, normalization, image downsampling and Gaussian filtering;

[0125] The first acquisition module 11 is specifically used to obtain the Hessian matrix corresponding to each pixel in the target image.

[0126] In one embodiment, the first determining module 12 is specifically configured to:

[0127] Determining the edge strength of each pixel point according to the two eigenvalues ​​corresponding to each of the Hessian matrices;

[0128] Determine the pixel points whose edge strength is greater than a first threshold as initial candidate edge points;

[0129] For the initial candidate edge points, the initial candidate edge points located within the region are determined as the candidate edge points.

[0130] In one embodiment, the second acquisition module 13 is specifically used for:

[0131] Determining the edge direction of each candidate edge point according to two eigenvectors of the Hessian matrix of each candidate edge point;

[0132] The equations of the straight lines are determined according to the position information of the candidate edge points and the vertical direction of the corresponding edge direction.

[0133] In one embodiment, the second determining module 14 is specifically configured to:

[0134] Determine a first coordinate range in a first direction and a second coordinate range in a second direction according to the position information of each of the candidate edge points, wherein the first coordinate range and the second coordinate range include a plurality of discrete points;

[0135] For each target discrete point among the plurality of discrete points, the first direction coordinate of the target discrete point is substituted into each of the straight line equations to obtain a plurality of corresponding second direction coordinates;

[0136] Determine the number of hits of the target discrete point according to the number of overlaps between the test pixel point formed by the first direction coordinate and the corresponding second direction coordinate and the discrete point;

[0137] The center of the circle and the radius are determined according to the number of hits of each discrete point, the position information of the candidate edge point and a preset neighborhood range.

[0138] In one embodiment, the second determining module 14 is specifically configured to:

[0139] Selecting a first center point and multiple second center points from the multiple discrete points according to the hit count, wherein the first center point is the discrete point with the largest hit count, and the second center point is the discrete point with a hit count greater than a second threshold;

[0140] Taking the first circle center point as the center, taking the second circle center point within the neighborhood as a candidate circle center point;

[0141] The center point and the radius are determined according to the position of the candidate center point, the number of times the candidate center point is hit, and the candidate edge points that hit the candidate center point.

[0142] In one embodiment, the second determining module 14 is specifically configured to:

[0143] Get the sum of the hit counts of all candidate circle center points;

[0144] According to the sum of the hit counts and the hit count of each candidate center point, weighted averaging is performed on the position information of the plurality of candidate points to obtain the center point;

[0145] Determine the distance between each candidate circle center point and the candidate edge point of the candidate circle center point to obtain multiple candidate distances;

[0146] According to the sum of the hit times and the hit times of each candidate center point, a weighted average is performed on the multiple candidate distances to obtain the radius.

[0147] The device for detecting the edge of a circular structure in an image provided in this embodiment can execute the above-mentioned method for detecting the edge of a circular structure in an image, and its implementation principle and technical effect are similar, which will not be elaborated here.

[0148] For the specific definition of the edge detection device for circular structures in images, please refer to the definition of the edge detection method for circular structures in images above, which will not be repeated here. Each module in the above-mentioned edge detection device for circular structures in images can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor of the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0149] The execution subject of the edge detection method of circular structures in images provided in the embodiment of the present application may be an electronic device, which may be a computer device, a terminal device, a server or a server cluster, and the embodiment of the present application does not specifically limit this.

[0150] Figure 5 This is a schematic diagram of the internal structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device includes a processor and a memory connected via a system bus. The processor is used to provide computing and control capabilities. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement the steps of the edge detection method of a circular structure in an image provided in each of the above embodiments. The internal memory provides a cache operating environment for the operating system and the computer program in the non-volatile storage medium.

[0151] Those skilled in the art will understand that Figure 5The internal structure diagram of the electronic device shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0152] In another embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the edge detection method of a circular structure in an image in the embodiment of the present application are implemented.

[0153] In another embodiment of the present application, a computer program product is provided. The computer program product includes computer instructions. When the computer instructions execute the steps of the method for edge detection of circular structures in an image in the method flow shown in the above method embodiment,

[0154] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer execution instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0155] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0156] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for edge detection of a circular structure in an image, characterized in that: The method comprises: Obtaining the Hessian matrix corresponding to each pixel in the image to be detected, wherein the two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength in the direction corresponding to the pixel; Determine candidate edge points of the circular structure based on each of the Hessian matrices and a preset region range; Obtaining a straight line equation of the normal direction of each candidate edge point; Determining the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation; The edge of the circular structure is obtained according to the center of the circle and the radius.

2. The method according to claim 1, characterized in that Before obtaining the Hessian matrix corresponding to each pixel in the image to be detected, the method further includes: Obtaining an initial image to be detected; Preprocessing the initial image to obtain a target image, wherein the preprocessing includes: grayscale conversion, normalization, image downsampling and Gaussian filtering; The obtaining of the Hessian matrix corresponding to each pixel in the image to be detected includes: Get the Hessian matrix corresponding to each pixel in the target image.

3. The method according to claim 1, characterized in that The step of determining candidate edge points of the circular structure based on each of the Hessian matrices and a preset region range includes: Determining the edge strength of each pixel according to the two eigenvalues ​​corresponding to each of the Hessian matrices; Determine the pixel points whose edge strength is greater than a first threshold as initial candidate edge points; For the initial candidate edge points, the initial candidate edge points located within the region are determined as the candidate edge points.

4. The method according to claim 1, characterized in that: The step of obtaining the straight line equation of the normal direction of each candidate edge point includes: Determining the edge direction of each candidate edge point according to two eigenvectors of the Hessian matrix of each candidate edge point; The equations of the straight lines are determined according to the position information of the candidate edge points and the vertical direction of the corresponding edge direction.

5. The method according to claim 4, characterized in that The step of determining the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation includes: Determine a first coordinate range in a first direction and a second coordinate range in a second direction according to the position information of each of the candidate edge points, wherein the first coordinate range and the second coordinate range include a plurality of discrete points; For each target discrete point among the plurality of discrete points, the first direction coordinate of the target discrete point is substituted into each of the straight line equations to obtain a plurality of corresponding second direction coordinates; Determine the number of hits of the target discrete point according to the number of overlaps between the test pixel point formed by the first direction coordinate and the corresponding second direction coordinate and the discrete point; The center of the circle and the radius are determined according to the number of hits of each discrete point, the position information of the candidate edge point and a preset neighborhood range.

6. The method according to claim 5, characterized in that The step of determining the center of the circle and the radius according to the number of hits of each of the discrete points, the position information of the candidate edge points, and a preset neighborhood range includes: Selecting a first center point and multiple second center points from the multiple discrete points according to the hit count, wherein the first center point is the discrete point with the largest hit count, and the second center point is the discrete point with a hit count greater than a second threshold; Taking the first circle center point as the center, taking the second circle center point within the neighborhood as a candidate circle center point; The center point and the radius are determined according to the position of the candidate center point, the number of times the candidate center point is hit, and the candidate edge points that hit the candidate center point.

7. The method according to claim 6, characterized in that The determining the center point and the radius according to the position of the candidate center point, the number of hits of the candidate center point, and the candidate edge points hitting the candidate center point includes: Get the sum of the hit counts of all candidate circle center points; According to the sum of the hit counts and the hit count of each candidate center point, weighted averaging is performed on the position information of the plurality of candidate points to obtain the center point; Determine the distance between each candidate circle center point and the candidate edge point of the candidate circle center point to obtain multiple candidate distances; According to the sum of the hit times and the hit times of each candidate center point, a weighted average is performed on the multiple candidate distances to obtain the radius.

8. An edge detection device for a circular structure in an image, characterized in that: The device comprises: A first acquisition module is used to obtain a Hessian matrix corresponding to each pixel in the image to be detected, wherein two eigenvalues ​​corresponding to the Hessian matrix are used to indicate the edge strength in the direction corresponding to the pixel; A first determination module, used to determine candidate edge points of a circular structure based on each of the Hessian matrices and a preset area range; A second acquisition module is used to obtain the straight line equation of the normal direction of each candidate edge point; A second determination module is used to determine the center and radius of the circular structure according to the position information of each candidate edge point and the corresponding straight line equation; A processing module is used to obtain the edge of the circular structure according to the center of the circle and the radius.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method for detecting an edge of a circular structure in an image as claimed in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method for detecting an edge of a circular structure in an image as claimed in any one of claims 1 to 7 is implemented.