CN115272346A - PCB production process online detection method based on edge detection - Google Patents

PCB production process online detection method based on edge detection Download PDF

Info

Publication number
CN115272346A
CN115272346A CN202211205424.2A CN202211205424A CN115272346A CN 115272346 A CN115272346 A CN 115272346A CN 202211205424 A CN202211205424 A CN 202211205424A CN 115272346 A CN115272346 A CN 115272346A
Authority
CN
China
Prior art keywords
target image
value
gray
threshold
image block
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.)
Pending
Application number
CN202211205424.2A
Other languages
Chinese (zh)
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.)
Jiangsu Weisheng Photoelectric Technology Co ltd
Original Assignee
Jiangsu Weisheng Photoelectric 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 Jiangsu Weisheng Photoelectric Technology Co ltd filed Critical Jiangsu Weisheng Photoelectric Technology Co ltd
Priority to CN202211205424.2A priority Critical patent/CN115272346A/en
Publication of CN115272346A publication Critical patent/CN115272346A/en
Pending legal-status Critical Current

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
    • 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/90Determination of colour characteristics
    • 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]

Abstract

The invention discloses an edge detection-based PCB production process online detection method, which relates to the field of image processing and comprises the following steps: acquiring a gray image of a PCB to be detected; dividing the gray level image into a plurality of target image blocks; determining an initial threshold interval of each target image block according to the distance between a pixel point on a suspected circular hole edge line in each target image block and a circumferential center point and the gray distribution entropy, determining an initial threshold from the initial threshold interval, performing image enhancement on the target image blocks, obtaining an iteration threshold of each target image block, and determining a high threshold and a low threshold in each target image block according to the initial threshold and the iteration threshold of the target image blocks; according to the method and the device, the edge of the target image block is detected according to the high threshold and the low threshold of the target image block, and the defect area of the PCB to be detected is obtained.

Description

PCB production process online detection method based on edge detection
Technical Field
The invention relates to the field of image processing, in particular to an edge detection-based PCB production process online detection method.
Background
With the development of the electronic industry, PCB technology is applied to many fields such as computer hardware, home appliances, and medical devices. Due to different functional requirements of various industries, the PCB board patterns are more diversified and complex, and the more complex PCB boards are easy to generate errors of short circuit, solder bridge and open circuit in the production process, so that the quality detection needs to be carried out when the PCB boards leave a factory, and the problems of short circuit, solder bridge and open circuit in use are avoided.
The method for detecting the quality of the PCB at present is to determine whether the PCB has a defect area or not through template matching, the template matching needs to determine edge characteristics on the PCB to be detected firstly, and then the defect area is obtained according to characteristic points and the template matching, so accurate characteristic points need to be obtained if the detection result is accurate, but the edge detection of the PCB at present is common canny operator detection, because the surface circuit of the PCB is complex, and the gray difference of the defect place of a tiny round hole area is not obvious, the improper dual-threshold selection during the edge detection is easily caused, so the edge characteristics of the tiny round hole area on the surface of the PCB cannot be completely and accurately detected, if the round hole area has problems and is not detected, the subsequent use of the PCB is influenced, therefore, the invention provides an online detection method for the production process of the PCB based on the edge detection.
Disclosure of Invention
The invention provides an edge detection-based PCB production process online detection method, which aims to solve the existing problems.
The invention relates to an edge detection-based PCB production process online detection method, which adopts the following technical scheme:
acquiring a gray image of a PCB to be detected;
dividing the gray level image into a plurality of image blocks according to the initial size, and acquiring a plurality of target image blocks according to the difference between the mean value of the gray level information entropies of all the image blocks and the gray level information entropy of the gray level image;
acquiring a suspected round hole edge line in each target image block; obtaining a gray level distribution entropy of each pixel point according to the gray level value distribution probability and the gray level value of each pixel point in the gray level image; determining an initial threshold interval of each target image block according to the distance between the pixel point on the edge line of the suspected circular hole and the circumferential center point of the edge line of the suspected circular hole and the gray level distribution entropy of the pixel point on the edge line of the suspected circular hole and the circumferential center point;
acquiring an optimal segmentation threshold of an image formed by pixel points corresponding to the initial threshold interval of each target image block, and taking the optimal segmentation threshold obtained by each target image block as an initial threshold for iteration of the target image block;
carrying out image enhancement on each target image block in the gray level image to obtain an image-enhanced target image block and a gray level image; acquiring a gray value average value of suspected edge points in a gray image as an iteration threshold of each target image block, and if the difference value between the iteration threshold and the initial threshold of each target image block meets a set judgment threshold, taking the initial threshold of each target image block as a high threshold;
if the difference value between the iteration threshold value and the initial threshold value of the target image block does not accord with the set judgment threshold value, taking the iteration threshold value of the target image block as a new initial threshold value of the target image block, re-determining the new iteration threshold value of the target image block according to the mean value of the maximum gray value and the minimum gray value in the target image block, re-judging whether the difference value between the new initial threshold value and the new iteration threshold value of the target image block accords with the judgment threshold value or not, if not, continuing iteration until the difference value between the initial threshold value and the iteration threshold value of the target image block accords with the judgment threshold value, and taking the iteration threshold value obtained when the difference value accords with the judgment threshold value as a high threshold value of the corresponding target image block;
obtaining a low threshold value of a corresponding target image block according to the high threshold value of each target image block;
and performing edge detection on each target image block by using the high threshold and the low threshold of each target image block, and acquiring a defect area of the PCB to be detected according to an edge detection result.
Further, the step of obtaining a plurality of target image blocks according to the difference between the mean value of the grayscale information entropies of all the image blocks and the grayscale information entropies of the grayscale image includes:
if the difference value between the mean value of the gray scale information entropies of all the image blocks obtained for the first time and the gray scale information entropies of the gray scale images is smaller than or equal to a set threshold value, optionally dividing one image block obtained for the first time to obtain a plurality of image blocks with smaller sizes;
calculating the difference between the mean value of the gray scale information entropies of all the image blocks in the gray scale image and the gray scale information entropy of the gray scale image;
if the obtained difference is smaller than or equal to the set threshold, selecting one image block obtained for the first time to be divided to obtain a plurality of image blocks with smaller sizes;
calculating the difference value between the mean value of the gray scale information entropies of all image blocks in the gray scale image and the gray scale information entropy of the gray scale image;
if the obtained difference is less than or equal to the set threshold, continuing to divide the image block in the gray level image;
stopping image segmentation until the difference between the mean value of the gray scale information entropies of all the image blocks and the gray scale information entropies of the gray scale images is greater than a set threshold;
and recording all the divided image blocks in the gray-scale image as target image blocks.
Further, the step of obtaining the suspected round hole edge line in each target image block comprises:
carrying out non-maximum suppression on the gray level image, wherein the reserved points in the gray level image after the non-maximum suppression are suspected edge points;
carrying out Hough circle detection on all the suspected edge points to obtain suspected round hole edge lines in the gray level image;
and obtaining a suspected round hole edge line in the target image block according to the corresponding position of the target image block in the gray level image.
Further, a formula for obtaining the gray scale distribution entropy of each pixel point according to the gray scale value distribution probability and the gray scale value of each pixel point in the gray scale image is as follows:
Figure 103350DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure 100002_DEST_PATH_IMAGE003
representing a gray value in a gray-scale image of
Figure 894720DEST_PATH_IMAGE004
Image ofThe gray level distribution entropy of the pixel points;
Figure 287655DEST_PATH_IMAGE004
is shown as
Figure 100002_DEST_PATH_IMAGE005
Gray values of the class pixels;
Figure 564309DEST_PATH_IMAGE005
is shown as
Figure 740206DEST_PATH_IMAGE005
The pixel points with the same gray value are the same type of pixel points;
Figure 212514DEST_PATH_IMAGE006
representing the total number of pixel points in the gray level image;
Figure 100002_DEST_PATH_IMAGE007
representing a gray value in a gray image of
Figure 714033DEST_PATH_IMAGE004
The number of pixels of (2).
Further, the step of determining the initial threshold interval of each target image block according to the distance between the pixel point on the suspected circular hole edge line and the circumferential center point of the suspected circular hole edge line in each target image block and the gray level distribution entropy of the pixel point on the suspected circular hole edge line and the circumferential center point comprises the following steps:
calculating the gray scale dispersion of each pixel point on the edge line according to the distance between the pixel point on the edge line of the suspected circular hole in each target image block and the circumferential center point and the gray scale distribution entropy of the pixel point on the edge line of the suspected circular hole and the circumferential center point;
the formula for calculating the gray scale dispersion is as follows:
Figure 100002_DEST_PATH_IMAGE009
wherein, the first and the second end of the pipe are connected with each other,
Figure 206545DEST_PATH_IMAGE010
expressing the gray dispersion between the pixel point on the suspected round hole edge line and the circumference center point of the suspected round hole edge line;
Figure 100002_DEST_PATH_IMAGE011
the coordinate on the edge line of the suspected round hole is represented as
Figure 186133DEST_PATH_IMAGE012
Pixel point (c) and the circumferential center point of the edge line of the suspected round hole
Figure 100002_DEST_PATH_IMAGE013
The Euclidean distance between;
Figure 716209DEST_PATH_IMAGE014
the coordinate on the edge line of the suspected round hole is represented as
Figure 247685DEST_PATH_IMAGE012
The gray level distribution entropy of the pixel points;
Figure 100002_DEST_PATH_IMAGE015
expressing the gray distribution entropy of the circumferential center point of the suspected circular hole edge line;
Figure 731887DEST_PATH_IMAGE013
the coordinates of the circumference center point of the suspected round hole edge line are obtained;
Figure 78948DEST_PATH_IMAGE016
is a natural constant;
setting a boundary threshold, and acquiring the median of gray values of all pixel points of which the gray dispersion is greater than the boundary threshold in the target image block as an upper boundary value;
acquiring the median of the gray values of all the pixel points with the gray dispersion smaller than or equal to the boundary threshold value as a lower boundary value;
and obtaining an initial threshold interval of each target image block by using the upper boundary value and the lower boundary value of each target image block.
Further, the step of re-determining a new iteration threshold of the target image block according to the mean value of the maximum gray value and the minimum gray value in the target image block comprises:
obtaining the average value of the maximum gray value and the minimum gray value in the target image block
Figure 100002_DEST_PATH_IMAGE017
Obtaining a mean value greater than in each target image block
Figure 964996DEST_PATH_IMAGE017
Mean value of gray values of pixel points
Figure 41274DEST_PATH_IMAGE018
And is equal to or less than the mean value
Figure 75089DEST_PATH_IMAGE017
Mean value of gray values of pixel points
Figure 100002_DEST_PATH_IMAGE019
Two mean values obtained
Figure 396480DEST_PATH_IMAGE018
Figure 718394DEST_PATH_IMAGE019
Calculating the mean value as a new iteration threshold value of the target image block;
if the difference value between the new iteration threshold and the new initial threshold of the target image block does not accord with the set judgment threshold, acquiring the difference value in the target image block
Figure 794934DEST_PATH_IMAGE017
To
Figure 316045DEST_PATH_IMAGE018
Mean value of gray values of pixels between
Figure 300182DEST_PATH_IMAGE020
And
Figure 721674DEST_PATH_IMAGE017
to
Figure 969115DEST_PATH_IMAGE019
Mean value of gray values of pixels between
Figure 100002_DEST_PATH_IMAGE021
To the two obtained mean values
Figure 915206DEST_PATH_IMAGE020
Figure 142181DEST_PATH_IMAGE021
And calculating the mean value to be used as a new iteration threshold value of the target image block again.
Further, the formula for obtaining the low threshold value of each target image block according to the high threshold value of each target image block is as follows:
Figure 100002_DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure 857327DEST_PATH_IMAGE024
a low threshold representing a target image block;
Figure 100002_DEST_PATH_IMAGE025
a high threshold representing a target image block;
Figure 383993DEST_PATH_IMAGE026
judging a threshold value;
Figure 100002_DEST_PATH_IMAGE027
to select the coefficients.
Further, the step of performing edge detection on each target image block by using the high threshold and the low threshold of each target image block to obtain the defect area of the PCB to be detected comprises the following steps:
judging whether two target image blocks need to be combined or not according to the high threshold and the low threshold of the two adjacent target image blocks, combining the target image blocks needing to be combined to obtain a target area, and obtaining the high threshold and the low threshold of the target area by using the high threshold and the low threshold of the two adjacent target image blocks;
and respectively carrying out edge detection on the corresponding target area and target image block by using the high threshold and the low threshold of all the merged target areas and the high threshold and the low threshold of the target image block without merging to obtain a defect area in the PCB to be detected.
Further, the step of judging whether the two target image blocks need to be combined according to the high threshold and the low threshold of the two adjacent target image blocks, and combining the target image blocks needing to be combined to obtain the target area comprises the following steps:
respectively calculating the proportion of gray values larger than a high threshold value in the suspected edge points of the two target image blocks
Figure 551800DEST_PATH_IMAGE028
Ratio of gray value smaller than low threshold value in suspected edge point
Figure 100002_DEST_PATH_IMAGE029
And the proportion of the gray value of the suspected edge point being less than the high threshold value and greater than the low threshold value
Figure 514290DEST_PATH_IMAGE030
Interchanging the high threshold and the low threshold of two adjacent target image blocks, and respectively calculating the proportion of gray values larger than the high threshold in the suspected edge points in the target image blocks after interchanging the high threshold and the low threshold
Figure 100002_DEST_PATH_IMAGE031
Ratio of gray value smaller than low threshold value in suspected edge point
Figure 83943DEST_PATH_IMAGE032
The gray value in the suspected edge point is less than the high threshold value and more than the high threshold valueLow threshold ratio
Figure 100002_DEST_PATH_IMAGE033
Respectively calculating the proportion of two target image blocks after threshold value interchange
Figure 906143DEST_PATH_IMAGE028
Figure 889142DEST_PATH_IMAGE029
Figure 222035DEST_PATH_IMAGE030
And
Figure 944396DEST_PATH_IMAGE031
Figure 970121DEST_PATH_IMAGE032
Figure 846942DEST_PATH_IMAGE033
and if the difference obtained by the two target image blocks is less than or equal to the set threshold, combining the two adjacent target image blocks to obtain a target area.
Further, the step of obtaining the high threshold and the low threshold of the target area by using the high threshold and the low threshold of the two adjacent target image blocks includes:
taking the larger value of the two groups of high threshold values of the two adjacent target image blocks as the high threshold value of the target area;
and taking the smaller value of the two groups of low threshold values of the two adjacent target image blocks as the low threshold value of the target area.
The invention has the beneficial effects that: according to the PCB production process online detection method based on edge detection, the gray level image is segmented according to the difference between the gray level information entropies of all the image blocks and the gray level image to obtain the final target image block, so that the circular hole areas which are distributed intensively and have the same type are segmented into the same target image block to the greatest extent, and the optimal threshold value in each target image block obtained subsequently is more accurate; calculating the gray dispersion between the pixel points on the edge line of the suspected circular hole and the central point of the circumference to obtain suspected boundary points and suspected edge intermediate points, and limiting an interval for the subsequent selection of an initial threshold; the image is enhanced by utilizing logarithmic transformation, so that the initial threshold and the iteration threshold in the subsequent iteration process are more accurately calculated; the invention also obtains the double thresholds of each target image block in a self-adaptive manner according to an iterative algorithm, so that the edge characteristic result obtained by final edge detection is more accurate, and the defect detection result is more accurate.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart illustrating the general steps of an embodiment of an on-line detection method for PCB production process based on edge detection according to the present invention;
fig. 2 is a grayscale image of a PCB to be tested.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, an embodiment of the online detection method for the production process of the PCB based on edge detection of the present invention includes:
s1, obtaining a gray image of the PCB to be detected.
Specifically, an image of the PCB to be detected is collected, and the collected image is subjected to graying processing to obtain a grayscale image of the PCB to be detected.
In order to eliminate the influence of noise in the process of collecting images, the grayscale images are subjected to noise reduction processing.
It should be noted that, in the conventional method for reducing noise of an image, gaussian filtering is adopted, but the edges of the image become blurred in the denoising process by gaussian filtering, so that the bilateral filter replaces the gaussian filter, the bilateral filter considers the spatial domain information of the pixel points on the basis of filtering to increase the influence of the pixel gray value, when the gray value of the pixel points on the two sides of the edge has a large difference, the weight is reduced, the edge is prevented from being blurred, and more edge information in the image can be retained.
And S2, dividing the gray level image into a plurality of image blocks according to the initial size, and acquiring a plurality of target image blocks according to the difference between the mean value of the gray level information entropies of all the image blocks and the gray level information entropy of the gray level image.
The scheme is that edge detection optimization is carried out on a canny operator, noise reduction processing on a gray image is completed in the step S1, non-maximum suppression is carried out on the noise-reduced image subsequently, and then double-threshold selection is carried out.
It should be noted that the dual thresholds in the traditional canny operator need to be set by themselves, but the self-set dual thresholds are not suitable for the PCB image, because the PCB image is complex, the types of the circular areas in the image are not uniform, the circular areas with pins, the circular areas with holes, and the gray levels are different, so it is difficult to accurately select the thresholds, and therefore, in the scheme, the characteristic that the distribution of the circular hole areas on the PCB is locally concentrated is considered, as shown in fig. 2, the image is segmented, the circular holes which are distributed in a concentrated manner as much as possible are distributed into the same image block, and then the dual thresholds are selected for edge detection.
Specifically, the image segmentation is carried out on the grayscale image after noise reduction, the grayscale image is segmented into 4 image blocks with equal size, and the grayscale information entropy of each image block is calculated; and obtaining the mean value of the gray scale information entropies of all the image blocks, and comparing the obtained mean value with the gray scale information entropies of the gray scale images to evaluate the segmentation effect.
Calculating the gray level entropy value difference before and after the gray level image segmentation according to the following formula:
Figure DEST_PATH_IMAGE035
wherein the content of the first and second substances,
Figure 154164DEST_PATH_IMAGE036
expressing the gray level entropy value difference before and after the division, namely the difference between the mean value of the gray level information entropies of all the image blocks after the division and the gray level information entropy of the gray level image;
Figure DEST_PATH_IMAGE037
a gray information entropy representing a gray image;
Figure 698409DEST_PATH_IMAGE038
and respectively representing the gray information entropy of each image block after division.
Setting a threshold value
Figure DEST_PATH_IMAGE039
Used for judging whether to continuously divide the gray level image or not, and obtaining the gray level image according to the empirical value
Figure 62744DEST_PATH_IMAGE040
If the difference between the gray level entropy before and after the first division
Figure DEST_PATH_IMAGE041
The difference between the gray information entropy in the divided image block and the gray information entropy of the gray image is small, image division can be continuously carried out, and any one of the image blocks obtained by the first division is divided into an image with a smaller size of 4 equal divisions when the second division is carried out; if the difference between the gray level entropy before and after the first division
Figure 426861DEST_PATH_IMAGE042
Explaining that the difference between the gray information entropy in the image block and the gray information entropy of the gray image is larger, the image division is achievedAnd (4) for the purpose of cutting, the target image block is obtained without continuing to cut.
If the difference of the gray level entropy before and after the second division
Figure 865670DEST_PATH_IMAGE041
And selecting one of the image blocks obtained by the first division for division, and repeating the steps to obtain smaller image blocks by continuous division until the difference between the mean value of the gray scale information entropies of all the image blocks and the gray scale information entropies of the gray scale image is greater than a set threshold, stopping image division, marking all the divided image blocks in the gray scale image as target image blocks, and finally obtaining a plurality of target image blocks with different sizes.
It should be noted that the purpose of segmenting the grayscale image is to obtain the real distribution of the target area on the PCB, because the target area is not uniformly distributed on the PCB and is locally and intensively distributed, the target area refers to a circular hole area on the PCB, if image segmentation is not performed, a dual threshold is calculated from the entire grayscale image, which is more easily affected by the surface grayscale value, the grayscale value of the background pixel in the grayscale image is smaller than the grayscale value of the pixel in the target area, and the calculated low threshold may be smaller. The gray information entropy can reflect the complex situation of the image, for a pair of smooth and flat images with consistent colors, the gray value of each pixel point in the image is almost consistent, and the difference between the gray information entropy of the image after the image is segmented and the mean value of the gray information entropy of the image block after the image is segmented is very small; for an image with disordered gray value distribution, the gray information entropy value is large, if the gray value distribution in the image block after division is still disordered, and the gray information entropy of the image block is still large, the difference value of the gray entropy before and after division is not large, so that the image block needs to be continuously divided until the gray value distribution in the image block is uniform, namely the gray information entropy of the image block is small, the difference value of the gray entropy before and after division is large, and the difference value reaches a set threshold value
Figure 123476DEST_PATH_IMAGE039
Description of the concentrated distribution and the same speciesThe circular hole area is divided into the same image block, and the purpose of image segmentation is achieved.
S3, obtaining a suspected round hole edge line in each target image block; obtaining a gray value distribution entropy of each pixel point according to the gray value distribution probability and the gray value of each pixel point in the gray image; and determining an initial threshold interval of each target image block according to the distance between the pixel point on the edge line of the suspected circular hole and the circumferential center point of the edge line of the suspected circular hole and the gray distribution entropy of the pixel point on the edge line of the suspected circular hole and the circumferential center point.
Specifically, the gray level distribution entropy of each pixel point in the gray level image is calculated according to the following formula:
Figure DEST_PATH_IMAGE043
wherein the content of the first and second substances,
Figure 163107DEST_PATH_IMAGE003
representing a gray value in a gray image of
Figure 578301DEST_PATH_IMAGE004
The gray level distribution entropy of the pixel points;
Figure 56687DEST_PATH_IMAGE004
is shown as
Figure 372262DEST_PATH_IMAGE005
Gray values of the class pixels;
Figure 81330DEST_PATH_IMAGE005
is shown as
Figure 482355DEST_PATH_IMAGE005
The pixel points of the same gray value are the same type of pixel points;
Figure 764432DEST_PATH_IMAGE006
expressing the total number of pixel points in the gray level image;
Figure 200093DEST_PATH_IMAGE007
representing a gray value in a gray image of
Figure 873870DEST_PATH_IMAGE004
The number of pixel points of (a);
Figure 27771DEST_PATH_IMAGE044
representing a gray value in a gray image of
Figure 847959DEST_PATH_IMAGE004
The larger the proportion of the pixel points in the gray level image, namely the gray level value distribution probability of the pixel points, the more the distribution is expressed in the gray level image, and the reuse is carried out
Figure DEST_PATH_IMAGE045
Calculating the reciprocal to show that the more the pixel points of the type are distributed in the gray level image, the smaller the obtained gray level distribution entropy of the pixel points is; then multiply by
Figure 574344DEST_PATH_IMAGE005
The gray value of the similar pixel point is larger, and the gray distribution entropy of the obtained pixel point is larger.
It should be noted that, here, calculating the gray distribution entropy of the pixel point is to use the gray distribution entropy to represent the distribution probability of the gray value size and the gray value type of the pixel point, the first one is
Figure 985734DEST_PATH_IMAGE005
The larger the gray value of the class pixel point is, the smaller the distribution range is, and the larger the obtained gray distribution entropy is.
The gray image is restrained and processed by using the non-maximum value, the reserved points in the gray image are suspected edge points and are not true edges, so that the true edges are obtained by thinning the edges according to the suspected edge points. The edge pixel point may be caused by stray effects, for example, color changes, and the edge pixel point caused by these color changes is located at the place where the circular hole area and the PCB board surface area are joined, that is, the boundary point of the circular hole.
And carrying out Hough circle detection on all the suspected edge points to obtain suspected round hole edge lines in the gray level image, and obtaining the suspected round hole edge lines in each target image block according to the corresponding positions of the target image blocks in the gray level image.
Calculating the gray dispersion between each pixel point on each suspected circular hole edge line in the target image block and the circumferential center point of the edge line according to the following formula:
Figure 361352DEST_PATH_IMAGE009
wherein the content of the first and second substances,
Figure 985231DEST_PATH_IMAGE010
expressing the gray dispersion between the pixel point on the suspected round hole edge line and the circumference center point of the suspected round hole edge line;
Figure 631370DEST_PATH_IMAGE011
the coordinate on the edge line of the suspected round hole is represented as
Figure 416923DEST_PATH_IMAGE012
Pixel point (c) and the circumference center point of the suspected round hole edge line
Figure 279837DEST_PATH_IMAGE013
The Euclidean distance between;
Figure 441828DEST_PATH_IMAGE014
the coordinate on the edge line of the suspected round hole is represented as
Figure 877226DEST_PATH_IMAGE012
The gray level distribution entropy of the pixel points;
Figure 99260DEST_PATH_IMAGE015
expressing the gray distribution entropy of the circumferential center point of the suspected circular hole edge line;
Figure 183891DEST_PATH_IMAGE013
the coordinates of the circumference center point of the suspected round hole edge line are obtained;
Figure 403036DEST_PATH_IMAGE016
is a natural constant.
It should be noted that, the boundary point and the edge intermediate point on the edge line of the suspected circular hole are distinguished by two factors, on the PCB, the boundary point is distinguished from the edge intermediate point in that the closer the pixel point is to the boundary, the larger the gray value difference with the surrounding pixel points is, the larger the gray value difference with the circumferential center point is, the edge points are all around the edge intermediate point, and the gray value difference is relatively small; and the number of the boundary points is less than that of the intermediate points of the edge lines, and the distribution probability is smaller. And the Euclidean distance from the boundary point to the central point of the circumference is longer, and the Euclidean distance is used
Figure 522302DEST_PATH_IMAGE046
The larger the value is, the more likely the boundary point is, the distribution probability and the gray value size are expressed by the gray distribution entropy, the larger the gray distribution entropy is, the larger the gray value difference is, the smaller the gray distribution probability is, and the more likely the boundary point is. The suspected round hole edge line has a certain pixel width, and the edge middle point is the rest pixel points on the edge line within the value boundary point.
Setting a boundary threshold value to be 60 according to experience, and if the gray dispersion of pixel points on the suspected round hole edge line is greater than the boundary threshold value 60, determining the pixel points to be suspected boundary points; and if the gray dispersion of the pixel point on the edge line is less than or equal to the boundary threshold, the pixel point is a suspected edge intermediate point.
And acquiring a median value in the gray values of all the suspected boundary points in each target image block as an upper boundary value, acquiring a median value in the gray values of all the suspected edge intermediate points in each target image block as a lower boundary value, and acquiring an initial threshold interval, which is used for calculating an initial threshold, of the target image block subsequently by using the upper boundary value and the lower boundary value.
And S4, acquiring an optimal segmentation threshold of an image formed by pixel points corresponding to the initial threshold interval of each target image block, and taking the optimal segmentation threshold acquired by each target image block as an initial threshold for iteration of the target image block.
Specifically, an image composed of all pixel points corresponding to the gray value of an initial threshold interval in each target image block is obtained and recorded as a new image, each target image block corresponds to one new image, an optimal segmentation threshold of each new image is obtained by utilizing an Otsu algorithm, the specific mode of obtaining the optimal segmentation threshold is to arbitrarily select the segmentation threshold, divide the new image into a foreground part and a background part by utilizing the segmentation threshold, respectively obtain the proportion of the new image occupied by the pixel points of the foreground part and the background part, respectively obtain the gray value mean value of the pixel points of the foreground part and the background part, and calculate and obtain the between-class variance according to the proportion of the pixel points of the foreground part and the background part occupied by the new image and the gray value mean value; and adjusting the segmentation threshold to obtain different inter-class variances, wherein the segmentation threshold corresponding to the maximum inter-class variance is the optimal segmentation threshold, the Otsu algorithm is the prior art, and the optimal segmentation threshold is used as the initial threshold for subsequent iteration circulation.
Thus, an initial threshold value for each target image block to iterate is obtained.
S5, carrying out image enhancement on each target image block in the gray level image to obtain an image-enhanced target image block and a gray level image; acquiring a gray value average value of suspected edge points in a gray image as an iteration threshold of each target image block, and if the difference value between the iteration threshold and the initial threshold of the target image block conforms to a set judgment threshold, taking the initial threshold of the target image block as a high threshold; if the difference value between the iteration threshold value and the initial threshold value of the target image block does not accord with the set judgment threshold value, the iteration threshold value of the target image block is used as a new initial threshold value of the target image block, the new iteration threshold value of the target image block is determined again according to the mean value of the maximum gray value and the minimum gray value in the target image block, whether the difference value between the new initial threshold value and the new iteration threshold value of the target image block accords with the judgment threshold value or not is determined again, if not, iteration is continued until the difference value between the initial threshold value and the iteration threshold value of the target image block accords with the judgment threshold value, and the iteration threshold value obtained when the difference value accords with the judgment threshold value is used as the high threshold value of the corresponding target image block.
Specifically, each target image block is subjected to logarithmic transformation, and the contrast of a low-gray area in the image block is enhanced by the logarithmic transformation, namely the dark part details of the target image block are enhanced, so that the result obtained by subsequent processing is more accurate.
And obtaining a logarithmic curve of each target image block, obtaining a maximum gray value and a minimum gray value on the edge line of the suspected round hole in the target image block by using the logarithmic curve, wherein the point corresponding to the minimum gray value in the logarithmic curve is located at the position with the maximum slope of the curve, the point corresponding to the maximum gray value is located at the position with the minimum slope of the curve, and calculating the average value of the maximum gray value and the minimum gray value.
Using the mean of the maximum and minimum gray values of each target image block
Figure 915237DEST_PATH_IMAGE017
Classifying the pixel points in the target image block, and enabling the pixel points to be larger than the mean value
Figure 549481DEST_PATH_IMAGE017
The pixel points are classified into one class, and are less than or equal to the mean value
Figure 551810DEST_PATH_IMAGE017
The pixel points of (a) are classified into one class.
Obtaining all the larger than average values in each target image block
Figure 525582DEST_PATH_IMAGE017
The gray value mean value of the pixel point is recorded as the first gray value mean value
Figure 89419DEST_PATH_IMAGE018
(ii) a Obtaining all average values less than or equal to in each target image block
Figure 148641DEST_PATH_IMAGE017
The gray value mean value of the pixel point is recorded as the second gray value mean value
Figure 692012DEST_PATH_IMAGE019
It should be noted that the mean value is calculated
Figure 785870DEST_PATH_IMAGE017
For obtaining a gray-scale division threshold value, first iteration
Figure DEST_PATH_IMAGE047
A gray scale division threshold value, which changes in subsequent iterations; the gray value mean value of the two types of pixel points in the target image block is calculated, the distribution condition of the gray value in the target image block can be reflected, and therefore the obtained gray value mean value of the two types of pixel points can be used as an iteration threshold value
Figure 628929DEST_PATH_IMAGE048
The update parameter of (2).
And calculating the gray value average value of the pixel points in the gray image, wherein only the suspected edge points are restrained by the non-maximum value in the gray image at the moment, so that the obtained gray value average value is the gray value average value of all the suspected edge points, and the gray value average value of the gray image is used as the iteration threshold value of each target image block.
And judging the difference value between the iteration threshold value and the initial threshold value of each target image block according to the following formula:
Figure 175448DEST_PATH_IMAGE050
wherein, the first and the second end of the pipe are connected with each other,
Figure 21045DEST_PATH_IMAGE048
an iteration threshold representing a target image block;
Figure DEST_PATH_IMAGE051
an initial threshold value representing a target image block;
Figure 668277DEST_PATH_IMAGE026
taking the set judgment threshold value according to experience
Figure 573916DEST_PATH_IMAGE052
When the difference value between the initial threshold value and the iteration threshold value of the obtained target image block
Figure DEST_PATH_IMAGE053
That is, when the difference is within the range of the judgment threshold, iteration is not required, and the iteration threshold is set
Figure 716053DEST_PATH_IMAGE048
As the high threshold of the dual thresholds for edge detection subsequently performed on the target image block
Figure 365340DEST_PATH_IMAGE025
. In step S4, an initial threshold value is calculated
Figure 433791DEST_PATH_IMAGE051
The optimal segmentation threshold is obtained according to an Otsu algorithm, namely the initial threshold is used for distinguishing boundary points from edge intermediate points to the maximum extent so as to obtain more accurate and fine boundaries of the circular hole; while
Figure 244752DEST_PATH_IMAGE048
The gray value mean value of all the suspected edge points in the target image block, namely the gray value mean value of the boundary point and the edge intermediate point, reflects the gray distribution condition of the edge, so when the initial threshold value is used
Figure 1749DEST_PATH_IMAGE051
And iteration threshold
Figure 251464DEST_PATH_IMAGE048
The smaller the difference therebetween, that is, the closer the iteration threshold value is to the optimal segmentation threshold value, the iteration threshold value at that time is considered to be capable of being used as a high threshold value to distinguish the boundary point and the edge intermediate point in the target image block.
When the target image block is obtainedIs compared with an iteration threshold
Figure 174421DEST_PATH_IMAGE054
That is, when the difference is outside the range of the judgment threshold, it is considered that the difference between the iteration threshold obtained at this time and the optimal segmentation threshold (initial threshold) is too large, and the boundary point cannot be accurately segmented, so that iteration is required to update the initial threshold and the iteration threshold.
The specific way of updating the initial threshold and the iteration threshold is to obtain the gray segmentation threshold of the initial iteration of each target image block
Figure 156283DEST_PATH_IMAGE017
And the maximum gray value in the target image block is obtained
Figure DEST_PATH_IMAGE055
And minimum gray value
Figure 335330DEST_PATH_IMAGE056
And in the target image block
Figure DEST_PATH_IMAGE057
Mean value of gray values of corresponding pixels
Figure 264103DEST_PATH_IMAGE018
And
Figure 209275DEST_PATH_IMAGE058
mean value of gray values of corresponding pixels
Figure 627618DEST_PATH_IMAGE019
(ii) a The new iteration threshold of the second step target image block
Figure 857742DEST_PATH_IMAGE048
Is updated to
Figure DEST_PATH_IMAGE059
Taking the iteration threshold of the first step of the target image block as the target of the second stepNew initial threshold for the target image block, i.e.
Figure 823162DEST_PATH_IMAGE060
(ii) a Updating new initial threshold value according to target image block
Figure DEST_PATH_IMAGE061
And a new iteration threshold
Figure 658394DEST_PATH_IMAGE062
Comparing the difference with a judgment threshold, stopping iteration if the difference is less than or equal to the judgment threshold, and adding a new iteration threshold
Figure 545841DEST_PATH_IMAGE062
High threshold as a subsequent edge detection of the target image block
Figure 263261DEST_PATH_IMAGE025
(ii) a If the obtained difference is larger than the judgment threshold, the iteration is continued, and the gray scale division threshold in the target image block is judged at the moment
Figure DEST_PATH_IMAGE063
Is composed of
Figure 268257DEST_PATH_IMAGE018
And
Figure 518848DEST_PATH_IMAGE019
respectively to obtain the mean values of
Figure 278993DEST_PATH_IMAGE064
And
Figure DEST_PATH_IMAGE065
is the mean value of
Figure 421393DEST_PATH_IMAGE020
And
Figure 725686DEST_PATH_IMAGE021
of a third step of the target image blockNew iteration threshold is updated to
Figure 332247DEST_PATH_IMAGE066
Taking the iteration threshold of the second step of the target image block as a new initial threshold of the third step
Figure DEST_PATH_IMAGE067
I.e. the initial threshold is updated to
Figure 433933DEST_PATH_IMAGE068
Calculating the difference between the new initial threshold and the new iteration threshold in the third step, if the obtained difference does not conform to the set judgment threshold, sequentially iterating the target image block according to the iteration method until the difference between the iteration threshold and the initial threshold in a certain step is less than or equal to the judgment threshold, stopping iteration, and taking the iteration threshold of the target image block obtained at the moment as the high threshold for subsequent edge detection of the target image block
Figure 125946DEST_PATH_IMAGE025
It should be noted that the initial threshold value used for iterative determination at the beginning is an optimal segmentation threshold value obtained by using an Otsu algorithm, and divides the boundary points and the edge intermediate points to the greatest extent, and the initial iteration threshold value is an average value of the suspected edge points and represents the gray level distribution of the boundary points and the intermediate points on the edge line, so when the difference between the initial threshold value and the iteration threshold value meets a certain condition, it is considered that the true edge points with higher reliability can be obtained by the high threshold value obtained by iteration.
And determining a low threshold according to the high threshold of each target image block. Specifically, the low threshold of the target image block is calculated according to the following formula:
Figure 66220DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure 324026DEST_PATH_IMAGE024
representing blocks of an object imageA low threshold, specifically a low threshold of the two thresholds when the target image block is subjected to edge detection in the subsequent process;
Figure 927439DEST_PATH_IMAGE025
the high threshold value of the target image block is represented, and specifically is the high threshold value of the double threshold values when the target image block is subjected to edge detection in the subsequent process;
Figure 106748DEST_PATH_IMAGE026
judging a threshold value;
Figure 319554DEST_PATH_IMAGE027
for selecting coefficients, the determination is based on empirical values
Figure DEST_PATH_IMAGE069
(ii) a Since the high threshold is about 2 times the low threshold in classical canny operator edge detection, the coefficients are taken
Figure 743451DEST_PATH_IMAGE070
(ii) a Using decision threshold
Figure 281880DEST_PATH_IMAGE026
The purpose of the subtraction is to avoid filtering out some real edge points with smaller gray values after the iteration is completed, because the smaller the lower threshold is, the more pixels are considered as real edge points after the upper and lower boundaries of the high and low thresholds are determined, and thus, the more edge information is retained.
Thus, a high threshold and a low threshold for each target image block are obtained.
And S6, performing edge detection on each target image block by using the high threshold and the low threshold of each target image block, and acquiring a defect area of the PCB to be detected according to an edge detection result.
Judging whether two target image blocks need to be combined or not according to the high threshold and the low threshold of the two adjacent target image blocks, combining the target image blocks needing to be combined to obtain a target area, obtaining the high threshold and the low threshold of the target area by using the high threshold and the low threshold of the two adjacent target image blocks, and respectively carrying out edge detection on the corresponding target area and the corresponding target image block by using the high threshold and the low threshold of all the combined target areas and the high threshold and the low threshold of the target image block which is not combined.
Specifically, taking the minimum target image block at the upper left corner in the grayscale image as an initial image block, respectively obtaining the dual thresholds of the target image block and the adjacent target image block, i.e. the high threshold and the low threshold of the target image block, and recording the dual thresholds of the target image block as the high threshold and the low threshold of the target image block
Figure 682905DEST_PATH_IMAGE025
Figure 218446DEST_PATH_IMAGE024
Recording the dual thresholds of the adjacent target image blocks of the target image block as
Figure DEST_PATH_IMAGE071
Figure 326210DEST_PATH_IMAGE072
Respectively calculating the gray value of the suspected edge point in each target image block to be greater than a high threshold value
Figure 35540DEST_PATH_IMAGE025
In a ratio of
Figure 219135DEST_PATH_IMAGE028
The gray value in the suspected edge point is less than the low threshold value
Figure 39323DEST_PATH_IMAGE024
In a ratio of
Figure 329490DEST_PATH_IMAGE029
The ratio of the gray value smaller than the high threshold value and larger than the low threshold value in the suspected edge points
Figure 944142DEST_PATH_IMAGE030
Interchanging the dual thresholds of the target image block and the adjacent target image block, and then according toTo obtain
Figure 821225DEST_PATH_IMAGE028
Figure 445104DEST_PATH_IMAGE029
Figure 589778DEST_PATH_IMAGE030
Respectively calculating the proportional relation between the suspected edge point and the high and low thresholds in each target image block, and sequentially recording the proportional relation as
Figure 811550DEST_PATH_IMAGE031
Figure 674463DEST_PATH_IMAGE032
Figure 836454DEST_PATH_IMAGE033
Respectively calculating three proportions of the target image block and each adjacent target image block after double-threshold interchange
Figure 101214DEST_PATH_IMAGE028
Figure 287695DEST_PATH_IMAGE029
Figure 637904DEST_PATH_IMAGE030
To correspond to
Figure 603586DEST_PATH_IMAGE031
Figure 722852DEST_PATH_IMAGE032
Figure 411060DEST_PATH_IMAGE033
The difference between the two, the sum of the differences being
Figure DEST_PATH_IMAGE073
If it satisfies
Figure 920670DEST_PATH_IMAGE074
If the two thresholds of the target image block and the adjacent target image block have universality, the two target image blocks are combined to obtain a target area.
And taking the larger value of the two groups of high threshold values of the two target image blocks as the high threshold value of the target area, and taking the smaller value of the two groups of low threshold values of the two target image blocks as the low threshold value of the target area.
Traversing the whole image, and satisfying all interchange dual thresholds
Figure 424464DEST_PATH_IMAGE074
The adjacent target image blocks are combined to obtain a plurality of target areas, and a dual threshold of each target area is obtained, at this time, the combined target areas and the target image blocks which are not combined exist in the gray scale image.
Then interchanging double thresholds for adjacent target areas or adjacent target image blocks and target areas, and calculating the image after interchanging the double thresholds
Figure 899701DEST_PATH_IMAGE073
Will all satisfy
Figure 463537DEST_PATH_IMAGE074
Until there is no target area and target image block in the gray-scale image that can be combined.
Thus, all target regions, target image blocks, and dual thresholds for each target region and target image block in the grayscale image are obtained.
Reserving and marking the gray value as 255 for the pixel points with the gray value larger than the high threshold value in each target area \ target image block, marking the gray value of the pixel points with the gray value smaller than the low threshold value in the target area \ target image block as 0, extracting the pixel points with the gray value larger than the low threshold value and smaller than the high threshold value in the target area \ target image block, reserving and marking the gray value as 255 for the pixel points with the gray value larger than the high threshold value in the neighborhood of the pixel point, marking the gray value of the pixel point as 0 in the neighborhood of the pixel point as 0 in the case of not having the pixel points larger than the high threshold value, and marking all the gray values in the target area \ target image block as the edge pixel points in the target area \ target image block.
Respectively carrying out edge detection on the corresponding target area and target image block by utilizing the high threshold and the low threshold of all the merged target areas and the high threshold and the low threshold of the target image block which is not merged, optionally, splicing all the target areas and the target image block by double-threshold connection or boundary tracking (the double-threshold connection and the boundary tracking are the prior art), completing the edge detection of the circular hole area of the whole gray image, obtaining the edge characteristics of the gray image of the PCB to be detected, matching and comparing the PCB to be detected with the standard template to obtain the defect area of the PCB to be detected, and further judging whether the PCB meets the production standard, wherein the template matching is a known technology, and detailed description is omitted here.
In summary, the invention provides an edge detection-based online detection method for a production process of a PCB, which completes segmentation of a gray level image according to differences between gray level information entropies of all image blocks and the gray level image to obtain a final target image block, thereby maximally segmenting circular hole areas with the same type and concentrated distribution into the same target image block, and enabling an optimal threshold value in each subsequently obtained target image block to be more accurate; calculating the gray dispersion between pixel points on the edge line of the suspected round hole and the central point of the circumference to obtain boundary points and edge intermediate points, and defining an interval for the subsequent selection of an initial threshold; the image is enhanced by utilizing logarithmic transformation, so that the initial threshold and the iteration threshold in the subsequent iteration process are more accurately calculated; the invention also obtains the double thresholds of each target image block in a self-adaptive manner according to an iterative algorithm, so that the edge characteristic result obtained by final edge detection is more accurate, and the defect detection result is more accurate.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. An edge detection-based PCB production process on-line detection method is characterized in that:
acquiring a gray image of a PCB to be detected;
dividing the gray level image into a plurality of image blocks according to the initial size, and acquiring a plurality of target image blocks according to the difference between the mean value of the gray level information entropies of all the image blocks and the gray level information entropy of the gray level image;
acquiring a suspected round hole edge line in each target image block; obtaining a gray level distribution entropy of each pixel point according to the gray level value distribution probability and the gray level value of each pixel point in the gray level image; determining an initial threshold interval of each target image block according to the distance between the pixel point on the edge line of the suspected round hole and the circumferential center point of the edge line of the suspected round hole and the gray level distribution entropy of the pixel point on the edge line of the suspected round hole and the circumferential center point;
acquiring an optimal segmentation threshold of an image formed by pixel points corresponding to the initial threshold interval of each target image block, and taking the optimal segmentation threshold obtained by each target image block as an initial threshold for iteration of the target image block;
carrying out image enhancement on each target image block in the gray level image to obtain an image-enhanced target image block and a gray level image; acquiring a gray value average value of suspected edge points in a gray image as an iteration threshold of each target image block, and if the difference value between the iteration threshold and the initial threshold of each target image block meets a set judgment threshold, taking the initial threshold of each target image block as a high threshold;
if the difference value between the iteration threshold value and the initial threshold value of the target image block does not accord with the set judgment threshold value, taking the iteration threshold value of the target image block as a new initial threshold value of the target image block, re-determining the new iteration threshold value of the target image block according to the mean value of the maximum gray value and the minimum gray value in the target image block, re-judging whether the difference value between the new initial threshold value and the new iteration threshold value of the target image block accords with the judgment threshold value or not, if not, continuing iteration until the difference value between the initial threshold value and the iteration threshold value of the target image block accords with the judgment threshold value, and taking the iteration threshold value obtained when the difference value accords with the judgment threshold value as a high threshold value of the corresponding target image block;
obtaining a low threshold value of a corresponding target image block according to the high threshold value of each target image block;
and performing edge detection on each target image block by using the high threshold and the low threshold of each target image block, and acquiring a defect area of the PCB to be detected according to an edge detection result.
2. The PCB production process on-line detection method based on edge detection as claimed in claim 1, wherein the step of obtaining a plurality of target image blocks according to the difference between the mean value of the gray scale information entropies of all the image blocks and the gray scale information entropy of the gray scale image comprises:
if the difference value between the mean value of the gray scale information entropies of all the image blocks obtained for the first time and the gray scale information entropies of the gray scale images is smaller than or equal to a set threshold value, optionally dividing one image block obtained for the first time to obtain a plurality of image blocks with smaller sizes;
calculating the difference value between the mean value of the gray scale information entropies of all the image blocks in the gray scale image and the gray scale information entropy of the gray scale image;
if the obtained difference is smaller than or equal to the set threshold, selecting one image block obtained for the first time to be divided to obtain a plurality of image blocks with smaller sizes;
calculating the difference between the mean value of the gray scale information entropies of all the image blocks in the gray scale image and the gray scale information entropy of the gray scale image;
if the obtained difference is less than or equal to the set threshold, continuing to divide the image block in the gray level image;
stopping image segmentation until the difference between the mean value of the gray scale information entropies of all the image blocks and the gray scale information entropies of the gray scale images is greater than a set threshold;
and recording all the divided image blocks in the gray-scale image as target image blocks.
3. The PCB production process on-line detection method based on edge detection as claimed in claim 1, wherein the step of obtaining the suspected round hole edge line in each target image block comprises:
carrying out non-maximum suppression on the gray level image, wherein the reserved points in the gray level image after the non-maximum suppression are suspected edge points;
carrying out Hough circle detection on all the suspected edge points to obtain suspected round hole edge lines in the gray level image;
and obtaining a suspected round hole edge line in the target image block according to the corresponding position of the target image block in the gray level image.
4. The PCB production process on-line detection method based on edge detection as claimed in claim 1, wherein the formula for obtaining the gray distribution entropy of each pixel point according to the gray value distribution probability and the gray value of each pixel point in the gray image is as follows:
Figure 135571DEST_PATH_IMAGE002
wherein, the first and the second end of the pipe are connected with each other,
Figure DEST_PATH_IMAGE003
representing a gray value in a gray-scale image of
Figure 36399DEST_PATH_IMAGE004
The gray level distribution entropy of the pixel points;
Figure 284978DEST_PATH_IMAGE004
is shown as
Figure DEST_PATH_IMAGE005
Gray values of the class pixel points;
Figure 457684DEST_PATH_IMAGE005
is shown as
Figure 944160DEST_PATH_IMAGE005
The pixel points of the same gray value are the same type of pixel points;
Figure 704306DEST_PATH_IMAGE006
representing the total number of pixel points in the gray level image;
Figure DEST_PATH_IMAGE007
representing a gray value in a gray-scale image of
Figure 141978DEST_PATH_IMAGE004
The number of pixels of (c).
5. The edge detection-based PCB production process online detection method of claim 1, wherein the step of determining the initial threshold interval of each target image block according to the distance between the pixel point on the suspected circular hole edge line and the circumferential center point of the suspected circular hole edge line and the gray scale distribution entropy of the pixel point on the suspected circular hole edge line and the circumferential center point comprises:
calculating the gray scale dispersion of each pixel point on the edge line according to the distance between the pixel point on the edge line of the suspected circular hole in each target image block and the circumferential center point and the gray scale distribution entropy of the pixel point on the edge line of the suspected circular hole and the circumferential center point;
the formula for calculating the gray scale dispersion is as follows:
Figure DEST_PATH_IMAGE009
wherein the content of the first and second substances,
Figure 216244DEST_PATH_IMAGE010
indicating a suspected round holeThe gray level dispersion between the pixel point on the edge line and the circumference center point of the suspected round hole edge line;
Figure DEST_PATH_IMAGE011
the coordinate on the edge line of the suspected round hole is represented as
Figure 996375DEST_PATH_IMAGE012
Pixel point (c) and the circumference center point of the suspected round hole edge line
Figure DEST_PATH_IMAGE013
The Euclidean distance between;
Figure 865105DEST_PATH_IMAGE014
the coordinate on the edge line of the suspected round hole is represented as
Figure 557117DEST_PATH_IMAGE012
The gray level distribution entropy of the pixel points;
Figure DEST_PATH_IMAGE015
expressing the gray distribution entropy of the circumferential center point of the suspected circular hole edge line;
Figure 340134DEST_PATH_IMAGE013
the coordinates of the circumference center point of the suspected round hole edge line are obtained;
Figure 535623DEST_PATH_IMAGE016
is a natural constant;
setting a boundary threshold, and acquiring the median of gray values of all pixel points of which the gray dispersion is greater than the boundary threshold in the target image block as an upper boundary value;
acquiring the median of the gray values of all the pixel points with the gray dispersion smaller than or equal to the boundary threshold value as a lower boundary value;
and obtaining an initial threshold interval of each target image block by using the upper boundary value and the lower boundary value of each target image block.
6. The PCB production process on-line detection method based on edge detection as claimed in claim 1, wherein the step of re-determining the new iteration threshold of the target image block according to the mean of the maximum gray value and the minimum gray value in the target image block comprises:
obtaining the mean value of the maximum gray value and the minimum gray value in the target image block
Figure DEST_PATH_IMAGE017
Obtaining a mean value greater than in each target image block
Figure 336439DEST_PATH_IMAGE017
Gray value mean value of pixel point
Figure 515748DEST_PATH_IMAGE018
And is not more than the mean value
Figure 525292DEST_PATH_IMAGE017
Gray value mean value of pixel point
Figure DEST_PATH_IMAGE019
Two mean values obtained
Figure 542665DEST_PATH_IMAGE018
Figure 549935DEST_PATH_IMAGE019
Calculating the mean value as a new iteration threshold value of the target image block;
if the difference value between the new iteration threshold and the new initial threshold of the target image block does not accord with the set judgment threshold, acquiring the difference value in the target image block
Figure 216540DEST_PATH_IMAGE017
To
Figure 734502DEST_PATH_IMAGE018
Mean value of gray values of pixels between
Figure 170163DEST_PATH_IMAGE020
And
Figure 551597DEST_PATH_IMAGE017
to
Figure 938453DEST_PATH_IMAGE019
Mean value of gray values of pixels between
Figure DEST_PATH_IMAGE021
To the two obtained mean values
Figure 696325DEST_PATH_IMAGE020
Figure 986492DEST_PATH_IMAGE021
And calculating the mean value to be used as a new iteration threshold value of the target image block again.
7. The PCB production process on-line detection method based on edge detection as recited in claim 1, wherein the formula for obtaining the low threshold value of the corresponding target image block according to the high threshold value of each target image block is as follows:
Figure DEST_PATH_IMAGE023
wherein, the first and the second end of the pipe are connected with each other,
Figure 870370DEST_PATH_IMAGE024
a low threshold representing a target image block;
Figure DEST_PATH_IMAGE025
representing objectsA high threshold for the image block;
Figure 980408DEST_PATH_IMAGE026
judging a threshold value;
Figure DEST_PATH_IMAGE027
to select the coefficients.
8. The PCB production process on-line detection method based on edge detection as claimed in claim 1, wherein the step of performing edge detection on each target image block by using the high threshold and the low threshold of each target image block to obtain the defect area of the PCB to be detected comprises:
judging whether two target image blocks need to be combined or not according to the high threshold and the low threshold of the two adjacent target image blocks, combining the target image blocks needing to be combined to obtain a target area, and obtaining the high threshold and the low threshold of the target area by using the high threshold and the low threshold of the two adjacent target image blocks;
and respectively carrying out edge detection on the corresponding target area and target image block by using the high threshold and the low threshold of all the merged target areas and the high threshold and the low threshold of the target image block without merging to obtain a defect area in the PCB to be detected.
9. The PCB production process on-line detection method based on edge detection as recited in claim 8, wherein the step of judging whether the two target image blocks need to be merged according to the high threshold and the low threshold of the two adjacent target image blocks, and merging the target image blocks that need to be merged to obtain the target area comprises:
respectively calculating the proportion of gray values greater than a high threshold value in the suspected edge points of the two target image blocks
Figure 509348DEST_PATH_IMAGE028
And the ratio of the gray value of the suspected edge point to be less than the low threshold value
Figure DEST_PATH_IMAGE029
And the proportion of the gray value of the suspected edge point being less than the high threshold value and greater than the low threshold value
Figure 857284DEST_PATH_IMAGE030
Interchanging the high threshold and the low threshold of two adjacent target image blocks, and respectively calculating the proportion of gray values larger than the high threshold in the suspected edge points in the target image blocks after interchanging the high threshold and the low threshold
Figure DEST_PATH_IMAGE031
Ratio of gray value smaller than low threshold value in suspected edge point
Figure 347564DEST_PATH_IMAGE032
The ratio of the gray value smaller than the high threshold value and larger than the low threshold value in the suspected edge points
Figure DEST_PATH_IMAGE033
Respectively calculating the proportion of two target image blocks after threshold value interchange
Figure 318800DEST_PATH_IMAGE028
Figure 215212DEST_PATH_IMAGE029
Figure 11130DEST_PATH_IMAGE030
And
Figure 135294DEST_PATH_IMAGE031
Figure 485503DEST_PATH_IMAGE032
Figure 185606DEST_PATH_IMAGE033
difference between two target maps, ifAnd if the difference values obtained by the image blocks are less than or equal to the set threshold, combining two adjacent target image blocks to obtain a target area.
10. The PCB production process on-line detection method based on edge detection as claimed in claim 8, wherein the step of obtaining the high threshold and the low threshold of the target area by using the high threshold and the low threshold of two adjacent target image blocks comprises:
taking the larger value of the two groups of high threshold values of the two adjacent target image blocks as the high threshold value of the target area;
and taking the smaller value of the two groups of low threshold values of the two adjacent target image blocks as the low threshold value of the target area.
CN202211205424.2A 2022-09-30 2022-09-30 PCB production process online detection method based on edge detection Pending CN115272346A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211205424.2A CN115272346A (en) 2022-09-30 2022-09-30 PCB production process online detection method based on edge detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211205424.2A CN115272346A (en) 2022-09-30 2022-09-30 PCB production process online detection method based on edge detection

Publications (1)

Publication Number Publication Date
CN115272346A true CN115272346A (en) 2022-11-01

Family

ID=83757970

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211205424.2A Pending CN115272346A (en) 2022-09-30 2022-09-30 PCB production process online detection method based on edge detection

Country Status (1)

Country Link
CN (1) CN115272346A (en)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115439474A (en) * 2022-11-07 2022-12-06 山东天意机械股份有限公司 Rapid positioning method for power equipment fault
CN115457035A (en) * 2022-11-10 2022-12-09 山东鲁旺机械设备有限公司 Machine vision-based construction hanging basket welding quality detection method
CN115546241A (en) * 2022-12-06 2022-12-30 成都数之联科技股份有限公司 Edge detection method, edge detection device, electronic equipment and computer readable storage medium
CN115578383A (en) * 2022-11-23 2023-01-06 惠州威尔高电子有限公司 Thick copper PCB detection method based on panoramic image
CN115689948A (en) * 2023-01-05 2023-02-03 济宁智诚物业管理有限公司 Image enhancement method for detecting cracks of building water supply pipeline
CN115858832A (en) * 2023-03-01 2023-03-28 天津市邱姆预应力钢绞线有限公司 Method and system for storing production data of steel strand
CN115908429A (en) * 2023-03-08 2023-04-04 山东歆悦药业有限公司 Foot bath powder grinding precision detection method and system
CN116128877A (en) * 2023-04-12 2023-05-16 山东鸿安食品科技有限公司 Intelligent exhaust steam recovery monitoring system based on temperature detection
CN116188462A (en) * 2023-04-24 2023-05-30 深圳市翠绿贵金属材料科技有限公司 Noble metal quality detection method and system based on visual identification
CN116664453A (en) * 2023-07-31 2023-08-29 山东中泳电子股份有限公司 PET (polyethylene terephthalate) plate detection method for swimming touch plate
CN116703921A (en) * 2023-08-07 2023-09-05 东莞市溢信高电子科技有限公司 Method for detecting quality of surface coating of flexible circuit board
CN116758077A (en) * 2023-08-18 2023-09-15 山东航宇游艇发展有限公司 Online detection method and system for surface flatness of surfboard
CN116883270A (en) * 2023-07-04 2023-10-13 广州医科大学附属第四医院(广州市增城区人民医院) Soft mirror clear imaging system for lithotripsy operation
CN116883401A (en) * 2023-09-07 2023-10-13 天津市生华厚德科技有限公司 Industrial product production quality detection system
CN116912277A (en) * 2023-09-12 2023-10-20 山东鲁泰化学有限公司 Circulating water descaling effect evaluation method and system
CN117274722A (en) * 2023-11-21 2023-12-22 深圳市咏华宇电子有限公司 Intelligent detection method for distribution box based on infrared image
CN117274291A (en) * 2023-11-21 2023-12-22 深圳市京鼎工业技术股份有限公司 Method for detecting mold demolding residues based on computer vision
CN117392130A (en) * 2023-12-12 2024-01-12 山东海纳智能装备科技股份有限公司 On-line fault diagnosis system based on infrared image
CN117437223A (en) * 2023-12-20 2024-01-23 连兴旺电子(深圳)有限公司 Intelligent defect detection method for high-speed board-to-board connector
CN117455870A (en) * 2023-10-30 2024-01-26 太康精密(中山)有限公司 Connecting wire and connector quality visual detection method
CN117522875A (en) * 2024-01-08 2024-02-06 深圳市新创源精密智造有限公司 Visual detection method for production quality of semiconductor carrier tape based on image filtering

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114155230A (en) * 2021-12-07 2022-03-08 江苏普立特科技有限公司 Quality classification method and system for injection molding PC board with smooth surface
CN114862849A (en) * 2022-07-06 2022-08-05 山东智领新材料有限公司 Aluminum alloy plate film coating effect evaluation method based on image processing
CN115049653A (en) * 2022-08-15 2022-09-13 凤芯微电子科技(聊城)有限公司 Integrated circuit board quality detection system based on computer vision
CN115063400A (en) * 2022-07-22 2022-09-16 山东中艺音美器材有限公司 Musical instrument production defect detection method using visual means

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114155230A (en) * 2021-12-07 2022-03-08 江苏普立特科技有限公司 Quality classification method and system for injection molding PC board with smooth surface
CN114862849A (en) * 2022-07-06 2022-08-05 山东智领新材料有限公司 Aluminum alloy plate film coating effect evaluation method based on image processing
CN115063400A (en) * 2022-07-22 2022-09-16 山东中艺音美器材有限公司 Musical instrument production defect detection method using visual means
CN115049653A (en) * 2022-08-15 2022-09-13 凤芯微电子科技(聊城)有限公司 Integrated circuit board quality detection system based on computer vision

Cited By (38)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115439474A (en) * 2022-11-07 2022-12-06 山东天意机械股份有限公司 Rapid positioning method for power equipment fault
CN115457035A (en) * 2022-11-10 2022-12-09 山东鲁旺机械设备有限公司 Machine vision-based construction hanging basket welding quality detection method
CN115457035B (en) * 2022-11-10 2023-03-24 山东鲁旺机械设备有限公司 Machine vision-based construction hanging basket welding quality detection method
CN115578383A (en) * 2022-11-23 2023-01-06 惠州威尔高电子有限公司 Thick copper PCB detection method based on panoramic image
CN115578383B (en) * 2022-11-23 2023-04-07 惠州威尔高电子有限公司 Thick copper PCB detection method based on panoramic image
CN115546241A (en) * 2022-12-06 2022-12-30 成都数之联科技股份有限公司 Edge detection method, edge detection device, electronic equipment and computer readable storage medium
CN115689948A (en) * 2023-01-05 2023-02-03 济宁智诚物业管理有限公司 Image enhancement method for detecting cracks of building water supply pipeline
CN115858832A (en) * 2023-03-01 2023-03-28 天津市邱姆预应力钢绞线有限公司 Method and system for storing production data of steel strand
CN115858832B (en) * 2023-03-01 2023-05-02 天津市邱姆预应力钢绞线有限公司 Method and system for storing production data of steel strand
CN115908429B (en) * 2023-03-08 2023-05-19 山东歆悦药业有限公司 Method and system for detecting grinding precision of foot soaking powder
CN115908429A (en) * 2023-03-08 2023-04-04 山东歆悦药业有限公司 Foot bath powder grinding precision detection method and system
CN116128877A (en) * 2023-04-12 2023-05-16 山东鸿安食品科技有限公司 Intelligent exhaust steam recovery monitoring system based on temperature detection
CN116188462A (en) * 2023-04-24 2023-05-30 深圳市翠绿贵金属材料科技有限公司 Noble metal quality detection method and system based on visual identification
CN116188462B (en) * 2023-04-24 2023-08-11 深圳市翠绿贵金属材料科技有限公司 Noble metal quality detection method and system based on visual identification
CN116883270A (en) * 2023-07-04 2023-10-13 广州医科大学附属第四医院(广州市增城区人民医院) Soft mirror clear imaging system for lithotripsy operation
CN116883270B (en) * 2023-07-04 2024-03-22 广州医科大学附属第四医院(广州市增城区人民医院) Soft mirror clear imaging system for lithotripsy operation
CN116664453A (en) * 2023-07-31 2023-08-29 山东中泳电子股份有限公司 PET (polyethylene terephthalate) plate detection method for swimming touch plate
CN116664453B (en) * 2023-07-31 2023-10-20 山东中泳电子股份有限公司 PET (polyethylene terephthalate) plate detection method for swimming touch plate
CN116703921A (en) * 2023-08-07 2023-09-05 东莞市溢信高电子科技有限公司 Method for detecting quality of surface coating of flexible circuit board
CN116703921B (en) * 2023-08-07 2023-12-05 东莞市溢信高电子科技有限公司 Method for detecting quality of surface coating of flexible circuit board
CN116758077A (en) * 2023-08-18 2023-09-15 山东航宇游艇发展有限公司 Online detection method and system for surface flatness of surfboard
CN116758077B (en) * 2023-08-18 2023-10-20 山东航宇游艇发展有限公司 Online detection method and system for surface flatness of surfboard
CN116883401A (en) * 2023-09-07 2023-10-13 天津市生华厚德科技有限公司 Industrial product production quality detection system
CN116883401B (en) * 2023-09-07 2023-11-10 天津市生华厚德科技有限公司 Industrial product production quality detection system
CN116912277B (en) * 2023-09-12 2023-12-12 山东鲁泰化学有限公司 Circulating water descaling effect evaluation method and system
CN116912277A (en) * 2023-09-12 2023-10-20 山东鲁泰化学有限公司 Circulating water descaling effect evaluation method and system
CN117455870B (en) * 2023-10-30 2024-04-16 太康精密(中山)有限公司 Connecting wire and connector quality visual detection method
CN117455870A (en) * 2023-10-30 2024-01-26 太康精密(中山)有限公司 Connecting wire and connector quality visual detection method
CN117274722B (en) * 2023-11-21 2024-01-26 深圳市咏华宇电子有限公司 Intelligent detection method for distribution box based on infrared image
CN117274291B (en) * 2023-11-21 2024-02-13 深圳市京鼎工业技术股份有限公司 Method for detecting mold demolding residues based on computer vision
CN117274291A (en) * 2023-11-21 2023-12-22 深圳市京鼎工业技术股份有限公司 Method for detecting mold demolding residues based on computer vision
CN117274722A (en) * 2023-11-21 2023-12-22 深圳市咏华宇电子有限公司 Intelligent detection method for distribution box based on infrared image
CN117392130A (en) * 2023-12-12 2024-01-12 山东海纳智能装备科技股份有限公司 On-line fault diagnosis system based on infrared image
CN117392130B (en) * 2023-12-12 2024-02-23 山东海纳智能装备科技股份有限公司 On-line fault diagnosis system based on infrared image
CN117437223A (en) * 2023-12-20 2024-01-23 连兴旺电子(深圳)有限公司 Intelligent defect detection method for high-speed board-to-board connector
CN117437223B (en) * 2023-12-20 2024-02-23 连兴旺电子(深圳)有限公司 Intelligent defect detection method for high-speed board-to-board connector
CN117522875A (en) * 2024-01-08 2024-02-06 深圳市新创源精密智造有限公司 Visual detection method for production quality of semiconductor carrier tape based on image filtering
CN117522875B (en) * 2024-01-08 2024-04-05 深圳市新创源精密智造有限公司 Visual detection method for production quality of semiconductor carrier tape based on image filtering

Similar Documents

Publication Publication Date Title
CN115272346A (en) PCB production process online detection method based on edge detection
CN116168026B (en) Water quality detection method and system based on computer vision
CN114418957B (en) Global and local binary pattern image crack segmentation method based on robot vision
CN109242853B (en) PCB defect intelligent detection method based on image processing
WO2017121018A1 (en) Method and apparatus for processing two-dimensional code image, and terminal and storage medium
CN111583216A (en) Defect detection method for PCBA
CN111598801B (en) Identification method for weak Mura defect
JP2024050880A (en) Character segmentation method, device, and computer-readable storage medium
CN111709964B (en) PCBA target edge detection method
CN110378893B (en) Image quality evaluation method and device and electronic equipment
CN115775250A (en) Golden finger circuit board defect rapid detection system based on digital image analysis
CN116735612B (en) Welding defect detection method for precise electronic components
CN114332026A (en) Visual detection method and device for scratch defects on surface of nameplate
CN116542982A (en) Departure judgment device defect detection method and device based on machine vision
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
TW202127372A (en) Method for defect level determination and computer readable storage medium thereof
CN112419207A (en) Image correction method, device and system
CN115439523A (en) Method and equipment for detecting pin size of semiconductor device and storage medium
CN115272350A (en) Method for detecting production quality of computer PCB mainboard
CN114998311A (en) Part precision detection method based on homomorphic filtering
CN117152165B (en) Photosensitive chip defect detection method and device, storage medium and electronic equipment
CN112819827B (en) LED electrode offset detection method and device based on polar coordinate transformation and storage medium
CN116883408B (en) Integrating instrument shell defect detection method based on artificial intelligence
CN115254674B (en) Bearing defect sorting method
CN109211919B (en) Method and device for identifying magnetic tile defect area

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