CN112991279B - Method, device, medium and equipment for detecting defect circle of flexible circuit board - Google Patents

Method, device, medium and equipment for detecting defect circle of flexible circuit board Download PDF

Info

Publication number
CN112991279B
CN112991279B CN202110234272.8A CN202110234272A CN112991279B CN 112991279 B CN112991279 B CN 112991279B CN 202110234272 A CN202110234272 A CN 202110234272A CN 112991279 B CN112991279 B CN 112991279B
Authority
CN
China
Prior art keywords
circle
contour
slope
candidate
circular arc
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
CN202110234272.8A
Other languages
Chinese (zh)
Other versions
CN112991279A (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.)
South China University of Technology SCUT
Original Assignee
South China University of Technology SCUT
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 South China University of Technology SCUT filed Critical South China University of Technology SCUT
Priority to CN202110234272.8A priority Critical patent/CN112991279B/en
Publication of CN112991279A publication Critical patent/CN112991279A/en
Application granted granted Critical
Publication of CN112991279B publication Critical patent/CN112991279B/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
    • G06T7/0006Industrial image inspection using a design-rule based approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • 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/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • 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
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/64Analysis of geometric attributes of convexity or concavity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30141Printed circuit board [PCB]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Length Measuring Devices By Optical Means (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

The invention discloses a method, a device, a medium and equipment for detecting a defective circle of a flexible circuit board, which comprises the steps of firstly obtaining an original image of the flexible circuit board and converting the original image into a gray image; obtaining a binary image by using a threshold segmentation method; extracting the contour in the binary image to obtain the contour of each line; screening out a candidate circle contour set according to the pixel point information of the contour, and preprocessing the candidate circle contour set; and aiming at the preprocessed candidate circular contour set, performing circular fitting and calculating an average fitting error, finding a candidate circular arc set according to the average fitting error and the position relation between a pixel point and a circle center, storing the pixel point of each candidate circular arc, sequentially performing effectiveness judgment on each candidate circular arc, screening an effective circle and storing effective circle parameters. The invention can not only accurately detect the round holes in the flexible circuit board, but also accurately detect the defective round holes and obtain accurate parameters.

Description

Method, device, medium and equipment for detecting defect circle of flexible circuit board
Technical Field
The invention relates to the field of application of image processing technology, in particular to a method, a device, a medium and equipment for detecting a defective circle of a flexible circuit board.
Background
A flexible printed circuit board, which is an excellent flexible printed circuit board with high reliability, made of a polyimide or polyester film as a base material, is called a flexible board or FPC for short, and is favored by its excellent characteristics of light weight, thin thickness, free bending and folding, and the like. The drilling is used as a key process technology in the production process of the flexible circuit board, some defects (such as size defects, edge defects and positioning defects) often occur in the production process, the defects more or less affect the performance of the flexible circuit board, and even the flexible circuit board cannot be normally used seriously, so that the drilling defects need to be strictly detected to ensure the quality of the flexible circuit board. In the process of detecting the drilling defect, the core of the method is to accurately detect the circular hole on the flexible circuit board and calculate the parameters of the circular hole, so that the method for accurately detecting the defect circle of the flexible circuit board has important research significance.
The commonly used round hole detection methods in the prior art are a CHT-based detection method and an RCD-based detection method. The detection method based on the CHT comprises the steps of firstly obtaining edge pixel points of an image by using an edge detector, then mapping the edge pixel points to a three-dimensional Hough circle space, and then screening out circular holes of the flexible circuit board through voting. The RCD-based circular hole detection method is to repeatedly randomly select 4 pixels from all edge pixel points of an image and then verify whether the selected pixels belong to a real circular hole in the image. Due to the drilling defect of the flexible circuit board, the detected drilling edge is not a complete round hole but an edge formed by a section of circular arc and other lines, and the two methods cannot detect the defective round hole. Recently, researchers have proposed a new circular hole detection method, namely, an arc-based rapid circular hole detection method, which improves the circular hole detection process, reduces a large amount of calculation time, and has great advantages in some real-time detection applications, but the method has a poor recognition effect on a circular target containing multiple textures, such as a flexible circuit board, and particularly for a flexible circuit board with a defective circle, the method cannot obtain accurate circular hole parameters, or even detect the circular hole in the flexible circuit board.
Disclosure of Invention
The first purpose of the present invention is to overcome the disadvantages and shortcomings of the prior art, and to provide a method for detecting a defective circle of a flexible circuit board, which can accurately detect a circular hole in the flexible circuit board and obtain more accurate circular hole parameters, and particularly, for a defective circle, can accurately detect a circular hole and determine a drilling defect.
The second purpose of the invention is to provide a flexible circuit board defect circle detection device.
A third object of the present invention is to provide a storage medium.
It is a fourth object of the invention to provide a computing device.
The first purpose of the invention is realized by the following technical scheme: a method for detecting a defective circle of a flexible circuit board comprises the following steps:
s1, acquiring an original image of the flexible circuit board, and converting the original image into a gray image; segmenting the gray level image to obtain a binary image; extracting the contour in the binary image to obtain the contour of each line on the image;
s2, aiming at each line contour extracted from the image, screening out a candidate circle contour set according to pixel point information of the contour, and then preprocessing the candidate circle contour set;
s3, aiming at the preprocessed candidate circular contour set, carrying out circular fitting and calculating an average fitting error, then finding out a candidate circular arc set according to the average fitting error and the position relation between a pixel point and a circle center, and storing the pixel point of each section of candidate circular arc;
and S4, sequentially carrying out effectiveness judgment on each section of candidate circular arc, screening out effective circles and storing parameters of the effective circles.
Preferably, in step S1, the specific process from the original image of the flexible circuit board to the extraction of each line profile on the image is as follows:
s11, firstly, carrying out Gaussian filtering processing on an original image of the flexible circuit board, and then converting the Gaussian filtered image into a gray image of the flexible circuit board;
s12, counting gray information of a gray image of the flexible circuit board to obtain a gray histogram, and acquiring each slope in the gray histogram, and a slope peak, a total slope value, a slope starting point and a slope ending point of each slope;
s13, searching the gray scale with the maximum statistic in the global range of the gray scale histogram, defining the slope where the gray scale is located as an initial slope, setting the left boundary L of the target gray scale range as the slope starting point of the initial slope, and setting the right boundary R of the target gray scale range as the slope terminal point of the initial slope;
step S14, adjusting the left boundary L and the right boundary R of the target gray scale range, specifically:
and searching left in sequence from the slope adjacent to the left of the initial slope, if the currently searched slope meets the following conditions: p is a radical of formula c-1 ≥γ×p c And p is c-1 -l c <γ×p c If so, adjusting the left boundary L to be the slope starting point searched currently, and then continuing searching; otherwise, stopping searching;
and searching from the slope adjacent to the right of the initial slope to the right in sequence, and if the currently searched slope meets the following conditions: p is a radical of c+1 Not less than gamma x pc and pc +1-r c If the value is less than gamma multiplied by pc, the right boundary R is adjusted to be the slope terminal point searched currently; then continuing searching, otherwise stopping searching;
where pc is the crest of the currently searched slope, l c Is the slope starting point of the currently searched slope, r c Is the slope end point, p, of the currently searched slope c-1 Is the crest of a slope, p, preceding the currently searched slope c+1 Is the peak of the slope that is the next slope of the currently searched slope, and gamma is a threshold parameter;
step S15: let LS represent the statistical sum of all gray levels on the left side of the left boundary of the target gray level range, and RS represent the statistical sum of all gray levels on the right side of the right boundary of the target gray level range;
if LS > RS, the target gray scale range is a copper foil area, the background gray scale range is searched within [0,L ], the left boundary L ' of the background area is searched in the following way, and the threshold value is set as σ = (L-L ')/4+L ':
the first slope at the rightmost side of the target gray scale range is taken as an initial slope from whichAnd (3) sequentially searching left slopes adjacent to the left, and if the currently searched slopes meet the following conditions: p is a radical of c-1 ≥γ×p c And p is c-1 -l c <γ×p c Adjusting the left boundary L' of the background area to be the slope starting point searched currently, and then continuing searching; otherwise, stopping searching;
if LS is not more than RS, the target gray scale range is a substrate hollow area, the background gray scale range is searched in [ R,255], and the right boundary R ' of the background area is searched in the following way, wherein the threshold value is set as sigma = (R-R ')/4+R ':
the first slope on the leftmost side of the target gray scale range is used as an initial slope, searching is sequentially carried out from the slope adjacent to the right of the initial slope to the right, and if the slope searched currently meets the following conditions: p is a radical of c+1 ≥γ×p c And p is c+1 -r c <γ×p c Adjusting the right boundary R' of the background area to be the currently searched slope terminal point; then continuing searching, otherwise stopping searching;
and S16, performing threshold segmentation on the flexible circuit board gray image according to the threshold sigma in the step S15 to obtain a binary image, and extracting the contour in the binary image by using a contour extraction function to obtain a contour image of the flexible circuit board.
Preferably, in step S2, for each line contour extracted from the image, a candidate circle contour set is screened out according to the pixel point information of the contour, and then the candidate circle contour set is preprocessed in a local linear smoothing manner, which specifically includes the following processes:
step S21, firstly initializing a candidate circle contour set to all the line contours extracted in the step S1, and counting the total number N of pixels of each line contour k extracted in the step S1 k And takes it as the perimeter of the outline, and then takes the perimeter of the outline N k Comparing the length of each section of contour with a set lower limit minl, and if the length of each section of contour is smaller than the set lower limit minl, deleting the contour from the candidate circular contour set;
step S22, aiming at each contour in the candidate circle contour set, preprocessing the contour in a local linear smoothing mode, wherein the specific process is as follows:
step S221,Aiming at the pixel point set of each contour in the candidate circular contour set, sequentially arranging each pixel point (x) according to the pixel point sequence m ,y m ) Front and back two pixel points (x) m-1 ,y m-1 )、(x m+1 ,y m+1 ) Form a straight line, and determine pixel points (x) m ,y m ) Whether or not on this straight line, if so,
Figure BDA0002960055450000041
the value is taken as the first value, otherwise,
Figure BDA0002960055450000042
taking the value as a second value;
step S222 for
Figure BDA0002960055450000043
Taking the value of the pixel point set as a second value, and adopting [ a, b, c]Preprocessing the pixel point set by the linear smoothing operator to obtain a new pixel point set coordinate, namely acquiring a preprocessed candidate circle contour; wherein in the linear smoothing operator, a is less than b, c is less than b, and a + b + c =1.
Preferably, in step S3, for the preprocessed candidate circular contour set, gradually selecting pixel points according to the step length to perform circular arc fitting and calculate an average fitting error, then finding a candidate circular arc set according to the average fitting error and the position relationship between the pixel point and the circle center, and storing the pixel points of each segment of candidate circular arc, wherein the specific process is as follows:
step S31, aiming at the pixel point set in each preprocessed candidate circular contour, averagely segmenting the pixel point set by step length k'; initializing variable l =1, variable i =1;
step S32, performing circle fitting on the first segment of pixel point set according to a least square method and calculating an average fitting error e;
judging whether the average fitting error e meets the condition: e is less than or equal to delta which is a set average fitting error threshold;
if yes, storing the pixel points of the first section in the circular arc M i In (1), the center (a) of the fit is saved i ,b i ) And radius r i Then, howeverThen, the process proceeds to step S33;
if not, adding 1 to the value of l, and then repeating the step S32;
s33, judging whether the segment l +1 pixel point set can be matched with the circular arc M i The pixel point set in (1) forms a section of circular arc, and each section of pixel point set is traversed to obtain a candidate circular arc set, wherein the specific process is as follows:
step S331, calculating each pixel point (x) in the l +1 th segment of pixel point set in sequence j ,y j ) To the center of a circle (a) i ,b i ) Distance d of ij
Step S332, determining d ij Whether or not the condition r is satisfied i ×minr<d ij <r i X maxr, minr and maxr respectively represent the set minimum and maximum radius parameters,
if each pixel point meets the condition, increasing the (l + 1) th segment of pixel point set to an arc set M i And according to the least square method to the updated circular arc M i All the pixel points in (1) are subjected to circle fitting, and the circle center (a) is updated i Bi), radius r i Then, the value of l is added by 1 and then the process returns to the step S331;
if part of the pixel points meet the condition, increasing the pixel points meeting the condition to the circular arc M i And according to the least square method to the updated circular arc M i All the pixel points in (1) are subjected to circle fitting and the average fitting error e is calculated i Updating the center of a circle (a) i ,b i ) Radius r i (ii) a Adding 1 to the value of i, adding 1 to the value of l, and returning to the step S32;
step S333, after traversing all pixel points, storing the obtained candidate arc set M = { M = { (M) } 1 ,M2,…,M I And each arc M i Corresponding circle center (a) i ,b i ) Radius r i Average fitting error e i ,i=1,2,3,…,I。
Still further, still include: s5, judging the drilling defects according to the standard parameters of the flexible circuit board, the parameters of the effective circle and the pixel point information of the effective circle;
the process of determining validity in step S4 is as follows:
step S41, aiming at each segment of circular arc M i Statistics of circular arc M i Total number of pixels N i Total number of pixels N i Minimum arc length S of set arc min By comparison, if N i <S min Then delete the arc M from the candidate arc set i
Step S42, according to the obtained circle center (a) i Bi), radius r i Average fitting error e i To the circular arc M i Carrying out validity judgment, if e is satisfied at the same time i D, judging the principle of Helmholtz to be less than or equal to delta, and considering the circular arc M i Is an effective circular hole and preserves the center of the circular hole (a) i ,b i ) And radius r i
The specific process of determining the drilling defects in the step S5 is as follows:
for the effective circular hole obtained in step S42, calculating a distance d from a starting point to an end point of a pixel in the candidate circular arc corresponding to the effective circular hole mi If d is mi If the minimum is a set parameter threshold value, judging that the arc has edge defects of the drilled hole, otherwise, detecting the standard parameters of the flexible circuit board and the circle center (a) of the round hole obtained by detection i ,b i ) And radius r i And comparing to judge whether the circular arc has the size defect and the positioning defect of the drill hole.
Further, in step S42, the arc M is aimed at i The specific process of determining whether the helmholtz principle is satisfied is as follows:
by r i ×(1±G 1 ) Constructing a ring-shaped zone for the radius, G 1 For the set parameters, NFA (n, l ') is calculated according to the following equation, and if NFA (n, l') is ≦ ε, and ε is the set error threshold, then arc M is considered to be the arc i Satisfying the helmholtz principle:
Figure BDA0002960055450000051
wherein n is a circular arc M i The total number of pixel points l' is an arc M i Pixel point in ring areaThe number, L' represents the length of the flexible circuit board, W represents the width of the flexible circuit board,
Figure BDA0002960055450000052
the combination number of l' pixels from n pixels is shown, and p is the probability that the set pixel point belongs to the circle.
Further, in step S43, the standard parameters of the flexible circuit board and the detected circle center (a) of the circular hole are compared i ,b i ) And radius r i Comparing, and judging whether the circular arc section has the size type defect and the positioning type defect of the drill hole according to the following steps:
if the center position of the circular hole in the standard parameter is equal to the circular arc M i Circle center (a) of the circular hole i ,b i ) If the error between the two is greater than the first threshold value, the arc M is judged i Positioning defects of the drill holes exist;
if the standard parameters are the radius of the circular hole and the circular arc M i Radius r of i If the error between the two is greater than the second threshold value, the arc M is judged i There are size class defects of the drilled hole.
The second purpose of the invention is realized by the following technical scheme: a flexible circuit board defective circle detecting apparatus includes:
the acquisition module is used for acquiring an original image of the flexible circuit board;
the conversion module is used for converting the original image of the flexible circuit board into a gray image;
the binarization module is used for segmenting the gray level image by using a threshold segmentation method to obtain a binary image;
the extraction module is used for extracting the contour in the binary image to obtain the contour of each line on the image;
the candidate module is used for screening out a candidate circular contour set according to the pixel point information of the contour for each line contour extracted from the image;
the preprocessing module is used for preprocessing the candidate circle contour set;
the error calculation module is used for performing circular arc fitting and calculating an average fitting error aiming at the preprocessed candidate circular contour set;
the candidate arc set determining module is used for finding a candidate arc set according to the average fitting error and the position relation between the pixel point and the circle center, and storing the pixel point of each segment of candidate arc;
and the effective circle judging module is used for sequentially judging the effectiveness of each section of candidate circular arc, screening out effective circles and storing parameters of the effective circles.
The third purpose of the invention is realized by the following technical scheme: a storage medium stores a program which, when executed by a processor, realizes the flexible circuit board defective circle detecting method according to the first object of the present invention.
The fourth purpose of the invention is realized by the following technical scheme: the computing equipment comprises a processor and a memory for storing a program executable by the processor, and when the processor executes the program stored by the memory, the flexible circuit board defect circle detection method achieves the first aim of the invention.
Compared with the prior art, the invention has the following advantages and effects:
(1) The invention discloses a method for detecting a defective circle of a flexible circuit board, which comprises the steps of firstly obtaining an original image of the flexible circuit board and converting the original image into a gray image; segmenting the gray level image to obtain a binary image; extracting the contour in the binary image to obtain the contour of each line on the image; aiming at each line contour extracted from the image, screening out a candidate circle contour set according to pixel point information of the contour, and then preprocessing the candidate circle contour set; and aiming at the preprocessed candidate circular contour set, performing circular fitting and calculating an average fitting error, then finding a candidate circular set according to the average fitting error and the position relation between the pixel point and the circle center, storing the pixel point of each segment of candidate circular, sequentially performing effectiveness judgment on each segment of candidate circular, screening an effective circle and storing the parameter of the effective circle. The defect circle detection method can accurately detect the circular holes in the flexible circuit board, particularly can accurately detect the defective circular holes and obtain accurate parameters, and solves the problems of low accuracy and low precision of the defect circle detection of the flexible circuit board in the prior art.
(2) In the method for detecting the defect circle of the flexible circuit board, the standard parameters of the flexible circuit board and the circle center (a) of the round hole obtained by detection are used i ,b i ) And radius r i And comparing the circular arc section with the circular arc section to judge whether the circular arc section has the size type defect and the positioning type defect of the drilled hole or not, so that the method not only can accurately detect the defective circular hole on the flexible circuit board, but also can judge the type of the drilled hole defect.
(3) According to the method for detecting the defective circle of the flexible circuit board, aiming at a preprocessed candidate circle contour set, pixel points are selected step by step according to step length to carry out arc fitting and calculate an average fitting error, then the candidate arc set is found according to the average fitting error and the position relation between the pixel points and the circle center, and the pixel points of each section of candidate arc are stored; according to the method, when the candidate circular arc set is obtained, the circle fitting is carried out on each segment of pixel point set in each candidate circular contour based on the iterative least square method, and based on the circle fitting, the circular hole with the defect in the flexible circuit board can be accurately detected.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Fig. 2 is an original image of a flexible circuit board in an embodiment of the present invention.
Fig. 3 is a flow chart of the determination process of the candidate arc set in the method of the present invention.
Fig. 4 shows a circle segment detected in the embodiment of the present invention.
FIG. 5 is a representation of all circular hole profiles detected in an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to examples and drawings, but the present invention is not limited thereto.
Example 1
The embodiment discloses a method for detecting a defective circle of a flexible circuit board, which can be executed by intelligent equipment such as a computer, and as shown in fig. 1, the method comprises the following steps:
s1, acquiring an original image of the flexible circuit board, and converting the original image into a gray image; segmenting the gray level image by using a threshold segmentation method to obtain a binary image; and extracting the contour in the binary image to obtain the contour of each line on the image. As shown in fig. 2, the original image of the flexible circuit board acquired in this embodiment has a size of 800 × 670.
In this embodiment, the specific process from the original image of the flexible circuit board to the extraction of the outline of each line on the image in this step is as follows:
s11, firstly, carrying out Gaussian filtering processing on an original image of the flexible circuit board, and then converting the image subjected to Gaussian filtering into a gray image of the flexible circuit board;
s12, counting gray information of a gray image of the flexible circuit board to obtain a gray histogram, and acquiring each slope in the gray histogram, and a slope peak, a total slope value, a slope starting point and a slope ending point of each slope;
s13, searching the gray scale with the maximum statistic in the global range of the gray scale histogram, defining the slope where the gray scale is located as an initial slope, setting the left boundary L of the target gray scale range as the slope starting point of the initial slope, and setting the right boundary R of the target gray scale range as the slope terminal point of the initial slope;
step S14, adjusting the left boundary L and the right boundary R of the target gray scale range, specifically:
and searching left in sequence from the slope adjacent to the left of the initial slope, if the currently searched slope meets the following conditions: p is a radical of c-1 ≥γ×p c And p is c-1 -l c <γ×p c If so, adjusting the left boundary L to be the slope starting point searched currently, and then continuing searching; otherwise, stopping searching;
and searching from the slope adjacent to the right of the initial slope to the right in sequence, and if the currently searched slope meets the following conditions: pc +1 is not less than gamma multiplied by pc and p c+1 -r c If the value is less than gamma multiplied by pc, the right boundary R is adjusted to be the slope terminal point searched currently; then continuing searching, otherwise stopping searching;
where pc is the crest of the currently searched slope, l c Is the slope starting point of the currently searched slope, r c Is the slope end point of the currently searched slope, pc-1 is the slope peak of the slope immediately preceding the currently searched slope, and pc +1 isThe peak value of the slope subsequent to the currently searched slope, γ is a threshold parameter, and in this embodiment, γ may be 0.25.
Step S15: let LS represent the statistical sum of all grays on the left side of the left boundary of the target gray scale range, and RS represent the statistical sum of all grays on the right side of the right boundary of the target gray scale range;
if LS > RS, the target gray scale range is a copper foil area, the background gray scale range is searched within [0,L ], the left boundary L ' of the background area is searched in the following way, and the threshold value is set as σ = (L-L ')/4+L ':
taking the rightmost first slope in the target gray scale range as an initial slope, sequentially searching left from the slope adjacent to the left of the initial slope, and if the slope searched currently meets the following conditions: p is a radical of c-1 ≥γ×p c And p is c-1 -l c <γ×p c Adjusting the left boundary L' of the background area to be the slope starting point searched currently, and then continuing searching; otherwise, stopping searching;
if LS is not more than RS, the target gray scale range is a substrate hollow area, the background gray scale range is searched in [ R,255], and the right boundary R ' of the background area is searched in the following way, wherein the threshold value is set as sigma = (R-R ')/4+R ':
the first slope on the leftmost side of the target gray scale range is used as an initial slope, searching is sequentially carried out from the slope adjacent to the right of the initial slope to the right, and if the slope searched currently meets the following conditions: p is a radical of c+1 ≥γ×p c And p is c+1 -r c <γ×p c Adjusting the right boundary R' of the background area to be the currently searched slope terminal point; then continuing searching, otherwise stopping searching;
and S16, performing threshold segmentation on the flexible circuit board gray-scale image according to the threshold value sigma in the step S15 to obtain a binary image, and extracting the contour in the binary image by using a contour extraction function such as findContours to obtain the contour image of the flexible circuit board.
S2, aiming at each line contour extracted from the image, screening out a candidate circle contour set according to the pixel point information of the contour, and then preprocessing the candidate circle contour set.
In this step, for each line contour extracted from the image, a candidate circle contour set is screened out according to the pixel point information of the contour, and then the candidate circle contour set is preprocessed in a local linear smoothing mode, wherein the specific process is as follows:
step S21, firstly initializing a candidate circle contour set to all the line contours extracted in the step S1, and counting the total number N of pixels of each line contour k extracted in the step S1 k And takes it as the perimeter of the outline, and then takes the perimeter of the outline N k Comparing with a set lower limit minl of the length of each section of contour, and if the length is smaller than the set lower limit minl, deleting the contour from the candidate circular contour set;
in this embodiment, the minl may be set to 0.1 of the image height, and if the original image size of the flexible circuit board is 800 × 670, the minl is 67.
Step S22, aiming at each contour in the candidate circle contour set, preprocessing the contour in a local linear smoothing mode, wherein the specific process is as follows:
step S221, aiming at the pixel point set of each contour in the candidate circle contour set, each pixel point (x) is sequentially arranged according to the pixel point m ,y m ) Front and back two pixel points (x) m-1 ,y m-1 )、(x m+1 ,y m+1 ) Form a straight line, and determine pixel points (x) m ,y m ) Whether it is on this straight line, if so,
Figure BDA0002960055450000091
taking the value as the first value, otherwise,
Figure BDA0002960055450000092
taking the value as a second value. In this embodiment, the first value may take 0 and the second value may take 1.
Step S222 for
Figure BDA0002960055450000093
Taking the value of the pixel point set as a second value, and adopting [ a, b, c]The linear smoothing operator of the type preprocesses the pixel point set to obtain a new pixel point set coordinateAcquiring a preprocessed candidate circle contour set; wherein, in the linear smoothing operator, a is less than b, c is less than b, and a + b + c =1. In this embodiment, a linear smoothing operator may be adopted as: [0.25 0.5 0.25]I.e. a, b and c correspond to 0.25, 0.5 and 0.25, respectively.
And S3, aiming at the preprocessed candidate circular contour set, carrying out circular fitting and calculating an average fitting error, then finding out a candidate circular arc set according to the average fitting error and the position relation between a pixel point and the circle center, and storing the pixel point of each section of candidate circular arc.
In this embodiment, for the preprocessed candidate circular contour set, gradually selecting pixel points according to the step length to perform circular arc fitting and calculate an average fitting error, then finding a candidate circular arc set according to the average fitting error and the position relationship between the pixel points and the circle center, and storing the pixel points of each segment of the candidate circular arc, as shown in fig. 3, the specific process is as follows:
step S31, aiming at the pixel point set in each preprocessed candidate circular contour, averagely segmenting the pixel point set by step length k'; initializing variable l =1, variable i =1; in the present embodiment, the step k' may be set to 30.
S32, performing circle fitting on the first segment of pixel point set according to a least square method and calculating an average fitting error e;
judging whether the average fitting error e meets the condition: e is less than or equal to delta which is a set average fitting error threshold value; in the present embodiment, δ may be set to 1.0.
If yes, storing the pixel points of the first section in the circular arc M i In (1), the center (a) of the fit is saved i ,b i ) And radius r i Then, the process proceeds to step S33; a is i ,b i And coordinates of the center of the circle obtained by fitting.
If not, adding 1 to the value of l, and then repeating the step S32; that is, the operation of step S32 is performed for the pixel point set of the l +1 th segment of the next segment.
S33, judging whether the segment l +1 pixel point set can be matched with the circular arc M i The set of the pixel points in (1) forms a section of circular arc, and each section of the set of the pixel points is traversed to obtain a candidate circular arc set, wherein the specific process is as followsThe following:
step S331, calculating each pixel point (x) in the l +1 th segment of pixel point set in sequence j ,y j ) To the center of a circle (a) i ,b i ) Distance d of ij
Step S332, determining d ij Whether or not the condition r is satisfied i ×minr<d ij <r i X maxr, minr, maxr represent the minimum and maximum radius parameters set, respectively. In this embodiment, minr can be 0.85, and maxr can be 1.15.
If each pixel point meets the condition, the (l + 1) th segment of pixel point set is added to the circular arc M i And according to the least square method to the updated circular arc M i All the pixel points in (1) are subjected to circle fitting, and the circle center is updated) a i ,b i ) Radius r i If yes, add 1 to the value of l, and return to step S331;
if part of the pixel points meet the condition, namely all the pixel points do not meet the condition, increasing the pixel points meeting the condition to the circular arc M i And according to the least square method to the updated circular arc M i All the pixel points in (1) are subjected to circle fitting and the average fitting error e is calculated i Updating the center of a circle (a) i ,b i ) Radius r i (ii) a Then adding 1 to the value of i, adding 1 to the value of l and returning to the step S32;
step S333, after traversing all pixel points, storing the obtained candidate arc set M = { M = { (M) } 1 ,M 2 ,…,M I And each segment of circular arc M i Corresponding circle center (a) i ,b i ) Radius r i Average fitting error e i I =1,2,3, …, I; the resulting arc segments in this example are shown in fig. 4.
S4, sequentially judging the effectiveness of each candidate arc, screening effective circles and storing parameters of the effective circles, wherein the effective circles are as follows:
step S41, aiming at each segment of arc M in step S3 i Statistics of circular arc M i Total number of pixels N i Total number of pixels N i Minimum arc length S of set arc min By comparison, if N i <S min If so, deleting the arc M from the candidate arc set i (ii) a In the present embodiment, the minimum arc length S of the arc is set min Is 120.
Step S42, according to the circle center (a) obtained in the step S3 i ,b i ) Radius r i Average fitting error e i To the circular arc M i Carrying out validity judgment, if e is satisfied at the same time i D, judging the principle of Helmholtz to be less than or equal to delta, and considering the circular arc M i Is an effective circular hole and preserves the center of the circular hole (a) i ,b i ) And radius r i (ii) a In this example, the resulting circular hole is shown in fig. 5.
In step S42 of the present embodiment, the arc M is pointed out i The specific process of determining whether the helmholtz principle is satisfied is as follows:
by r i ×(1±G 1 ) Constructing a ring-shaped zone for the radius, G 1 For the set parameters, NFA (n, l ') is calculated according to the following formula, and if NFA (n, l') is ≦ ε, and ε is the set error threshold, then arc M is considered to be the arc i Satisfying the helmholtz principle:
Figure BDA0002960055450000111
wherein n is a circular arc M i The total number of pixel points l' is an arc M i The number of pixels in the annular region, L' represents the length of the flexible circuit board, W represents the width of the flexible circuit board,
Figure BDA0002960055450000112
the combination number of l' pixels from n pixels is shown, and p is the probability that the set pixel point belongs to the circle. In this embodiment, G 1 May be set to 0.1 and epsilon may be set to 1,p may be set to 0.55.
S5, judging the drilling defects according to the standard parameters of the flexible circuit board, the parameters of the effective circle and the pixel point information of the effective circle; the method comprises the following specific steps: aiming at the effective round hole obtained in the step S42, calculating the starting point to the end of the pixel in the candidate circular arc corresponding to the effective round holeDistance d of points mi
If d is mi If the minimum is greater than the set parameter threshold, judging that the edge defects of the drilled hole exist in the arc; in this embodiment, minll may be set to 2.
Otherwise, the standard parameters of the flexible circuit board and the circle center (a) of the round hole obtained by detection are compared i ,b i ) And radius r i And comparing to judge whether the circular arc has the size defect and the positioning defect of the drill hole, wherein the specific judging process is as follows:
if the center position of the circular hole in the standard parameter is equal to the circular arc M i Circle center (a) of the circular hole i ,b i ) If the error between the two is greater than the first threshold value, the arc M is judged i The positioning defects of the drill holes exist;
if the radius of the circular hole and the circular arc M in the standard parameters i Radius r of i If the error between the two is greater than the second threshold value, the arc M is judged i There are size class defects of the drilled hole.
In this embodiment, the first threshold and the second threshold may both be 1.0, and the unit is a pixel point.
Those skilled in the art will appreciate that all or part of the steps in the method according to the present embodiment may be implemented by a program to instruct the relevant hardware, and the corresponding program may be stored in a computer-readable storage medium.
Example 2
The embodiment discloses a flexible circuit board defect circle detection device includes:
the acquisition module is used for acquiring an original image of the flexible circuit board;
the conversion module is used for converting the original image of the flexible circuit board into a gray image;
the binarization module is used for segmenting the gray level image to obtain a binary image;
the extraction module is used for extracting the contour in the binary image to obtain the contour of each line on the image;
the candidate module is used for screening out a candidate circular contour set according to the pixel point information of the contour for each line contour extracted from the image;
the preprocessing module is used for preprocessing the candidate circle contour set;
the error calculation module is used for performing circular arc fitting and calculating an average fitting error aiming at the preprocessed candidate circular contour set;
the candidate arc set determining module is used for finding a candidate arc set according to the average fitting error and the position relation between the pixel point and the circle center, and storing the pixel point of each segment of candidate arc;
the effective circle judging module is used for sequentially judging the effectiveness of each section of candidate circular arc, screening effective circles and storing parameters of the effective circles;
and the defect judging module is used for judging the drilling defects according to the standard parameters of the flexible circuit board, the parameters of the effective circle and the pixel point information of the effective circle.
For specific implementation of each module in this embodiment, reference may be made to embodiment 1, and details are not described here. It should be noted that, the apparatus provided in this embodiment is only illustrated by dividing the functional modules, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure is divided into different functional modules to complete all or part of the functions described above.
Example 3
The present embodiment discloses a storage medium storing a program, wherein when the program is executed by a processor, the method for detecting a defective circle of a flexible circuit board according to embodiment 1 is implemented as follows:
acquiring an original image of the flexible circuit board, and converting the original image into a gray image; segmenting the gray level image to obtain a binary image; extracting the contour in the binary image to obtain the contour of each line on the image;
aiming at each line contour extracted from the image, screening out a candidate circle contour set according to pixel point information of the contour, and then preprocessing the candidate circle contour set;
and performing arc fitting and calculating an average fitting error aiming at the preprocessed candidate circular contour set, then finding the candidate circular arc set according to the average fitting error and the position relation between the pixel point and the circle center, and storing the pixel point of each segment of candidate circular arc.
And sequentially carrying out effectiveness judgment on each section of candidate circular arc, screening out effective circles and storing parameters of the effective circles.
The specific implementation process of each process is as described in embodiment 1, and is not described herein again.
In this embodiment, the storage medium may be a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a Random Access Memory (RAM), a usb disk, a removable hard disk, or other media.
Example 4
The embodiment discloses a computing device, which includes a processor and a memory for storing an executable program of the processor, and is characterized in that when the processor executes the program stored in the memory, the method for detecting a defective circle of a flexible circuit board in embodiment 1 is implemented as follows:
acquiring an original image of the flexible circuit board, and converting the original image into a gray image; segmenting the gray level image to obtain a binary image; extracting the contour in the binary image to obtain the contour of each line on the image;
aiming at each line contour extracted from the image, screening out a candidate circle contour set according to pixel point information of the contour, and then preprocessing the candidate circle contour set;
and performing arc fitting and calculating an average fitting error aiming at the preprocessed candidate circular contour set, then finding the candidate circular arc set according to the average fitting error and the position relation between the pixel point and the circle center, and storing the pixel point of each segment of candidate circular arc.
The specific implementation process of each process is as described in embodiment 1, and is not described herein again.
In this embodiment, the computing device may be a desktop computer, a notebook computer, a smart phone, a PDA handheld terminal, a tablet computer, or other terminal devices.
The above embodiments are preferred embodiments of the present invention, but the present invention is not limited to the above embodiments, and any other changes, modifications, substitutions, combinations, and simplifications which do not depart from the spirit and principle of the present invention should be construed as equivalents thereof, and all such modifications are intended to be included in the scope of the present invention.

Claims (9)

1. A method for detecting a defective circle of a flexible circuit board is characterized by comprising the following steps:
s1, acquiring an original image of the flexible circuit board, and converting the original image into a gray image; segmenting the gray level image to obtain a binary image; extracting the contour in the binary image to obtain the contour of each line on the image;
s2, aiming at each line contour extracted from the image, screening out a candidate circle contour set according to pixel point information of the contour, and then preprocessing the candidate circle contour set;
s3, aiming at the preprocessed candidate circular contour set, carrying out circular fitting and calculating an average fitting error, then finding out a candidate circular arc set according to the average fitting error and the position relation between a pixel point and a circle center, and storing the pixel point of each section of candidate circular arc;
in step S3, aiming at the preprocessed candidate circular contour set, gradually selecting pixel points according to the step length to perform circular arc fitting and calculate the average fitting error, then finding the candidate circular arc set according to the average fitting error and the position relation between the pixel points and the circle center, and storing the pixel points of each section of candidate circular arc, wherein the specific process is as follows:
step S31, aiming at the pixel point set in each preprocessed candidate circular contour, averagely segmenting the pixel point set by step length k'; initializing variable l =1, variable i =1;
s32, performing circle fitting on the first segment of pixel point set according to a least square method and calculating an average fitting error e;
judging whether the average fitting error e meets the condition: e is less than or equal to delta which is a set average fitting error threshold;
if yes, storing the pixel points of the first section in the circular arc M i In (1), the center (a) of the fit is saved i ,b i ) And radius r i Then, the flow proceeds to step S33;
if not, adding 1 to the value of l, and then repeating the step S32;
step S33, judging whether the segment l +1 pixel point set can be matched with the circular arc M i The pixel point set in (1) forms a section of circular arc, and each section of pixel point set is traversed to obtain a candidate circular arc set, wherein the specific process is as follows:
step S331, calculating each pixel point (x) in the l +1 th segment of pixel point set in sequence j ,y j ) To the center of a circle (a) i ,b i ) Distance d of ij
Step S332, determining d ij Whether or not the condition r is satisfied i ×minr<d ij <r i X maxr, minr and maxr respectively represent the set minimum and maximum radius parameters,
if each pixel point meets the condition, the (l + 1) th segment of pixel point set is added to the circular arc set M i And according to the least square method to the updated circular arc M i All the pixel points in the image are subjected to circle fitting, and the circle center (a) is updated i ,b i ) Radius r i Then, the value of l is added by 1 and then the process returns to the step S331;
if part of the pixel points meet the condition, increasing the pixel points meeting the condition to the circular arc M i And according to the least square method to the updated circular arc M i All the pixel points in (1) are subjected to circle fitting and the average fitting error e is calculated i Updating the center of a circle (a) i ,b i ) Radius r i (ii) a Then adding 1 to the value of i, adding 1 to the value of l and returning to the step S32;
step S333, after traversing all pixel points, storing the obtained candidate arc set M = { M = { (M) } 1 ,M 2 ,...,M I And each segment of circular arc M i Corresponding circle center (a) i ,b i ) Radius r i Average fitting error e i ,i=1,2,3,,...,I;
And S4, sequentially judging the effectiveness of each candidate arc, screening effective circles and storing parameters of the effective circles.
2. The method for detecting the defect circle of the flexible circuit board as claimed in claim 1, wherein in the step S1, the specific process from the original image of the flexible circuit board to the extraction of the outline of each line on the image is as follows:
s11, firstly, carrying out Gaussian filtering processing on an original image of the flexible circuit board, and then converting the image subjected to Gaussian filtering into a gray image of the flexible circuit board;
s12, counting gray information of a gray image of the flexible circuit board to obtain a gray histogram, and acquiring each slope in the gray histogram, and a slope peak, a total slope value, a slope starting point and a slope ending point of each slope;
s13, searching the gray scale with the maximum statistic in the global range of the gray scale histogram, defining the slope where the gray scale is located as an initial slope, then setting the left boundary L of the target gray scale range as the slope starting point of the initial slope, and setting the right boundary R of the target gray scale range as the slope terminal point of the initial slope;
step S14, adjusting the left boundary L and the right boundary R of the target gray scale range, specifically:
and searching left in sequence from the slope adjacent to the left of the initial slope, if the currently searched slope meets the following conditions: p is a radical of c-1 ≥γ×p c And p is c-1 -l c <γ×p c If so, adjusting the left boundary L to be the slope starting point searched currently, and then continuing searching; otherwise, stopping searching;
and searching from the slope adjacent to the right of the initial slope to the right in sequence, and if the slope searched currently meets the following conditions: p is a radical of c+1 ≥γ×p c And p is c+1 -r c <γ×p c Adjusting the right boundary R to be the currently searched slope terminal point; then continuing searching, otherwise stopping searching;
wherein p is c Is the crest of the currently searched slope, l c Is the slope starting point of the currently searched slope, r c Is the slope end point, p, of the currently searched slope c-1 Is the crest of a slope, p, preceding the currently searched slope c+1 Is the peak of the slope that is the next slope of the currently searched slope, and gamma is a threshold parameter;
step S15: let LS represent the statistical sum of all gray levels on the left side of the left boundary of the target gray level range, and RS represent the statistical sum of all gray levels on the right side of the right boundary of the target gray level range;
if LS > RS, the target gray scale range is a copper foil area, the background gray scale range is searched within [0,L ], the left boundary L ' of the background area is searched in the following way, and the threshold value is set as σ = (L-L ')/4+L ':
and taking the first slope on the rightmost side of the target gray scale range as an initial slope, sequentially searching leftwards from the slope adjacent to the left of the initial slope, and if the currently searched slope meets the following conditions: p is a radical of c-1 ≥γ×p c And p is c-1 -l c <γ×p c Adjusting the left boundary L' of the background area to be the slope starting point searched currently, and then continuing searching; otherwise, stopping searching;
if LS is less than or equal to RS, the target gray scale range is a substrate hollow area, the background gray scale range is searched in [ R,255], and the right boundary R ' of the background area is searched in the following way, and the threshold value is set as sigma = (R-R ')/4+R ':
and taking the first slope on the leftmost side of the target gray scale range as an initial slope, and sequentially searching from the slope adjacent to the right of the initial slope to the right, wherein if the currently searched slope meets the following conditions: p is a radical of c+1 ≥γ×p c And p is c+1 -r c <γ×p c Adjusting the right boundary R' of the background area to be the currently searched slope terminal point; then continuing searching, otherwise stopping searching;
and S16, performing threshold segmentation on the flexible circuit board gray image according to the threshold sigma in the step S15 to obtain a binary image, and extracting the contour in the binary image by using a contour extraction function to obtain a contour image of the flexible circuit board.
3. The method for detecting the defective circle of the flexible circuit board as claimed in claim 1, wherein in step S2, for each line contour extracted from the image, a candidate circle contour set is screened out according to pixel point information of the contour, and then the candidate circle contour set is preprocessed in a local linear smoothing manner, specifically comprising the following steps:
step S21, firstInitializing a candidate circle contour set to be all the line contours extracted in the step S1, and counting the total number N of pixels of each line contour k extracted in the step S1 k And using it as the perimeter of the outline, and then using the perimeter of the outline N k Comparing the length of each section of contour with a set lower limit minl, and if the length of each section of contour is smaller than the set lower limit minl, deleting the contour from the candidate circular contour set;
step S22, aiming at each contour in the candidate circle contour set, preprocessing the contour in a local linear smoothing mode, wherein the specific process is as follows:
step S221, aiming at the pixel point set of each contour in the candidate circle contour set, each pixel point (x) is sequentially arranged according to the pixel point m ,Y m ) Front and back two pixel points (x) m-1 ,Y m-1 )、(x m+1 ,Y m+1 ) Form a straight line, and determine pixel points (x) m ,Y m ) Whether it is on this straight line, if so,
Figure FDA0003881599930000031
taking the value as the first value, otherwise,
Figure FDA0003881599930000032
taking the value as a second value;
step S222 for
Figure FDA0003881599930000033
Taking the value of the pixel point set as a second value, and adopting [ a, b, c]Preprocessing the pixel point set by the linear smoothing operator to obtain a new pixel point set coordinate, namely acquiring a preprocessed candidate circle contour; wherein, in the linear smoothing operator, a is less than b, c is less than b, and a + b + c =1.
4. The method for detecting the defective circle of the flexible circuit board as claimed in claim 1, further comprising: s5, judging the drilling defects according to the standard parameters of the flexible circuit board, the parameters of the effective circle and the pixel point information of the effective circle;
the process of determining validity in step S4 is as follows:
step S41, aiming at each segment of circular arc M i Statistics of circular arc M i Total number of pixels N i Total number of pixels N i Minimum arc length S of set arc min By comparison, if N i <S min Then delete the arc M from the candidate arc set i
Step S42, according to the obtained circle center (a) i ,b i ) Radius r i Average fitting error e i To the circular arc M i Carrying out validity judgment, if e is satisfied at the same time i D, judging the principle of Helmholtz to be less than or equal to delta, and considering the circular arc M i Is an effective circular hole and preserves the center of the circular hole (a) i ,b i ) And radius r i
The specific process of determining the drilling defects in step S5 is as follows:
for the effective circular hole obtained in step S42, calculating a distance d from a starting point to an end point of a pixel in the candidate circular arc corresponding to the effective circular hole mi If d is mi If the minimum is a set parameter threshold value, judging that the arc has edge defects of the drilled hole, otherwise, detecting the standard parameters of the flexible circuit board and the circle center (a) of the round hole obtained by detection i ,b i ) And radius r i And comparing to judge whether the circular arc has the size defect and the positioning defect of the drill hole.
5. The method as claimed in claim 4, wherein in step S42, the defect circle is detected for the circular arc M i The specific process of determining whether the helmholtz principle is satisfied is as follows:
by r i ×(1±G 1 ) Constructing a ring-shaped zone for the radius, G 1 For the set parameters, NFA (n, l ') is calculated according to the following formula, and if NFA (n, l') is ≦ ε, and ε is the set error threshold, then arc M is considered to be the arc i Satisfying the helmholtz principle:
Figure FDA0003881599930000041
wherein n is a circular arc M i The total number of pixel points of (c) is l' is an arc M i The number of pixels in the annular region, L' represents the length of the flexible circuit board, W represents the width of the flexible circuit board,
Figure FDA0003881599930000042
the combination number of l' pixels in n pixels is shown, and p is the probability that the set pixel point belongs to the circle.
6. The method for detecting the defect circle of the flexible circuit board as claimed in claim 4, wherein in step S43, the standard parameters of the flexible circuit board and the detected circle center (a) of the circular hole are compared i ,b i ) And radius r i Comparing, and judging whether the circular arc section has the size type defect and the positioning type defect of the drill hole according to the following steps:
if the center position of the circular hole and the circular arc M in the standard parameters i Circle center (a) of the circular hole i ,b i ) If the error between the two is greater than the first threshold value, the arc M is judged i The positioning defects of the drill holes exist;
if the radius of the circular hole and the circular arc M in the standard parameters i Radius r of i If the error between the two is greater than the second threshold value, the arc M is judged i There are size class defects of the drilled hole.
7. A flexible circuit board defect circle detection device, characterized by includes:
the acquisition module is used for acquiring an original image of the flexible circuit board;
the conversion module is used for converting the original image of the flexible circuit board into a gray image;
the binarization module is used for segmenting the gray level image by using a threshold segmentation method to obtain a binary image;
the extraction module is used for extracting the contour in the binary image to obtain the contour of each line on the image;
the candidate module is used for screening out a candidate circular contour set according to the pixel point information of the contour for each line contour extracted from the image;
the preprocessing module is used for preprocessing the candidate circle contour set;
the error calculation module is used for performing arc fitting and calculating an average fitting error aiming at the preprocessed candidate circle contour set;
the candidate arc set determining module is used for finding a candidate arc set according to the average fitting error and the position relation between the pixel point and the circle center, and storing the pixel point of each segment of candidate arc;
aiming at the preprocessed candidate circular contour set, gradually selecting pixel points according to the step length to perform circular arc fitting and calculate the average fitting error, finding the candidate circular arc set according to the average fitting error and the position relation between the pixel points and the circle center, and storing the pixel points of each section of candidate circular arc, wherein the specific process comprises the following steps:
step S31, aiming at the pixel point set in each preprocessed candidate circular contour, averagely segmenting the pixel point set by step length k'; initializing variable l =1, variable i =1;
s32, performing circle fitting on the first segment of pixel point set according to a least square method and calculating an average fitting error e;
judging whether the average fitting error e meets the condition: e is less than or equal to delta which is a set average fitting error threshold value;
if yes, storing the pixel points of the first section in the circular arc M i In (c), the fitted center (a) is saved i ,b i ) And radius r i Then, the process proceeds to step S33;
if not, adding 1 to the value of l, and then repeating the step S32;
s33, judging whether the segment l +1 pixel point set can be matched with the circular arc M i The pixel point set in (1) forms a section of circular arc, and each section of pixel point set is traversed to obtain a candidate circular arc set, wherein the specific process is as follows:
step S331, calculating each pixel point (x) in the l +1 th segment of pixel point set in sequence j ,y j ) To the center of a circle (a) i ,b i ) Distance d of ij
Step S332 of determining d ij Whether or not the condition r is satisfied i ×minr<d ij <r i X maxr, minr and maxr respectively represent the set minimum and maximum radius parameters,
if each pixel point meets the condition, increasing the (l + 1) th segment of pixel point set to an arc set M i And according to the least square method to the updated circular arc M i All the pixel points in (1) are subjected to circle fitting, and the circle center (a) is updated i ,b i ) Radius r i Then, the value of l is added by 1 and then the process returns to the step S331;
if part of the pixel points meet the condition, increasing the pixel points meeting the condition to the circular arc M i And performing circle fitting on all pixel points in the updated arc Mi according to a least square method and calculating an average fitting error e i Updating the center of a circle (a) i ,b i ) Radius r i (ii) a Then adding 1 to the value of i, adding 1 to the value of l and returning to the step S32;
step S333, after all pixel points are traversed, storing the obtained candidate arc set M = { M = } 1 ,M 2 ,...,M I And each arc M i Corresponding circle center (a) i ,b i ) Radius r i Average fitting error e i ,i=1,2,3,,...,I;
And the effective circle judging module is used for sequentially judging the effectiveness of each section of candidate circular arc, screening out effective circles and storing parameters of the effective circles.
8. A storage medium storing a program, wherein the program when executed by a processor implements the flexible circuit board defective circle detecting method according to any one of claims 1 to 6.
9. A computing device comprising a processor and a memory for storing a program executable by the processor, wherein the processor implements the method for detecting a defective circle of a flexible circuit board according to any one of claims 1 to 6 when executing the program stored in the memory.
CN202110234272.8A 2021-03-03 2021-03-03 Method, device, medium and equipment for detecting defect circle of flexible circuit board Active CN112991279B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110234272.8A CN112991279B (en) 2021-03-03 2021-03-03 Method, device, medium and equipment for detecting defect circle of flexible circuit board

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110234272.8A CN112991279B (en) 2021-03-03 2021-03-03 Method, device, medium and equipment for detecting defect circle of flexible circuit board

Publications (2)

Publication Number Publication Date
CN112991279A CN112991279A (en) 2021-06-18
CN112991279B true CN112991279B (en) 2023-02-14

Family

ID=76352351

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110234272.8A Active CN112991279B (en) 2021-03-03 2021-03-03 Method, device, medium and equipment for detecting defect circle of flexible circuit board

Country Status (1)

Country Link
CN (1) CN112991279B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113379744B (en) * 2021-08-12 2021-11-19 山东大拇指喷雾设备有限公司 Nozzle device surface defect detection method and system based on image processing
CN114022439B (en) * 2021-11-01 2024-06-25 苏州科德软体电路板有限公司 Flexible circuit board defect detection method based on morphological image processing
CN113822890B (en) * 2021-11-24 2022-02-25 中科慧远视觉技术(北京)有限公司 Microcrack detection method, device and system and storage medium
CN115035056B (en) * 2022-05-31 2024-04-30 华南理工大学 Differential geometry-based flexible IC substrate circuit etching defect detection method and system
CN115063429B (en) * 2022-08-18 2022-11-11 山东安德机械科技有限公司 Quality detection method for mechanical parts
CN115311281B (en) * 2022-10-12 2023-11-24 深圳市芯盛长盈科技有限公司 Wafer circle center correction method
CN115375693B (en) * 2022-10-27 2023-02-10 浙江托普云农科技股份有限公司 Method, system and device for detecting defects of probe of agricultural information acquisition sensor
CN116958125B (en) * 2023-09-18 2023-12-26 惠州市鑫晖源科技有限公司 Electronic contest host power supply element defect visual detection method based on image processing
CN117994248A (en) * 2024-03-28 2024-05-07 中导光电设备股份有限公司 Method and system for detecting circular outline of display screen

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010008125A (en) * 2008-06-25 2010-01-14 Toppan Printing Co Ltd Bubble sorting method in glass substrate
CN108537778A (en) * 2018-03-27 2018-09-14 华南理工大学 A kind of random circular hole detection method of improvement for flexible base board

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705297B (en) * 2017-09-18 2020-05-22 华南理工大学 Threshold segmentation detection method for circular hole of flexible circuit board

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010008125A (en) * 2008-06-25 2010-01-14 Toppan Printing Co Ltd Bubble sorting method in glass substrate
CN108537778A (en) * 2018-03-27 2018-09-14 华南理工大学 A kind of random circular hole detection method of improvement for flexible base board

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
A fast circle detection methold based on threshold segmentation and validity check for FPC images;Luo Jiaxiang et al;《IEEE Chinese Automation Congress》;20171231;第3214-3217页 *
DCircles: A real-time circle detector with a false detection control;Akinlar C et al;《Pattern Recognition》;20131231;第46卷(第3期);第725-740页 *
高密度柔性基板视觉检测中的图像分割与圆孔检测技术研究;陈绪超;《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》;20190115(第1期);第I138-4084页 *
高密度柔性集成电路基板的表面氧化缺陷检测;罗家祥 等;《计算机集成制造系统》;20201231;第26卷(第9期);第2379-2387页 *

Also Published As

Publication number Publication date
CN112991279A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN112991279B (en) Method, device, medium and equipment for detecting defect circle of flexible circuit board
CN110807473B (en) Target detection method, device and computer storage medium
CN111553425B (en) Template matching LSP algorithm, medium and equipment for visual positioning
CN112819845B (en) Flexible package substrate contour, line width and line distance defect detection method, medium and equipment
CN107705297B (en) Threshold segmentation detection method for circular hole of flexible circuit board
CN108038481A (en) A kind of combination maximum extreme value stability region and the text positioning method of stroke width change
CN112649793A (en) Sea surface target radar trace condensation method and device, electronic equipment and storage medium
CN117710399B (en) Crack contour extraction method in geological survey based on vision
CN109766924B (en) Image detection method based on image information entropy and adaptive threshold DAISY feature points
CN113128378B (en) Finger vein rapid identification method
CN108694411B (en) Method for identifying similar images
CN104881670B (en) A kind of fast target extracting method for SAR orientation angular estimation
CN112258532B (en) Positioning and segmentation method for callus in ultrasonic image
CN111292346B (en) Method for detecting contour of casting box body in noise environment
CN108763261B (en) Graph retrieval method
Zhang et al. Oil tank extraction based on joint-spatial saliency analysis for multiple SAR images
CN112630743A (en) Sea surface target point trace condensation method and system based on contour tracking area growth
CN112258534B (en) Method for positioning and segmenting small brain earthworm parts in ultrasonic image
CN114677428A (en) Power transmission line icing thickness detection method based on unmanned aerial vehicle image processing
CN110059719B (en) Walsh transform-based target identification method for image moment
CN111401385A (en) Similarity calculation method for image local topological structure feature descriptors
CN113077410A (en) Image detection method, device and method, chip and computer readable storage medium
CN112232348B (en) Oracle identification method and system based on machine vision
CN112946598B (en) Sky-wave radar ionosphere correction coefficient extraction method
CN116453117B (en) Image interpretation image spot positioning and precision evaluation method

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