CN115294314B - Electronic component surface defect identification method - Google Patents
Electronic component surface defect identification method Download PDFInfo
- Publication number
- CN115294314B CN115294314B CN202211169832.7A CN202211169832A CN115294314B CN 115294314 B CN115294314 B CN 115294314B CN 202211169832 A CN202211169832 A CN 202211169832A CN 115294314 B CN115294314 B CN 115294314B
- Authority
- CN
- China
- Prior art keywords
- dispersion
- image
- block
- pixel point
- processed
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/10—Image acquisition
-
- 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/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/66—Analysis of geometric attributes of image moments or centre of gravity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
-
- 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]
Abstract
The invention relates to the technical field of data processing, in particular to a method for identifying surface defects of an electronic component, which acquires an image to be identified; dividing an image to be identified into a plurality of image blocks, screening out the blocks to be adjusted and splicing the blocks into a merging block; acquiring the overall trend direction of a block to be adjusted; obtaining the dispersion direction of each pixel point in the block to be adjusted, and classifying all the pixel points based on the dispersion direction; obtaining the dispersion of each pixel point; screening out pixels to be processed, and acquiring the type of self-adaptive structural element for the same type of pixels to be processed according to the dispersion direction and dispersion of each pixel to be processed and the total number of the type of pixels to be processed; and performing morphological closed operation on each pixel point to be processed by using the corresponding self-adaptive structural element to remove noise to obtain a de-noised image, and performing threshold segmentation on the de-noised image to obtain a defect identification result. The invention can make the image denoising effect better and make the defect result more accurate.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a method for identifying surface defects of electronic components.
Background
The printed circuit board is one of the most common electronic components in the industrial field, and due to the influences of production process, equipment failure and the like, defects can be caused at the golden fingers of the produced printed circuit board, so that the use of the printed circuit board is influenced.
In the process of detecting the golden finger defects of the printed circuit board, noise can be generated in the acquired images due to the influence of acquisition equipment, the random distribution of the noise can influence the defect identification of the images, the noise distribution is generated at the defect, and then the errors occur in the defect detection process.
In the traditional morphological denoising method, a morphological closed operation is usually adopted for denoising, and in the morphological closed operation process, the selection of a structural element and the operation position of the closed operation directly influence the operation result and time of an image.
Disclosure of Invention
In order to solve the technical problems, the invention provides a method for identifying surface defects of electronic components, which adopts the following technical scheme:
one embodiment of the invention provides a method for identifying surface defects of electronic components, which comprises the following steps:
collecting an image of a printed circuit board and carrying out image preprocessing to obtain an image to be identified; the preprocessing comprises background removal and graying;
dividing the image to be identified into a plurality of image blocks, acquiring the adjustment necessity of the corresponding image block based on the gray value of each image block, and taking the image block corresponding to the adjustment necessity larger than a preset adjustment threshold value as the block to be adjusted; splicing all blocks to be adjusted into merging blocks;
acquiring the overall trend direction of each block to be adjusted based on the mass center of each block to be adjusted in the block to be adjusted; obtaining the dispersion direction of each pixel point in the block to be adjusted according to the overall trend direction, and classifying all the pixel points based on the dispersion direction; obtaining the dispersion of each pixel point according to the distribution information of each pixel point neighborhood in the block to be adjusted;
screening out pixels to be processed based on the dispersion degree, and acquiring the self-adaptive structural element of the same type of the pixels to be processed according to the dispersion degree direction and the dispersion degree of each pixel to be processed and the total number of the pixels to be processed of the same type;
and performing morphological closed operation on each pixel point to be processed by utilizing the corresponding self-adaptive structural element to remove noise to obtain a de-noised image, and performing threshold segmentation on the de-noised image to obtain a defect identification result.
Preferably, the method for removing the background comprises the following steps: removing a background by semantically segmenting the printed circuit board image.
Preferably, the method for acquiring the adjustment necessity comprises:
for each image block, acquiring the occurrence frequency of each gray value, taking the ratio of the frequency to the number of pixel points in the image block as the occurrence probability of the corresponding gray value, acquiring the information entropy of the image block based on the occurrence probability, and taking the normalization result of the information entropy as the adjustment necessity.
Preferably, the method for acquiring the overall trend direction includes:
and calculating corresponding directivity according to the centroid coordinates of each block to be adjusted in all the combined blocks, and acquiring the average value of all the directivities as the overall trend direction of the combined blocks.
Preferably, the obtaining the direction of the dispersion of each pixel point in the block to be adjusted according to the overall trend direction includes:
sliding the window with a preset size in the merging block, respectively calculating the difference between the overall trend direction and four preset directions in the window, and selecting a pixel point corresponding to a direction range corresponding to the preset direction with the minimum difference as a mark point of a central pixel point of the window;
and calculating the gray difference between the central pixel point and each mark point as the directional dispersion in the corresponding direction, and taking the direction of the minimum directional dispersion as the dispersion direction of the central pixel point.
Preferably, the classifying all the pixel points based on the dispersion direction includes:
setting a direction difference threshold, calculating the difference value of the dispersion direction between a first window and a next window for two adjacent windows, if the difference value is smaller than the direction difference threshold, determining the central pixel points of the two adjacent windows as one type, continuing to judge the central pixel points of the next adjacent window until the difference value is not smaller than the direction difference threshold and the central pixel points of the corresponding windows as another type, and calculating in sequence until the windows traverse the merging block.
Preferably, the method for acquiring the dispersion includes:
the average of all the directional dispersion corresponding to each pixel point is taken as the dispersion.
Preferably, the method for obtaining the adaptive structural element comprises the following steps:
accumulating the directional dispersion corresponding to the dispersion direction corresponding to each type of pixel point to be processed to obtain an accumulated value as the integral dispersion of the type; the total number of the pixels to be processed of each type is used as the length of the self-adaptive structural element, the preset multiple of the integral dispersion is used as the width of the self-adaptive structural element, and the dispersion direction mean value of all the pixels to be processed of each type is used as the direction of the self-adaptive structural element.
The embodiment of the invention at least has the following beneficial effects:
according to the random distribution characteristics of the noise information, calculating the distribution information of the neighborhood around each pixel point in the region, further acquiring the dispersion of each pixel point, and accurately acquiring the defect real edge of the image; by calculating the dispersion of each pixel point, the position for morphological operation and the characteristics of the structural element are obtained, so that when the morphological operation is performed, the shape and the size of the structural element are self-adapted according to the characteristics of the pixel points, and the morphological operation performance is better. And setting the self-adaptive structural elements according to the dispersion direction and dispersion of each type of pixel points and the number of the pixel points forming the type. The defect of image processing effect caused by the fact that structural elements with the same size are adopted for different pixel points in the traditional morphological closed operation is avoided, the image denoising effect is better, and then the defect result is more accurate.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of 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 other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart illustrating steps of a method for identifying surface defects of an electronic component according to an embodiment of the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the method for identifying surface defects of electronic components according to the present invention with reference to the accompanying drawings and preferred embodiments shows the following detailed descriptions of the specific implementation, structure, features and effects thereof. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following describes a specific scheme of the method for identifying surface defects of electronic components in detail with reference to the accompanying drawings.
Referring to fig. 1, a flowchart illustrating steps of a method for identifying surface defects of an electronic component according to an embodiment of the present invention is shown, where the method includes the following steps:
s001, collecting an image of the printed circuit board, preprocessing the image, and acquiring an image to be identified; the preprocessing includes background removal and graying.
The method comprises the following specific steps:
1. a printed circuit board image is collected.
Arranging a printed circuit board image acquisition device for image acquisition, wherein the image acquisition device comprises: high resolution camera, light source, support, printed circuit board place the platform. The printed circuit board image is collected and transmitted for the following analysis.
2. And carrying out image preprocessing on the printed circuit board image.
Removing the background by performing semantic segmentation on the printed circuit board image, and graying the image after removing the background.
It should be noted that semantic segmentation and graying are well-known technologies, and a detailed process is not described in detail in the embodiment of the present invention.
Step S002, dividing the image to be identified into a plurality of image blocks, acquiring the adjustment necessity of the corresponding image block based on the gray value of each image block, and taking the image block corresponding to the adjustment necessity larger than a preset adjustment threshold value as the block to be adjusted; and splicing all the blocks to be adjusted into a merging block.
The method comprises the following specific steps:
1. the image to be identified is divided into a plurality of image blocks, and the adjustment necessity of the corresponding image block is obtained based on the gray value of each image block.
When the self-adaptive operation is carried out, as the collected printed circuit board image contains more pixel points, in order to reduce the calculation amount, the necessity of carrying out self-adaptive morphology of each region is calculated by carrying out region division on each printed circuit board image.
In the embodiment of the present invention, the image is divided into 8 image blocks, and in other embodiments, how many image blocks are divided may be determined according to specific implementation conditions.
For each image block, the occurrence frequency of each gray value is obtained, the ratio of the occurrence frequency to the number of pixel points in the image block is used as the occurrence probability of the corresponding gray value, the information entropy of the image block is obtained based on the occurrence probability, and the normalization result of the information entropy is used as the adjustment necessity.
The necessity of each image area block is related to the distribution of the image gray values within the block. If the gray-level value distribution in the image block is more, it indicates that different gray-level values appear in the image block, and the probability that noise and defects may exist is higher, i.e. the necessity for adjustment in the corresponding current image block is higher.
Wherein, the first and the second end of the pipe are connected with each other,is a hyperbolic tangent function for normalizing the value of the adjustment necessity;is shown asThe number of gray values of the image blocks;is shown asFirst of each image blockA grey value;is shown asFirst of each image blockProbability of occurrence of gray-scale value within current image block, i.e.WhereinIs shown asFirst of each image blockThe frequency of occurrences of gray values within the current image block,is shown asThe number of all pixel points in each image block.
2. And taking the image blocks corresponding to the adjustment necessity larger than the preset adjustment threshold as blocks to be adjusted, and splicing all the blocks to be adjusted into a combined block.
Setting an adjustment threshold for the necessity of an adjustmentTaking the image block larger than the adjustment necessity threshold as the block to be adjusted, wherein the adjustment threshold is used for adjusting the image blockThe reference value in the embodiments of the present invention is。
The edge pixels of the block to be adjusted may include real defect edges or noise information. Because the normal region edge pixel points, the real defect edge pixel points, the golden finger inner region pixel points of the printed circuit board and the noise pixel points exist in the to-be-adjusted blocks, all the to-be-adjusted blocks are combined, and the complete real defect edge can be obtained through calculation.
The block to be adjusted is merged by using the existing image merging and splicing method, and the specific method is not described again.
Step S003, acquiring the overall trend direction of the block to be adjusted based on the mass center of each block to be adjusted in the block to be adjusted; obtaining the dispersion direction of each pixel point in the block to be adjusted according to the overall trend direction, and classifying all the pixel points based on the dispersion direction; and obtaining the dispersion of each pixel point according to the distribution information of the neighborhood of each pixel point in the block to be adjusted.
The method comprises the following specific steps:
1. and acquiring the overall trend direction of the block to be adjusted based on the mass center of each block to be adjusted in the block to be adjusted.
And calculating corresponding directivity according to the centroid coordinates of each block to be adjusted in all the combined blocks, and acquiring the average value of all the directivities as the overall trend direction of the combined blocks.
In the combined image block, each pixel point is taken as a central pixel point in a window, the dispersion of the current pixel point is analyzed in different windows, wherein the dispersion of the pixel point is related to the gray value distribution of the pixel points in the windows and the directionality of each point, so that the dispersion of the current pixel point in different directions can be obtained, the dispersion value of the current pixel point in different directions is selected, and the morphological operation is self-adapted according to the direction dispersion.
Since the overall tendency of defects in the merged image block is related to the distribution of each image block constituting the merged image block, the centroid of each image block constituting the merged image block, i.e. the first image block constituting the merged image block, is calculatedThe coordinates of the mass center of each image block are. Calculating the directivity according to the centroid coordinates of each image block in all the combined image blocks, and further acquiring the overall trend direction。
wherein the content of the first and second substances,representing the first of the blocks constituting the merged imageCenter of mass of an image blockThe coordinates of (a);representing the first of the blocks constituting the merged imageCenter of mass of an image blockThe coordinates of (a);representing the number of image blocks constituting the merged image block;representing the arctan function.
2. And acquiring the dispersion direction of each pixel point in the block to be adjusted according to the overall trend direction.
Sliding a window with a preset size in the merging block, respectively calculating the difference between the overall trend direction and four preset directions in the window, and selecting a pixel point corresponding to a direction range corresponding to the preset direction with the minimum difference as a mark point of a central pixel point of the window; and calculating the gray difference between the central pixel point and each mark point as the directional dispersion in the corresponding direction, and taking the direction of the minimum directional dispersion as the dispersion direction of the central pixel point.
The method and the device calculate the directionality of each pixel point according to the acquired overall trend directionWindow analysis of directionality of each pixel. The overall trend obtained by calculation is in the directionThe analysis is carried out in the window, and 4 possible regions may exist in the window due to the directivity of the pixel points, namely 4 possible ranges including up, down, left and right may exist in the window:、、、. Calculating overall trend directionsAnd selecting the direction between the pixel points when the direction dispersion of each pixel point is calculated later, wherein the difference between the direction and the 4 possible ranges is small. When calculating the difference between the 4 possible ranges in the window, it can be known through analysis that the angle intermediate value between the overall trend direction and each possible range is calculated, that is, the angle intermediate value of each of the 4 possible ranges in the window may exist is respectively、、、. Then the corresponding merged image block isThe determining process of the directional angle of each pixel point is as follows:
calculate the minimum difference in direction between the overall trend direction and the 4 possible ranges within the window:
Wherein the content of the first and second substances,representing the overall trend direction of the merged image block;Representing the middle of the first possible range, i.e.;Intermediate values representing a second possible range, i.e.;Intermediate values representing a third possible range, i.e.;Intermediate values representing a fourth possible range, i.e.;Indicating taking the minimum function.
The range corresponding to the minimum difference value is the firstThe range of the directional angle of each pixel. Sequentially marking pixel points in the window as 1-9 pixel points, wherein the No. 5 pixel point represents a central pixel point, and if the minimum difference value is within a first possible range, indicating that the dispersion in the window is calculated, selecting the pixel points marked with the pixel points of 1, 2, 3, 4 and 6 to mark as marking points for calculating the dispersion; if the minimum difference value is within the second possible range, indicating that the dispersion in the window is calculated, selecting pixel points marked with pixel points 4, 6, 7, 8 and 9 to mark as marking points for calculating the dispersion; if the minimum difference value is within the third possible range, indicating that the dispersion in the window is calculated, selecting pixel points marked with 1, 2, 4, 7 and 8 as marking points for calculating the dispersion; if the minimum difference value is within the fourth possible range, when the dispersion in the calculation window is indicated, selecting pixel points marked with 2, 3, 6, 8 and 9 as marking points for calculating the dispersion.
The steps can obtain the directional characteristic of each pixel point in the merged block, and further calculate the directional dispersionWherein the first image block is mergedThe first of each pixel pointDirectional dispersionThe calculation expression of (a) is:wherein, in the step (A),indicating the first in the merged image blockThe gray value of each pixel point is the gray value of the central pixel point in the current window;representing to merge image blocksIn the window with the central pixel point as the individual pixel pointThe gray value of each mark point;is a hyperbolic tangent function and is used for normalizing the gray difference value.
Selecting the minimum dispersion of directivityThe direction of (2) is taken as the direction of dispersion of the central pixel point.
3. And classifying all the pixel points based on the dispersion direction.
Setting a direction difference threshold, calculating the difference value of the dispersion directions between a first window and a next window for two adjacent windows, if the difference value is smaller than the direction difference threshold, determining the central pixel points of the two adjacent windows as one type, continuing to judge the central pixel points of the next adjacent window until the difference value is not smaller than the direction difference threshold and the central pixel points of the corresponding windows as another type, and calculating in sequence until the windows traverse the merging block.
And regarding the defect edge as a plurality of thin straight lines to form the same straight line and a plurality of pixel points, wherein the characteristics of the pixel points are similar, and performing morphological operation by regarding the continuous pixel points with similar dispersion directions as the same type.
Setting a direction difference thresholdCalculating the direction difference value of dispersion between the first window and the next window in the calculation process of selecting the next window every time, and if the direction difference value is less than the direction difference threshold valueIf the minimum dispersion direction does not meet the threshold condition, the central pixel points of the next window are indicated to be another type, and calculation is carried out in sequence until the windows traverse the merging block. Wherein the direction difference threshold valueThe empirical reference value can be determined according to specific implementation conditions。
4. And obtaining the dispersion of each pixel point according to the distribution information of the neighborhood of each pixel point in the block to be adjusted.
The average of all the directional dispersion corresponding to each pixel point is taken as dispersion.
And step S004, screening out pixels to be processed based on the dispersion, and acquiring the self-adaptive structural element of the same type of the pixels to be processed according to the dispersion direction and the dispersion of each pixel to be processed and the total number of the pixels to be processed of the same type.
The method comprises the following specific steps:
1. and screening out pixel points needing morphological operation based on the dispersion degree to serve as pixel points to be processed.
Since only part of the merged image blocks is the defect edge, not all the pixels need to be morphologically operated, and therefore, the dispersion threshold is setAnd if the dispersion of the current pixel point is greater than the set dispersion threshold, indicating that the current pixel point needs to be subjected to morphological operation. Through this operation, the position of the pixel point for morphological operation can be determined. Wherein the dispersion threshold valueAnd may be determined according to specific implementation, the embodiments of the present invention provide empirical reference values,。
2. and for the same type of pixels to be processed, acquiring the type of self-adaptive structural element according to the dispersion direction and dispersion of each pixel to be processed and the total number of the type of pixels to be processed.
Accumulating the directional dispersion corresponding to the dispersion direction corresponding to each type of pixel point to be processed to obtain an accumulated value as the integral dispersion of the type; the total number of the pixels to be processed of each type is used as the length of the self-adaptive structural element, the preset multiple of the integral dispersion is used as the width of the self-adaptive structural element, and the dispersion direction mean value of all the pixels to be processed of each type is used as the direction of the self-adaptive structural element.
Each type of pixel point belongs to similar pixel points, so that the self-adaptive structural element is set according to the characteristics of each type of pixel point. The size of the self-adaptive structural element is related to the dispersion accumulated value of the class and the number of pixel points forming the class; the direction of the adaptive structural element is related to the direction of the dispersion of the class.
By the firstClass as an example, the size of the structural element is adaptedThe calculation expression of (a) is:wherein, in the step (A),the first to the second of the composition to be morphologically manipulatedThe number of pixels of the class;means for constructing the second one requiring morphological operationsThe degree of dispersion of the classes is,represents a preset multiple.
The dispersion value of each type of pixel point self-adaptive structural element is related to the number of pixel points forming the type, wherein the larger the number of the pixel points forming the type is, the longer the corresponding self-adaptive structural element is, namelyThe larger; wherein, the larger the dispersion value is, the larger the peripheral neighborhood noise angle of the current pixel point is, the width of the corresponding self-adaptive structural element is, that isThe larger.
The direction of the corresponding adaptive structural element is related to the direction of the dispersion of the class, i.e. the first one that needs to be morphologically manipulatedDirection of class-like adaptive structural elementsWhereinAnd expressing the dispersion direction mean value of all the pixel points forming the second class.
And setting the self-adaptive structural elements according to the dispersion direction and dispersion of each type of pixel points and the number of the pixel points forming the type. The defect of image processing effect caused by the fact that structural elements with the same size are adopted for different pixel points in the traditional morphological closed operation is avoided, the image denoising effect is better, and then the defect result is more accurate.
And S005, performing morphological closed operation on each pixel point to be processed by using the corresponding self-adaptive structural element to remove noise to obtain a denoised image, and performing threshold segmentation on the denoised image to obtain a defect identification result.
The method comprises the following specific steps:
1. and performing morphological closed operation on each pixel point to be processed by using the corresponding self-adaptive structural element to remove noise, so as to obtain a de-noising image.
The morphological closing operation is a well-known technique, and is not described in detail in the embodiments of the present invention.
2. And obtaining a defect identification result by carrying out threshold segmentation on the denoised image.
And generating a self-adaptive threshold value by adopting an OTSU threshold value segmentation method, setting the pixel value of the pixel point with the pixel point smaller than the self-adaptive threshold value to be 0, and setting the pixel value of the pixel point with the pixel point larger than the self-adaptive threshold value to be 1, generating a binary image, and further identifying the golden finger defect of the printed circuit board.
In summary, in the embodiment of the present invention, the image of the printed circuit board is collected and is subjected to image preprocessing, so as to obtain the image to be identified; the pretreatment comprises background removal and graying; dividing an image to be identified into a plurality of image blocks, acquiring the adjustment necessity of the corresponding image block based on the gray value of each image block, and taking the image block corresponding to the adjustment necessity larger than a preset adjustment threshold value as the block to be adjusted; splicing all blocks to be adjusted into merging blocks; acquiring the overall trend direction of each block to be adjusted based on the mass center of each block to be adjusted in the block to be adjusted; obtaining the dispersion direction of each pixel point in the block to be adjusted according to the overall trend direction, and classifying all the pixel points based on the dispersion direction; obtaining the dispersion of each pixel point according to the distribution information of each pixel point neighborhood in the block to be adjusted; screening out pixels to be processed based on the dispersion degree, and acquiring the self-adaptive structural element of the same type of the pixels to be processed according to the dispersion degree direction and the dispersion degree of each pixel to be processed and the total number of the pixels to be processed of the same type; and performing morphological closed operation on each pixel point to be processed by using the corresponding self-adaptive structural element to remove noise to obtain a de-noised image, and performing threshold segmentation on the de-noised image to obtain a defect identification result. The embodiment of the invention avoids the defect of image processing effect caused by adopting the structural elements with the same size for different pixel points in the traditional morphological closed operation, so that the image denoising effect is better, and the defect result is more accurate.
It should be noted that: the sequence of the above embodiments of the present invention is only for description, and does not represent the advantages or disadvantages of the embodiments. And specific embodiments thereof have been described above. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same or similar parts in the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; modifications of the technical solutions described in the foregoing embodiments, or equivalents of some technical features thereof, are not essential to the spirit of the technical solutions of the embodiments of the present application, and are all included in the scope of the present application.
Claims (4)
1. A method for identifying surface defects of electronic components is characterized by comprising the following steps:
collecting an image of a printed circuit board and carrying out image preprocessing to obtain an image to be identified; the preprocessing comprises background removal and graying;
dividing the image to be identified into a plurality of image blocks, acquiring the adjustment necessity of the corresponding image block based on the gray value of each image block, and taking the image block corresponding to the adjustment necessity larger than a preset adjustment threshold value as the block to be adjusted; splicing all blocks to be adjusted into merging blocks;
acquiring the overall trend direction of the block to be adjusted based on the mass center of each block to be adjusted in the block to be adjusted; obtaining the dispersion direction of each pixel point in the block to be adjusted according to the overall trend direction, and classifying all the pixel points based on the dispersion direction; obtaining the dispersion of each pixel point according to the distribution information of the neighborhood of each pixel point in the block to be adjusted;
screening out pixels to be processed based on the dispersion degree, and acquiring the self-adaptive structural element of the same type of the pixels to be processed according to the dispersion degree direction and the dispersion degree of each pixel to be processed and the total number of the pixels to be processed of the same type;
performing morphological closed operation on each pixel point to be processed by using a corresponding self-adaptive structural element to remove noise to obtain a de-noised image, and performing threshold segmentation on the de-noised image to obtain a defect identification result;
the obtaining the dispersion direction of each pixel point in the block to be adjusted according to the overall trend direction comprises the following steps:
sliding the window with a preset size in the merging block, respectively calculating the difference between the overall trend direction and four preset directions in the window, and selecting a pixel point corresponding to a direction range corresponding to the preset direction with the minimum difference as a mark point of a central pixel point of the window;
calculating the gray difference between the central pixel point and each mark point as the directional dispersion in the corresponding direction, and taking the direction of the minimum directional dispersion as the dispersion direction of the central pixel point;
the classifying all the pixel points based on the dispersion direction comprises:
setting a direction difference threshold, calculating the difference value of the dispersion direction between a first window and a next window for two adjacent windows, if the difference value is smaller than the direction difference threshold, determining the central pixel point of the two adjacent windows as one type, continuing to judge the central pixel point of the next adjacent window until the difference value is not smaller than the direction difference threshold and the central pixel point of the corresponding window as another type, and calculating in sequence until the windows traverse the merging block;
the method for acquiring the dispersion comprises the following steps:
taking the average of all the directional dispersion corresponding to each pixel point as the dispersion;
the method for acquiring the self-adaptive structural element comprises the following steps:
accumulating the directional dispersion corresponding to the dispersion direction corresponding to each type of pixel point to be processed to obtain an accumulated value as the integral dispersion of the type; the total number of the pixels to be processed of each type is used as the length of the self-adaptive structural element, the preset multiple of the integral dispersion is used as the width of the self-adaptive structural element, and the dispersion direction mean value of all the pixels to be processed of each type is used as the direction of the self-adaptive structural element.
2. The method for identifying the surface defects of the electronic component as claimed in claim 1, wherein the method for removing the background comprises the following steps: removing a background by semantically segmenting the printed circuit board image.
3. The method for identifying the surface defects of the electronic component as claimed in claim 1, wherein the method for acquiring the adjustment necessity comprises:
for each image block, acquiring the occurrence frequency of each gray value, taking the ratio of the frequency to the number of pixel points in the image block as the occurrence probability of the corresponding gray value, acquiring the information entropy of the image block based on the occurrence probability, and taking the normalization result of the information entropy as the adjustment necessity.
4. The method for identifying the surface defects of the electronic component as claimed in claim 1, wherein the method for acquiring the overall trend direction comprises the following steps:
and calculating corresponding directivity according to the centroid coordinates of each block to be adjusted in all the combined blocks, and acquiring the average value of all the directivities as the overall trend direction of the combined blocks.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211169832.7A CN115294314B (en) | 2022-09-26 | 2022-09-26 | Electronic component surface defect identification method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211169832.7A CN115294314B (en) | 2022-09-26 | 2022-09-26 | Electronic component surface defect identification method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115294314A CN115294314A (en) | 2022-11-04 |
CN115294314B true CN115294314B (en) | 2022-12-30 |
Family
ID=83833984
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211169832.7A Active CN115294314B (en) | 2022-09-26 | 2022-09-26 | Electronic component surface defect identification method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115294314B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117115165A (en) * | 2023-10-24 | 2023-11-24 | 长沙康乾电子科技有限公司 | Method and device for scratching processing surface of mask |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004045356A (en) * | 2002-05-20 | 2004-02-12 | Jfe Steel Kk | Surface defect detection method |
CN109242782B (en) * | 2017-07-11 | 2022-09-09 | 深圳市道通智能航空技术股份有限公司 | Noise processing method and device |
CN109870461B (en) * | 2019-03-29 | 2020-04-24 | 泗阳恒润电子有限公司 | Electronic components quality detection system |
CN115018828B (en) * | 2022-08-03 | 2022-10-25 | 深圳市尹泰明电子有限公司 | Defect detection method for electronic component |
-
2022
- 2022-09-26 CN CN202211169832.7A patent/CN115294314B/en active Active
Non-Patent Citations (2)
Title |
---|
基于局部熵的织物疵点检测;范为福等;《中原工学院学报》;20071025(第05期);第16-19页 * |
基于自适应结构元的形态学在水下焊缝图像去噪中的应用;李冰等;《材料科学与工艺》;20070429;第14卷;第181-183页 * |
Also Published As
Publication number | Publication date |
---|---|
CN115294314A (en) | 2022-11-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114842017B (en) | HDMI cable surface quality detection method and system | |
CN116109644B (en) | Surface defect detection method for copper-aluminum transfer bar | |
CN110472479B (en) | Finger vein identification method based on SURF feature point extraction and local LBP coding | |
US20180101710A1 (en) | Method and apparatus for recognizing fingerprint ridge point | |
EP3678046B1 (en) | Hand detection method and system, image detection method and system, hand segmentation method, storage medium, and device | |
CN115294099B (en) | Method and system for detecting hairline defect in steel plate rolling process | |
CN115775250A (en) | Golden finger circuit board defect rapid detection system based on digital image analysis | |
CN116664559B (en) | Machine vision-based memory bank damage rapid detection method | |
CN115311262A (en) | Printed circuit board defect identification method | |
CN115311507B (en) | Building board classification method based on data processing | |
CN115294314B (en) | Electronic component surface defect identification method | |
CN113888536B (en) | Printed matter double image detection method and system based on computer vision | |
CN116310290B (en) | Method for correcting swimming touch pad feedback time | |
CN114863492B (en) | Method and device for repairing low-quality fingerprint image | |
CN116309577B (en) | Intelligent detection method and system for high-strength conveyor belt materials | |
CN116071763A (en) | Teaching book intelligent correction system based on character recognition | |
CN116012291A (en) | Industrial part image defect detection method and system, electronic equipment and storage medium | |
CN114998341A (en) | Gear defect detection method and system based on template matching | |
CN114937006A (en) | Hammerhead refinement defect detection method based on image enhancement | |
CN117152165B (en) | Photosensitive chip defect detection method and device, storage medium and electronic equipment | |
CN115564705B (en) | Burr detection precision enhancement method and system for precision standard component | |
CN115862121A (en) | Face rapid matching method based on multimedia resource library | |
CN113902667B (en) | Thread turning identification method and system for machine vision | |
US8811741B2 (en) | Differentiated processing method of image zones | |
US8903189B2 (en) | Image processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |