CN115294314B - Electronic component surface defect identification method - Google Patents

Electronic component surface defect identification method Download PDF

Info

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
Application number
CN202211169832.7A
Other languages
Chinese (zh)
Other versions
CN115294314A (en
Inventor
杜坤香
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nantong Hengtian Electronic Technology Co ltd
Original Assignee
Nantong Hengtian Electronic Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nantong Hengtian Electronic Technology Co ltd filed Critical Nantong Hengtian Electronic Technology Co ltd
Priority to CN202211169832.7A priority Critical patent/CN115294314B/en
Publication of CN115294314A publication Critical patent/CN115294314A/en
Application granted granted Critical
Publication of CN115294314B publication Critical patent/CN115294314B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/10Image acquisition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30141Printed circuit board [PCB]

Abstract

The invention 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

Electronic component surface defect identification method
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.
Taking the ith image block as an example, adjust the necessity
Figure 216947DEST_PATH_IMAGE001
Is calculated by
Figure 548572DEST_PATH_IMAGE002
Wherein, the first and the second end of the pipe are connected with each other,
Figure 694644DEST_PATH_IMAGE003
is a hyperbolic tangent function for normalizing the value of the adjustment necessity;
Figure 478930DEST_PATH_IMAGE004
is shown as
Figure 499975DEST_PATH_IMAGE005
The number of gray values of the image blocks;
Figure 390833DEST_PATH_IMAGE006
is shown as
Figure 737501DEST_PATH_IMAGE005
First of each image block
Figure 212344DEST_PATH_IMAGE007
A grey value;
Figure 833819DEST_PATH_IMAGE008
is shown as
Figure 579183DEST_PATH_IMAGE005
First of each image block
Figure 300014DEST_PATH_IMAGE007
Probability of occurrence of gray-scale value within current image block, i.e.
Figure 262154DEST_PATH_IMAGE009
Wherein
Figure 890582DEST_PATH_IMAGE010
Is shown as
Figure 490452DEST_PATH_IMAGE005
First of each image block
Figure 444502DEST_PATH_IMAGE007
The frequency of occurrences of gray values within the current image block,
Figure 628359DEST_PATH_IMAGE011
is shown as
Figure 591635DEST_PATH_IMAGE005
The 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 adjustment
Figure 311592DEST_PATH_IMAGE012
Taking 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 block
Figure 905384DEST_PATH_IMAGE012
The reference value in the embodiments of the present invention is
Figure 576537DEST_PATH_IMAGE013
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 calculated
Figure 122268DEST_PATH_IMAGE014
The coordinates of the mass center of each image block are
Figure 929687DEST_PATH_IMAGE015
. 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
Figure 959960DEST_PATH_IMAGE016
Direction of overall trend
Figure 915146DEST_PATH_IMAGE016
The calculation expression of (a) is:
Figure 924953DEST_PATH_IMAGE017
wherein the content of the first and second substances,
Figure 852457DEST_PATH_IMAGE018
representing the first of the blocks constituting the merged image
Figure 850369DEST_PATH_IMAGE014
Center of mass of an image block
Figure 732000DEST_PATH_IMAGE019
The coordinates of (a);
Figure 44033DEST_PATH_IMAGE020
representing the first of the blocks constituting the merged image
Figure 357202DEST_PATH_IMAGE021
Center of mass of an image block
Figure 260436DEST_PATH_IMAGE022
The coordinates of (a);
Figure 629363DEST_PATH_IMAGE023
representing the number of image blocks constituting the merged image block;
Figure 541824DEST_PATH_IMAGE024
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 direction
Figure 178342DEST_PATH_IMAGE025
Window analysis of directionality of each pixel. The overall trend obtained by calculation is in the direction
Figure 222783DEST_PATH_IMAGE025
The 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:
Figure 577541DEST_PATH_IMAGE026
Figure 496956DEST_PATH_IMAGE027
Figure 253559DEST_PATH_IMAGE028
Figure 468902DEST_PATH_IMAGE029
. Calculating overall trend directions
Figure 373273DEST_PATH_IMAGE016
And 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
Figure 34062DEST_PATH_IMAGE030
Figure 645172DEST_PATH_IMAGE031
Figure 296995DEST_PATH_IMAGE032
Figure 423083DEST_PATH_IMAGE033
. Then the corresponding merged image block is
Figure 153141DEST_PATH_IMAGE034
The 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
Figure 884337DEST_PATH_IMAGE035
Figure 503800DEST_PATH_IMAGE036
Wherein the content of the first and second substances,
Figure 789287DEST_PATH_IMAGE016
representing the overall trend direction of the merged image block
Figure 854195DEST_PATH_IMAGE016
Figure 195223DEST_PATH_IMAGE037
Representing the middle of the first possible range, i.e.
Figure 421805DEST_PATH_IMAGE038
Figure 725747DEST_PATH_IMAGE039
Intermediate values representing a second possible range, i.e.
Figure 532029DEST_PATH_IMAGE040
Figure 972238DEST_PATH_IMAGE041
Intermediate values representing a third possible range, i.e.
Figure 136765DEST_PATH_IMAGE042
Figure 928004DEST_PATH_IMAGE043
Intermediate values representing a fourth possible range, i.e.
Figure 334714DEST_PATH_IMAGE044
Figure 98271DEST_PATH_IMAGE045
Indicating taking the minimum function.
The range corresponding to the minimum difference value is the first
Figure 168120DEST_PATH_IMAGE034
The 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 dispersion
Figure 712234DEST_PATH_IMAGE046
Wherein the first image block is merged
Figure 657056DEST_PATH_IMAGE034
The first of each pixel point
Figure 71857DEST_PATH_IMAGE047
Directional dispersion
Figure 14405DEST_PATH_IMAGE048
The calculation expression of (a) is:
Figure 281701DEST_PATH_IMAGE049
wherein, in the step (A),
Figure 30214DEST_PATH_IMAGE050
indicating the first in the merged image block
Figure 299521DEST_PATH_IMAGE034
The gray value of each pixel point is the gray value of the central pixel point in the current window;
Figure 678550DEST_PATH_IMAGE051
representing to merge image blocks
Figure 167563DEST_PATH_IMAGE034
In the window with the central pixel point as the individual pixel point
Figure 454187DEST_PATH_IMAGE052
The gray value of each mark point;
Figure 109160DEST_PATH_IMAGE053
is a hyperbolic tangent function and is used for normalizing the gray difference value.
Selecting the minimum dispersion of directivity
Figure 455827DEST_PATH_IMAGE054
The 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 threshold
Figure 166557DEST_PATH_IMAGE055
Calculating 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 value
Figure 460135DEST_PATH_IMAGE055
If 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 value
Figure 704034DEST_PATH_IMAGE055
The empirical reference value can be determined according to specific implementation conditions
Figure 487182DEST_PATH_IMAGE056
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 set
Figure 652585DEST_PATH_IMAGE057
And 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 value
Figure 782477DEST_PATH_IMAGE058
And may be determined according to specific implementation, the embodiments of the present invention provide empirical reference values,
Figure 880883DEST_PATH_IMAGE059
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 first
Figure 834932DEST_PATH_IMAGE060
Class as an example, the size of the structural element is adapted
Figure 18789DEST_PATH_IMAGE062
The calculation expression of (a) is:
Figure 952372DEST_PATH_IMAGE063
wherein, in the step (A),
Figure 374126DEST_PATH_IMAGE064
the first to the second of the composition to be morphologically manipulated
Figure 233498DEST_PATH_IMAGE060
The number of pixels of the class;
Figure 904651DEST_PATH_IMAGE065
means for constructing the second one requiring morphological operations
Figure 140460DEST_PATH_IMAGE060
The degree of dispersion of the classes is,
Figure 929904DEST_PATH_IMAGE066
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, namely
Figure 960177DEST_PATH_IMAGE067
The 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 is
Figure 384205DEST_PATH_IMAGE068
The 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 manipulated
Figure 158126DEST_PATH_IMAGE060
Direction of class-like adaptive structural elements
Figure 852675DEST_PATH_IMAGE069
Wherein
Figure 788270DEST_PATH_IMAGE070
And 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.
CN202211169832.7A 2022-09-26 2022-09-26 Electronic component surface defect identification method Active CN115294314B (en)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
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