CN107507185B - Method for rapidly detecting circle suitable for industrial detection - Google Patents

Method for rapidly detecting circle suitable for industrial detection Download PDF

Info

Publication number
CN107507185B
CN107507185B CN201710898747.7A CN201710898747A CN107507185B CN 107507185 B CN107507185 B CN 107507185B CN 201710898747 A CN201710898747 A CN 201710898747A CN 107507185 B CN107507185 B CN 107507185B
Authority
CN
China
Prior art keywords
circle
circle center
gradient
image
points
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201710898747.7A
Other languages
Chinese (zh)
Other versions
CN107507185A (en
Inventor
刘平
姜贺
詹铭泽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Bomming Vision Technology Co ltd
Original Assignee
Zhuhai Bomming Vision Technology Co ltd
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 Zhuhai Bomming Vision Technology Co ltd filed Critical Zhuhai Bomming Vision Technology Co ltd
Priority to CN201710898747.7A priority Critical patent/CN107507185B/en
Publication of CN107507185A publication Critical patent/CN107507185A/en
Application granted granted Critical
Publication of CN107507185B publication Critical patent/CN107507185B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20016Hierarchical, coarse-to-fine, multiscale or multiresolution image processing; Pyramid transform
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20092Interactive image processing based on input by user
    • G06T2207/20104Interactive definition of region of interest [ROI]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a method for rapidly detecting a circle, which is suitable for industrial detection and aims to provide a method for rapidly detecting a circle, which is suitable for industrial detection and can improve the speed and the precision of the circle detected by a full graph in the industrial detection. The invention comprises the following steps: A. inputting an image; B. image pyramid processing; C. detecting edges; D. dividing into sectors; E. voting the circle center; F. filtering the circle center coordinate points; G. voting for the radius; H. returning to the fitting circle of the image; I. and outputting the radius of the circle center. The invention is applied to the technical field of industrial intelligent manufacturing.

Description

Method for rapidly detecting circle suitable for industrial detection
Technical Field
The invention relates to a method for rapidly detecting a circle, which is suitable for industrial detection.
Background
The Hough transform is a parameter estimation technique using a voting principle, and the basic principle of the Hough transform is to detect whether a given image has a curve of a given property by changing a line of an image space into a focus point of a parameter space using duality of a point and a line. To detect a circle of unknown radius from an image, the parameter plane is expanded to a three-dimensional space, with the x-y-r corresponding to the center and radius of the circle. Each point on the image plane corresponds to a circle, in fact a cone, under each radius in the parameter space. This obviously requires a large amount of memory and operating speed is also a significant problem.
The Hough transform is divided into two stages, the first stage is used for detecting the circle center, and the second stage deduces the radius according to the circle center, so that the dimension of the Hough space is reduced. However, the detection of the circle radius of the algorithm completely depends on the detection of the circle center, and if the circle center detection has deviation, the detection of the circle radius also has the deviation, so that the detection result is inaccurate and unstable
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method for rapidly detecting a circle, which improves the speed and the precision of detecting the circle by a full graph in industrial detection and is suitable for industrial detection.
The technical scheme adopted by the invention is as follows: the invention comprises the following steps:
A. inputting an image;
B. image pyramid processing;
C. edge detection: taking the pixels with obvious image gray level change as gradient points;
D. sectorization: obtaining two information of gradient strength and direction from the gradient points, averagely dividing the gradient points into 36 sectors according to the direction, and reserving a part of points with larger gradient strength in each sector;
E. voting the circle center: each gradient point is searched for a gradient point corresponding to the direction from a sector with the opposite direction according to the gradient direction, the midpoint coordinate of the two corresponding gradient points is calculated, and each center coordinate is accumulated to a circle center (a, b) accumulator, wherein a and b are circle center coordinates;
F. filtering circle center coordinate points: the circle center obtained by the circle center voting result is an area, the area is subjected to filtering processing to accurately find a focusing center point again, a threshold value is set, and the focusing center point smaller than the threshold value is subjected to elimination processing;
G. voting for the radius: counting all gradient points to the circle center of the obtained circle center, accumulating the distance from the gradient points to the circle center to a radius (r) accumulator, removing the circle center smaller than a set threshold value, and setting the circle center larger than the set threshold value as an optimal circle parameter (a, b, r);
H. returning to the fitting circle of the image: according to the obtained circle center radius parameters, an annular ROI area is defined along the circumference, and edge detection, edge point filtering and circle fitting are carried out in the ROI;
I. and outputting the radius of the circle center.
Further, in the step B, the width and height of any layer of the image pyramid are half of the width and height of the layer above the layer.
Further, in the step D, each of the sectors is a 10 ° sector.
Further, in the step F, the threshold size is determined by the picture contrast and can be set to 100-.
The invention has the beneficial effects that: the invention comprises the following steps: A. inputting an image; B. image pyramid processing; C. detecting edges; D. dividing into sectors; E. voting the circle center; F. filtering the circle center coordinate points; G. voting for the radius; H. returning to the fitting circle of the image; I. the radius of the circle center is output, so the method of the invention increases the improvement of reducing the calculation amount of Hough transformation, not only can realize the quick circle detection of the whole graph, but also can reduce the influence of noise points, and the invention increases the improvement of improving the precision, thereby leading the detection speed to be faster, the detection result to be more accurate and the stability to be better.
Drawings
FIG. 1 is a flow chart of the steps of the present invention;
FIG. 2 is a schematic view of an image pyramid;
FIG. 3 is an original image;
FIG. 4 is an image after edge detection;
fig. 5 is a sectorized image.
Detailed Description
As shown in fig. 1, in the present embodiment, the present invention includes the following steps:
A. inputting an image;
B. performing image pyramid processing on the homogenized image, wherein the image pyramid is a form of multi-scale representation of the image and is an effective but simple-concept structure for explaining the image with multiple resolutions, the pyramid of one image is a series of image sets with gradually reduced resolutions arranged in a pyramid shape, all images are derived from the same original image and are obtained by down-sampling in a gradient manner until a certain termination condition is reached, the images of one layer and one layer are compared into the pyramid, the higher the hierarchy is, the smaller the image is, the lower the resolution is, as shown in fig. 2, the lowest layer is a 0 th layer, namely an original image, the higher the hierarchy is, the smaller the image is, the width and the height of any layer of the image pyramid are half of the width and the height of the upper layer of the original image, for example, if the original image is an image with the size of 3968x2624, the size of the image of the 3 rd layer is 496 × 328, the width and the height of the image are all reduced, obviously, after the image is reduced, the time for subsequent processing can be saved, and the step adopts the image of the third layer or more than the third layer;
C. edge detection: the pixels with obvious image gray scale change are used as gradient points, more specifically, the image shown in fig. 3 can be obtained as shown in fig. 4 after edge detection, and as can be seen from fig. 4, not only are the gradient points of the circle to be detected, but also other linear gradient points, curve gradient points and impurity points are available;
D. sectorization: obtaining two information of gradient strength and direction (0-360 degrees) from gradient points, averagely dividing the gradient points into 36 sectors according to the direction, namely 10 degrees of one sector, and 360 degrees of the 36 sectors, wherein each sector is a 10-degree sector area, each sector keeps a part of points with larger gradient strength, more specifically, points with 40% gradient strength, so that straight line type gradient points and impurity points can be greatly reduced, and the calculation amount of Hough transformation is greatly reduced, and as shown in figure 5, an image after the points with 40% gradient strength are kept is provided, and the gradient points are greatly reduced compared with the image after filtering in figure 4;
E. voting the circle center: each gradient point is searched for a gradient point corresponding to the direction from the sector with the opposite direction according to the gradient direction, for example, a 5-degree point is in a 0-10-degree sector, a 180-190-degree sector is searched for a corresponding gradient point, the midpoint coordinates of the two corresponding gradient points are calculated, and each center coordinate is accumulated to a center (a, b) accumulator, wherein a and b are center coordinates;
F. filtering circle center coordinate points: and (3) taking the circle center obtained by the circle center voting result as an area, carrying out filtering processing on the area to accurately find a focusing central point again, setting a threshold value, wherein the size of the threshold value is determined by the contrast of the picture and is generally set to be 100-200, if the proper threshold value cannot be determined and can be set to be 0, an algorithm can automatically obtain the threshold value, if the threshold value is greater than the set threshold value, the circle center is determined, and if the threshold value is not greater than the set threshold value, the false circle center is removed. Thus, the circle center is more accurate;
G. voting for the radius: counting all gradient points to the circle center of the obtained circle center, accumulating the distance from the gradient points to the circle center to a radius (r) accumulator, removing the circle center smaller than a set threshold value, and setting the circle center larger than the set threshold value as an optimal circle parameter (a, b, r);
H. returning to the fitting circle of the image: according to the obtained circle center radius parameters, an annular ROI area is defined along the circumference, the ROI area is an interested area, in machine vision and image processing, the area needing to be processed is outlined in a square frame, circle, ellipse, irregular polygon and other modes from a processed image and is called the interested area, and edge detection, edge point filtering and circle fitting are carried out in the ROI;
I. and outputting the radius of the circle center.
Aiming at the problems that a large amount of memory is needed and the operation speed is high in the traditional technology, on one hand, the image pyramid is adopted to carry out subsequent processing on the top-level image, so that the calculated amount is reduced, and the impurity noise gradient point is also reduced; on the other hand, the gradient is divided into 36 sectors, and only a small number of larger gradient value points of each sector are reserved, so that straight line type gradient points can be greatly reduced, and the calculation amount of Hough transformation is greatly reduced; in the third aspect, each gradient point is searched for one or more gradient points corresponding to the opposite direction in a sector according to the gradient direction, and the center coordinate is calculated and added to the accumulator of the circle centers (a, b), so that the use of the memory is reduced.
Aiming at the problem that if the circle center detection is deviated, the detection result is inaccurate and unstable, the algorithm votes the circle center (namely, each gradient point looks for the gradient point corresponding to the direction in the opposite sector according to the gradient direction, calculates the final point and accumulates the final table to the circle center accumulator), then filters the circle center gathering point to accurately find the gathering center point again, takes the gathering center point as the circle center, and then votes the radius. After the circle center and the radius are respectively projected, the original picture is returned, the ROI is defined again for each circle, and then point selection and fitting are carried out. Therefore, the detection result is more accurate, and the precision is higher.
In order to compare the advantages of the method relative to the OpenCV Hough circle, a 14-image atlas is tested, comparison is respectively carried out according to time, the number of detection circles and precision, and meanwhile, compared with the foreign known machine vision software Halcon, the method has similar performance and obvious advantages in speed, and the result is shown in Table 1.
TABLE 1 comparison of the results of the present method with OpenCV and Halcon
The invention is applied to the technical field of industrial intelligent manufacturing.
While the embodiments of the present invention have been described in terms of practical embodiments, they are not to be construed as limiting the meaning of the present invention, and modifications of the embodiments and combinations with other embodiments will be apparent to those skilled in the art in light of the present description.

Claims (3)

1. A method for rapidly detecting a circle suitable for industrial detection is characterized by comprising the following steps:
A. inputting an image;
B. image pyramid processing;
C. edge detection: taking the pixels with obvious image gray level change as gradient points;
D. sectorization: obtaining two information of gradient strength and direction from the gradient points, averagely dividing the gradient points into 36 sectors according to the direction, reserving points with large gradient strength in each sector, and enabling each sector to be a 10-degree sector area;
E. voting the circle center: each gradient point is searched for a gradient point corresponding to the direction from a sector with the opposite direction according to the gradient direction, the midpoint coordinate of the two corresponding gradient points is calculated, and each center coordinate is accumulated to a circle center (a, b) accumulator, wherein a and b are circle center coordinates;
F. filtering circle center coordinate points: the circle center obtained by the circle center voting result is an area, the area is subjected to filtering processing to accurately find a focusing center point again, a threshold value is set, and the focusing center point smaller than the threshold value is subjected to elimination processing;
G. voting for the radius: counting all gradient points to the circle center of the obtained circle center, accumulating the distance from the gradient points to the circle center to a radius (r) accumulator, removing the circle center smaller than a set threshold value, and setting the circle center larger than the set threshold value as an optimal circle parameter (a, b, r);
H. returning to the fitting circle of the image: according to the obtained circle center radius parameters, an annular ROI area is defined along the circumference, and edge detection, edge point filtering and circle fitting are carried out in the ROI;
I. and outputting the radius of the circle center.
2. The method for rapidly detecting the circle suitable for industrial detection as claimed in claim 1, wherein: in the step B, the width and the height of any layer of the image pyramid are half of the width and the height of the layer above the layer.
3. The method for rapidly detecting the circle suitable for industrial detection as claimed in claim 1, wherein: in step F, the threshold is determined by the contrast of the picture and is set to 100-.
CN201710898747.7A 2017-09-28 2017-09-28 Method for rapidly detecting circle suitable for industrial detection Active CN107507185B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710898747.7A CN107507185B (en) 2017-09-28 2017-09-28 Method for rapidly detecting circle suitable for industrial detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710898747.7A CN107507185B (en) 2017-09-28 2017-09-28 Method for rapidly detecting circle suitable for industrial detection

Publications (2)

Publication Number Publication Date
CN107507185A CN107507185A (en) 2017-12-22
CN107507185B true CN107507185B (en) 2021-01-01

Family

ID=60699093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710898747.7A Active CN107507185B (en) 2017-09-28 2017-09-28 Method for rapidly detecting circle suitable for industrial detection

Country Status (1)

Country Link
CN (1) CN107507185B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109404785A (en) * 2018-11-22 2019-03-01 珠海博明软件有限公司 A kind of source of parallel light
CN109785284A (en) * 2018-12-01 2019-05-21 深圳力普尔智能科技有限公司 A kind of image detection and measurement method
US11756224B2 (en) * 2019-06-27 2023-09-12 Boe Technology Group Co. Ltd. Circle center detection in imagery
US11767752B2 (en) 2020-10-02 2023-09-26 Saudi Arabian Oil Company Methodology for automated verification and qualification of sidewall core recovery depth using borehole image logs

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012076036A1 (en) * 2010-12-11 2012-06-14 Valeo Schalter Und Sensoren Gmbh Method of circle detection in images for round traffic sign identification and vehicle driving assistance device
CN104282027A (en) * 2014-10-29 2015-01-14 福州大学 Circle detecting method based on Hough transformation
CN104778707A (en) * 2015-04-22 2015-07-15 福州大学 Electrolytic capacitor detecting method for improving general Hough transform

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012076036A1 (en) * 2010-12-11 2012-06-14 Valeo Schalter Und Sensoren Gmbh Method of circle detection in images for round traffic sign identification and vehicle driving assistance device
CN104282027A (en) * 2014-10-29 2015-01-14 福州大学 Circle detecting method based on Hough transformation
CN104778707A (en) * 2015-04-22 2015-07-15 福州大学 Electrolytic capacitor detecting method for improving general Hough transform

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于随机Hough变换的复杂条件下圆检测与数目辨识;周封等;《仪器仪表学报》;20130331;第34卷(第3期);第622-628页 *

Also Published As

Publication number Publication date
CN107507185A (en) 2017-12-22

Similar Documents

Publication Publication Date Title
CN107507185B (en) Method for rapidly detecting circle suitable for industrial detection
CN109060836B (en) Machine vision-based high-pressure oil pipe joint external thread detection method
CN106934803B (en) method and device for detecting surface defects of electronic device
CN106855520B (en) Workpiece defect detection method based on machine vision
CN109859226B (en) Detection method of checkerboard corner sub-pixels for graph segmentation
CN107895375B (en) Complex road route extraction method based on visual multi-features
CN104156951B (en) A kind of white blood cell detection method for BAL fluid smear
CN103292701A (en) Machine-vision-based online dimensional measurement method of precise instrument
CN103985108A (en) Method for multi-focus image fusion through boundary detection and multi-scale morphology definition measurement
CN107133623B (en) Pointer position accurate detection method based on background difference and circle center positioning
CN111354047B (en) Computer vision-based camera module positioning method and system
CN102999886A (en) Image edge detector and ruler raster grid line precision detection system
CN113269791B (en) Point cloud segmentation method based on edge judgment and region growth
CN110533601B (en) Method for acquiring center position and contour of laser spot
CN109724988B (en) PCB defect positioning method based on multi-template matching
CN103136525A (en) High-precision positioning method for special-shaped extended target by utilizing generalized Hough transformation
JP2009259036A (en) Image processing device, image processing method, image processing program, recording medium, and image processing system
CN114241018B (en) Tooth point cloud registration method, system and readable storage medium
CN115375629A (en) Method for detecting line defect and extracting defect information in LCD screen
CN109035170A (en) Adaptive wide-angle image correction method and device based on single grid chart subsection compression
CN105405122A (en) Circle detection method based on data stationarity
CN114140416A (en) Glass edge detection method and system based on machine vision
CN116503462A (en) Method and system for quickly extracting circle center of circular spot
CN113781413A (en) Electrolytic capacitor positioning method based on Hough gradient method
CN111815575B (en) Bearing steel ball part detection method based on machine vision

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant