CN117893457B - PCB intelligent detection method, device and computer equipment - Google Patents
PCB intelligent detection method, device and computer equipment Download PDFInfo
- Publication number
- CN117893457B CN117893457B CN202410306969.5A CN202410306969A CN117893457B CN 117893457 B CN117893457 B CN 117893457B CN 202410306969 A CN202410306969 A CN 202410306969A CN 117893457 B CN117893457 B CN 117893457B
- Authority
- CN
- China
- Prior art keywords
- value
- image
- illumination
- pcb
- brightness
- 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
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 70
- 238000005286 illumination Methods 0.000 claims description 161
- 238000000034 method Methods 0.000 claims description 34
- 238000012545 processing Methods 0.000 claims description 29
- 230000003044 adaptive effect Effects 0.000 claims description 26
- 239000000523 sample Substances 0.000 claims description 25
- 239000011159 matrix material Substances 0.000 claims description 17
- 238000004364 calculation method Methods 0.000 claims description 14
- 238000003709 image segmentation Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 11
- 238000004422 calculation algorithm Methods 0.000 claims description 9
- 150000003071 polychlorinated biphenyls Chemical class 0.000 claims description 9
- 238000004891 communication Methods 0.000 claims description 8
- 238000000605 extraction Methods 0.000 claims description 4
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 238000012937 correction Methods 0.000 claims description 3
- 238000003708 edge detection Methods 0.000 claims description 3
- 230000000694 effects Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 5
- 238000007689 inspection Methods 0.000 description 4
- 239000003990 capacitor Substances 0.000 description 3
- 230000007547 defect Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000005259 measurement Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 238000000265 homogenisation Methods 0.000 description 1
- 230000006698 induction Effects 0.000 description 1
- 230000005764 inhibitory process Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
- 238000011179 visual inspection Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30141—Printed circuit board [PCB]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The application relates to the technical field of PCB detection, in particular to an intelligent PCB detection method, an intelligent PCB detection device and intelligent PCB detection computer equipment.
Description
Technical Field
The application belongs to the technical field of PCB detection, and particularly relates to an intelligent PCB detection method, device and computer equipment.
Background
For the current PCB (printed circuit board, namely a printed circuit board, simply called a printed board) industry, automatic optical inspection (Automated Optical Inspection, simply called AOI) is adopted, so that a plurality of faults in the PCB can be detected. It is very useful at many stages of the PCB production process, it is faster than manual visual inspection, and eliminates the possibility of human error. However, when the detection method is used for detecting, it is difficult to detect components outside the inspection line and places where the brightness of the image is not obvious, and erroneous judgment is likely to occur.
Disclosure of Invention
The application mainly aims to provide an intelligent detection system and a detection method for a PCB (printed Circuit Board) to solve the technical problems in the background technology.
The application provides an intelligent detection method of a PCB, which comprises the following steps:
Acquiring first illumination image data of a plurality of PCBs, wherein the first illumination image data comprises a first illumination image and illumination parameter information;
Performing image processing on the first illumination image of each PCB to obtain a binarization image;
extracting the appearance outline of each PCB according to the binarization graph;
Judging whether the appearance outline meets a first preset condition or not;
if the appearance outline meets the first preset condition, calibrating the PCB corresponding to the appearance outline meeting the first preset condition as a first PCB;
acquiring illumination parameter information corresponding to the first PCB, and carrying out illumination detection on the first PCB according to the illumination parameter information to obtain detection results, wherein the detection results comprise illumination uniformity and illumination non-uniformity;
when the detection result is that illumination is uneven, image segmentation is carried out on a first illumination image corresponding to the first PCB, so that a plurality of brightness areas are obtained;
Acquiring a gray value corresponding to each brightness region, and carrying out graying treatment on each brightness region according to the gray value to obtain an initial brightness threshold value of each brightness region;
and calculating an adaptive threshold according to the plurality of initial brightness thresholds, and adaptively adjusting the initial brightness threshold of each brightness region according to the adaptive threshold so as to make the brightness of the plurality of brightness regions identical.
Preferably, the step of performing image processing on the first illumination image of each PCB to obtain a binarized image includes:
Acquiring an image format of a first illumination image, and judging whether the image format is an RGB format or not;
If the first illumination image format is an RGB format, acquiring an RGB color space of the first illumination image, and determining an RGB color space matrix according to the RGB color space;
Carrying out graying treatment on the first illumination image according to the RGB color space matrix to obtain a gray image histogram;
Performing image format conversion on the gray image histogram to obtain a gray image and a gray image threshold corresponding to the gray image;
and carrying out binarization processing on the gray level image based on a threshold iteration method and a gray level image threshold value to obtain a binarization image.
Preferably, the step of extracting the appearance outline of each PCB according to the binarization map includes:
According to an edge detection algorithm, acquiring a gradient direction and image parameters of a binarization image edge pixel point, wherein the gradient direction comprises a vertical direction and a horizontal direction, and the image parameters comprise image brightness information, color information and image pixel information;
Acquiring a first convolution kernel of the edge pixel point in the vertical direction, and convolving the first convolution kernel with the image parameters to obtain the maximum first appearance contour gradient amplitude value in the vertical direction of the edge pixel point;
Acquiring a second convolution kernel of the edge pixel points in the horizontal direction, and convolving the second convolution kernel with the image parameters to obtain the maximum second appearance contour gradient amplitude value of each pixel point in the horizontal direction of the edge;
judging whether the first appearance contour gradient amplitude and the second appearance contour gradient amplitude are both larger than a preset appearance contour gradient amplitude or not;
And if the first appearance contour gradient amplitude value and the second appearance contour gradient amplitude value are both larger than the preset appearance contour gradient amplitude value, taking the corresponding edge pixel points as the appearance contour of the PCB.
Preferably, after the step of taking the corresponding edge pixel point as the appearance outline of the PCB board, if the first appearance outline gradient amplitude and the second appearance outline gradient amplitude are both greater than the preset appearance outline gradient amplitude, the method further includes:
acquiring a communication area according to the binarization graph, and judging whether an arc-shaped image exists in the communication area;
If the circular arc image exists in the communication area, acquiring at least one circle center coordinate corresponding to the circular arc image;
obtaining a circle center deformation value corresponding to the circle center coordinate and a linear distance from the circle center coordinate to any one edge point of the arc image;
calculating the radius of the arc according to the circle center deformation value and the straight line distance from the circle center coordinate to any edge point of the arc image, wherein the calculation formula is as follows:
r=C*S;
Wherein r represents the radius of the arc, and C represents the linear distance from the center coordinates to any edge point of the arc image;
obtaining a gradient calculation error value, and calculating a maximum allowable error value corresponding to the circle center coordinate according to the gradient calculation error value and the arc radius, wherein a calculation formula is as follows:
;
Wherein the said Representing the maximum allowable error value corresponding to the center coordinates, the/>Representing gradient calculation error values;
And calibrating the circle center coordinates according to the maximum allowable error value, taking the calibrated circle center coordinates as the circle center of the circular arc image, and taking the straight line distance from the circle center to any edge point of the circular arc image as the radius of the circular arc image.
Preferably, after the step of determining whether the appearance outline meets the first preset condition, the method further includes:
If the appearance outline does not accord with the first preset condition, calibrating the PCB which does not accord with the first preset condition as a second PCB, and acquiring equipment positioning information corresponding to the second PCB, wherein the equipment positioning information comprises a coordinate value of an acquisition device and a coordinate value of an illumination probe;
judging whether the coordinate value of the acquisition device accords with a first preset value or not;
if the coordinate value of the acquisition device does not accord with the first preset value, adjusting the position of the acquisition device according to the first preset value, and acquiring the adjusted coordinate value of the acquisition device;
returning to the step of judging whether the coordinate value of the acquisition device accords with a first preset value;
If the coordinate value of the acquisition device accords with a first preset value, judging whether the coordinate value of the illumination probe accords with a second preset value or not;
If the coordinate value of the illumination probe does not accord with the second preset position, adjusting the position of the illumination probe according to the second preset value, and acquiring the adjusted coordinate value of the illumination probe;
returning to the step of judging whether the coordinate value of the illumination probe accords with a second preset value;
The sensor acquires the position information of the second PCB, converts the position information of the second PCB into output signals and sends the output signals to the conveyor belt, wherein the second PCB is positioned on the conveyor belt, and the sensors are at least two and are respectively arranged on two sides of the conveyor belt;
the conveyor belt receives the output signal, and calculates the moving distance of the second PCB according to the output signal, the first preset value and the second preset value, so as to move the second PCB according to the moving distance.
Preferably, the step of calculating an adaptive threshold according to a plurality of initial luminance thresholds and adaptively adjusting the initial luminance threshold of each luminance region according to the adaptive threshold so as to make the luminance of the plurality of luminance regions the same comprises:
calculating a brightness average value and a brightness difference average value according to the initial brightness threshold values;
Searching a maximum threshold value in a plurality of initial brightness threshold values;
acquiring an illumination reflection value of each brightness area;
Calculating an adaptive threshold value of each brightness region according to the brightness average value, the maximum threshold value and the illumination reflection value, wherein a calculation formula is as follows:
Wherein, For each luminance region, m is the maximum of a plurality of initial luminance thresholds,For correction factor,/>For the illumination reflection value of the brightness region,/>For the average luminance value, μ is the average luminance difference value.
The application also provides an intelligent detection device for the PCB, which comprises the following components:
the first acquisition module is used for acquiring first illumination image data of a plurality of PCBs, wherein the first illumination image data comprises first illumination images and illumination parameter information;
The image processing module is used for carrying out image processing on the first illumination image of each PCB to obtain a binarization image;
the extraction module is used for extracting the appearance outline of each PCB according to the binarization graph;
The judging module is used for judging whether the appearance outline accords with a first preset condition;
The calibration module is used for calibrating the PCB corresponding to the appearance outline meeting the first preset condition as a first PCB if the appearance outline meets the first preset condition;
The second acquisition module is used for acquiring illumination parameter information corresponding to the first PCB, and carrying out illumination detection on the first PCB according to the illumination parameter information to obtain detection results, wherein the detection results comprise illumination uniformity and illumination non-uniformity;
the image segmentation module is used for carrying out image segmentation on a first illumination image corresponding to the first PCB when the detection result is that illumination is uneven, so as to obtain a plurality of brightness areas;
the grey processing module is used for acquiring the grey value corresponding to each brightness region, and carrying out grey processing on each brightness region according to the grey value to obtain an initial brightness threshold value of each brightness region;
And the adjusting module is used for calculating an adaptive threshold according to the plurality of initial brightness thresholds and carrying out adaptive adjustment on the initial brightness threshold of each brightness area according to the adaptive threshold so as to enable the brightness of the plurality of brightness areas to be the same.
The application also provides a computer device comprising a memory storing a computer program and a processor implementing the steps of the above method when executing the computer program.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the above method.
The beneficial effects are that: the first illumination image data of the plurality of PCBs are obtained and subjected to image processing, so that whether the appearance outline of each PCB is complete or not can be judged according to the obtained binarization image, when the appearance outline is complete, the PCB is indicated to be in the detected sight, the PCB can be defined as the first PCB, illumination reference information of the first PCB is obtained, whether uneven illumination occurs or not can be judged through the illumination reference information, when uneven illumination occurs, the first illumination image is subjected to image segmentation, and the plurality of brightness areas of the first illumination image are subjected to self-adaptive adjustment through calculating the self-adaptive threshold value, so that the brightness is the same, the condition that the detection result is inaccurate due to different illumination darkness of the image can be avoided, and the probability of detection erroneous judgment is reduced.
Drawings
Fig. 1 is a schematic diagram illustrating steps of a method for intelligent detection of a PCB board according to an embodiment of the present application.
Fig. 2 is a schematic structural diagram of a PCB intelligent detection system according to an embodiment of the application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
As shown in fig. 1 and 2, the present application provides an intelligent detection method for a PCB board, including:
S1, acquiring first illumination image data of a plurality of PCBs, wherein the first illumination image data comprises a first illumination image and illumination parameter information;
s2, performing image processing on the first illumination image of each PCB to obtain a binarization image;
S3, extracting the appearance outline of each PCB according to the binarization graph;
s4, judging whether the appearance outline meets a first preset condition or not;
S5, if the appearance outline meets a first preset condition, calibrating the PCB corresponding to the appearance outline meeting the first preset condition as a first PCB;
S6, acquiring illumination parameter information corresponding to the first PCB, and carrying out illumination detection on the first PCB according to the illumination parameter information to obtain detection results, wherein the detection results comprise illumination uniformity and illumination non-uniformity;
s7, when the detection result is that the illumination is uneven, performing image segmentation on a first illumination image corresponding to the first PCB to obtain a plurality of brightness areas;
s8, acquiring a gray value corresponding to each brightness region, and carrying out gray processing on each brightness region according to the gray value to obtain an initial brightness threshold value of each brightness region;
S9, calculating an adaptive threshold according to the initial brightness thresholds, and carrying out adaptive adjustment on the initial brightness threshold of each brightness area according to the adaptive threshold so as to enable the brightness of the brightness areas to be the same.
As described in the above steps S1-S9, in recent years, along with the continuous advancement of the modern information technology level, people put forward higher requirements on the quality of electronic products, as an electronic product carrier, the quality detection of a printed circuit board (Printed Circuit Board, PCB) becomes a core problem very important to the electronic manufacturing industry, but when the detection is performed by an automatic optical detection method, it is difficult to detect components outside the inspection line and places where the brightness of images is not very obvious, in order to improve the efficiency and precision of defect detection, when the detection is performed on a PCB board, the first illumination image data of a plurality of PCB boards in detection is acquired, the first illumination image data comprises first illumination images and illumination parameter information, thereby obtaining a binarization map by performing gray processing on the first illumination images, and judging whether the appearance contour of each PCB board is within a detection range according to the integrity of the appearance contour of the PCB board, if the appearance contour of the PCB board is not within the detection range is complete, the appearance contour of the PCB board is not completely, namely, if the appearance contour of the PCB board is not completely detected within the first detection range, namely, the appearance contour of the PCB board is not completely corresponds to the first illumination contour of the PCB board, and the first illumination parameter can be obtained by a first illumination condition; if the illumination is uniform, the detection can be performed by an automatic optical detection method, if the illumination is non-uniform, the occurrence of bright and dark areas is represented, the detection cannot be performed by the automatic optical detection method, at this time, a first PCB board with the detection result of the non-uniform illumination can be screened out, the first illumination image corresponding to the first PCB board is subjected to image segmentation to obtain a plurality of different brightness areas, the gray value corresponding to each brightness area is obtained, and the gray value corresponding to each brightness area is subjected to gray processing according to the gray value.
In one embodiment, the step S2 of performing image processing on the first illumination image of each PCB to obtain a binarized image includes:
S21, acquiring an image format of a first illumination image, and judging whether the image format is an RGB format or not;
S22, if the first illumination image format is an RGB format, acquiring an RGB color space of the first illumination image, and determining an RGB color space matrix according to the RGB color space;
S23, carrying out graying treatment on the first illumination image according to the RGB color space matrix to obtain a gray image histogram;
s24, performing image format conversion on the gray image histogram to obtain a gray image and a gray image threshold corresponding to the gray image;
s25, binarizing the gray level image based on a threshold iteration method and a gray level image threshold to obtain a binarization image.
As described in the above steps S21-S25, when the image is collected on the PCB in the prior art, the image format is usually in RGB format, that is, the color image, if the appearance outline is obtained directly based on the color image pair, because it includes three channels of RGB, the operation processing needs to be performed on each channel, which results in excessive data processing capacity, in order to reduce the operation loss and increase the data processing speed, the embodiment obtains the appearance outline based on the binarization map, in the prior art, the binarization map is generally obtained by the local thresholding method and the global thresholding method, the binarization effect of the local thresholding method on small objects (such as the PCB with smaller area (20 CM long and 10CM wide) is poor, if the global thresholding method is adopted, and if the fixed thresholding method in the global thresholding method is too high because the set selection thresholding is adopted, if the threshold is too low, the background outside the first illumination image is easily misidentified as the first illumination image, which easily results in that the obtained binarized image cannot accurately correspond to the first illumination image, based on which, in the present embodiment, the RGB color space of the first illumination image is first obtained, the RGB image of the first illumination image can be understood as three planes in the RGB color space, each plane is a matrix of m×n, and red, green, and blue are respectively stored, so the matrix of the RGB color space is a three-dimensional matrix of m×n×3 as a whole, where M represents the number of rows, N represents the number of columns, and 3 represents three channels of three basic colors R (red) G (green) B (blue), for example: if the three-dimensional matrix of the first illumination image is (400,300,3), 400 and 300 represent the spatial information of the first illumination image, 400 represents the number of rows, and 300 represents the number of columns, wherein the R value of the red channel matrix is (400,300,1), the G value of the green channel matrix is (400,300,2), and the B value of the blue channel matrix is (400,300,3) in the first layer matrix. And determining an RGB color space matrix of the PCB to be detected according to the RGB first illumination image, wherein R values, G values and B values corresponding to all pixel points in the RGB image are respectively determined, and an average value of the R values, an average value of the G values and an average value of the B values corresponding to all pixel points form the RGB color space matrix of the PCB to be detected. And converting the RGB color space matrix into a gray image by gray processing, wherein the gray value corresponding to each pixel in the gray image is obtained by calculating the multi-channel numerical value of the pixel in the matched RGB image by comparing each pixel in the image with a set value, and the calculating method comprises the following steps:
determining a target area with a gray value smaller than a threshold value in the gray image, calculating to obtain a gray image histogram through the target area and each corresponding pixel value, converting an image format of a first illumination image according to the gray image histogram to obtain a gray image and a threshold value corresponding to the gray image, and performing binarization processing on the gray image based on a threshold iteration method to obtain a binarization image, wherein the specific threshold iteration method comprises the following steps: the method comprises the steps of calculating an optimal threshold value by using a threshold value iteration method, firstly obtaining a minimum gray value and a maximum gray value in a gray image, dividing the initial threshold value by a quotient of 2, dividing all pixel points of the gray image into two types according to the initial threshold value, wherein the pixel value of one type is smaller than or equal to the pixel value of a background area, the pixel value of the other type is larger than the pixel value of a first illumination image area, respectively calculating the pixel average value of the background area and the pixel average value of the first illumination image area, taking half of the sum of the pixel average values of the background area and the pixel average value as the threshold value of the next iteration, ending the iteration if the difference between the threshold value obtained by the current iteration and the threshold value of the previous iteration meets the preset condition, and obtaining a binary image.
In one embodiment, the step S3 of extracting the appearance outline of each PCB according to the binarization map includes:
S31, acquiring gradient directions and image parameters of edge pixel points of a binarization map according to an edge detection algorithm, wherein the gradient directions comprise a vertical direction and a horizontal direction, and the image parameters comprise image brightness information, color information and image pixel information;
s32, acquiring a first convolution kernel of the edge pixel point in the vertical direction, and convolving the first convolution kernel with the image parameters to obtain the maximum first appearance contour gradient amplitude value in the vertical direction of the edge pixel point;
s33, acquiring a second convolution kernel of the edge pixel point in the horizontal direction, and convolving the second convolution kernel with the image parameters to obtain the maximum second appearance contour gradient amplitude value of the edge pixel point in the horizontal direction;
s34, judging whether the first appearance contour gradient amplitude and the second appearance contour gradient amplitude are both larger than a preset appearance contour gradient amplitude;
and S35, if the first appearance contour gradient amplitude and the second appearance contour gradient amplitude are both larger than the preset appearance contour gradient amplitude, taking the corresponding edge pixel points as the appearance contour of the PCB.
As described in the above steps S31-S35, the image appearance contour and edge contour of each PCB board are extracted according to the binarized graph, the image edge can be detected by the gradient magnitude and direction, the gradient magnitude represents the image edge strength, the gradient direction represents the changing direction of the image edge, therefore the gradient magnitude and direction are used to combine the magnitude images in the horizontal direction and the vertical direction, the maximum magnitude can be obtained by comparing the directions thereof, the maximum magnitude image can be obtained by combining the portions with the maximum magnitudes in the respective directions, the purpose is to obtain the edge image, and the edge image can be used as the basis for further obtaining the edge contour and pixel coordinate extraction; after the maximum amplitude image and the corresponding pixel point are obtained as edge points, the operation of obtaining the edge contour can be performed. And positioning the components on the PCB in the obtained appearance outline of the PCB, and preparing for detecting the defects of the components. In the prior art, boundary position measurement is generally realized through a Hough algorithm in a position measurement algorithm, but the mode is performed in a three-dimensional space, so that the calculated amount is large, the operation speed is easy to cause, the equipment loss is high, based on the fact, the improved Hough algorithm performs simplified operation in the two-dimensional space, the effect of dimension reduction is achieved, and the false target phenomenon caused by partial gradient direction errors when the image edge gradient is calculated is removed, for example: the method is characterized in that most of image information is on the side face of a cylindrical body of the electrolytic capacitor, an acquired image can only show top information, the top image is a circle, after the edge contour of each PCB is extracted from a binarization graph, an image area consisting of front pixel points which have the same pixel value and are adjacent in position, namely a communication area, is divided and marked, the position area of the electronic component on the PCB in the communication area is screened out, the local gradient of a non-zero point in a circular image at the top of the electrolytic capacitor in the area is calculated, the non-maximum value of pixels is restrained in a Hough space to acquire the circle center of the circular image of the electrolytic capacitor in the circular component area, the distance from the circle center to the non-zero point pixel at the edge of the circular image is calculated as a radius, and because the direction error is generated when the edge gradient of the image is calculated, the error can lead to the position of the circle center to be detected and positioned, the position of the circle center is deviated from the position of the true circle center, the position of the circle center is different, the maximum allowable error is introduced into a Hough algorithm, the maximum allowable error is increased, the circle center error is defined by the maximum allowable error, and the maximum allowable error is obtained by the maximum error of the circle center of the circular area. Assuming that the error generated by the gradient calculation is B, the maximum allowable error obtaining formula is:
Wherein/> The maximum allowable error value of the circle center position is represented, and r represents the radius of the maximum allowable error region. After the maximum allowable error area is defined, some circle centers mapped by unnecessary edge points exist in the maximum allowable error area, the circle centers can cause the edge points to be used as target points, the deformation degree of the edge points can influence the positioning accuracy, therefore, the radius setting range of the maximum allowable error area is more than or equal to the product of the deformation degree of the circle centers and the radius, the error value needs to consider both the gradient error extremum and the deformation error extremum, and the gradient error extremum needs to be smaller than the deformation error extremum. The improved Hough algorithm has the advantages that the positioning speed is faster than that of a standard Hough algorithm, the positioning accuracy is improved on the basis of ensuring the positioning speed, and the images of the PCBs in the acquisition area are preprocessed in the mode, so that the appearance outline and the edges of each obtained PCB have obvious boundary lines, key characteristic parts of the images are extracted, and the good effects of detecting and identifying the defects of the PCBs in the later period are achieved.
In one embodiment, after the step S5 of determining whether the appearance outline meets the first preset condition, the method further includes:
S51, if the appearance outline does not meet the first preset condition, calibrating the PCB which does not meet the first preset condition as a second PCB, and acquiring equipment positioning information corresponding to the second PCB, wherein the equipment positioning information comprises a coordinate value of an acquisition device and a coordinate value of an illumination probe;
S52, judging whether the coordinate value of the acquisition device accords with a first preset value;
S53, if the coordinate value of the acquisition device does not accord with a first preset value, adjusting the position of the acquisition device according to the first preset value, and acquiring the adjusted coordinate value of the acquisition device;
S54, returning to the step of judging whether the coordinate value of the acquisition device accords with a first preset value;
s55, if the coordinate value of the acquisition device accords with a first preset value, judging whether the coordinate value of the illumination probe accords with a second preset value;
s56, if the coordinate value of the illumination probe does not accord with the second preset position, adjusting the position of the illumination probe according to the second preset value, and acquiring the adjusted coordinate value of the illumination probe;
s57, returning to the step of judging whether the coordinate value of the illumination probe accords with a second preset value;
S58, the sensor acquires the position information of the second PCB and positions the second PCB
The information is converted into output signals and sent to the conveyor belt, wherein the second PCB is positioned on the conveyor belt, and the sensors are at least two and are respectively arranged on two sides of the conveyor belt;
and S59, the conveyor belt receives the output signal, and calculates the moving distance of the second PCB according to the output signal, the first preset value and the second preset value, so as to move the second PCB according to the moving distance.
In the above steps S51-S59, the embodiment matches the coordinate value of the collecting device with the first preset position value, matches the coordinate value of the illumination probe with the second preset position value, determines whether the device reaches the preset placement area according to the current position coordinate value and the first preset value and the second preset value, and can be adjusted according to the preset coordinate value. Under the condition that the positions of other detection devices are not wrong, the position information of the second PCB which is not in the detection sight range is converted into an output signal according to the sensor induction and sent to the conveyor belt, the conveyor belt receives the output signal, the position of the output signal is adjusted to a preset position, the PCB which is not in the detection range can be detected more quickly through the mode, and adjustment is made quickly, so that the collected image of the PCB meets the detection standard with the complete preset appearance outline.
In one embodiment, a gray level image of a first illumination image is input into an illumination image segmentation model, the first illumination image is segmented into a plurality of illumination images with the same size by using a template with the size of N multiplied by N, specifically, a plurality of gray level values of the first illumination image can be obtained, statistical analysis is carried out on segmented areas of the first illumination image according to the gray level values, the brightness of the areas with high gray level values is bright, and the brightness of the areas with low gray level values is dark; the first illumination image is divided according to the divided gray values, so that divided areas of a plurality of areas with different brightness are obtained.
In one embodiment, the step S7 of calculating an adaptive threshold according to the plurality of initial luminance thresholds and adaptively adjusting the initial luminance threshold of each luminance region according to the adaptive threshold so that the luminance of the plurality of luminance regions is the same includes:
s71, calculating a brightness average value and a brightness difference average value according to a plurality of initial brightness thresholds;
S72, searching a maximum threshold value in a plurality of initial brightness threshold values;
S73, acquiring an illumination reflection value of each brightness area;
s74, calculating an adaptive threshold value of each brightness area according to the brightness average value, the maximum threshold value and the illumination reflection value, wherein a calculation formula is as follows:
Wherein, For each luminance region, m is the maximum of a plurality of initial luminance thresholds,For correction factor,/>For the illumination reflection value of the brightness region,/>For the average luminance value, μ is the average luminance difference value.
As described in the above steps S71-S74, in the prior art, the image histogram is generally uniformly processed, but in this way, the whole image is lightened when the image is globally equalized, the darker part of the image is lightened, but the originally bright part is also lightened, and exposure is caused, which clearly increases the difficulty of post detection. The brightness of each brightness area is adjusted through the self-adaptive threshold value, so that the part with uneven brightness of the first illumination image can be adjusted, the method has a good inhibition effect on the brighter area and a good compensation effect on the darker area, and the brightness of each brightness area is the same while the fine adjustment of other uniform parts is ensured, so that the overall homogenization of the brightness of the first illumination image is realized.
The application also provides an intelligent detection device for the PCB, which comprises the following components:
The first acquisition module 1 is used for acquiring first illumination image data of a plurality of PCBs, wherein the first illumination image data comprises a first illumination image and illumination parameter information;
The image processing module 2 is used for performing image processing on the first illumination image of each PCB to obtain a binarization image;
the extraction module 3 is used for extracting the appearance outline of each PCB according to the binarization graph;
the judging module 4 is used for judging whether the appearance outline accords with a first preset condition;
The calibration module 5 is used for calibrating the PCB corresponding to the appearance outline conforming to the first preset condition as a first PCB if the appearance outline conforms to the first preset condition;
the second obtaining module 6 is configured to obtain illumination parameter information corresponding to the first PCB, and perform illumination detection on the first PCB according to the illumination parameter information to obtain a detection result, where the detection result includes illumination uniformity and illumination non-uniformity;
the image segmentation module 7 is used for carrying out image segmentation on the first illumination image corresponding to the first PCB when the detection result is that illumination is uneven, so as to obtain a plurality of brightness areas;
the graying processing module 8 is configured to obtain a gray value corresponding to each brightness region, and perform graying processing on each brightness region according to the gray value, so as to obtain an initial brightness threshold value of each brightness region;
And the adjusting module 9 is used for calculating an adaptive threshold according to the plurality of initial brightness thresholds and carrying out adaptive adjustment on the initial brightness threshold of each brightness area according to the adaptive threshold so as to make the brightness of the plurality of brightness areas identical.
The application also provides computer equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the intelligent PCB detection method when executing the computer program.
The application also provides a computer readable storage medium, on which a computer program is stored, which when being executed by a processor, implements the steps of the above-mentioned intelligent detection method for the PCB.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by hardware associated with a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present application and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the application.
Claims (8)
1. The intelligent detection method for the PCB is characterized by comprising the following steps of:
Acquiring first illumination image data of a plurality of PCBs, wherein the first illumination image data comprises a first illumination image and illumination parameter information;
Performing image processing on the first illumination image of each PCB to obtain a binarization image;
extracting the appearance outline of each PCB according to the binarization graph;
Judging whether the appearance outline meets a first preset condition or not;
if the appearance outline meets the first preset condition, calibrating the PCB corresponding to the appearance outline meeting the first preset condition as a first PCB;
acquiring illumination parameter information corresponding to the first PCB, and carrying out illumination detection on the first PCB according to the illumination parameter information to obtain detection results, wherein the detection results comprise illumination uniformity and illumination non-uniformity;
when the detection result is that illumination is uneven, image segmentation is carried out on a first illumination image corresponding to the first PCB, so that a plurality of brightness areas are obtained;
Acquiring a gray value corresponding to each brightness region, and carrying out graying treatment on each brightness region according to the gray value to obtain an initial brightness threshold value of each brightness region;
Calculating an adaptive threshold according to the multiple initial brightness thresholds, and adaptively adjusting the initial brightness threshold of each brightness area according to the adaptive threshold so as to make the brightness of the multiple brightness areas identical;
After the step of judging whether the appearance outline meets the first preset condition, the method further comprises the following steps:
If the appearance outline does not accord with the first preset condition, calibrating the PCB which does not accord with the first preset condition as a second PCB, and acquiring equipment positioning information corresponding to the second PCB, wherein the equipment positioning information comprises a coordinate value of an acquisition device and a coordinate value of an illumination probe;
judging whether the coordinate value of the acquisition device accords with a first preset value or not;
if the coordinate value of the acquisition device does not accord with the first preset value, adjusting the position of the acquisition device according to the first preset value, and acquiring the adjusted coordinate value of the acquisition device;
returning to the step of judging whether the coordinate value of the acquisition device accords with a first preset value;
If the coordinate value of the acquisition device accords with a first preset value, judging whether the coordinate value of the illumination probe accords with a second preset value or not;
If the coordinate value of the illumination probe does not accord with the second preset position, adjusting the position of the illumination probe according to the second preset value, and acquiring the adjusted coordinate value of the illumination probe;
returning to the step of judging whether the coordinate value of the illumination probe accords with a second preset value;
The sensor acquires the position information of the second PCB, converts the position information of the second PCB into output signals and sends the output signals to the conveyor belt, wherein the second PCB is positioned on the conveyor belt, and the sensors are at least two and are respectively arranged on two sides of the conveyor belt;
the conveyor belt receives the output signal, and calculates the moving distance of the second PCB according to the output signal, the first preset value and the second preset value, so as to move the second PCB according to the moving distance.
2. The intelligent detection method of the PCB board according to claim 1, wherein the step of performing image processing on the first illumination image of each PCB board to obtain a binary image includes:
Acquiring an image format of a first illumination image, and judging whether the image format is an RGB format or not;
If the first illumination image format is an RGB format, acquiring an RGB color space of the first illumination image, and determining an RGB color space matrix according to the RGB color space;
Carrying out graying treatment on the first illumination image according to the RGB color space matrix to obtain a gray image histogram;
Performing image format conversion on the gray image histogram to obtain a gray image and a gray image threshold corresponding to the gray image;
and carrying out binarization processing on the gray level image based on a threshold iteration method and a gray level image threshold value to obtain a binarization image.
3. The intelligent detection method of the PCB board according to claim 2, wherein the step of extracting the appearance outline of each PCB board according to the binarization map includes:
According to an edge detection algorithm, acquiring a gradient direction and image parameters of a binarization image edge pixel point, wherein the gradient direction comprises a vertical direction and a horizontal direction, and the image parameters comprise image brightness information, color information and image pixel information;
Acquiring a first convolution kernel of the edge pixel point in the vertical direction, and convolving the first convolution kernel with the image parameters to obtain the maximum first appearance contour gradient amplitude value in the vertical direction of the edge pixel point;
Acquiring a second convolution kernel of the edge pixel points in the horizontal direction, and convolving the second convolution kernel with the image parameters to obtain the maximum second appearance contour gradient amplitude value of each pixel point in the horizontal direction of the edge;
judging whether the first appearance contour gradient amplitude and the second appearance contour gradient amplitude are both larger than a preset appearance contour gradient amplitude or not;
And if the first appearance contour gradient amplitude value and the second appearance contour gradient amplitude value are both larger than the preset appearance contour gradient amplitude value, taking the corresponding edge pixel points as the appearance contour of the PCB.
4. The intelligent detection method of the PCB board according to claim 3, wherein after the step of taking the corresponding edge pixel point as the appearance outline of the PCB board if the first appearance outline gradient amplitude and the second appearance outline gradient amplitude are both greater than the preset appearance outline gradient amplitude, further comprises:
acquiring a communication area according to the binarization graph, and judging whether an arc-shaped image exists in the communication area;
If the circular arc image exists in the communication area, acquiring at least one circle center coordinate corresponding to the circular arc image;
obtaining a circle center deformation value corresponding to the circle center coordinate and a linear distance from the circle center coordinate to any one edge point of the arc image;
calculating the radius of the arc according to the circle center deformation value and the straight line distance from the circle center coordinate to any edge point of the arc image, wherein the calculation formula is as follows:
r=c×s; wherein r represents the radius of the arc, C represents the linear distance from the center coordinates to any edge point of the arc image, and S represents the center deformation value; obtaining a gradient calculation error value, and calculating a maximum allowable error value corresponding to the circle center coordinate according to the gradient calculation error value and the arc radius, wherein a calculation formula is as follows: ; wherein said/> Representing the maximum allowable error value corresponding to the center coordinates, the/>Representing gradient calculation error values;
And calibrating the circle center coordinates according to the maximum allowable error value, taking the calibrated circle center coordinates as the circle center of the circular arc image, and taking the straight line distance from the circle center to any edge point of the circular arc image as the radius of the circular arc image.
5. The intelligent detection method of a PCB board according to claim 1, wherein the steps of calculating an adaptive threshold according to a plurality of initial brightness thresholds, and adaptively adjusting the initial brightness threshold of each brightness area according to the adaptive threshold so that the brightness of the plurality of brightness areas is the same, include:
calculating a brightness average value and a brightness difference average value according to the initial brightness threshold values;
Searching a maximum threshold value in a plurality of initial brightness threshold values; acquiring an illumination reflection value of each brightness area; calculating an adaptive threshold value of each brightness region according to the brightness average value, the maximum threshold value and the illumination reflection value, wherein a calculation formula is as follows: (1-/> ) Wherein/> For each luminance region, an adaptive threshold, m is the maximum threshold of a plurality of initial luminance thresholds,/>For correction factor,/>For the illumination reflection value of the brightness region,/>For the average luminance value, μ is the average luminance difference value.
6. PCB board intelligent detection device, its characterized in that includes:
the first acquisition module is used for acquiring first illumination image data of a plurality of PCBs, wherein the first illumination image data comprises first illumination images and illumination parameter information;
The image processing module is used for carrying out image processing on the first illumination image of each PCB to obtain a binarization image;
the extraction module is used for extracting the appearance outline of each PCB according to the binarization graph;
The judging module is used for judging whether the appearance outline accords with a first preset condition;
The calibration module is used for calibrating the PCB corresponding to the appearance outline meeting the first preset condition as a first PCB if the appearance outline meets the first preset condition;
The second acquisition module is used for acquiring illumination parameter information corresponding to the first PCB, and carrying out illumination detection on the first PCB according to the illumination parameter information to obtain detection results, wherein the detection results comprise illumination uniformity and illumination non-uniformity;
the image segmentation module is used for carrying out image segmentation on a first illumination image corresponding to the first PCB when the detection result is that illumination is uneven, so as to obtain a plurality of brightness areas;
the grey processing module is used for acquiring the grey value corresponding to each brightness region, and carrying out grey processing on each brightness region according to the grey value to obtain an initial brightness threshold value of each brightness region;
The adjusting module is used for calculating an adaptive threshold according to the multiple initial brightness thresholds and carrying out adaptive adjustment on the initial brightness threshold of each brightness area according to the adaptive threshold so as to enable the brightness of the multiple brightness areas to be the same;
Further comprises:
The second calibration module is used for calibrating the PCB which does not accord with the first preset condition as a second PCB if the appearance outline does not accord with the first preset condition, and acquiring equipment positioning information corresponding to the second PCB, wherein the equipment positioning information comprises a coordinate value of an acquisition device and a coordinate value of an illumination probe;
The second judging module is used for judging whether the coordinate value of the acquisition device accords with a first preset value or not;
The first adjusting module is used for adjusting the position of the acquisition device according to the first preset value if the coordinate value of the acquisition device does not accord with the first preset value, and acquiring the adjusted coordinate value of the acquisition device;
the first return module is used for returning to the step of judging whether the coordinate value of the acquisition device accords with a first preset value;
the third judging module is used for judging whether the coordinate value of the illumination probe accords with a second preset position value or not if the coordinate value of the acquisition device accords with the first preset value;
The second adjusting module is used for adjusting the position of the illumination probe according to the second preset value if the coordinate value of the illumination probe does not accord with the second preset position, and acquiring the adjusted coordinate value of the illumination probe;
the second return module is used for returning to the step of judging whether the coordinate value of the illumination probe accords with a second preset value;
The conveyor belt conveying module is used for acquiring the position information of the second PCB by the sensor, converting the position information of the second PCB into output signals and sending the output signals to the conveyor belt, wherein the second PCB is positioned on the conveyor belt, and the sensors are at least two and are respectively arranged on two sides of the conveyor belt;
And the conveyor belt receiving module is used for receiving the output signal by the conveyor belt, and calculating the moving distance of the second PCB according to the output signal, the first preset value and the second preset value so as to move the second PCB according to the moving distance.
7. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410306969.5A CN117893457B (en) | 2024-03-18 | 2024-03-18 | PCB intelligent detection method, device and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410306969.5A CN117893457B (en) | 2024-03-18 | 2024-03-18 | PCB intelligent detection method, device and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117893457A CN117893457A (en) | 2024-04-16 |
CN117893457B true CN117893457B (en) | 2024-05-14 |
Family
ID=90639949
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410306969.5A Active CN117893457B (en) | 2024-03-18 | 2024-03-18 | PCB intelligent detection method, device and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117893457B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118314105A (en) * | 2024-04-18 | 2024-07-09 | 山东衡昊信息技术有限公司 | Flexible circuit board flaw detection method and system |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022088900A1 (en) * | 2020-11-02 | 2022-05-05 | 亿咖通(湖北)技术有限公司 | Parking space line detection method for parking area, and computer device |
CN115311301A (en) * | 2022-10-12 | 2022-11-08 | 江苏银生新能源科技有限公司 | PCB welding spot defect detection method |
KR102467036B1 (en) * | 2021-11-23 | 2022-11-14 | 주식회사 버넥트 | Method and system for setting dynamic image threshold for detecting two-dimensional identification code |
CN115587966A (en) * | 2022-08-31 | 2023-01-10 | 山东省科学院自动化研究所 | Method and system for detecting whether parts are missing or not under condition of uneven illumination |
CN116681606A (en) * | 2023-05-23 | 2023-09-01 | 中山大学 | Underwater uneven illumination image enhancement method, system, equipment and medium |
CN116907341A (en) * | 2023-07-06 | 2023-10-20 | 深圳市塔联科技有限公司 | Intelligent detection method and system for PCB |
-
2024
- 2024-03-18 CN CN202410306969.5A patent/CN117893457B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022088900A1 (en) * | 2020-11-02 | 2022-05-05 | 亿咖通(湖北)技术有限公司 | Parking space line detection method for parking area, and computer device |
KR102467036B1 (en) * | 2021-11-23 | 2022-11-14 | 주식회사 버넥트 | Method and system for setting dynamic image threshold for detecting two-dimensional identification code |
CN115587966A (en) * | 2022-08-31 | 2023-01-10 | 山东省科学院自动化研究所 | Method and system for detecting whether parts are missing or not under condition of uneven illumination |
CN115311301A (en) * | 2022-10-12 | 2022-11-08 | 江苏银生新能源科技有限公司 | PCB welding spot defect detection method |
CN116681606A (en) * | 2023-05-23 | 2023-09-01 | 中山大学 | Underwater uneven illumination image enhancement method, system, equipment and medium |
CN116907341A (en) * | 2023-07-06 | 2023-10-20 | 深圳市塔联科技有限公司 | Intelligent detection method and system for PCB |
Also Published As
Publication number | Publication date |
---|---|
CN117893457A (en) | 2024-04-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN117893457B (en) | PCB intelligent detection method, device and computer equipment | |
CN110389127B (en) | System and method for identifying metal ceramic parts and detecting surface defects | |
CN108629775B (en) | Thermal state high-speed wire rod surface image processing method | |
CN110476056B (en) | Visual detection method, detection equipment and robot | |
CN113570605B (en) | Defect detection method and system based on liquid crystal display panel | |
CN109472271B (en) | Printed circuit board image contour extraction method and device | |
CN110675376A (en) | PCB defect detection method based on template matching | |
CN116559183B (en) | Method and system for improving defect judging efficiency | |
CN113538491B (en) | Edge identification method, system and storage medium based on self-adaptive threshold | |
CN116993744B (en) | Weld defect detection method based on threshold segmentation | |
CN113034488B (en) | Visual inspection method for ink-jet printed matter | |
CN112651968A (en) | Wood board deformation and pit detection method based on depth information | |
CN117252882A (en) | Cylinder head quality detection method and system | |
CN118037722B (en) | Copper pipe production defect detection method and system | |
CN111861979A (en) | Positioning method, positioning equipment and computer readable storage medium | |
CN114549441A (en) | Sucker defect detection method based on image processing | |
CN115100166A (en) | Welding spot defect detection method and device | |
CN116993725B (en) | Intelligent patch information processing system of flexible circuit board | |
CN114529555A (en) | Image recognition-based efficient cigarette box in-and-out detection method | |
CN117372435A (en) | Connector pin detection method based on image characteristics | |
CN113132693B (en) | Color correction method | |
CN116563298B (en) | Cross line center sub-pixel detection method based on Gaussian fitting | |
CN115876786B (en) | Wedge-shaped welding spot detection method and motion control device | |
CN108805854A (en) | Tablet quick counter and integrality detection method under a kind of complex environment | |
WO2022250584A1 (en) | A method and an electronic device for analysing an image |
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 |