WO2020133538A1 - Circular feature detection method, processing system and apparatus having storage function - Google Patents

Circular feature detection method, processing system and apparatus having storage function Download PDF

Info

Publication number
WO2020133538A1
WO2020133538A1 PCT/CN2018/125877 CN2018125877W WO2020133538A1 WO 2020133538 A1 WO2020133538 A1 WO 2020133538A1 CN 2018125877 W CN2018125877 W CN 2018125877W WO 2020133538 A1 WO2020133538 A1 WO 2020133538A1
Authority
WO
WIPO (PCT)
Prior art keywords
polar
detection
image
parameter
value
Prior art date
Application number
PCT/CN2018/125877
Other languages
French (fr)
Chinese (zh)
Inventor
李洪杰
Original Assignee
深圳配天智能技术研究院有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳配天智能技术研究院有限公司 filed Critical 深圳配天智能技术研究院有限公司
Priority to CN201880088735.0A priority Critical patent/CN111801709B/en
Priority to PCT/CN2018/125877 priority patent/WO2020133538A1/en
Publication of WO2020133538A1 publication Critical patent/WO2020133538A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes

Definitions

  • the present application relates to the field of image processing technology, and in particular, to a circular feature detection method, a processing system, and a device with a storage function.
  • the edge is a circular feature
  • the area to be processed can be outlined on the image to be processed in the form of boxes, circles, ellipses, irregular polygons, etc. This area is called the area of interest (ROI).
  • ROI area of interest
  • the circular feature detection time can be shortened.
  • the results of the circular feature detection will be quite different, and the accuracy and stability of the results cannot be guaranteed.
  • the present application provides a circular feature detection method, processing system, and device with a storage function, which can improve the accuracy and stability of circular feature detection results.
  • a technical solution adopted by the present application is: to provide a circular feature detection method, the circular feature detection method includes receiving an image to be processed, the image to be processed includes a circular feature; Extract the region of interest from the image to be processed and obtain the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, the region of interest is a circle, and the first The parameters include a first center-of-circle coordinate, an inner diameter, and an outer diameter corresponding to the region of interest; the first feature is used to detect the circular feature to obtain a detection parameter corresponding to the circular feature, the detection The parameters include the detection center coordinates and the detection radius; use the detection parameters to adjust the first parameter, and return to the step of using the first parameters to detect the circular feature, and record the results obtained after each detection Detecting parameters until the distance between the first center-of-circle coordinates and the detected center-of-center coordinates is less than or equal to a preset threshold; determining the final parameters of the circular feature based
  • the circular feature detection method includes: receiving an image to be processed, the image to be processed includes a circular feature; Extracting the region of interest by the image to be processed and obtaining the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, the region of interest is a circle, the The first parameter includes the first center coordinates, inner diameter, and outer diameter corresponding to the region of interest; the first parameter is used to detect the circular feature to obtain a detection parameter corresponding to the circular feature, so
  • the detection parameters include detecting the coordinates of the center of the circle and the detection radius; adjusting the first parameter using the detection parameter, and returning to the step of detecting the circular feature using the first parameter, recording each detection
  • the detection parameters obtained, and the value of the iteration parameter is updated after each detection until the value of the iteration parameter exceeds a preset range; the circular feature is determined according to the recorded multiple detection parameters and the first predetermined strategy Final parameters,
  • the circular feature detection and processing system includes a processor, a memory, a transceiver, and a display.
  • the transceiver is used for Receive the image to be processed, and transmit the image to be processed to the processor, the display is used to display the detection result, the memory stores program instructions, and the program instructions can be loaded by the processor and execute the above The circular feature detection method described in any embodiment.
  • another technical solution adopted by the present application is to provide a device with a storage function on which program data is stored, and when the program data is executed by a processor, the program described in any of the above embodiments is implemented. Steps in the circular feature detection method.
  • the circular feature detection method provided by the present application includes: using the first parameter corresponding to the region of interest to obtain the detection parameter corresponding to the circular feature after detection; and using The detection parameter adjusts the first parameter, and returns to the step of detecting the circular feature using the first parameter, and records the detection parameter obtained after each detection, until the distance between the first center coordinates and the detected center coordinates is less than or equal to the preset threshold Determine the final parameters of the circular feature according to the recorded multiple detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature.
  • the above-mentioned iterative method can make the region of interest closer to the circular feature, and the center of the region of interest closer to the circular feature, so as to reduce the randomness of the region of interest and improve the circular feature
  • the accuracy of the detection results; on the other hand, the method of using multiple detection parameters and the first predetermined strategy to obtain the final parameters of the circular feature in the above method can give a more average result and further improve the detection result of the circular feature Accuracy and stability, in an application scenario, the circle detection results can reach a few pixels.
  • FIG. 1 is a schematic flowchart of an embodiment of a circular feature detection method of this application
  • FIG. 2 is a schematic flowchart of an implementation manner of step S103 in FIG. 1;
  • 3a is a schematic structural diagram of an embodiment of an image of a region of interest in a rectangular coordinate system
  • 3b is a schematic structural view of an embodiment of converting an image of a region of interest in a rectangular coordinate system in FIG. 3a into a first image in a polar coordinate system;
  • FIG. 4 is a schematic flowchart of an implementation manner of step S203 in FIG. 2;
  • FIG. 5 is a schematic flowchart of an embodiment of screening multiple second pole diameters in step S206 in FIG. 2 to reserve at most one second pole diameter;
  • FIG. 6 is a schematic flowchart of an embodiment of screening multiple third pole diameters in step S207 in FIG. 2 to reserve at most one third pole diameter;
  • FIG. 7 is a schematic flowchart of another embodiment of a circular feature detection method of this application.
  • FIG. 8 is a schematic structural diagram of an embodiment of a circular feature detection and processing system of the present application.
  • FIG. 9 is a schematic structural diagram of an embodiment of a device with a storage function according to this application.
  • FIG. 1 is a schematic flowchart of an embodiment of a circular feature detection method according to the present application.
  • the detection method includes:
  • S101 Receive an image to be processed, the image to be processed includes a circular feature.
  • the image to be processed may be provided by an imaging device with a shooting function such as a camera, and the image to be processed may be a black-and-white image or a color image.
  • the image to be processed contains circular features, such as round holes, cylinders, etc. of the workpiece.
  • the circular features may be the outer edge of the workpiece or the edge of the inner hollowed-out area of the workpiece.
  • circular features include noise-free standard circular features, noisy standard circular features, and non-standard circular features (that is, irregular circular features), and the processor can receive pending processing provided by the camera device Image, and then process it.
  • S102 Extract the region of interest of the image to be processed, and obtain the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, and the region of interest is a circle.
  • a variety of PEEK tools eg, surface PEEK, line PEEK, and point PEEK
  • the user can input the coordinates of the center of the circle, the diameter of the outer circle and the diameter of the inner circle on the PEEK tool interface.
  • the first parameter includes the first circle center coordinate, inner diameter, and outer diameter corresponding to the region of interest.
  • the detection parameters include detection center coordinates corresponding to the circular features and detection radius.
  • FIG. 2 is a schematic flowchart of an implementation manner of step S103 in FIG. 1.
  • the above step S103 specifically includes:
  • S201 Convert the image of the region of interest in the rectangular coordinate system to the first image in the polar coordinate system, where the image of the region of interest contains circular features.
  • the abscissa of the first image in the polar coordinate system is a polar diameter
  • the ordinate is a polar angle
  • the region of interest is a ring
  • the inner diameter of the ring is R 1
  • the outer diameter is R 2
  • the circular feature in the image to be detected is located within the ring.
  • FIG. 3a is a schematic structural diagram of an embodiment of an image of a region of interest in a rectangular coordinate system
  • FIG. 3b is a diagram of an image of a region of interest in a rectangular coordinate system in FIG.
  • the origin and positive direction can be determined by the user.
  • the abscissa of this figure is the polar diameter r, and the ordinate is the polar angle ⁇ ; the origin is the upper left corner of the figure, the positive direction of the abscissa is right, and the ordinate is downward.
  • I'(r, ⁇ ) I(rcos ⁇ ,rsin ⁇ ), where: r ⁇ [0, R 2 -R 1 ], ⁇ [0,359].
  • S202 Obtain a one-dimensional histogram corresponding to the first image, and a first gradient image corresponding to the first image and a second gradient image corresponding to the one-dimensional histogram.
  • the above step S202 specifically includes: performing a first-order derivation on the first image to obtain the corresponding first gradient image; and obtaining a row of vector images by calculating the average value of the pixel gray levels in columns for the first image.
  • the row vector image is a one-dimensional histogram; the first-order derivation is performed on the one-dimensional histogram to obtain a second gradient image.
  • the second gradient image in the above step S202 is used to find the abrupt part of the image, and then obtain its edge information.
  • FIG. 4 is a schematic flowchart of an implementation manner of step S203 in FIG. 2.
  • the above step S203 specifically includes:
  • the predetermined order may be from left to right or from right to left, or other prescribed order, which is not limited in this application.
  • the extreme value includes a maximum value and a minimum value
  • the above step S302 specifically includes: obtaining the first gradient value and the second gradient value corresponding to two pixel positions adjacent to the left and right at the current position; Whether the gradient value is greater than or equal to the first gradient value, and whether the gradient value at the current position is greater than or equal to the second gradient value, and if so, the gradient value at the current position is the maximum value; otherwise, it is further determined whether the gradient value at the current position Less than or equal to the first gradient value, and whether the gradient value at the current position is less than or equal to the second gradient value, and if so, the gradient value at the current position is a minimum value; otherwise, the gradient value at the current position is not an extreme value.
  • the polar diameter at the current position is r 1 and the gradient value is T 1 ;
  • the polar diameters at the two adjacent pixel positions at the left and right are r 1 -1, r 1 +1, and r 1 -1 and r 1 +1 gradient values corresponding to T 2 and T 3, when T 1 ⁇ T 2, and T 1 ⁇ T 3, the current value of the gradient polar radius r 1 corresponding to a maximum value T 1; T 1 ⁇ T 2 when and T 1 ⁇ T 3, the polar radius r 1 corresponding to the current gradient value T 1 is the minimum value. Otherwise, the current polar radius r 1 corresponding to the gradient value T 1, not extremum.
  • step S303 If yes, obtain the corresponding first pole diameter at the current position; otherwise, go directly to step S304;
  • the corresponding polar diameter at the current position in the second gradient image is obtained from left to right, it can be determined whether the corresponding polar diameter value at the current position is smaller than the maximum polar diameter value in the second gradient image, If it is less, it is determined that the current position is not the last position in the second gradient image; if it is equal, it is determined that the current position is the last position in the second gradient image.
  • step S203 may also be implemented in other ways.
  • the step of "determining whether the current position is the last position in the second gradient image" in the above step S304 may also be located in “determining” in step S302 Before the step of whether the corresponding gradient value at the current position is an extreme value".
  • S204 Obtain a maximum value point within a predetermined range of each first polar diameter in the first gradient image, and a polar diameter and a polar angle corresponding to the maximum value point are defined as a first local polar diameter and a first polar angle.
  • the second gradient image in step S203 is used to indicate where the edge information appears, and only the position range can be known, and the precise positioning cannot be obtained; and through the above step S204, the precise positioning can be performed from the first gradient image.
  • the predetermined range may be artificially predetermined, for example, it may be 3 or 5 pixels wide, and the maximum point or the minimum point within the predetermined range and the corresponding value of the maximum point or the minimum point within the predetermined range may be obtained from the first gradient image
  • the first local polar diameter and the first polar angle For example, taking the first image in FIG. 3b as the first gradient image temporarily, r 1 in the figure is the first polar diameter obtained from the second gradient image, the middle of the two dotted lines is the predetermined range, and the point P in the figure is The highest point within the predetermined range.
  • S205 Obtain a second polar angle and a third polar angle corresponding to each first polar angle in the first gradient image, where the first polar angle, the second polar angle, and the third polar angle satisfy the first preset condition.
  • satisfying the first preset condition between the first polar angle, the second polar angle, and the third polar angle includes: the absolute value of the difference between the second polar angle and the first polar angle is 180° The absolute value of the difference between the third polar angle and the first polar angle is 90°.
  • the three points that are not collinear can uniquely define a circle.
  • the process of obtaining multiple second polar diameters corresponding to the second polar angle from the first gradient image in step S206 includes: obtaining the corresponding second polar angle from the first gradient image For the row vector, search from the leftmost or rightmost side of the row vector to obtain multiple extreme points (the extreme points are edge points) appearing on the row vector, and then obtain multiple second extreme diameters.
  • the point corresponding to the first polar angle is the circular feature
  • the point closest to or farthest from the center of the circle of interest; the point corresponding to the second polar angle is the point farthest or closest to the center of the circle of interest.
  • the second The conjoint circle is real, and the second polar diameter remains; if the extreme point corresponding to the second polar diameter and the second polar angle is not a point on a circular feature, but a noise point or an interference point, then this second pseudo There is no roundness, and the second polar diameter is screened out.
  • the above process will filter out multiple second polar diameters and only one will be left.
  • FIG. 5 is a schematic flowchart of an embodiment in which a plurality of second pole diameters are screened in step S206 in FIG. 2 to reserve at most one second pole diameter.
  • a plurality of second polar diameters are screened to retain at most one second polar diameter, that is, the method for specifically determining whether the second fitting circle actually exists includes:
  • S401 Fit all second polar diameters and second polar angles to the first local polar diameters and first polar angles, respectively, to obtain a plurality of second fitting circles, and a plurality of second fitting circles corresponding to the first Four parameters.
  • the first polar angle, the first local polar diameter, the second polar angle, and the second polar diameter can be converted into corresponding first coordinate values and second coordinate values in a rectangular coordinate system;
  • the first coordinate value and the second coordinate value obtain a second fitted circle, and a fourth parameter corresponding to the second fitted circle in the rectangular coordinate system.
  • the above-mentioned fourth parameter includes the coordinates and radius of the center of the circle corresponding to the second fitted circle in the rectangular coordinate system.
  • S402 Use the fourth parameter corresponding to the second fitted circle to obtain a first partial image within a first predetermined range from the second fitted circle from the region of interest.
  • the first predetermined range may be set by the user, and may generally be 1-10 (for example, 1, 3, 5, 7, 10, etc.) pixel widths;
  • the first partial image can be converted into a second image in a polar coordinate system; the second image can be averaged by the pixel gray scale in columns to obtain a corresponding one of the second image Dimensional histogram, and first-order derivation of the one-dimensional histogram to obtain its corresponding third gradient image.
  • the first contrast can be obtained by any one of the prior art.
  • the first contrast is the maximum value of the absolute value of gradient values in the third gradient image.
  • S405 Use the first contrast to score the second fitted circle, the first contrast is proportional to the first score.
  • the first contrast can be multiplied by a scale factor to obtain the first score; of course, in other application scenarios, the first score can also be obtained in other ways, which is not limited in this application .
  • S406 Obtain a second polar diameter corresponding to the second fitting circle whose first score exceeds the first threshold and whose score is the highest.
  • the first threshold can be set by the user.
  • S207 Obtain multiple third pole diameters corresponding to the third pole angle from the first gradient image, and filter the multiple third pole diameters to retain at most one third pole diameter.
  • the process of obtaining multiple third polar diameters corresponding to the third polar angle from the first gradient image in step S207 includes: obtaining the third polar angle corresponding to the third polar angle in the first gradient image For the row vector, search from the leftmost or rightmost side of the row vector to obtain multiple extreme points (the extreme points are edge points) appearing on the row vector, and then obtain multiple third extreme diameters.
  • the process of screening multiple third polar diameters in step S207 to retain at most one third polar diameter includes: Fit the current third polar diameter and third polar angle to the first local polar diameter, first polar angle, second polar diameter, and second polar angle found previously to obtain a third fitted circle, and then determine the third Whether the fitted circle really exists, if the extreme point corresponding to the third pole diameter and the third pole angle is the point on the circular feature, then the third fitted circle is real, and the third pole diameter remains; if The extreme point corresponding to the third polar diameter and the third polar angle is not a point on the circular feature, but is a noise point or an interference point. Then this third fitting circle does not exist, and the third polar diameter is filtered out. The above process will screen out multiple third pole diameters, leaving at most one.
  • FIG. 6 is a schematic flowchart of an embodiment of screening a plurality of third pole diameters in step S207 in FIG. 2 to reserve at most one third pole diameter.
  • step S207 a plurality of third pole diameters are screened to reserve at most one third pole diameter, that is, the method for specifically determining whether the third fitting circle actually exists includes:
  • step S501 Fit all third polar diameters and third polar angles to the first local polar diameters, first polar angles, and the second polar diameters and second polar angles screened and retained after step S206 to obtain multiple Three fitted circles, and fifth parameters corresponding to multiple third fitted circles.
  • the current third polar diameter, the third polar angle and the first local polar diameter, the first polar angle, the second polar diameter retained after the screening in step S206, and the second polar angle can be converted into Corresponding first coordinate value, second coordinate value, and third coordinate value in a rectangular coordinate system; according to the first coordinate value, second coordinate value, and third coordinate value, a third fitted circle is obtained, and the third fitted circle is in The corresponding fifth parameter in the Cartesian coordinate system.
  • the above-mentioned fifth parameter includes the coordinate and radius of the center of the circle corresponding to the third fitted circle in the rectangular coordinate system.
  • the second predetermined range may be set by the user, and may generally be 1-10 (for example, 1, 3, 5, 7, 10, etc.) pixel widths;
  • the second partial image can be converted into a third image in a polar coordinate system; the third image can be averaged by the pixel gray scale in columns to obtain a corresponding one of the third image Dimensional histogram, and first-order derivation of the one-dimensional histogram to obtain its corresponding fourth gradient image.
  • the second contrast can be obtained by any method in the prior art.
  • the second contrast is the maximum value of the absolute value of the gradient value in the fourth gradient image.
  • S505 Use the second contrast to score the third fitted circle, and the second contrast is proportional to the second score.
  • the second contrast can be multiplied by a scale factor to obtain a second score; of course, in other application scenarios, the second score can also be obtained in other ways, which is not limited in this application .
  • S506 Obtain a third polar diameter corresponding to the third fitting circle whose second score exceeds the second threshold and whose second score is the highest.
  • the second threshold can be set by the user.
  • one first local pole diameter corresponds to one second pole diameter and one third pole diameter.
  • S208 obtaining a plurality of first fitting circles corresponding to the selected first polar angle, first local polar diameter, second polar angle, second polar diameter, third polar angle, and third polar diameter after screening, and Multiple third parameters corresponding to multiple first fitting circles.
  • the above step S208 specifically includes: obtaining a third fitting circle corresponding to all the first polar angles and the first local polar diameter retaining the third polar diameter, and the first fitting circle is the third Fitting a circle, the third parameter is the fifth parameter.
  • the above-mentioned third parameters include the coordinates and radius of the center of the circle corresponding to the first fitted circle in the rectangular coordinate system.
  • S209 Use a plurality of first fitted circles, a plurality of third parameters, and a second predetermined strategy to obtain detection parameters.
  • the above step S209 specifically includes: obtaining a circle with the highest score, or a circle with the largest radius, or a circle with the smallest radius among the plurality of first fitting circles, and the third parameter corresponding to the circle As a detection parameter.
  • S104 Adjust the first parameter using the detection parameter, and return to the step of detecting the circular feature using the first parameter, and record the detection parameter obtained after each detection until the distance between the first center coordinate and the detected center coordinate is less than or equal to Preset threshold.
  • using the detection parameter to adjust the first parameter of the region of interest in step S104 above specifically includes: using the center coordinates of the detection in the detection parameters obtained from the latest detection as the first center coordinates of the region of interest To adjust the position of the region of interest.
  • the purpose of this step is equivalent to adjusting the position of the region of interest so that the center of the region of interest coincides with the center of the circular feature as much as possible.
  • the size of the region of interest can be further adjusted, for example, the inner diameter and the outer diameter corresponding to the region of interest can be adjusted according to the radius in the detection parameter obtained from the last detection To reduce the area of interest. It should be noted that when adjusting the size of the region of interest, it is necessary to ensure that the circular features are within the range of the region of interest.
  • the detection method provided by the present application further includes: obtaining the distance between the first circle center coordinate and the detection circle center coordinate, and judging whether the distance is less than or equal to a preset threshold ; If yes, go to the subsequent step S105; otherwise, return to step S103.
  • the preset threshold mentioned above can be set by the user.
  • S105 Determine the final parameters of the circular feature according to the recorded multiple detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature.
  • the above step S105 includes: using the average value of multiple detection parameters as the final parameter of the circular feature, for example, the center coordinates of the circular feature are equal to the average of all detected center coordinates, and the radius of the center feature Equal to the average of all detection radii.
  • FIG. 7 is a schematic flowchart of another embodiment of a circular feature detection method according to the present application.
  • the detection method includes:
  • step S601 Receive an image to be processed, the image to be processed contains circular features. Specifically, this step is the same as step S101 in the foregoing embodiment, and will not be repeated here.
  • step S602 Extract the region of interest of the image to be processed, and obtain the first parameter corresponding to the region of interest, where the circular feature is located in the region of interest, and the region of interest is a circle, and the first parameter includes the first parameter corresponding to the region of interest A circle center coordinate, inner diameter and outer diameter. Specifically, this step is the same as step S102 in the foregoing embodiment, and will not be repeated here.
  • step S603 Detect the circular feature by using the first parameter to obtain a detection parameter corresponding to the circular feature.
  • the detection parameter includes the detection center coordinate and the detection radius. Specifically, this step is the same as step S103 in the foregoing embodiment, and details are not described herein again.
  • S604 Adjust the first parameter using the detection parameter, and return to the step of detecting the circular feature using the first parameter, record the detection parameter obtained after each detection, and update the value of the iteration parameter after each detection until the iteration The value of the parameter is outside the preset range.
  • the first parameter of the region of interest adjusted by the detection parameter in step S604 is the same as the related content in step S104 in the foregoing embodiment, and details are not described herein again.
  • the iteration parameter is the number of times that the first parameter is used to detect the circular feature. If the value of the iteration parameter exceeds the preset range, the number of detections is greater than or equal to the preset value, or less than or equal to the preset value.
  • the initial value of the iteration parameter can also be an arbitrary positive integer.
  • the iteration parameter can be increased by a set value after each detection until the value of the iteration parameter is greater than or equal to the preset value; of course, the iteration parameter can also be subtracted by one after each detection Set the value until the value of the iteration parameter is less than or equal to the preset value.
  • the iteration parameter may also be an angle value on the circular feature that uses the first parameter to detect the circular feature.
  • the value of the iteration parameter that exceeds the preset range is that the angle value is greater than or equal to the preset angle, or less than Equal to the preset angle.
  • the initial value of the iteration parameter can be an arbitrary angle, the iteration parameter can be increased by a set value after each detection until the value of the iteration parameter is greater than or equal to the preset angle; of course, the iteration parameter can also be subtracted by a setting after each detection Value until the value of the iteration parameter is less than or equal to the preset angle.
  • the initial value of the iteration parameter may be 0°
  • the set value may be 45°
  • the preset angle may be 360°.
  • the detection method provided by the present application further includes: judging whether the value of the current iteration parameter exceeds the preset range; if yes, proceed to the subsequent step S605; otherwise, return In step S603, the value of the iteration parameter is updated (for example, a set value is added or subtracted).
  • step S605 Determine the final parameters of the circular feature according to the recorded multiple detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature. Specifically, this step is the same as step S105 in the foregoing embodiment, and will not be repeated here.
  • the detection methods shown in FIGS. 1 and 7 of the present application can also be combined.
  • the method in FIG. 1 can be performed first.
  • the method in FIG. 1 is equivalent to the process of roughly searching for a circular feature.
  • the circular feature and the region of interest may not be concentric or severely eccentric.
  • the method in FIG. 1 can make the sense
  • the distance between the first center coordinates corresponding to the region of interest and the detection center coordinates of the circular feature is less than or equal to the preset threshold, thereby making the circular feature substantially concentric with the moved region of interest; then, the method in FIG. 7 can be performed.
  • the method in 7 is equivalent to the process of finely searching for circular features. Iterative parameters control the number of circular feature detections, thereby ensuring the accuracy and stability of circular features.
  • circular features include noise-free standard circular features, noisy standard circular features, and non-standard circular features (ie, irregular circular features).
  • noise-free standard circular feature because it has high-quality edge information, it can accurately calculate the edge detection parameters after two or three iterations, and the accuracy can reach 0.03 pixels; for the noisy standard
  • For circular features due to the presence of noise, there is usually a case of oscillation and non-convergence in the detection of circular features.
  • FIG. 8 is a schematic structural diagram of an embodiment of a circular feature detection and processing system of the present application.
  • the circular feature detection and processing system 1 includes a processor 10, a memory 12, a transceiver 14, and a display 16.
  • the transceiver 14 is used to receive an image to be processed, and transmits the image to be processed to the processor 10, and the display 16 is used to display detection
  • the display 16 can also display the image to be processed and the region of interest
  • the memory 12 stores program instructions, which can be loaded by the processor 10 and execute the circular feature detection method in any of the above embodiments.
  • FIG. 9 is a schematic structural diagram of an embodiment of a device with a storage function according to the present application.
  • the device 2 with a storage function stores program data 20.
  • the program data 20 is executed by a processor, any of the above embodiments is implemented. Steps in the circular feature detection method.
  • the circular feature detection method provided by the present application includes: using the first parameter corresponding to the region of interest to obtain the detection parameter corresponding to the circular feature after detection; and using the detection parameter to adjust the first Parameters, and return to the step of detecting the circular features using the first parameter, recording the detection parameters obtained after each detection, until the distance between the first center coordinates and the detected center coordinates is less than or equal to the preset threshold; according to the number of records
  • the detection parameters and the first predetermined strategy determine the final parameters of the circular feature.
  • the final parameters include the center coordinates and radius of the circular feature.
  • the above-mentioned iterative method can make the region of interest closer to the circular feature, and the center of the region of interest closer to the circular feature, so as to reduce the randomness of the region of interest and improve the circular feature
  • the accuracy of the detection results; on the other hand, the method of using multiple detection parameters and the first predetermined strategy to obtain the final parameters of the circular feature in the above method can give a more average result and further improve the detection result of the circular feature Accuracy and stability, in an application scenario, the circle detection results can reach a few pixels.

Abstract

A circular feature detection method, a processing system, and an apparatus having a storage function. The detection method comprises: receiving an image to be processed, said image comprising a circular feature (S101); extracting a region of interest from said image, and obtaining a first parameter corresponding to the region of interest, the circular feature being located within the region of interest, the region of interest being a circle (S102); using the first parameter to detect the circular feature, to obtain a detection parameter corresponding to the circular feature (S103); using the detection parameter to adjust the first parameter, and returning to the step of using the first parameter to detect the circular feature, recording the obtained detection parameter of each detection, until the distance between first center coordinates and detected center coordinates is less than or equal to a preset threshold (S104); and determining final parameters of the circular feature according to a plurality of recorded detection parameters and a first preset policy, the final parameters comprising the center coordinates and the radius of the circular feature (S105). In the described manner, the detection method improves the accuracy of a detection result.

Description

一种圆形特征检测方法、处理系统及具有存储功能的装置Circular feature detection method, processing system and device with storage function 技术领域Technical field
本申请涉及图像处理技术领域,特别涉及一种圆形特征检测方法、处理系统及具有存储功能的装置。The present application relates to the field of image processing technology, and in particular, to a circular feature detection method, a processing system, and a device with a storage function.
背景技术Background technique
采用机器视觉技术对待处理图像进行检测时,并不一定需要对整个待处理图像进行检测,而只需要对待处理图像上的一部分进行检测即可,例如,只需要对待处理图像的边缘进行检测。When using machine vision technology to detect the image to be processed, it is not necessary to detect the entire image to be processed, but only to detect a part of the image to be processed, for example, only to detect the edge of the image to be processed.
例如,当边缘为圆形特征时,可以在待处理图像上以方框、圆、椭圆、不规则多边形等方式勾勒出需要处理的区域,该区域称为感兴趣区域(ROI)。通过对该感兴趣区域进行圆形特征检测,可以缩短圆形特征检测时间。但由于感兴趣区域的随机性,会导致圆形特征检测结果相差较大,无法保证结果的准确性和稳定性。For example, when the edge is a circular feature, the area to be processed can be outlined on the image to be processed in the form of boxes, circles, ellipses, irregular polygons, etc. This area is called the area of interest (ROI). By performing circular feature detection on the region of interest, the circular feature detection time can be shortened. However, due to the randomness of the region of interest, the results of the circular feature detection will be quite different, and the accuracy and stability of the results cannot be guaranteed.
发明内容Summary of the invention
本申请提供一种圆形特征检测方法、处理系统及具有存储功能的装置,能够提高圆形特征检测结果的准确性和稳定性。The present application provides a circular feature detection method, processing system, and device with a storage function, which can improve the accuracy and stability of circular feature detection results.
为解决上述技术问题,本申请采用的一个技术方案是:提供一种圆形特征检测方法,所述圆形特征检测方法包括接收待处理图像,所述待处理图像包含圆形特征;对所述待处理图像进行感兴趣区域提取,并获得所述感兴趣区域对应的第一参数,其中,所述圆形特征位于所述感兴趣区域内,所述感兴趣区域为圆环,所述第一参数包括所述感兴趣区域对应的第一圆心坐标、内径和外径;利用所述第一参数对所述圆形特征进行检测,以获得与所述圆形特征对应的检测参数,所述检测参数包括检测圆心坐标以及检测半径;利用所述检测参数调整所述第一参数,并返回至所述利用所述第一参数对所述圆形特征进行检测的步骤,记录每次检测后得到的检测参数,直至所述第一圆心坐标与所述检测圆心坐标的距离小于或等于预设阈值;根据记录的多个所述检测参数和第一预定策略确定所述圆形特征的最终参数,所述最终参数包括所述圆形特征的圆心坐标和半径。In order to solve the above technical problems, a technical solution adopted by the present application is: to provide a circular feature detection method, the circular feature detection method includes receiving an image to be processed, the image to be processed includes a circular feature; Extract the region of interest from the image to be processed and obtain the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, the region of interest is a circle, and the first The parameters include a first center-of-circle coordinate, an inner diameter, and an outer diameter corresponding to the region of interest; the first feature is used to detect the circular feature to obtain a detection parameter corresponding to the circular feature, the detection The parameters include the detection center coordinates and the detection radius; use the detection parameters to adjust the first parameter, and return to the step of using the first parameters to detect the circular feature, and record the results obtained after each detection Detecting parameters until the distance between the first center-of-circle coordinates and the detected center-of-center coordinates is less than or equal to a preset threshold; determining the final parameters of the circular feature based on the recorded multiple detection parameters and the first predetermined strategy The final parameter includes the center coordinates and radius of the circular feature.
为解决上述技术问题,本申请采用的另一个技术方案是:提供一种圆形特征检测方法,所述圆形特征检测方法包括:接收待处理图像,所述待处理图像包含圆形特征;对所述待处理图像进行感兴趣区域提取,并获得所述感兴趣区域对应的第一参数,其中,所述圆形特征位于所述感兴趣区域内,所述感兴趣区域为圆环,所述第一参数包括所述感兴趣区域对应的第一圆心坐标、内径和外径;利用所述第一参数对所述圆形特征进行检测,以获得与所述圆形特征对应的检测参数,所述检测参数包括检测圆心坐标以及检测半径;利用所述检测参数调整所述第一参数,并返回至所述利用所述第一参数对所述圆形特征进行检测的步骤,记录每次检测后得到的检测参数,并在每次检测后更新迭代参数的值,直至所述迭代参数的值超出预设范围;根据记录的多个所述检测参数和第一预定策略确定所述圆形特征的最终参数,所述最终参数包括所述圆形特征的圆心坐标和半径。In order to solve the above technical problems, another technical solution adopted by the present application is to provide a circular feature detection method. The circular feature detection method includes: receiving an image to be processed, the image to be processed includes a circular feature; Extracting the region of interest by the image to be processed and obtaining the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, the region of interest is a circle, the The first parameter includes the first center coordinates, inner diameter, and outer diameter corresponding to the region of interest; the first parameter is used to detect the circular feature to obtain a detection parameter corresponding to the circular feature, so The detection parameters include detecting the coordinates of the center of the circle and the detection radius; adjusting the first parameter using the detection parameter, and returning to the step of detecting the circular feature using the first parameter, recording each detection The detection parameters obtained, and the value of the iteration parameter is updated after each detection until the value of the iteration parameter exceeds a preset range; the circular feature is determined according to the recorded multiple detection parameters and the first predetermined strategy Final parameters, the final parameters include the center coordinates and radius of the circular feature.
为解决上述技术问题,本申请采用的另一个技术方案是:提供一种圆形特征检测处理系统,所述圆形特征检测处理系统包括处理器、存储器、收发器和显示器,所述收发器用于接收待处理图像,并将所述待处理图像传输至所述处理器,所述显示器用于显示检测结果,所述存储器存储有程序指令,所述程序指令可被所述处理器加载并执行上述任一实施例所述的圆形特征检测方法。In order to solve the above technical problems, another technical solution adopted by the present application is to provide a circular feature detection and processing system. The circular feature detection and processing system includes a processor, a memory, a transceiver, and a display. The transceiver is used for Receive the image to be processed, and transmit the image to be processed to the processor, the display is used to display the detection result, the memory stores program instructions, and the program instructions can be loaded by the processor and execute the above The circular feature detection method described in any embodiment.
为解决上述技术问题,本申请采用的又一个技术方案是:提供一种具有存储功能的装置,其上存储有程序数据,所述程序数据被处理器执行时实现上述任一实施例所述的圆形特征检测方法中的步骤。In order to solve the above technical problems, another technical solution adopted by the present application is to provide a device with a storage function on which program data is stored, and when the program data is executed by a processor, the program described in any of the above embodiments is implemented. Steps in the circular feature detection method.
本申请的有益效果是:区别于现有技术的情况,本申请所提供的圆形特征检测方法中包括:利用感兴趣区域对应的第一参数获得检测后圆形特征对应的检测参数;并利用检测参数调整第一参数,并返回至利用第一参数对圆形特征进行检测的步骤,记录每次检测后得到的检测参数,直至第一圆心坐标与检测圆心坐标的距离小于或等于预设阈值;根据记录的多个检测参数和第一预定策略确定圆形特征的最终参数,最终参数包括圆形特征的圆心坐标和半径。一方面,通过上述迭代的方式可以使得感兴趣区域与圆形特征越来越接近,且感兴趣区域与圆形特征的中心越来越接近,以降低感兴趣区域的随机性,提高圆形特征检测结果的准确性;另一方面,上述方法中利用多个检测参数和第一预定策略获得圆形特征的最终参数的方式,可以给出一个较平均的结果,进一步提高圆形特征检测结果的准确性和稳定性,在一个应用场景中,圆检测结果能达到零 点几像素。The beneficial effects of the present application are: different from the situation in the prior art, the circular feature detection method provided by the present application includes: using the first parameter corresponding to the region of interest to obtain the detection parameter corresponding to the circular feature after detection; and using The detection parameter adjusts the first parameter, and returns to the step of detecting the circular feature using the first parameter, and records the detection parameter obtained after each detection, until the distance between the first center coordinates and the detected center coordinates is less than or equal to the preset threshold Determine the final parameters of the circular feature according to the recorded multiple detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature. On the one hand, the above-mentioned iterative method can make the region of interest closer to the circular feature, and the center of the region of interest closer to the circular feature, so as to reduce the randomness of the region of interest and improve the circular feature The accuracy of the detection results; on the other hand, the method of using multiple detection parameters and the first predetermined strategy to obtain the final parameters of the circular feature in the above method can give a more average result and further improve the detection result of the circular feature Accuracy and stability, in an application scenario, the circle detection results can reach a few pixels.
【附图说明】[Description of the drawings]
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图,其中:In order to more clearly explain the technical solutions in the embodiments of the present invention, the drawings required in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without paying any creative work, other drawings can also be obtained based on these drawings, in which:
图1为本申请圆形特征检测方法一实施方式的流程示意图;FIG. 1 is a schematic flowchart of an embodiment of a circular feature detection method of this application;
图2为图1中步骤S103一实施方式的流程示意图;2 is a schematic flowchart of an implementation manner of step S103 in FIG. 1;
图3a为直角坐标系下的感兴趣区域图像一实施方式的结构示意图;3a is a schematic structural diagram of an embodiment of an image of a region of interest in a rectangular coordinate system;
图3b为图3a中直角坐标系下的感兴趣区域图像转化为极坐标系下的第一图像一实施方式的结构示意图;3b is a schematic structural view of an embodiment of converting an image of a region of interest in a rectangular coordinate system in FIG. 3a into a first image in a polar coordinate system;
图4为图2中步骤S203一实施方式的流程示意图;4 is a schematic flowchart of an implementation manner of step S203 in FIG. 2;
图5为图2中步骤S206中对多个第二极径进行筛选以保留最多一个第二极径的一实施方式的流程示意图;FIG. 5 is a schematic flowchart of an embodiment of screening multiple second pole diameters in step S206 in FIG. 2 to reserve at most one second pole diameter;
图6为图2中步骤S207中对多个第三极径进行筛选以保留最多一个第三极径一实施方式的流程示意图;FIG. 6 is a schematic flowchart of an embodiment of screening multiple third pole diameters in step S207 in FIG. 2 to reserve at most one third pole diameter;
图7为本申请圆形特征检测方法另一实施方式的流程示意图;7 is a schematic flowchart of another embodiment of a circular feature detection method of this application;
图8为本申请圆形特征检测处理系统一实施方式的结构示意图;8 is a schematic structural diagram of an embodiment of a circular feature detection and processing system of the present application;
图9为本申请具有存储功能的装置一实施方式的结构示意图。9 is a schematic structural diagram of an embodiment of a device with a storage function according to this application.
【具体实施方式】【detailed description】
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,均属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be described clearly and completely in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.
请参阅图1,图1为本申请圆形特征检测方法一实施方式的流程示意图,该检测方法包括:Please refer to FIG. 1. FIG. 1 is a schematic flowchart of an embodiment of a circular feature detection method according to the present application. The detection method includes:
S101:接收待处理图像,所述待处理图像包含圆形特征。S101: Receive an image to be processed, the image to be processed includes a circular feature.
具体地,待处理图像可由照相机等具有拍摄功能的摄像装置提供,该待处理图像可以是黑白图像,也可以是彩色图像。待处理图像包含圆形特征,例如, 工件的圆孔、圆柱等,在本实施例中,圆形特征可以是工件的外边缘,也可以是工件的内部镂空区域边缘。在实际应用过程中,圆形特征包括无噪声标准圆形特征、有噪声标准圆形特征以及非标准圆形特征(即不太规则的圆形特征),处理器可以接收摄像装置提供的待处理图像,进而对其进行后续处理。Specifically, the image to be processed may be provided by an imaging device with a shooting function such as a camera, and the image to be processed may be a black-and-white image or a color image. The image to be processed contains circular features, such as round holes, cylinders, etc. of the workpiece. In this embodiment, the circular features may be the outer edge of the workpiece or the edge of the inner hollowed-out area of the workpiece. In practical applications, circular features include noise-free standard circular features, noisy standard circular features, and non-standard circular features (that is, irregular circular features), and the processor can receive pending processing provided by the camera device Image, and then process it.
S102:对待处理图像进行感兴趣区域提取,并获得感兴趣区域对应的第一参数,其中,圆形特征位于感兴趣区域内,感兴趣区域为圆环。S102: Extract the region of interest of the image to be processed, and obtain the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, and the region of interest is a circle.
具体地,在一个应用场景中,可以采用现有的机器视觉软件sherlock中制定的多种PEEK工具(例如,面PEEK、线PEEK和点PEEK)选择感兴趣区域(ROI)。用户可以在PEEK工具界面输入圆环的圆心坐标和外圆直径、内圆直径等。第一参数包括感兴趣区域对应的第一圆心坐标、内径和外径。Specifically, in an application scenario, a variety of PEEK tools (eg, surface PEEK, line PEEK, and point PEEK) developed in the existing machine vision software sherlock can be used to select a region of interest (ROI). The user can input the coordinates of the center of the circle, the diameter of the outer circle and the diameter of the inner circle on the PEEK tool interface. The first parameter includes the first circle center coordinate, inner diameter, and outer diameter corresponding to the region of interest.
S103:利用第一参数对圆形特征进行检测,以获得与圆形特征对应的检测参数。S103: Detect the circular feature using the first parameter to obtain the detection parameter corresponding to the circular feature.
具体地,检测参数包括圆形特征对应的检测圆心坐标以及检测半径。Specifically, the detection parameters include detection center coordinates corresponding to the circular features and detection radius.
在一个应用场景中,如图2所示,图2为图1中步骤S103一实施方式的流程示意图,上述步骤S103具体包括:In an application scenario, as shown in FIG. 2, FIG. 2 is a schematic flowchart of an implementation manner of step S103 in FIG. 1. The above step S103 specifically includes:
S201:将直角坐标系下的感兴趣区域的图像转化为极坐标系下的第一图像,其中感兴趣区域图像包含圆形特征。S201: Convert the image of the region of interest in the rectangular coordinate system to the first image in the polar coordinate system, where the image of the region of interest contains circular features.
具体地,极坐标系下的第一图像的横坐标为极径、纵坐标为极角。在本实施例中,感兴趣区域为圆环,圆环的内径为R 1,外径为R 2,待检测图像中的圆特征圆形特征位于圆环内。如图3所示,图3a为直角坐标系下的感兴趣区域的图像一实施方式的结构示意图,图3b为图3a中直角坐标系下的感兴趣区域的图像转化为极坐标系下的第一图像一实施方式的结构示意图。上述图3a中直角坐标系与图3b中极坐标系的原点和正方向相同,原点和正方向可由用户自行决定。例如,如图3b所示,此图的横坐标是极径r,纵坐标是极角θ;原点为图中的左上角,横坐标正方向为向右,纵坐标为向下。 Specifically, the abscissa of the first image in the polar coordinate system is a polar diameter, and the ordinate is a polar angle. In this embodiment, the region of interest is a ring, the inner diameter of the ring is R 1 , and the outer diameter is R 2 , and the circular feature in the image to be detected is located within the ring. As shown in FIG. 3, FIG. 3a is a schematic structural diagram of an embodiment of an image of a region of interest in a rectangular coordinate system, and FIG. 3b is a diagram of an image of a region of interest in a rectangular coordinate system in FIG. A schematic diagram of an embodiment of an image and an embodiment. The rectangular coordinate system in FIG. 3a and the polar coordinate system in FIG. 3b have the same origin and positive direction. The origin and positive direction can be determined by the user. For example, as shown in FIG. 3b, the abscissa of this figure is the polar diameter r, and the ordinate is the polar angle θ; the origin is the upper left corner of the figure, the positive direction of the abscissa is right, and the ordinate is downward.
假设在直角坐标系(或者,图像坐标系)下,圆形特征上的每一点坐标为I(x,y),转换到极坐标系中,每一点坐标为I'(r,θ),感兴趣区域外径为R 2,内径为R 1,则I'(r,θ)满足以下关系: Assuming that in a rectangular coordinate system (or, image coordinate system), the coordinates of each point on the circular feature is I(x, y), converted to a polar coordinate system, the coordinates of each point is I'(r, θ). The outer diameter of the area of interest is R 2 and the inner diameter is R 1 , then I'(r,θ) satisfies the following relationship:
I'(r,θ)=I(rcosθ,rsinθ),其中:r∈[0,R 2-R 1],θ∈[0,359]。 I'(r,θ)=I(rcosθ,rsinθ), where: r∈[0, R 2 -R 1 ], θ∈[0,359].
S202:获得第一图像对应的一维直方图,以及第一图像对应的第一梯度图 像和一维直方图对应的第二梯度图像。S202: Obtain a one-dimensional histogram corresponding to the first image, and a first gradient image corresponding to the first image and a second gradient image corresponding to the one-dimensional histogram.
在一个应用场景中,上述步骤S202具体包括:对第一图像进行一阶求导以获得对应的第一梯度图像;对第一图像按列求像素灰度平均值即可获得一行向量图像,该行向量图像即为一维直方图;对一维直方图进行一阶求导以获得第二梯度图像。当然,在其他应用场景中,也可对第一图像或一维直方图进行二阶求导等。上述步骤S202中第二梯度图像用于找到图像突变部分,进而获得其边缘信息。In an application scenario, the above step S202 specifically includes: performing a first-order derivation on the first image to obtain the corresponding first gradient image; and obtaining a row of vector images by calculating the average value of the pixel gray levels in columns for the first image. The row vector image is a one-dimensional histogram; the first-order derivation is performed on the one-dimensional histogram to obtain a second gradient image. Of course, in other application scenarios, it is also possible to perform second-order derivation on the first image or the one-dimensional histogram. The second gradient image in the above step S202 is used to find the abrupt part of the image, and then obtain its edge information.
S203:获得第二梯度图像中的多个极值处对应的第一极径。S203: Obtain corresponding first polar diameters at multiple extreme values in the second gradient image.
具体地,在一个应用场景中,请参阅图4,图4为图2中步骤S203一实施方式的流程示意图,上述步骤S203具体包括:Specifically, in an application scenario, please refer to FIG. 4, which is a schematic flowchart of an implementation manner of step S203 in FIG. 2. The above step S203 specifically includes:
S301:按预定顺序获得第二梯度图像中当前位置处对应的梯度值。S301: Obtain the corresponding gradient value at the current position in the second gradient image in a predetermined order.
具体地,该预定顺序可以是从左至右或者从右至左,又或者其他规定的顺序,本申请对此不作限定。Specifically, the predetermined order may be from left to right or from right to left, or other prescribed order, which is not limited in this application.
S302:判断梯度值是否为极值。S302: Determine whether the gradient value is an extreme value.
具体地,极值包括极大值和极小值;上述步骤S302中具体包括:获得当前位置处左右相邻两个像素位置处对应的第一梯度值和第二梯度值;判断当前位置处的梯度值是否大于等于第一梯度值,且当前位置处的梯度值是否大于等于第二梯度值,若是,则当前位置处的梯度值为极大值;否则,进一步判断当前位置处的梯度值是否小于等于第一梯度值,且当前位置处的梯度值是否小于等于第二梯度值,若是,则当前位置处的梯度值为极小值;否则,当前位置处的梯度值不是极值。Specifically, the extreme value includes a maximum value and a minimum value; the above step S302 specifically includes: obtaining the first gradient value and the second gradient value corresponding to two pixel positions adjacent to the left and right at the current position; Whether the gradient value is greater than or equal to the first gradient value, and whether the gradient value at the current position is greater than or equal to the second gradient value, and if so, the gradient value at the current position is the maximum value; otherwise, it is further determined whether the gradient value at the current position Less than or equal to the first gradient value, and whether the gradient value at the current position is less than or equal to the second gradient value, and if so, the gradient value at the current position is a minimum value; otherwise, the gradient value at the current position is not an extreme value.
例如,假设当前位置处的极径为r 1,梯度值为T 1;左右相邻两个像素位置处的极径分别为r 1-1、r 1+1,且r 1-1和r 1+1对应的梯度值为T 2和T 3,当T 1≥T 2,且T 1≥T 3时,当前极径r 1对应的梯度值T 1为极大值;当T 1≤T 2,且T 1≤T 3时,当前极径r 1对应的梯度值T 1为极小值。否则,当前极径r 1对应的梯度值T 1不是极值。 For example, suppose the polar diameter at the current position is r 1 and the gradient value is T 1 ; the polar diameters at the two adjacent pixel positions at the left and right are r 1 -1, r 1 +1, and r 1 -1 and r 1 +1 gradient values corresponding to T 2 and T 3, when T 1 ≥T 2, and T 1 ≥T 3, the current value of the gradient polar radius r 1 corresponding to a maximum value T 1; T 1 ≤T 2 when and T 1 ≤T 3, the polar radius r 1 corresponding to the current gradient value T 1 is the minimum value. Otherwise, the current polar radius r 1 corresponding to the gradient value T 1, not extremum.
S303:若是,则获得当前位置处对应的第一极径;否则,直接进入步骤S304;S303: If yes, obtain the corresponding first pole diameter at the current position; otherwise, go directly to step S304;
S304:判断当前位置是否为第二梯度图像中的最后一个位置,若是则结束,否则获得当前位置的下一个位置处对应的梯度值并返回至步骤S302。S304: Determine whether the current position is the last position in the second gradient image, and if so, end, otherwise obtain the corresponding gradient value at the next position of the current position and return to step S302.
具体地,当以从左至右的顺序获得第二梯度图像中当前位置处对应的极径时,可以通过判断当前位置处对应的极径值是否小于第二梯度图像中的最大极 径值,若小于,则判断当前位置并不是第二梯度图像中的最后一个位置;若等于,则判断当前位置为第二梯度图像中的最后一个位置。Specifically, when the corresponding polar diameter at the current position in the second gradient image is obtained from left to right, it can be determined whether the corresponding polar diameter value at the current position is smaller than the maximum polar diameter value in the second gradient image, If it is less, it is determined that the current position is not the last position in the second gradient image; if it is equal, it is determined that the current position is the last position in the second gradient image.
当然,在其他应用场景中,上述步骤S203也可采用其他方式实现,例如,上述步骤S304中“判断当前位置是否为第二梯度图像中的最后一个位置”的步骤也可位于步骤S302中“判断当前位置处对应的梯度值是否为极值”的步骤之前。Of course, in other application scenarios, the above step S203 may also be implemented in other ways. For example, the step of "determining whether the current position is the last position in the second gradient image" in the above step S304 may also be located in "determining" in step S302 Before the step of whether the corresponding gradient value at the current position is an extreme value".
S204:获得第一梯度图像中距离每个第一极径预定范围内的最值点,最值点对应的极径和极角定义为第一局部极径和第一极角。S204: Obtain a maximum value point within a predetermined range of each first polar diameter in the first gradient image, and a polar diameter and a polar angle corresponding to the maximum value point are defined as a first local polar diameter and a first polar angle.
具体地,上述步骤S203中第二梯度图像用来指示什么位置出现了边缘信息,仅仅能获知位置范围,不能精确定位;而通过上述步骤S204可以从第一梯度图像中进行精确定位。该预定范围可以人为预先规定,例如,可以是3个或者5个像素宽,从第一梯度图像中获得该预定范围内的最大值点或者最小值点,以及最大值点或最小值点对应的第一局部极径和第一极角。例如,以附图3b中的第一图像暂时作为第一梯度图像说明,图中r 1为从第二梯度图像中获得的第一极径,两个虚线中间为预定范围,图中点P为该预定范围内的最值点。 Specifically, the second gradient image in step S203 is used to indicate where the edge information appears, and only the position range can be known, and the precise positioning cannot be obtained; and through the above step S204, the precise positioning can be performed from the first gradient image. The predetermined range may be artificially predetermined, for example, it may be 3 or 5 pixels wide, and the maximum point or the minimum point within the predetermined range and the corresponding value of the maximum point or the minimum point within the predetermined range may be obtained from the first gradient image The first local polar diameter and the first polar angle. For example, taking the first image in FIG. 3b as the first gradient image temporarily, r 1 in the figure is the first polar diameter obtained from the second gradient image, the middle of the two dotted lines is the predetermined range, and the point P in the figure is The highest point within the predetermined range.
S205:获得第一梯度图像中与每个第一极角对应的第二极角、第三极角,其中,第一极角、第二极角、第三极角满足第一预设条件。S205: Obtain a second polar angle and a third polar angle corresponding to each first polar angle in the first gradient image, where the first polar angle, the second polar angle, and the third polar angle satisfy the first preset condition.
具体地,在一个应用场景中,第一极角、第二极角以及第三极角之间满足第一预设条件包括:第二极角与第一极角之差的绝对值为180°,第三极角与第一极角之差的绝对值为90°。上述不共线的三个点可以唯一确定一个圆。Specifically, in an application scenario, satisfying the first preset condition between the first polar angle, the second polar angle, and the third polar angle includes: the absolute value of the difference between the second polar angle and the first polar angle is 180° The absolute value of the difference between the third polar angle and the first polar angle is 90°. The three points that are not collinear can uniquely define a circle.
S206:从第一梯度图像中获得与第二极角对应的多个第二极径,对多个第二极径进行筛选以保留最多一个第二极径。S206: Obtain multiple second polar diameters corresponding to the second polar angle from the first gradient image, and filter the multiple second polar diameters to retain at most one second polar diameter.
具体地,在一个应用场景中,上述步骤S206中从第一梯度图像中获得与第二极角对应的多个第二极径的过程包括:在第一梯度图像中获得第二极角对应的行向量,从行向量的最左侧或者最右侧开始搜索,以获得该行向量上出现多个极值点(极值点就是边缘点),进而获得多个第二极径。Specifically, in an application scenario, the process of obtaining multiple second polar diameters corresponding to the second polar angle from the first gradient image in step S206 includes: obtaining the corresponding second polar angle from the first gradient image For the row vector, search from the leftmost or rightmost side of the row vector to obtain multiple extreme points (the extreme points are edge points) appearing on the row vector, and then obtain multiple second extreme diameters.
在本实施例中,由于第二极角与第一极角之差的绝对值为180°,当感兴趣区域与圆形特征不是同一个圆心时,第一极角对应的点为圆形特征上距离感兴趣区域的圆心最近或者最远的点;第二极角对应的点为距离感兴趣区域的圆心最远或者最近的点,这两个点正好构成圆的直径,由直径上的两个点也可以确定一个圆。上述步骤S206中对多个第二极径进行筛选以保留最多一个第二极 径的过程包括:将当前第二极径、第二极角与前面找到的第一局部极径、第一极角进行拟合以获得第二拟合圆,然后判断第二拟合圆是否真实存在,如果该第二极径、第二极角对应的极值点是圆形特征上的点,那么第二拟合圆就是真实存在的,该第二极径保留;如果该第二极径、第二极角对应的极值点不是圆形特征上的点,是噪声点或者干扰点,那么这个第二拟合圆是不存在的,该第二极径筛除。上述过程会将多个第二极径筛除最多只剩一个。In this embodiment, since the absolute value of the difference between the second polar angle and the first polar angle is 180°, when the region of interest and the circular feature are not at the same center, the point corresponding to the first polar angle is the circular feature The point closest to or farthest from the center of the circle of interest; the point corresponding to the second polar angle is the point farthest or closest to the center of the circle of interest. These two points exactly constitute the diameter of the circle. A point can also define a circle. The process of screening multiple second pole diameters in step S206 to retain at most one second pole diameter includes: matching the current second pole diameter and second pole angle with the first local pole diameter and first pole angle found previously Perform fitting to obtain a second fitted circle, and then determine whether the second fitted circle actually exists. If the extreme point corresponding to the second polar diameter and the second polar angle is a point on a circular feature, then the second The conjoint circle is real, and the second polar diameter remains; if the extreme point corresponding to the second polar diameter and the second polar angle is not a point on a circular feature, but a noise point or an interference point, then this second pseudo There is no roundness, and the second polar diameter is screened out. The above process will filter out multiple second polar diameters and only one will be left.
请参阅图5,图5为图2中步骤S206中对多个第二极径进行筛选以保留最多一个第二极径的一实施方式的流程示意图。上述步骤S206中对多个第二极径进行筛选以保留最多一个第二极径,即具体判断第二拟合圆是否真实存在的方法过程包括:Please refer to FIG. 5. FIG. 5 is a schematic flowchart of an embodiment in which a plurality of second pole diameters are screened in step S206 in FIG. 2 to reserve at most one second pole diameter. In step S206, a plurality of second polar diameters are screened to retain at most one second polar diameter, that is, the method for specifically determining whether the second fitting circle actually exists includes:
S401:将所有第二极径、第二极角分别与第一局部极径、第一极角进行拟合,以获得多个第二拟合圆,以及多个第二拟合圆对应的第四参数。S401: Fit all second polar diameters and second polar angles to the first local polar diameters and first polar angles, respectively, to obtain a plurality of second fitting circles, and a plurality of second fitting circles corresponding to the first Four parameters.
具体地,在一个应用场景中,可以将第一极角、第一局部极径、第二极角、第二极径转换成直角坐标系下对应的第一坐标值、第二坐标值;根据第一坐标值、第二坐标值获得第二拟合圆,以及第二拟合圆在直角坐标系下对应的第四参数。上述第四参数包括第二拟合圆在直角坐标系下对应的圆心坐标和半径。Specifically, in an application scenario, the first polar angle, the first local polar diameter, the second polar angle, and the second polar diameter can be converted into corresponding first coordinate values and second coordinate values in a rectangular coordinate system; The first coordinate value and the second coordinate value obtain a second fitted circle, and a fourth parameter corresponding to the second fitted circle in the rectangular coordinate system. The above-mentioned fourth parameter includes the coordinates and radius of the center of the circle corresponding to the second fitted circle in the rectangular coordinate system.
S402:利用第二拟合圆对应的第四参数,从感兴趣区域中获取距离第二拟合圆第一预定范围内的第一局部图像。S402: Use the fourth parameter corresponding to the second fitted circle to obtain a first partial image within a first predetermined range from the second fitted circle from the region of interest.
具体地,上述第一预定范围可以由用户自行设定,一般可以是1-10(例如,1、3、5、7、10等)个像素宽度;Specifically, the first predetermined range may be set by the user, and may generally be 1-10 (for example, 1, 3, 5, 7, 10, etc.) pixel widths;
S403:获得第一局部图像对应的第三梯度图像。S403: Obtain a third gradient image corresponding to the first partial image.
具体地,在一个应用场景中,可以将第一局部图像转换成极坐标系下的第二图像;将第二图像按列求像素灰度的平均和,以此来获得第二图像对应的一维直方图,并对一维直方图进行一阶求导获得其对应的第三梯度图像。Specifically, in an application scenario, the first partial image can be converted into a second image in a polar coordinate system; the second image can be averaged by the pixel gray scale in columns to obtain a corresponding one of the second image Dimensional histogram, and first-order derivation of the one-dimensional histogram to obtain its corresponding third gradient image.
S404:通过第三梯度图像获得第二拟合圆的第一对比度。S404: Obtain the first contrast of the second fitted circle through the third gradient image.
具体地,可以通过现有技术中任一种获得第一对比度。例如,第一对比度为第三梯度图像中梯度值的绝对值的最大值。Specifically, the first contrast can be obtained by any one of the prior art. For example, the first contrast is the maximum value of the absolute value of gradient values in the third gradient image.
S405:利用第一对比度对第二拟合圆进行打分,第一对比度与第一分数成正比。S405: Use the first contrast to score the second fitted circle, the first contrast is proportional to the first score.
具体地,在一个应用场景中,可以将第一对比度乘以一个比例系数,即获得第一分数;当然,在其他应用场景中,还可采用其他方式获得第一分数,本申 请对此不作限定。Specifically, in an application scenario, the first contrast can be multiplied by a scale factor to obtain the first score; of course, in other application scenarios, the first score can also be obtained in other ways, which is not limited in this application .
S406:获得第一分数超过第一阈值,且分数最高的第二拟合圆对应的第二极径。S406: Obtain a second polar diameter corresponding to the second fitting circle whose first score exceeds the first threshold and whose score is the highest.
具体地,该第一阈值可由用户自行设定。Specifically, the first threshold can be set by the user.
S207:从第一梯度图像中获得与第三极角对应的多个第三极径,对多个第三极径进行筛选以保留最多一个第三极径。S207: Obtain multiple third pole diameters corresponding to the third pole angle from the first gradient image, and filter the multiple third pole diameters to retain at most one third pole diameter.
具体地,在一个应用场景中,上述步骤S207中从第一梯度图像中获得与第三极角对应的多个第三极径的过程包括:在第一梯度图像中获得第三极角对应的行向量,从行向量的最左侧或者最右侧开始搜索,以获得该行向量上出现多个极值点(极值点就是边缘点),进而获得多个第三极径。Specifically, in an application scenario, the process of obtaining multiple third polar diameters corresponding to the third polar angle from the first gradient image in step S207 includes: obtaining the third polar angle corresponding to the third polar angle in the first gradient image For the row vector, search from the leftmost or rightmost side of the row vector to obtain multiple extreme points (the extreme points are edge points) appearing on the row vector, and then obtain multiple third extreme diameters.
在本实施例中,由于第三极角与第一极角之差的绝对值为90°,上述步骤S207中对多个第三极径进行筛选以保留最多一个第三极径的过程包括:将当前第三极径、第三极角与前面找到的第一局部极径、第一极角、第二极径、第二极角进行拟合以获得第三拟合圆,然后判断第三拟合圆是否真实存在,如果该第三极径、第三极角对应的极值点是圆形特征上的点,那么第三拟合圆就是真实存在的,该第三极径保留;如果该第三极径、第三极角对应的极值点不是圆形特征上的点,是噪声点或者干扰点,那么这个第三拟合圆是不存在的,该第三极径筛除。上述过程会将多个第三极径筛除最多只剩一个。In this embodiment, since the absolute value of the difference between the third polar angle and the first polar angle is 90°, the process of screening multiple third polar diameters in step S207 to retain at most one third polar diameter includes: Fit the current third polar diameter and third polar angle to the first local polar diameter, first polar angle, second polar diameter, and second polar angle found previously to obtain a third fitted circle, and then determine the third Whether the fitted circle really exists, if the extreme point corresponding to the third pole diameter and the third pole angle is the point on the circular feature, then the third fitted circle is real, and the third pole diameter remains; if The extreme point corresponding to the third polar diameter and the third polar angle is not a point on the circular feature, but is a noise point or an interference point. Then this third fitting circle does not exist, and the third polar diameter is filtered out. The above process will screen out multiple third pole diameters, leaving at most one.
请参阅图6,图6为图2中步骤S207中对多个第三极径进行筛选以保留最多一个第三极径一实施方式的流程示意图。上述步骤S207中对多个第三极径进行筛选以保留最多一个第三极径,即具体判断第三拟合圆是否真实存在的方法过程包括:Please refer to FIG. 6. FIG. 6 is a schematic flowchart of an embodiment of screening a plurality of third pole diameters in step S207 in FIG. 2 to reserve at most one third pole diameter. In step S207, a plurality of third pole diameters are screened to reserve at most one third pole diameter, that is, the method for specifically determining whether the third fitting circle actually exists includes:
S501:将所有第三极径、第三极角分别与第一局部极径、第一极角、步骤S206后筛选保留的第二极径、第二极角进行拟合,以获得多个第三拟合圆,以及多个第三拟合圆对应的第五参数。S501: Fit all third polar diameters and third polar angles to the first local polar diameters, first polar angles, and the second polar diameters and second polar angles screened and retained after step S206 to obtain multiple Three fitted circles, and fifth parameters corresponding to multiple third fitted circles.
具体地,在一个应用场景中,可以将当前第三极径、第三极角与第一局部极径、第一极角、步骤S206后筛选保留的第二极径、第二极角转换成直角坐标系下对应的第一坐标值、第二坐标值、第三坐标值;根据第一坐标值、第二坐标值、第三坐标值获得第三拟合圆,以及第三拟合圆在直角坐标系下对应的第五参数。上述第五参数包括第三拟合圆在直角坐标系下对应的圆心坐标和半径。Specifically, in an application scenario, the current third polar diameter, the third polar angle and the first local polar diameter, the first polar angle, the second polar diameter retained after the screening in step S206, and the second polar angle can be converted into Corresponding first coordinate value, second coordinate value, and third coordinate value in a rectangular coordinate system; according to the first coordinate value, second coordinate value, and third coordinate value, a third fitted circle is obtained, and the third fitted circle is in The corresponding fifth parameter in the Cartesian coordinate system. The above-mentioned fifth parameter includes the coordinate and radius of the center of the circle corresponding to the third fitted circle in the rectangular coordinate system.
S502:利用第三拟合圆对应的第五参数,从感兴趣区域中获取距离第三拟 合圆第二预定范围内的第二局部图像。S502: Using the fifth parameter corresponding to the third fitted circle, obtain a second partial image within a second predetermined range from the third fitted circle from the region of interest.
具体地,上述第二预定范围可以由用户自行设定,一般可以是1-10(例如,1、3、5、7、10等)个像素宽度;Specifically, the second predetermined range may be set by the user, and may generally be 1-10 (for example, 1, 3, 5, 7, 10, etc.) pixel widths;
S503:获得第二局部图像对应的第四梯度图像。S503: Obtain a fourth gradient image corresponding to the second partial image.
具体地,在一个应用场景中,可以将第二局部图像转换成极坐标系下的第三图像;将第三图像按列求像素灰度的平均和,以此来获得第三图像对应的一维直方图,并对一维直方图进行一阶求导获得其对应的第四梯度图像。Specifically, in an application scenario, the second partial image can be converted into a third image in a polar coordinate system; the third image can be averaged by the pixel gray scale in columns to obtain a corresponding one of the third image Dimensional histogram, and first-order derivation of the one-dimensional histogram to obtain its corresponding fourth gradient image.
S504:通过第四梯度图像获得第三拟合圆的第二对比度。S504: Obtain the second contrast of the third fitted circle from the fourth gradient image.
具体地,可以通过现有技术中任一种方法获得第二对比度。例如,第二对比度为第四梯度图像中梯度值的绝对值的最大值。Specifically, the second contrast can be obtained by any method in the prior art. For example, the second contrast is the maximum value of the absolute value of the gradient value in the fourth gradient image.
S505:利用第二对比度对第三拟合圆进行打分,第二对比度与第二分数成正比。S505: Use the second contrast to score the third fitted circle, and the second contrast is proportional to the second score.
具体地,在一个应用场景中,可以将第二对比度乘以一个比例系数,即获得第二分数;当然,在其他应用场景中,还可采用其他方式获得第二分数,本申请对此不作限定。Specifically, in an application scenario, the second contrast can be multiplied by a scale factor to obtain a second score; of course, in other application scenarios, the second score can also be obtained in other ways, which is not limited in this application .
S506:获得第二分数超过第二阈值,且第二分数最高的第三拟合圆对应的第三极径。S506: Obtain a third polar diameter corresponding to the third fitting circle whose second score exceeds the second threshold and whose second score is the highest.
具体地,该第二阈值可由用户自行设定。Specifically, the second threshold can be set by the user.
至此,经过上述步骤S207,一个第一局部极径,对应一个第二极径、一个第三极径。So far, after the above step S207, one first local pole diameter corresponds to one second pole diameter and one third pole diameter.
S208:获得筛选后的多组第一极角、第一局部极径、第二极角、第二极径、第三极角、第三极径对应的多个第一拟合圆,以及与多个第一拟合圆对应的多个第三参数。S208: obtaining a plurality of first fitting circles corresponding to the selected first polar angle, first local polar diameter, second polar angle, second polar diameter, third polar angle, and third polar diameter after screening, and Multiple third parameters corresponding to multiple first fitting circles.
具体地,在一个应用场景中,上述步骤S208具体包括:获得保留有第三极径的所有第一极角、第一局部极径对应的第三拟合圆,第一拟合圆即第三拟合圆,第三参数即第五参数。上述第三参数包括第一拟合圆在直角坐标系下对应的圆心坐标和半径。Specifically, in an application scenario, the above step S208 specifically includes: obtaining a third fitting circle corresponding to all the first polar angles and the first local polar diameter retaining the third polar diameter, and the first fitting circle is the third Fitting a circle, the third parameter is the fifth parameter. The above-mentioned third parameters include the coordinates and radius of the center of the circle corresponding to the first fitted circle in the rectangular coordinate system.
S209:利用多个第一拟合圆、多个第三参数和第二预定策略获得检测参数。S209: Use a plurality of first fitted circles, a plurality of third parameters, and a second predetermined strategy to obtain detection parameters.
具体地,在一个应用场景中,上述步骤S209具体包括:获得多个第一拟合圆中的分数最高的圆、或者半径最大的圆、或者半径最小的圆,将该圆对应的第三参数作为检测参数。Specifically, in an application scenario, the above step S209 specifically includes: obtaining a circle with the highest score, or a circle with the largest radius, or a circle with the smallest radius among the plurality of first fitting circles, and the third parameter corresponding to the circle As a detection parameter.
S104:利用检测参数调整第一参数,并返回至利用第一参数对圆形特征进行检测的步骤,记录每次检测后得到的检测参数,直至第一圆心坐标与检测圆心坐标的距离小于或等于预设阈值。S104: Adjust the first parameter using the detection parameter, and return to the step of detecting the circular feature using the first parameter, and record the detection parameter obtained after each detection until the distance between the first center coordinate and the detected center coordinate is less than or equal to Preset threshold.
具体地,在一个应用场景中,上述步骤S104中利用检测参数调整感兴趣区域的第一参数具体包括:将最近一次检测得到的检测参数中的检测圆心坐标作为感兴趣区域对应的第一圆心坐标,以调整感兴趣区域的位置。该步骤的目的相当于调整感兴趣区域的位置,以使得感兴趣区域的圆心尽可能与圆形特征的圆心重合。当然,在其他应用场景中,在调整感兴趣区域的位置的同时,还可以进一步调整感兴趣区域的大小,例如,根据最近一次检测得到的检测参数中的半径调整感兴趣区域对应的内径和外径,以使得感兴趣区域范围缩小。需要注意的是,在调整感兴趣区域大小时,需要保证圆形特征位于感兴趣区域范围内。Specifically, in an application scenario, using the detection parameter to adjust the first parameter of the region of interest in step S104 above specifically includes: using the center coordinates of the detection in the detection parameters obtained from the latest detection as the first center coordinates of the region of interest To adjust the position of the region of interest. The purpose of this step is equivalent to adjusting the position of the region of interest so that the center of the region of interest coincides with the center of the circular feature as much as possible. Of course, in other application scenarios, while adjusting the position of the region of interest, the size of the region of interest can be further adjusted, for example, the inner diameter and the outer diameter corresponding to the region of interest can be adjusted according to the radius in the detection parameter obtained from the last detection To reduce the area of interest. It should be noted that when adjusting the size of the region of interest, it is necessary to ensure that the circular features are within the range of the region of interest.
另外,在本实施例中,在利用检测参数调整第一参数后,本申请所提供的检测方法还包括:获得第一圆心坐标与检测圆心坐标的距离,并判断该距离是否小于等于预设阈值;若是,则进入后续步骤S105;否则,返回步骤S103。其中,上述提及的预设阈值可由用户自行设定。In addition, in this embodiment, after the first parameter is adjusted by using the detection parameter, the detection method provided by the present application further includes: obtaining the distance between the first circle center coordinate and the detection circle center coordinate, and judging whether the distance is less than or equal to a preset threshold ; If yes, go to the subsequent step S105; otherwise, return to step S103. Among them, the preset threshold mentioned above can be set by the user.
S105:根据记录的多个检测参数和第一预定策略确定圆形特征的最终参数,最终参数包括圆形特征的圆心坐标和半径。S105: Determine the final parameters of the circular feature according to the recorded multiple detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature.
具体地,在一个应用场景中,上述步骤S105包括:将多个检测参数的平均值作为圆形特征的最终参数,例如圆形特征的圆心坐标等于所有检测圆心坐标的平均值,圆心特征的半径等于所有检测半径的平均值。Specifically, in an application scenario, the above step S105 includes: using the average value of multiple detection parameters as the final parameter of the circular feature, for example, the center coordinates of the circular feature are equal to the average of all detected center coordinates, and the radius of the center feature Equal to the average of all detection radii.
请参阅图7,图7为本申请圆形特征检测方法另一实施方式的流程示意图,该检测方法包括:Please refer to FIG. 7, which is a schematic flowchart of another embodiment of a circular feature detection method according to the present application. The detection method includes:
S601:接收待处理图像,待处理图像包含圆形特征。具体地,该步骤与上述实施例中步骤S101相同,在此不再赘述。S601: Receive an image to be processed, the image to be processed contains circular features. Specifically, this step is the same as step S101 in the foregoing embodiment, and will not be repeated here.
S602:对待处理图像进行感兴趣区域提取,并获得感兴趣区域对应的第一参数,其中,圆形特征位于感兴趣区域内,感兴趣区域为圆环,第一参数包括感兴趣区域对应的第一圆心坐标、内径和外径。具体地,该步骤与上述实施例中步骤S102相同,在此不再赘述。S602: Extract the region of interest of the image to be processed, and obtain the first parameter corresponding to the region of interest, where the circular feature is located in the region of interest, and the region of interest is a circle, and the first parameter includes the first parameter corresponding to the region of interest A circle center coordinate, inner diameter and outer diameter. Specifically, this step is the same as step S102 in the foregoing embodiment, and will not be repeated here.
S603:利用第一参数对圆形特征进行检测,以获得与圆形特征对应的检测参数,检测参数包括检测圆心坐标以及检测半径。具体地,该步骤与上述实施 例中步骤S103相同,在此不再赘述。S603: Detect the circular feature by using the first parameter to obtain a detection parameter corresponding to the circular feature. The detection parameter includes the detection center coordinate and the detection radius. Specifically, this step is the same as step S103 in the foregoing embodiment, and details are not described herein again.
S604:利用检测参数调整第一参数,并返回至利用第一参数对圆形特征进行检测的步骤,记录每次检测后得到的检测参数,并在每次检测后更新迭代参数的值,直至迭代参数的值超出预设范围。S604: Adjust the first parameter using the detection parameter, and return to the step of detecting the circular feature using the first parameter, record the detection parameter obtained after each detection, and update the value of the iteration parameter after each detection until the iteration The value of the parameter is outside the preset range.
具体地,上述步骤S604中利用检测参数调整感兴趣区域的第一参数与上述实施例中步骤S104中相关内容相同,在此不再赘述。Specifically, the first parameter of the region of interest adjusted by the detection parameter in step S604 is the same as the related content in step S104 in the foregoing embodiment, and details are not described herein again.
在本实施例中,迭代参数为利用第一参数对圆形特征进行检测的次数,迭代参数的值超出预设范围为检测次数大于或等于预设数值、或者小于等于预设数值。迭代参数的初始值也可以为一个任意正整数,每次检测后迭代参数可以增加一个设定值,直至迭代参数的值大于等于预设数值;当然,每次检测后迭代参数也可以减去一个设定值,直至迭代参数的值小于等于预设数值。In this embodiment, the iteration parameter is the number of times that the first parameter is used to detect the circular feature. If the value of the iteration parameter exceeds the preset range, the number of detections is greater than or equal to the preset value, or less than or equal to the preset value. The initial value of the iteration parameter can also be an arbitrary positive integer. The iteration parameter can be increased by a set value after each detection until the value of the iteration parameter is greater than or equal to the preset value; of course, the iteration parameter can also be subtracted by one after each detection Set the value until the value of the iteration parameter is less than or equal to the preset value.
在其他实施例中,迭代参数也可为利用第一参数对圆形特征进行检测的圆形特征上的角度值,迭代参数的值超出预设范围为角度值大于或等于预设角度、或者小于等于预设角度。迭代参数的初始值可以为一个任意角度,每次检测后迭代参数可以增加一个设定值,直至迭代参数的值大于等于预设角度;当然,每次检测后迭代参数也可以减去一个设定值,直至迭代参数的值小于等于预设角度。例如,迭代参数的初始值可以为0°,设定值可以为45°,预设角度可以为360°。In other embodiments, the iteration parameter may also be an angle value on the circular feature that uses the first parameter to detect the circular feature. The value of the iteration parameter that exceeds the preset range is that the angle value is greater than or equal to the preset angle, or less than Equal to the preset angle. The initial value of the iteration parameter can be an arbitrary angle, the iteration parameter can be increased by a set value after each detection until the value of the iteration parameter is greater than or equal to the preset angle; of course, the iteration parameter can also be subtracted by a setting after each detection Value until the value of the iteration parameter is less than or equal to the preset angle. For example, the initial value of the iteration parameter may be 0°, the set value may be 45°, and the preset angle may be 360°.
在另一个实施例中,在利用检测参数调整第一参数后,本申请所提供的检测方法还包括:判断当前迭代参数的值是否超出预设范围;若是,则进入后续步骤S605;否则,返回步骤S603,并将迭代参数的值更新(例如,增加或者减去一个设定值)。In another embodiment, after the first parameter is adjusted using the detection parameter, the detection method provided by the present application further includes: judging whether the value of the current iteration parameter exceeds the preset range; if yes, proceed to the subsequent step S605; otherwise, return In step S603, the value of the iteration parameter is updated (for example, a set value is added or subtracted).
S605:根据记录的多个检测参数和第一预定策略确定圆形特征的最终参数,最终参数包括圆形特征的圆心坐标和半径。具体地,该步骤与上述实施例中步骤S105相同,在此不再赘述。S605: Determine the final parameters of the circular feature according to the recorded multiple detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature. Specifically, this step is the same as step S105 in the foregoing embodiment, and will not be repeated here.
在另一个实施方式中,本申请图1与图7中所给出的检测方法也可进行结合。例如,可以先进行图1中的方法,图1中的方法相当于粗略寻找圆形特征的过程,起初圆形特征与感兴趣区域可能不同心或者严重偏心,经过图1中的方法可以使得感兴趣区域对应的第一圆心坐标与圆形特征的检测圆心坐标的距离小于等于预设阈值,进而使得圆形特征与移动后的感兴趣区域基本同心;然后,可以进行图7中的方法,图7中的方法相当于精细寻找圆形特征的过程,通过 迭代参数控制进行圆形特征检测的次数,进而保证圆形特征的精确性和稳定性。In another embodiment, the detection methods shown in FIGS. 1 and 7 of the present application can also be combined. For example, the method in FIG. 1 can be performed first. The method in FIG. 1 is equivalent to the process of roughly searching for a circular feature. At first, the circular feature and the region of interest may not be concentric or severely eccentric. The method in FIG. 1 can make the sense The distance between the first center coordinates corresponding to the region of interest and the detection center coordinates of the circular feature is less than or equal to the preset threshold, thereby making the circular feature substantially concentric with the moved region of interest; then, the method in FIG. 7 can be performed. The method in 7 is equivalent to the process of finely searching for circular features. Iterative parameters control the number of circular feature detections, thereby ensuring the accuracy and stability of circular features.
在实际应用过程中,圆形特征包括无噪声标准圆形特征、有噪声标准圆形特征以及非标准圆形特征(即不太规则的圆形特征)。对于无噪声的标准圆形特征而言,由于其本身就具有高质量的边缘信息,因此经过两三次迭代,就能精确计算出边缘的检测参数,精度可达到0.03个像素内;对于有噪声标准圆形特征而言,由于噪声的存在通常在圆形特征检测中存在震荡不收敛的情况,使用多次迭代然后求平均值的方式能够很好避免噪声的影响,保证最终参数的精确性和稳定性;对于非标准圆形特征而言,理论上无法给出它的参数(因为是非圆形特征,所以无圆心,无半径等参数),但是通过对其进行全方位地检测计算,能够给出它的平均圆心坐标和半径参数,对于实际应用很有用处,因为实际图片中的圆形特征很多都是非标准圆形特征。此外,本申请所提供的圆形特征检测方法中的迭代思想也可用于其他特定形状的检测过程中,例如,直线等,本申请对此不作过多说明。In practical applications, circular features include noise-free standard circular features, noisy standard circular features, and non-standard circular features (ie, irregular circular features). For the noise-free standard circular feature, because it has high-quality edge information, it can accurately calculate the edge detection parameters after two or three iterations, and the accuracy can reach 0.03 pixels; for the noisy standard For circular features, due to the presence of noise, there is usually a case of oscillation and non-convergence in the detection of circular features. Using multiple iterations and then averaging can well avoid the influence of noise and ensure the accuracy and stability of the final parameters For non-standard circular features, it is theoretically impossible to give its parameters (because it is a non-circular feature, so there is no center, no radius and other parameters), but by comprehensively detecting and calculating it, it can be given Its average center coordinates and radius parameters are very useful for practical applications, because many of the circular features in the actual picture are non-standard circular features. In addition, the iterative idea in the circular feature detection method provided by this application can also be used in the detection process of other specific shapes, such as straight lines, etc., which will not be described in detail in this application.
请参阅图8,图8为本申请圆形特征检测处理系统一实施方式的结构示意图。该圆形特征检测处理系统1包括处理器10、存储器12、收发器14和显示器16,收发器14用于接收待处理图像,并将待处理图像传输至处理器10,显示器16用于显示检测结果,当然,显示器16还可以显示待处理图像以及感兴趣区域,存储器12存储有程序指令,程序指令可被处理器10加载并执行上述任一实施例中的圆形特征检测方法。Please refer to FIG. 8, which is a schematic structural diagram of an embodiment of a circular feature detection and processing system of the present application. The circular feature detection and processing system 1 includes a processor 10, a memory 12, a transceiver 14, and a display 16. The transceiver 14 is used to receive an image to be processed, and transmits the image to be processed to the processor 10, and the display 16 is used to display detection As a result, of course, the display 16 can also display the image to be processed and the region of interest, and the memory 12 stores program instructions, which can be loaded by the processor 10 and execute the circular feature detection method in any of the above embodiments.
请参阅图9,图9为本申请具有存储功能的装置一实施方式的结构示意图,该具有存储功能的装置2上存储有程序数据20,程序数据20被处理器执行时实现上述任一实施例中的圆形特征检测方法中的步骤。Please refer to FIG. 9. FIG. 9 is a schematic structural diagram of an embodiment of a device with a storage function according to the present application. The device 2 with a storage function stores program data 20. When the program data 20 is executed by a processor, any of the above embodiments is implemented. Steps in the circular feature detection method.
总而言之,区别于现有技术的情况,本申请所提供的圆形特征检测方法中包括:利用感兴趣区域对应的第一参数获得检测后圆形特征对应的检测参数;并利用检测参数调整第一参数,并返回至利用第一参数对圆形特征进行检测的步骤,记录每次检测后得到的检测参数,直至第一圆心坐标与检测圆心坐标的距离小于或等于预设阈值;根据记录的多个检测参数和第一预定策略确定圆形特征的最终参数,最终参数包括圆形特征的圆心坐标和半径。一方面,通过上述迭代的方式可以使得感兴趣区域与圆形特征越来越接近,且感兴趣区域与圆形特征的中心越来越接近,以降低感兴趣区域的随机性,提高圆形特征检测结果的准确性;另一方面,上述方法中利用多个检测参数和第一预定策略获得圆形特征 的最终参数的方式,可以给出一个较平均的结果,进一步提高圆形特征检测结果的准确性和稳定性,在一个应用场景中,圆检测结果能达到零点几像素。In a word, different from the situation in the prior art, the circular feature detection method provided by the present application includes: using the first parameter corresponding to the region of interest to obtain the detection parameter corresponding to the circular feature after detection; and using the detection parameter to adjust the first Parameters, and return to the step of detecting the circular features using the first parameter, recording the detection parameters obtained after each detection, until the distance between the first center coordinates and the detected center coordinates is less than or equal to the preset threshold; according to the number of records The detection parameters and the first predetermined strategy determine the final parameters of the circular feature. The final parameters include the center coordinates and radius of the circular feature. On the one hand, the above-mentioned iterative method can make the region of interest closer to the circular feature, and the center of the region of interest closer to the circular feature, so as to reduce the randomness of the region of interest and improve the circular feature The accuracy of the detection results; on the other hand, the method of using multiple detection parameters and the first predetermined strategy to obtain the final parameters of the circular feature in the above method can give a more average result and further improve the detection result of the circular feature Accuracy and stability, in an application scenario, the circle detection results can reach a few pixels.

Claims (20)

  1. 一种圆形特征检测方法,其特征在于,所述圆形特征检测方法包括:A circular feature detection method, characterized in that the circular feature detection method includes:
    接收待处理图像,所述待处理图像包含圆形特征;Receiving an image to be processed, the image to be processed includes a circular feature;
    对所述待处理图像进行感兴趣区域提取,并获得所述感兴趣区域对应的第一参数,其中,所述圆形特征位于所述感兴趣区域内,所述感兴趣区域为圆环,所述第一参数包括所述感兴趣区域对应的第一圆心坐标、内径和外径;Extract the region of interest from the image to be processed, and obtain the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, and the region of interest is a circle, so The first parameter includes the first circle center coordinate, inner diameter, and outer diameter corresponding to the region of interest;
    利用所述第一参数对所述圆形特征进行检测,以获得与所述圆形特征对应的检测参数,所述检测参数包括检测圆心坐标以及检测半径;Detecting the circular feature by using the first parameter to obtain a detection parameter corresponding to the circular feature, the detection parameter including a detection center coordinate and a detection radius;
    利用所述检测参数调整所述第一参数,并返回至所述利用所述第一参数对所述圆形特征进行检测的步骤,记录每次检测后得到的检测参数,直至所述第一圆心坐标与所述检测圆心坐标的距离小于或等于预设阈值;Adjust the first parameter using the detection parameter, and return to the step of detecting the circular feature using the first parameter, and record the detection parameter obtained after each detection until the first circle center The distance between the coordinates and the coordinates of the detected circle center is less than or equal to a preset threshold;
    根据记录的多个所述检测参数和第一预定策略确定所述圆形特征的最终参数,所述最终参数包括所述圆形特征的圆心坐标和半径。The final parameters of the circular feature are determined according to the multiple recorded detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature.
  2. 根据权利要求1所述的检测方法,其特征在于,所述利用所述检测参数调整所述第一参数,包括:The detection method according to claim 1, wherein the adjusting the first parameter using the detection parameter comprises:
    将最近一次检测得到的所述检测参数中的所述检测圆心坐标作为所述感兴趣区域对应的第一圆心坐标,以调整所述感兴趣区域的位置。The detected center coordinates of the detection parameters obtained in the latest detection are used as the first center coordinates of the region of interest to adjust the position of the region of interest.
  3. 根据权利要求2所述的检测方法,其特征在于,所述利用所述检测参数调整所述第一参数,还包括:The detection method according to claim 2, wherein the adjusting the first parameter using the detection parameter further comprises:
    根据最近一次检测得到的所述检测参数中的检测半径调整所述感兴趣区域对应的内径和外径,以使得所述感兴趣区域范围缩小。The inner diameter and the outer diameter corresponding to the region of interest are adjusted according to the detection radius in the detection parameter obtained in the latest detection, so that the range of the region of interest is reduced.
  4. 根据权利要求1所述的检测方法,其特征在于,所述利用所述第一参数对所述圆形特征进行检测,以获得与所述圆形特征对应的检测参数,包括:The detection method according to claim 1, wherein the detecting the circular feature using the first parameter to obtain a detection parameter corresponding to the circular feature includes:
    将直角坐标系下的所述感兴趣区域的图像转化为极坐标系下的第一图像,其中,所述感兴趣区域的图像包含所述圆形特征,所述第一图像的横坐标为极径,纵坐标为极角;Converting the image of the region of interest in the rectangular coordinate system into the first image in the polar coordinate system, wherein the image of the region of interest contains the circular feature, and the abscissa of the first image is polar Diameter, the ordinate is the polar angle;
    获得所述第一图像对应的一维直方图、所述第一图像对应的第一梯度图像以及所述一维直方图对应的第二梯度图像;Obtaining a one-dimensional histogram corresponding to the first image, a first gradient image corresponding to the first image, and a second gradient image corresponding to the one-dimensional histogram;
    获得所述第二梯度图像中的多个极值处对应的第一极径;Obtaining a first polar diameter corresponding to multiple extreme values in the second gradient image;
    获得所述第一梯度图像中距离每个所述第一极径预定范围内的最值点,最值 点对应的极径和极角定义为第一局部极径和第一极角;Obtaining a maximum value point within a predetermined range of each first polar diameter in the first gradient image, and a polar diameter and a polar angle corresponding to the maximum value point are defined as a first local polar diameter and a first polar angle;
    获得所述第一梯度图像中与所述第一极角对应的第二极角、第三极角,其中,所述第一极角、所述第二极角、所述第三极角满足第一预设条件;Obtaining a second polar angle and a third polar angle corresponding to the first polar angle in the first gradient image, wherein the first polar angle, the second polar angle, and the third polar angle satisfy The first preset condition;
    获得所述第一梯度图像中与所述第二极角对应的多个第二极径,并对多个所述第二极径进行筛选以保留最多一个所述第二极径;Obtaining a plurality of second polar diameters corresponding to the second polar angle in the first gradient image, and filtering the plurality of second polar diameters to retain at most one second polar diameter;
    获得所述第一梯度图像中与所述第三极角对应的多个第三极径,并对多个所述第三极径进行筛选以保留最多一个所述第三极径;Obtaining a plurality of third polar diameters corresponding to the third polar angle in the first gradient image, and filtering the plurality of third polar diameters to retain at most one third polar diameter;
    获得多组所述第一极角、所述第一局部极径、所述第二极角、所述第二极径、所述第三极角、所述第三极径对应的多个第一拟合圆,以及与多个所述第一拟合圆对应的多个第三参数;Obtain multiple sets of multiple first corresponding to the first polar angle, the first local polar diameter, the second polar angle, the second polar diameter, the third polar angle, and the third polar diameter A fitting circle, and a plurality of third parameters corresponding to the plurality of first fitting circles;
    利用多个所述第一拟合圆、多个第三参数和第二预定策略获得所述检测参数。The detection parameters are obtained by using a plurality of the first fitted circles, a plurality of third parameters, and a second predetermined strategy.
  5. 根据权利要求4所述的检测方法,其特征在于,所述获得所述第二梯度图像中的多个极值处对应的第一极径,包括:The detection method according to claim 4, wherein the obtaining the first polar diameter corresponding to a plurality of extreme values in the second gradient image includes:
    按预定顺序获得所述第二梯度图像中当前位置处对应的梯度值;Obtaining the corresponding gradient value at the current position in the second gradient image in a predetermined order;
    判断所述梯度值是否为极值;Determine whether the gradient value is an extreme value;
    若是,则获得当前位置处对应的第一极径,并判断当前位置是否为所述第二梯度图像中的最后一个位置,若是,则结束所述获得所述第二梯度图像中的多个极值处对应的第一极径的步骤;否则,获得所述当前位置的下一个位置处对应的梯度值,并返回至判断所述梯度值是否为极值的步骤;If yes, obtain the corresponding first pole diameter at the current position and determine whether the current position is the last position in the second gradient image; if so, end the obtaining of multiple poles in the second gradient image The step corresponding to the first polar diameter at the value; otherwise, obtaining the corresponding gradient value at the next position of the current position, and returning to the step of determining whether the gradient value is an extreme value;
    否则,判断当前位置是否为所述第二梯度图像中的最后一个位置,若是,则结束所述获得所述第二梯度图像中的多个极值处对应的第一极径的步骤;否则,获得所述当前位置的下一个位置处对应的梯度值,并返回至判断所述梯度值是否为极值的步骤。Otherwise, it is determined whether the current position is the last position in the second gradient image, and if so, the step of obtaining corresponding first polar diameters at multiple extreme values in the second gradient image is ended; otherwise, Obtain the corresponding gradient value at the next position of the current position, and return to the step of determining whether the gradient value is an extreme value.
  6. 根据权利要求5所述的检测方法,其特征在于,所述极值包括极大值和极小值,所述判断所述梯度值是否为极值包括:The detection method according to claim 5, wherein the extreme value includes a maximum value and a minimum value, and the judging whether the gradient value is an extreme value includes:
    获得当前位置处左右相邻两个像素位置处对应的第一梯度值和第二梯度值;Obtain the first gradient value and the second gradient value corresponding to the two adjacent pixel positions at the current position;
    判断当前位置处的所述梯度值是否大于等于所述第一梯度值,且当前位置处的所述梯度值是否大于等于所述第二梯度值;Judging whether the gradient value at the current position is greater than or equal to the first gradient value, and whether the gradient value at the current position is greater than or equal to the second gradient value;
    若是,则当前位置处的所述梯度值为极大值;If yes, the gradient value at the current position is a maximum value;
    否则,进一步判断当前位置处的所述梯度值是否小于等于所述第一梯度值, 且当前位置处的所述梯度值是否小于等于所述第二梯度值;Otherwise, it is further determined whether the gradient value at the current position is less than or equal to the first gradient value, and whether the gradient value at the current position is less than or equal to the second gradient value;
    若是,则当前位置处的所述梯度值为极小值;If yes, the gradient value at the current position is a minimum value;
    否则,当前位置处的所述梯度值不是极值。Otherwise, the gradient value at the current position is not an extreme value.
  7. 根据权利要求4所述的检测方法,其特征在于,所述第一极角、所述第二极角、所述第三极角满足第一预设条件,包括:The detection method according to claim 4, wherein the first polar angle, the second polar angle, and the third polar angle satisfy a first preset condition, including:
    所述第二极角与所述第一极角之差的绝对值为180°,所述第三极角与所述第一极角之差的绝对值为90°。The absolute value of the difference between the second polar angle and the first polar angle is 180°, and the absolute value of the difference between the third polar angle and the first polar angle is 90°.
  8. 根据权利要求7所述的检测方法,其特征在于,所述对多个所述第二极径进行筛选以保留最多一个所述第二极径,包括:The detection method according to claim 7, wherein the screening of the plurality of second pole diameters to retain at most one second pole diameter includes:
    将所有第二极径、第二极角分别与所述第一局部极径、所述第一极角进行拟合,以获得多个第二拟合圆,以及多个第二拟合圆对应的第四参数,所述第四参数包括所述第二拟合圆对应的圆心坐标和半径;Fitting all the second polar diameters and second polar angles to the first local polar diameters and the first polar angles, respectively, to obtain a plurality of second fitting circles, and a plurality of second fitting circles corresponding The fourth parameter, the fourth parameter includes the coordinates and radius of the center of the circle corresponding to the second fitted circle;
    利用所述第二拟合圆对应的所述第四参数,从感兴趣区域中获取距离第二拟合圆第一预定范围内的第一局部图像;Using the fourth parameter corresponding to the second fitted circle to obtain a first partial image within a first predetermined range from the second fitted circle from the region of interest;
    获得第一局部图像对应的第三梯度图像;Obtain a third gradient image corresponding to the first partial image;
    通过所述第三梯度图像获得所述第二拟合圆的第一对比度;Obtaining the first contrast of the second fitted circle through the third gradient image;
    利用所述第一对比度对所述第二拟合圆进行打分,所述第一对比度与第一分数成正比;Scoring the second fitted circle using the first contrast, the first contrast is proportional to the first score;
    获得所述第一分数超过第一阈值、且第一分数最高的所述第二拟合圆对应的第二极径。A second polar diameter corresponding to the second fitted circle with the first score exceeding the first threshold and the highest first score is obtained.
  9. 根据权利要求8所述的检测方法,其特征在于,所述对多个所述第三极径进行筛选以保留最多一个所述第三极径,包括:The detection method according to claim 8, wherein the screening of the plurality of third pole diameters to retain at most one third pole diameter includes:
    将所有第三极径、第三极角分别与所述第一局部极径、所述第一极角、筛选保留的所述第二极径、所述第二极角进行拟合,以获得多个第三拟合圆,以及多个第三拟合圆对应的第五参数;Fitting all third polar diameters and third polar angles to the first local polar diameters, the first polar angles, the second polar diameters and the second polar angles selected by screening to obtain Multiple third fitting circles, and fifth parameters corresponding to multiple third fitting circles;
    利用所述第三拟合圆对应的所述第五参数,从感兴趣区域中获取距离第三拟合圆第二预定范围内的第二局部图像;Using the fifth parameter corresponding to the third fitted circle to obtain a second partial image within a second predetermined range from the third fitted circle from the region of interest;
    获得所述第二局部图像对应的第四梯度图像;Obtaining a fourth gradient image corresponding to the second partial image;
    通过所述第四梯度图像获得所述第三拟合圆的第二对比度;Obtaining the second contrast of the third fitted circle through the fourth gradient image;
    利用所述第二对比度对所述第三拟合圆进行打分,所述第二对比度与第二分数成正比;Scoring the third fitted circle using the second contrast, the second contrast is proportional to the second score;
    获得所述第二分数超过第二阈值,且所述第二分数最高的第三拟合圆对应的第三极径。A third polar diameter corresponding to a third fitted circle with the second score exceeding the second threshold and the highest second score is obtained.
  10. 根据权利要求9所述的检测方法,其特征在于,所述获得多组第一极角、第一局部极径、第二极角、第二极径、第三极角、第三极径对应的多个第一拟合圆,以及与多个第一拟合圆对应的多个第三参数,包括:The detection method according to claim 9, wherein the obtained multiple sets of first polar angle, first local polar diameter, second polar angle, second polar diameter, third polar angle, third polar diameter correspond The plurality of first fitted circles and the plurality of third parameters corresponding to the plurality of first fitted circles include:
    获得保留有所述第三极径的所有所述第一极角、第一局部极径对应的所述第三拟合圆,所述第一拟合圆即所述第三拟合圆,所述第三参数即所述第五参数。Obtaining the third fitted circle corresponding to all the first polar angles and the first local polar diameters retaining the third polar diameter, the first fitted circle being the third fitted circle, so The third parameter is the fifth parameter.
  11. 根据权利要求10所述的检测方法,其特征在于,所述利用多个第一拟合圆、多个第三参数和第二预定策略获得所述检测参数,包括:The detection method according to claim 10, wherein the use of a plurality of first fitted circles, a plurality of third parameters, and a second predetermined strategy to obtain the detection parameters includes:
    获得多个所述第一拟合圆中的所述第二分数最高的圆、或者半径最大的圆、或者半径最小的圆,将所述圆对应的所述第三参数作为检测参数。Obtain the circle with the highest second score, the circle with the largest radius, or the circle with the smallest radius among the plurality of first fitting circles, and use the third parameter corresponding to the circle as the detection parameter.
  12. 根据权利要求8所述的检测方法,其特征在于,所述将所有第二极径、第二极角分别与所述第一局部极径、所述第一极角进行拟合,以获得多个第二拟合圆,以及多个第二拟合圆对应的第四参数,包括:The detection method according to claim 8, wherein all the second polar diameters and second polar angles are fitted to the first local polar diameters and the first polar angles, respectively, to obtain multiple A second fitted circle, and the fourth parameters corresponding to a plurality of second fitted circles, including:
    将极坐标系下的所述第二极径、第二极角、第一极角、所述第一局部极径转换成直角坐标系下对应的第一坐标值、第二坐标值;Converting the second polar diameter, the second polar angle, the first polar angle, and the first local polar diameter in the polar coordinate system to the corresponding first coordinate value and second coordinate value in the rectangular coordinate system;
    根据所述第一坐标值、所述第二坐标值获得所述第二拟合圆,以及所述第二拟合圆在直角坐标系下对应的所述第四参数。Obtain the second fitted circle according to the first coordinate value and the second coordinate value, and the fourth parameter corresponding to the second fitted circle in the rectangular coordinate system.
  13. 根据权利要求4所述的检测方法,其特征在于,The detection method according to claim 4, characterized in that
    所述获得所述第一图像对应的一维直方图,包括:对所述第一图像按列求像素灰度平均值,以获得所述一维直方图;The obtaining a one-dimensional histogram corresponding to the first image includes: averaging pixel gray scales in columns of the first image to obtain the one-dimensional histogram;
    所述获得所述第一图像对应的第一梯度图像,包括:对所述第一图像进行一阶求导以获得所述第一梯度图像;The obtaining the first gradient image corresponding to the first image includes: performing first-order derivation on the first image to obtain the first gradient image;
    所述获得所述一维直方图对应的第二梯度图像,包括:对所述一维直方图进行一阶求导以获得所述第二梯度图像。The obtaining the second gradient image corresponding to the one-dimensional histogram includes: performing first-order derivation on the one-dimensional histogram to obtain the second gradient image.
  14. 根据权利要求1所述的检测方法,其特征在于,所述根据记录的多个所述检测参数和第一预定策略确定所述圆形特征的最终参数,包括:The detection method according to claim 1, wherein the determining the final parameter of the circular feature based on the plurality of recorded detection parameters and the first predetermined strategy includes:
    将多个所述检测参数的平均值作为所述圆形特征的最终参数。The average value of the multiple detection parameters is used as the final parameter of the circular feature.
  15. 一种圆形特征检测方法,其特征在于,所述圆形特征检测方法包括:A circular feature detection method, characterized in that the circular feature detection method includes:
    接收待处理图像,所述待处理图像包含圆形特征;Receiving an image to be processed, the image to be processed includes a circular feature;
    对所述待处理图像进行感兴趣区域提取,并获得所述感兴趣区域对应的第一 参数,其中,所述圆形特征位于所述感兴趣区域内,所述感兴趣区域为圆环,所述第一参数包括所述感兴趣区域对应的第一圆心坐标、内径和外径;Extract the region of interest from the image to be processed, and obtain the first parameter corresponding to the region of interest, wherein the circular feature is located in the region of interest, and the region of interest is a circle, so The first parameter includes the first circle center coordinate, inner diameter, and outer diameter corresponding to the region of interest;
    利用所述第一参数对所述圆形特征进行检测,以获得与所述圆形特征对应的检测参数,所述检测参数包括检测圆心坐标以及检测半径;Detecting the circular feature by using the first parameter to obtain a detection parameter corresponding to the circular feature, the detection parameter including a detection center coordinate and a detection radius;
    利用所述检测参数调整所述第一参数,并返回至所述利用所述第一参数对所述圆形特征进行检测的步骤,记录每次检测后得到的检测参数,并在每次检测后更新迭代参数的值,直至所述迭代参数的值超出预设范围;Adjust the first parameter using the detection parameter, and return to the step of detecting the circular feature using the first parameter, record the detection parameter obtained after each detection, and after each detection Update the value of the iteration parameter until the value of the iteration parameter exceeds a preset range;
    根据记录的多个所述检测参数和第一预定策略确定所述圆形特征的最终参数,所述最终参数包括所述圆形特征的圆心坐标和半径。The final parameters of the circular feature are determined according to the multiple recorded detection parameters and the first predetermined strategy, and the final parameters include the center coordinates and radius of the circular feature.
  16. 根据权利要求15所述的检测方法,其特征在于,The detection method according to claim 15, characterized in that
    所述迭代参数为所述利用所述第一参数对所述圆形特征进行检测的次数,所述迭代参数的值超出预设范围为所述检测次数大于或等于预设数值。The iteration parameter is the number of times that the first parameter is used to detect the circular feature, and the value of the iteration parameter exceeds a preset range when the number of detections is greater than or equal to a preset value.
  17. 根据权利要求15所述的检测方法,其特征在于,所述利用所述检测参数调整所述第一参数,包括:将最近一次检测得到的所述检测参数中的所述检测圆心坐标作为所述感兴趣区域对应的第一圆心坐标,以调整所述感兴趣区域的位置。The detection method according to claim 15, wherein the adjusting the first parameter by using the detection parameter comprises: using the detection center coordinates of the detection parameters obtained in the most recent detection as the Coordinate of the first circle center corresponding to the region of interest to adjust the position of the region of interest.
  18. 根据权利要求15所述的检测方法,其特征在于,所述利用所述第一参数对所述圆形特征进行检测,以获得与所述圆形特征对应的检测参数,包括:The detection method according to claim 15, wherein the detecting the circular feature using the first parameter to obtain a detection parameter corresponding to the circular feature includes:
    将直角坐标系下的所述感兴趣区域的图像转化为极坐标系下的第一图像,其中,所述感兴趣区域的图像包含所述圆形特征,所述第一图像的横坐标为极径,纵坐标为极角;Converting the image of the region of interest in the rectangular coordinate system into the first image in the polar coordinate system, wherein the image of the region of interest contains the circular feature, and the abscissa of the first image is polar Diameter, the ordinate is the polar angle;
    获得所述第一图像对应的一维直方图、所述第一图像对应的第一梯度图像以及所述一维直方图对应的第二梯度图像;Obtaining a one-dimensional histogram corresponding to the first image, a first gradient image corresponding to the first image, and a second gradient image corresponding to the one-dimensional histogram;
    获得所述第二梯度图像中的多个极值处对应的第一极径;Obtaining a first polar diameter corresponding to multiple extreme values in the second gradient image;
    获得所述第一梯度图像中距离每个所述第一极径预定范围内的最值点,最值点对应的极径和极角定义为第一局部极径和第一极角;Obtaining a maximum value point within a predetermined range of each first polar diameter in the first gradient image, and a polar diameter and a polar angle corresponding to the maximum value point are defined as a first local polar diameter and a first polar angle;
    获得所述第一梯度图像中与所述第一极角对应的第二极角、第三极角,其中,所述第一极角、所述第二极角、所述第三极角满足第一预设条件;Obtaining a second polar angle and a third polar angle corresponding to the first polar angle in the first gradient image, wherein the first polar angle, the second polar angle, and the third polar angle satisfy The first preset condition;
    获得所述第一梯度图像中与所述第二极角对应的多个第二极径,并对多个所述第二极径进行筛选以保留最多一个所述第二极径;Obtaining a plurality of second polar diameters corresponding to the second polar angle in the first gradient image, and filtering the plurality of second polar diameters to retain at most one second polar diameter;
    获得所述第一梯度图像中与所述第三极角对应的多个第三极径,并对多个所 述第三极径进行筛选以保留最多一个所述第三极径;Obtaining a plurality of third polar diameters corresponding to the third polar angle in the first gradient image, and filtering the plurality of third polar diameters to retain at most one third polar diameter;
    获得多组所述第一极角、所述第一局部极径、所述第二极角、所述第二极径、所述第三极角、所述第三极径对应的多个第一拟合圆,以及与多个所述第一拟合圆对应的多个第三参数;Obtain multiple sets of multiple first corresponding to the first polar angle, the first local polar diameter, the second polar angle, the second polar diameter, the third polar angle, and the third polar diameter A fitting circle, and a plurality of third parameters corresponding to the plurality of first fitting circles;
    利用多个所述第一拟合圆、多个第三参数和第二预定策略获得所述检测参数。The detection parameters are obtained by using a plurality of the first fitted circles, a plurality of third parameters, and a second predetermined strategy.
  19. 一种圆形特征检测处理系统,其特征在于,所述圆形特征检测处理系统包括处理器、存储器、收发器和显示器,所述收发器用于接收待处理图像,并将所述待处理图像传输至所述处理器,所述显示器用于显示检测结果,所述存储器存储有程序指令,所述程序指令可被所述处理器加载并执行如权利要求1-14任一项或如权利要求15-18任一项所述的圆形特征检测方法。A circular feature detection and processing system, characterized in that the circular feature detection and processing system includes a processor, a memory, a transceiver, and a display, and the transceiver is used to receive an image to be processed and transmit the image to be processed To the processor, the display is used to display the detection result, and the memory stores program instructions, which can be loaded by the processor and execute any one of claims 1-14 or claim 15 -18 Any one of the circular feature detection methods.
  20. 一种具有存储功能的装置,其上存储有程序数据,其特征在于,所述程序数据被处理器执行时实现如权利要求1-14任一项或如权利要求15-18任一项所述的圆形特征检测方法中的步骤。A device with a storage function, on which program data is stored, characterized in that, when the program data is executed by a processor, it is implemented according to any one of claims 1-14 or any one of claims 15-18 Steps in the circular feature detection method.
PCT/CN2018/125877 2018-12-29 2018-12-29 Circular feature detection method, processing system and apparatus having storage function WO2020133538A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880088735.0A CN111801709B (en) 2018-12-29 2018-12-29 Circular feature detection method, processing system and device with storage function
PCT/CN2018/125877 WO2020133538A1 (en) 2018-12-29 2018-12-29 Circular feature detection method, processing system and apparatus having storage function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/125877 WO2020133538A1 (en) 2018-12-29 2018-12-29 Circular feature detection method, processing system and apparatus having storage function

Publications (1)

Publication Number Publication Date
WO2020133538A1 true WO2020133538A1 (en) 2020-07-02

Family

ID=71128908

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/125877 WO2020133538A1 (en) 2018-12-29 2018-12-29 Circular feature detection method, processing system and apparatus having storage function

Country Status (2)

Country Link
CN (1) CN111801709B (en)
WO (1) WO2020133538A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113600868A (en) * 2021-06-29 2021-11-05 东风汽车集团股份有限公司 Method and device for determining circle center of cylinder hole and fine boring machine tool

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6859555B1 (en) * 2000-09-19 2005-02-22 Siemens Corporate Research, Inc. Fast dominant circle detection through horizontal and vertical scanning
JP2009259036A (en) * 2008-04-17 2009-11-05 Sharp Corp Image processing device, image processing method, image processing program, recording medium, and image processing system
CN105678763A (en) * 2016-01-05 2016-06-15 吴晓军 A method for stably detecting straight line/ circle features
CN106204542A (en) * 2016-06-29 2016-12-07 上海晨兴希姆通电子科技有限公司 Visual identity method and system
CN106204540A (en) * 2016-06-29 2016-12-07 上海晨兴希姆通电子科技有限公司 Visible detection method
CN106546174A (en) * 2016-10-26 2017-03-29 湖南大学 A kind of circle detection method based on model filtering

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101557271B1 (en) * 2014-06-26 2015-10-06 한밭대학교 산학협력단 Method for detecting a circle-type object and approximating a substitute circle based on Image processing
CN106530347B (en) * 2016-09-28 2020-06-09 吴晓军 Stable high-performance circle feature detection method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6859555B1 (en) * 2000-09-19 2005-02-22 Siemens Corporate Research, Inc. Fast dominant circle detection through horizontal and vertical scanning
JP2009259036A (en) * 2008-04-17 2009-11-05 Sharp Corp Image processing device, image processing method, image processing program, recording medium, and image processing system
CN105678763A (en) * 2016-01-05 2016-06-15 吴晓军 A method for stably detecting straight line/ circle features
CN106204542A (en) * 2016-06-29 2016-12-07 上海晨兴希姆通电子科技有限公司 Visual identity method and system
CN106204540A (en) * 2016-06-29 2016-12-07 上海晨兴希姆通电子科技有限公司 Visible detection method
CN106546174A (en) * 2016-10-26 2017-03-29 湖南大学 A kind of circle detection method based on model filtering

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113600868A (en) * 2021-06-29 2021-11-05 东风汽车集团股份有限公司 Method and device for determining circle center of cylinder hole and fine boring machine tool
CN113600868B (en) * 2021-06-29 2022-11-08 东风汽车集团股份有限公司 Method and device for determining circle center of cylinder hole and fine boring machine tool

Also Published As

Publication number Publication date
CN111801709B (en) 2023-12-22
CN111801709A (en) 2020-10-20

Similar Documents

Publication Publication Date Title
CN109977949B (en) Frame fine adjustment text positioning method and device, computer equipment and storage medium
JP6469678B2 (en) System and method for correcting image artifacts
US10013764B2 (en) Local adaptive histogram equalization
JP5075757B2 (en) Image processing apparatus, image processing program, image processing method, and electronic apparatus
WO2021196548A1 (en) Distance determination method, apparatus and system
JP4813517B2 (en) Image processing apparatus, image processing program, image processing method, and electronic apparatus
WO2015106700A1 (en) Method and apparatus for implementing image denoising
WO2017088637A1 (en) Method and apparatus for locating image edge in natural background
WO2020119467A1 (en) High-precision dense depth image generation method and device
KR20140090778A (en) Method for removing color fringe
WO2020051792A1 (en) Fingerprint identification method and apparatus, and device and storage medium
JP2021086616A (en) Method for extracting effective region of fisheye image based on random sampling consistency
WO2020133538A1 (en) Circular feature detection method, processing system and apparatus having storage function
CN111340693B (en) Interpolation method and device of Bayer image and electronic equipment
JP4296617B2 (en) Image processing apparatus, image processing method, and recording medium
CN108182666A (en) A kind of parallax correction method, apparatus and terminal
US20190096090A1 (en) Camera control method, camera control device, and non-transitory computer-readable storage medium
WO2020051750A1 (en) Image processing method, edge extracting method, processing device, and storage medium
CN107085843B (en) System and method for estimating modulation transfer function in optical system
WO2019011017A1 (en) Method and device for noise processing
WO2019148894A1 (en) Method and device for tracking measurement offset by using image patches, and storage medium
WO2023273158A1 (en) Method and apparatus for determining operating range of camera in cooperative vehicle infrastructure and roadside device
JP6390248B2 (en) Information processing apparatus, blur condition calculation method, and program
CN111340714B (en) Moire pattern processing method and device and electronic equipment
US11240484B2 (en) Information processing apparatus and information processing method for stereo imaging based on corrected parameters

Legal Events

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

Ref document number: 18944221

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 09.11.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18944221

Country of ref document: EP

Kind code of ref document: A1