CN116630325A - Method, equipment and storage medium for detecting UV glue based on circuit board - Google Patents

Method, equipment and storage medium for detecting UV glue based on circuit board Download PDF

Info

Publication number
CN116630325A
CN116630325A CN202310912587.2A CN202310912587A CN116630325A CN 116630325 A CN116630325 A CN 116630325A CN 202310912587 A CN202310912587 A CN 202310912587A CN 116630325 A CN116630325 A CN 116630325A
Authority
CN
China
Prior art keywords
glue
area
point
contour
outline
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.)
Granted
Application number
CN202310912587.2A
Other languages
Chinese (zh)
Other versions
CN116630325B (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.)
Suzhou Hexin Technology Co ltd
Original Assignee
Suzhou Hexin 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 Suzhou Hexin Technology Co ltd filed Critical Suzhou Hexin Technology Co ltd
Priority to CN202310912587.2A priority Critical patent/CN116630325B/en
Publication of CN116630325A publication Critical patent/CN116630325A/en
Application granted granted Critical
Publication of CN116630325B publication Critical patent/CN116630325B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/001Industrial image inspection using an image reference approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • 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/762Arrangements for image or video recognition or understanding using pattern recognition or machine learning using clustering, e.g. of similar faces in social networks
    • G06V10/763Non-hierarchical techniques, e.g. based on statistics of modelling distributions
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Software Systems (AREA)
  • Geometry (AREA)
  • Probability & Statistics with Applications (AREA)
  • Quality & Reliability (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a method, equipment and storage medium for detecting UV glue based on a circuit board, which comprises the following steps of obtaining an initial RGB image of the whole circuit board, selecting a reference template area on the initial RGB image to extract color, and obtaining the UV glue in the reference template area; performing contour extraction and binarization processing on the initial RGB image according to the color extraction parameters to obtain a UV glue paving area and a contour thereof; filling the outline of the UV glue laying area to obtain a non-UV glue laying area; constructing a fence area between the UV glue laying area and the non-UV glue laying area without detection; setting a flaw detection area to detect flaws in a threshold range conforming to flaw areas in the UV glue paving area; and setting a UV glue detection area to detect UV glue in a range which accords with the area threshold of the UV glue in a non-UV glue laying area. The detection of whether the UV glue leaks or not is realized by the UV glue laying area to flaws such as bubbles and orange peels and the non-UV glue laying area, and the detection accuracy and efficiency are improved.

Description

Method, equipment and storage medium for detecting UV glue based on circuit board
Technical Field
The invention relates to the technical field of circuit board image detection, in particular to a circuit board-based UV glue detection method, equipment and a storage medium.
Background
The UV glue on the surface of the traditional circuit board is mostly detected by a method combining manual detection and machine vision detection. However, manual detection has the defects of large workload, low working efficiency, insufficient detection precision caused by large human interference factors and the like, and cannot meet the industrial production requirements of UV glue detection. Although the machine vision detection can detect partial defects, the false detection rate is high, and for defects with smaller targets and complex forms, the defects need to be detected in different areas, so that the positions of the detection areas cannot be determined, the robustness of the detection of the defects is poor, and the false detection rate is high.
Disclosure of Invention
In order to overcome the problem in the prior art, most of UV adhesives on the surface of a traditional circuit board are detected by a method combining manual detection and machine vision detection. However, manual detection has the defects of large workload, low working efficiency, insufficient detection precision caused by large human interference factors and the like, and cannot meet the industrial production requirements of UV glue detection. Although the machine vision detection can detect partial defects, the false detection rate is high, and for defects with smaller targets and complex forms, the defects need to be detected in different areas, so that the positions of detection areas cannot be determined, the robustness of the detection of the defects is poor, and the false detection rate is high.
In order to achieve the above purpose, the invention adopts the following technical scheme:
in a first aspect of the present invention, a method for detecting UV glue based on a circuit board is provided, comprising the steps of:
acquiring an initial RGB image of the whole circuit board;
selecting a reference template area on the initial RGB image, and carrying out color extraction on the reference template area to obtain UV glue in the reference template area;
performing contour extraction on the initial RGB image according to the parameters of the color extraction, and performing binarization processing to obtain the UV glue paving area and the contour thereof;
filling the outline of the UV glue paving area to obtain a non-UV glue paving area;
constructing a fence area between the UV glue laying area and the non-UV glue laying area, wherein the fence area is not detected;
setting a flaw detection area to detect the UV glue laying area, and detecting flaws in a flaw area threshold range;
and setting a UV glue detection area to detect the non-UV glue paving area, and detecting the UV glue in the area threshold range of the UV glue.
Compared with the prior art, the invention has the beneficial effects that: the parameters of the color extraction of the UV glue in the reference template area are obtained, the parameters are applied to an initial RGB image of the whole circuit board to extract the outline, and then binarization processing is carried out to obtain a UV glue paving area and the outline thereof, so that the UV glue paving area can be conveniently distinguished from a visual area; through filling the contour of the UV glue laying area, a non-UV glue laying area is obtained, the UV glue laying area and the non-UV glue laying area are positioned and divided on the circuit board, the regional detection of defects is realized, the detection of defects such as bubbles and orange peel can be realized in the UV glue laying area, the detection of whether dripping exists in the UV glue in the non-UV glue laying area is also realized, the accuracy and the efficiency of the detection of the UV glue are improved, and the detection of a large number of defects on the surface of the circuit board is remarkably achieved. Through setting up the rail region, tolerance non-detection area has prevented that the detection interference between the area was laid to the UV glue in the testing process and the non-UV glue was laid the area, has further improved the rate of accuracy and the efficiency that the UV glued was detected.
In some possible embodiments, performing color extraction on the reference template region, and obtaining the UV glue in the reference template region includes the following steps:
HSV conversion is carried out on the RGB image of the reference template area, and a converted component histogram is obtained;
carrying out equalization treatment on the component histogram to obtain an equalization histogram;
and clustering and enhancing the equalization histogram to obtain the UV glue in the reference template area.
In some possible embodiments, the equalization histogram is cluster enhanced by a K-means clustering algorithm that blends in with the rgb2ind function, the K-means clustering algorithm that blends in with the rgb2ind function having the following formula:
wherein k represents a kth cluster; mu (mu) k Representing the average value of pixel values in a kth cluster, wherein when k is an odd number, the kth cluster is a UV glue color cluster; when k is even, the kth cluster is a non-UV glue color cluster; i.e. when k=1, the first cluster is a UV glue color cluster; when k=2, the second cluster is a non-UV glue color cluster, and with continuous iteration, the pixel values in the UV glue color cluster or the non-UV glue color cluster are changed; n represents the number of pixel points in the UV glue color cluster or the non-UV glue color cluster, C k Represents the region where the kth cluster is located, x j Representing the pixel value of the j-th point in the UV glue color cluster or non-UV glue color cluster.
In some possible embodiments, constructing a fenced area between the UV glue laying area and the non-UV glue laying area comprises the steps of:
determining a first retraction point to retract the outline of the UV glue laying area;
determining a first expansion point to expand the outline of the UV glue paving area;
and constructing a fence area through the first inward contraction point and the first outward expansion point.
In some possible embodiments, constructing a fenced area between the UV glue laying area and the non-UV glue laying area comprises the steps of:
determining a second shrinking point to shrink the outline of the non-UV glue laying area;
determining a second expansion point to expand the outline of the non-UV glue paving area;
and constructing a fence area through the second inward shrinking point and the second outward expanding point.
In some possible embodiments, the method for determining the first pinch point includes the following steps:
determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue paving area;
Determining a first retraction point along the retraction direction by taking each contour point as a salient point based on the set retraction distance of each contour point;
judging whether each first shrinkage point is positioned in the outline of the UV glue paving area, and if the current first shrinkage point is positioned in the outline, determining the current first shrinkage point as a correct first shrinkage point; if the current first pinch point is not located in the outline, determining the correct first pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current first pinch point.
In some possible embodiments, the method for determining the first expansion point includes the following steps:
determining the outward expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue paving area;
determining a first expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point;
judging whether each first expansion point is positioned in the outline of the UV glue paving area, and if the current first expansion point is positioned in the outline, determining the current first expansion point as a correct first expansion point; if the current first expansion point is not located in the outline, determining the correct first expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current first expansion point.
In some possible embodiments, the method for determining the second pinch point includes the following steps:
determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue paving area;
determining a second retraction point along the retraction direction by taking each profile point as a salient point based on the set retraction distance of each profile point;
judging whether each second shrinkage point is positioned in the outline of the non-UV glue paving area, and if the current second shrinkage point is positioned in the outline, determining the current second shrinkage point as a correct second shrinkage point; and if the current second pinch point is not positioned in the outline, determining the correct second pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current second pinch point.
In some possible embodiments, the method for determining the second expansion point includes the following steps:
determining the outward expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue paving area;
determining a second expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point;
Judging whether each second expansion point is positioned in the outline of the non-UV glue paving area, and if the current second expansion point is positioned in the outline, determining the current second expansion point as a correct second expansion point; if the current second expansion point is not located in the outline, determining a correct second expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current second expansion point.
In some possible embodiments, filling the contour of the UV glue spreading area, obtaining a non-UV glue spreading area comprises the steps of:
acquiring all initial connected domains in the UV glue laying area through a bidirectional scanning algorithm;
traversing the binarized image of the UV glue paving area, and endowing each pixel point in the initial connected area with a digital label;
performing union processing on the array storing the digital tag to obtain a true connected domain;
merging contour points of all the true connected domains to obtain a merged contour;
and filling the merging contours to obtain a non-UV glue laying area.
In some possible embodiments, the union process specifically includes the following: and combining the different digital labels belonging to the same initial connected domain, so that the digital labels of all the pixel points in the same initial connected domain are consistent.
In some possible embodiments, when the combined contour is a single image contour, filling is performed in a line scanning manner; and when the combined contour is a multi-image contour, filling is carried out in a mode of dividing the level from large to small in area.
In some possible embodiments, setting a UV glue detection area to detect the non-UV glue placement area includes the steps of:
aligning the plane coordinates of the standard CAD drawing of the whole circuit board and the plane coordinates of the initial RGB image of the circuit board to the same coordinate system;
acquiring all pattern contours of the non-UV glue laying area, wherein the pattern contours comprise an outer contour of the non-UV glue laying area, and an element contour and a non-element contour in the non-UV glue laying area;
dividing the hierarchical relationship among the graphic outlines, namely the father-son relationship, according to the positions of the graphic outlines;
sequencing all the graphic outlines according to the father-son relationship;
and the UV glue detection areas are sequentially detected according to the sorting sequence.
In some possible embodiments, the hierarchical relationship between the graphic outlines is divided according to the positions of the graphic outlines, namely, the parent-child relationship specifically includes the following:
Retrieving all graphic outlines and dividing them into two level hierarchies, placing the external outline of the non-UV glue-laid area on the parent label,
placing the element profile and the non-element profile in the non-UV glue laying area on a sub-label;
if a certain non-UV glue laying area exists in the non-UV glue laying area, the certain non-UV glue laying area is placed on the parent label, and the element outline and the non-element outline in the certain non-UV glue laying area are placed on the child label until no other non-UV glue laying areas exist in the non-UV glue laying area.
In a second aspect of the present invention, there is provided a circuit board-based UV glue inspection apparatus comprising
An image acquisition and division module: the method comprises the steps of acquiring an initial RGB image of a whole circuit board, dividing the initial RGB image into N x M sub-areas, and acquiring an RGB image in each sub-area, wherein N is the number of rows and M is the number of columns;
reference area UV glue extraction module: the method comprises the steps of selecting a reference template area on an initial RGB image, and extracting colors of the reference template area to obtain UV glue in the reference template area;
UV glue laying area extraction module: the method comprises the steps of carrying out contour extraction on each sub-region in the initial RGB image according to the parameters of color extraction, and then carrying out binarization processing to obtain the UV glue paving region and the contour thereof;
non-UV glue laying area extraction module: the method comprises the steps of filling the outline of the UV glue paving area to obtain a non-UV glue paving area;
tolerance non-detection region construction module: the method comprises the steps that a fence area is built between the UV glue paving area and the non-UV glue paving area, wherein the fence area is a tolerance non-detection area and is not detected;
UV glue lays regional flaw detection module: the method comprises the steps of setting a flaw detection area to detect the UV glue laying area, and detecting flaws in a flaw area conforming threshold range;
non-UV glues and lays regional UV and glues detection module: the UV glue detection area detection device is used for setting a UV glue detection area to detect the non-UV glue paving area, and detecting UV glue in the area threshold range of the UV glue.
In a third aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above-described board-based UV glue detection method.
Drawings
Fig. 1 is a flowchart illustrating the overall steps of a method for detecting UV glue based on a circuit board according to a first embodiment of the present invention;
FIG. 2 is a flowchart showing a process for extracting UV glue according to a first embodiment of the invention;
FIG. 3 is a schematic view showing the positions of a UV glue spreading area and a non-UV glue spreading area according to a first embodiment of the present invention;
FIG. 4 is a flowchart showing the steps for acquiring a non-UV glue spreading area according to a first embodiment of the present invention;
FIG. 5 is a flowchart showing steps for implementing line scanning for a single image profile in accordance with an embodiment of the present invention;
FIG. 6 is a schematic view of the position of a fence area (tolerance non-detection area) according to the first embodiment of the present invention;
FIG. 7 is a flowchart showing steps for constructing a fence area by retracting and expanding a UV glue placement area in accordance with a first embodiment of the present invention;
FIG. 8 is a flowchart illustrating a first pinch point determination step according to an embodiment of the present invention;
FIG. 9 is a flowchart illustrating a first step of determining a first flare point according to an embodiment of the present invention;
FIG. 10 is a flowchart showing steps for constructing a fence area by retracting and expanding a non-UV glue placement area in accordance with a first embodiment of the present invention;
FIG. 11 is a flowchart illustrating a second pinch point determination step according to an embodiment of the present invention;
FIG. 12 is a flowchart illustrating a second expansion point determination step according to an embodiment of the present invention;
FIG. 13 is a schematic diagram showing the positions of flaws detected in a flaw detection area in a UV glue spreading area according to a first embodiment of the present invention;
FIG. 14 is a schematic diagram showing the positions of UV glue detected in a UV glue detection area in a non-UV glue placement area according to the first embodiment of the invention;
FIG. 15 is a flowchart showing a step of UV glue detection in a non-UV glue application area according to a first embodiment of the invention;
fig. 16 is a schematic structural diagram of a UV glue detection device based on a circuit board in a second embodiment of the invention.
Detailed Description
The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making clear and defining the scope of the present invention.
Referring to fig. 1, the method for detecting UV glue based on a circuit board in the first embodiment specifically includes the following steps:
s1: and acquiring an initial RGB image of the whole circuit board, and dividing the initial RGB image into N x M sub-areas, wherein N is the number of rows and M is the number of columns.
Specifically, the initial RGB image is divided by DirectX to obtain an RGB image in each sub-region. Because the images in the subareas are mutually independent, all the areas on the circuit board can be blocked in parallel, and the images in each subarea can be acquired simultaneously by multithreading, so that the image processing speed is increased, and the detection efficiency is improved.
S2: and selecting a reference template area on the initial RGB image, and carrying out color extraction on the reference template area to obtain the UV glue in the reference template area. Referring to fig. 2, the method specifically comprises the following steps:
S21: HSV conversion is carried out on the RGB image of the reference template area, and a converted component histogram is obtained.
RGB is the most widely used color space, while HSV is a color space proposed based on human perception of color. HSV can intuitively express the tone, the brightness degree and the color concentration of the color, is convenient for color comparison, and can track a target with a specific color more easily. The color characteristics of the UV glue in the reference template area can be extracted more accurately by HSV conversion of the RGB image of the reference template area, so that the UV glue laying area in the initial RGB image of the whole circuit board can be positioned more accurately.
S22: and carrying out equalization treatment on the component histogram to obtain an equalization histogram. The equalization process is to eliminate the effect of uneven distribution of the image.
S23: and clustering and enhancing the equalization histogram to obtain the UV glue in the reference template area. Cluster enhancement is to solve the problem that some colors in the equalized histogram still have contrast retention.
Specifically, in this embodiment, the equalization histogram is clustered and enhanced by a K-means clustering algorithm incorporated into the rgb2ind function. The color clustering process of the K-means algorithm is represented by the class through a clustering center, so that clustering layering in different directions is marked by different colors in a three-dimensional scatter diagram, and the extraction target and the extraction quantity of the color features of the image are enhanced.
The K-means clustering algorithm is a distance clustering method, and classification estimation is carried out by utilizing the distance between the object and the object, and the K-means clustering algorithm has the characteristics of high operation efficiency and good scalability.
The principle of the application of the K-means clustering algorithm in this embodiment is as follows: randomly selecting a certain pixel point in the reference template area, wherein the pixel point is called a centroid point, and calculating Euclidean distance between each pixel point and the centroid point in the reference template area, so as to form clusters of different categories according to the Euclidean distance, namely: and respectively gathering different color types to form a UV glue color cluster and a non-UV glue color cluster, then recalculating the centroid point of each cluster, and then repeating iteration until the distances from the pixel points of the UV glue color cluster and the non-UV glue color cluster to the corresponding centroid points are the smallest. The algorithm formula of the K-means clustering algorithm is as follows:
(formula one), wherein d is Euclidean distance formula; x is x i H, S or V components corresponding to the ith of the x-point pixel values in the reference template region; wherein x is 1 Representing the H component, x, of the x-point pixel value in the reference template region 2 S component representing x-point pixel values in a reference template region, x 3 A V component representing an x-point pixel value in the reference template region; y is i The ith correspondence for the y pixel value of the centroid point in the reference template regionH, S or V component of (2), wherein y 1 H component, y representing centroid point y pixel value in reference template region 2 S component, y representing centroid point y pixel value in reference template region 3 A V component representing a centroid point y pixel value in the reference template region; n is the number of components.
And respectively calculating the average value of the pixel points of the UV glue color clusters and the pixel points of the non-UV glue color clusters based on the formula I, and respectively obtaining the centroid points of the corresponding clusters. The formula of the K-means clustering algorithm incorporated into the rgb2ind function is as follows:
(equation II)
Wherein k represents a kth cluster; mu (mu) k Representing the average value of pixel values in a kth cluster, wherein when k is an odd number, the kth cluster is a UV glue color cluster; when k is even, the kth cluster is a non-UV glue color cluster; i.e. when k=1, the first cluster is a UV glue color cluster; when k=2, the second cluster is a non-UV glue color cluster, and with continuous iteration, the pixel values in the UV glue color cluster or the non-UV glue color cluster are changed; n represents the number of pixel points in the UV glue color cluster or the non-UV glue color cluster, C k Represents the region where the kth cluster is located, x j Representing the pixel value of the j-th point in the UV glue color cluster or non-UV glue color cluster. Then by calculation formula three of the minimum distance value:
(equation three)
Wherein t represents the number of clusters, arg represents the average value, min represents the minimum value, and the formula III is the minimum average value of the sum of the distances from the pixel points in all clusters to the corresponding centroid points.
The beneficial effects of the rgb2ind function are: the true color image is converted into an index image, and as one pixel of the image in the reference template area occupies three bytes, the values of H, S and V components are respectively stored, and one pixel of the index image occupies one byte, the memory space can be saved, and the operation efficiency can be improved.
The beneficial effects of the K-means clustering algorithm integrated with the rgb2ind function are as follows: the method has higher processing efficiency in the aspect of processing the image color, and can enhance the extraction target and the quantity of the image color characteristics, thereby more accurately positioning the UV glue in the reference template area.
Specifically, in another embodiment of the present application, the color extraction in S2 may also use HSV color extraction, RGB color extraction or luminance color extraction.
The RGB color extraction is specifically as follows: setting a threshold range of R, G, B three channels respectively, traversing each pixel point in the RGB image of the reference template area, and if R, G, B values of the pixel points all accord with the set range, the pixel point is regarded as a target pixel point to be extracted, namely, a pixel point of UV glue, and setting R, G, B upper and lower limit thresholds are extracted color parameters.
HSV color extraction: converting the RGB image of the reference template area into an HSV image, respectively setting the threshold ranges of the three channels H, S, V, traversing each pixel point in the HSV image, and if H, S, V values of the pixel points all accord with the set ranges, considering the pixel point as a target pixel point to be extracted, namely, the pixel point of the UV glue, wherein the set upper and lower limit thresholds H, S, V are the extracted color parameters.
Brightness and color extraction: converting an RGB image of a reference template area into a gray image, setting a threshold range of brightness, traversing each pixel point in the gray image, and if the gray value of the pixel point accords with the set range, the pixel point is regarded as a target pixel point to be extracted, namely, the pixel point of the UV glue, and the set brightness upper and lower limit thresholds are the extracted color parameters.
S3: and applying the parameters of color extraction to each sub-region in the initial RGB image to perform contour extraction, and performing binarization processing to obtain the UV glue paving region and the contour thereof.
Because some UV glue area boundaries have the condition that glue is inhomogeneous, leak glue or many drips glue, the mode through using color parameter lays the regional location of UV glue and is not very accurate, be applied to in the concrete implementation, draw the regional profile of UV glue and lay at the graphics processing interface, drag regional profile point and carry out whole translation and scale in fine setting, can more accurate location to more careful UV glue lay the regional, be convenient for follow-up processing to improve detection precision and efficiency.
Specifically, in other embodiments of the present application, the positioning of the UV glue placement area is further achieved by performing color extraction on each component on the circuit board, so as to position the UV glue area on a single component.
The above embodiment does not locate the whole UV glue spreading area on the circuit board in advance, but performs color extraction on each element area when detecting each element, and extracts UV glue on the element, thereby locating the local UV glue spreading area in a single element area, then detecting flaws in the local UV glue spreading area on the element, and detecting UV glue in the local non-UV glue spreading area on the element.
S4: and filling the outline of the UV glue laying area to obtain a non-UV glue laying area. A schematic diagram of the positions of the UV glue spreading area and the non-UV glue spreading area is shown in fig. 3. Referring to fig. 4, the method specifically comprises the following steps:
s41: and acquiring all initial connected domains in the UV glue laying area through a bidirectional scanning algorithm. Specifically, a Two-way scanning algorithm of the Two-way Pass can be utilized, and the Two-way scanning algorithm of the Two-way Pass can accurately detect any complex shape and any number of connected areas, so that false detection and missing detection are prevented.
S42: traversing the binarized image of the UV glue spreading area, and endowing each pixel point in the initial connected domain with a digital label. Wherein, non-zero pixels in the binarized image are UV glue, and zero pixels are non-UV glue.
The pixel points right above and the pixel points right to the left of the accessed current pixel point from the traversing sequence are given digital labels; when the current pixel point is a non-zero pixel, there are four cases as follows:
a) And if the pixel points of the upper neighborhood and the left neighborhood of the current pixel point are zero, giving a new digital label to the current pixel point, and recording the digital label value.
b) The neighborhood pixel above the current pixel is zero, the neighborhood pixel at the left side is not zero, and the digital label of the current pixel is consistent with the digital label of the pixel at the left side.
c) The upper neighborhood pixel point of the current pixel point is not zero, the left neighborhood pixel point is zero, and the digital label of the current pixel point is consistent with the digital label of the upper neighborhood pixel point.
d) And if the pixel points of the upper neighborhood and the left neighborhood of the current pixel point are not zero, the digital label of the current pixel point is the minimum value of the digital labels of the pixels of the left neighborhood and the upper neighborhood.
S43: and carrying out merging processing on the array storing the digital tag to obtain a true connected domain.
Different digital labels in the same initial connected domain are pointed to the same digital label through merging processing, and different digital labels belonging to the same initial connected domain are merged, so that the digital labels of all pixel points in the same initial connected domain are consistent. Therefore, a more accurate true connected domain is obtained, and the division of the UV glue laying area and the non-UV glue laying area is more accurate.
After the collection processing, the number of the true connected domains which need to be acquired and the number of the true connected domains which do not need to be acquired can be set according to the needs in specific implementation, so that the non-UV glue laying area can be positioned more accurately.
S44: and merging contour points of all the true connected domains according to the position of each sub-region to obtain a merged contour.
S45: and filling the merging contours to obtain a non-UV glue laying area.
In some embodiments, when the merged contour is a single image contour, filling is performed in a line scanning manner, which is specifically as follows: all lines of a single image are scanned from top to bottom, and during the scanning it is determined which pixels in the image should be filled. Referring to fig. 5, the implementation process is as follows:
S45a. for each row of a single image, find all the intersections of the contour of the single image in each row, and rank the intersections in a left-to-right order.
S45b. for each intersection point, find the point to the left of its neighbor and fill in the color between the two intersection points.
S45c. repeat steps S45a and S45b until all rows are scanned.
The line scanning mode can only access each pixel in a single image once, reduces repeated access and missed access of the pixels, and can fill the polygonal area efficiently, quickly and accurately, so that the non-UV glue paving area can be accurately and quickly obtained.
And when the combined contour is a multi-image contour, filling is carried out in a mode of dividing the level from large to small in area. The specific application is as follows: the contours of the plurality of images are arranged from large to small in area, and each contour is filled by the line scanning method. Therefore, the situation that sub-contours cannot be filled when the parent-child relationship exists in the multi-image contours can be avoided, and the situation of filling leakage is prevented, so that a more accurate non-UV glue paving area is obtained.
S5: and constructing a fence area between the UV glue laying area and the non-UV glue laying area, wherein the fence area is a tolerance non-detection area and is not detected. The position of the fence area is shown in fig. 6, wherein the inward shrinking point in fig. 6 is a first inward shrinking point, and the outward expanding point is a first outward expanding point.
Because the contact area between the UV glue laying area and the non-UV glue laying area often has the conditions of uneven glue, glue leakage or glue dripping, in order to prevent the conditions from detecting flaws on the UV glue area, the non-UV glue area detects the influence of the UV glue, thereby setting a tolerance non-detection area for removal, avoiding detection interference between the UV glue laying area and the non-UV glue laying area in the detection process, and ensuring the accuracy of detection results.
In some embodiments, referring to fig. 7, specifically, the steps of individually shrinking and expanding the UV glue spreading area to construct the fence area specifically include the following steps:
s51a: determining a first retraction point to retract the outline of the UV glue laying area;
s52a: determining a first expansion point to expand the outline of the UV glue paving area;
s53a: and constructing a fence area through the first inward contraction point and the first outward expansion point.
In some embodiments, referring to fig. 8, the method for determining the first retraction point specifically includes the following steps:
s511a: and determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue laying area.
S512a: and determining a first retraction point along the retraction direction by taking each contour point as a salient point based on the set retraction distance of each contour point.
S513a: and judging whether each first shrinkage point is positioned in the outline of the UV glue laying area by a ray method. Specifically, if the current first pinch point is located in the contour, determining the current first pinch point as a correct first pinch point; if the current first pinch point is not located in the outline, determining the correct first pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current first pinch point.
Referring to fig. 9, the method for determining the first expansion point specifically includes the following steps:
s521a: and determining the expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue laying area.
S522a: and determining a first expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point.
S523a: and judging whether each first expansion point is positioned in the outline of the UV glue paving area by a ray method. Specifically, if the current first expansion point is located in the outline, determining the current first expansion point as a correct first expansion point; if the current first expansion point is not located in the outline, determining the correct first expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current first expansion point.
In some embodiments, referring to fig. 10, the steps of constructing the fence area by separately shrinking and expanding the non-UV glue spreading area comprise the following steps:
s51b: determining a second shrinking point to shrink the outline of the non-UV glue laying area;
s52b: determining a second expansion point to expand the outline of the non-UV glue paving area;
s53b: and constructing a fence area through the second inward shrinking point and the second outward expanding point.
In some embodiments, referring to fig. 11, the method for determining the second retraction point specifically includes the following steps:
s511b: and determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue laying area.
S512b: and determining a second retraction point along the retraction direction by taking each contour point as a salient point based on the set retraction distance of each contour point.
S513b: and judging whether each second shrinkage point is positioned in the outline of the non-UV glue laying area by a ray method. Specifically, if the current second pinch point is located in the contour, determining the current second pinch point as a correct second pinch point; and if the current second pinch point is not positioned in the outline, determining the correct second pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current second pinch point.
Referring to fig. 12, the method for determining the second expansion point specifically includes the following steps:
s521b: and determining the expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue laying area.
S522b: and determining a second expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point.
S523b: and judging whether each second expansion point is positioned in the outline of the non-UV glue laying area by a ray method. Specifically, if the current second expansion point is located in the outline, the current second expansion point is determined to be a correct second expansion point; if the current second expansion point is not located in the outline, determining a correct second expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current second expansion point.
The conventional outward expansion and inward contraction method is to perform outward expansion and inward contraction on each layer of contour in an image respectively, but the method does not consider the situation that multiple layers of contours exist in the image, namely, the two layers of contours of a UV glue paving area and a non-UV glue paving area exist in the embodiment, and the mutual influence relationship exists between the contour shapes after outward expansion or inward contraction is larger than the actual difference, and the embodiment adopts the inward contraction points and the outward expansion points to perform inward contraction and outward expansion on the contour of the UV glue paving area or the non-UV glue paving area independently, so that the mutual influence relationship between the two layers of contours during inward contraction and outward expansion respectively can be avoided, the difference between the contour shapes of the UV glue paving area or the non-UV glue paving area after inward contraction and outward expansion and the actual difference is reduced, and the situation that multiple layers of contours exist in the image is effectively processed.
In some embodiments, the above-described points of invagination and invagination may also be determined by the polyline parallel line method. The method comprises the following steps: and respectively equidistantly taking parallel lines in the inward shrinking or outward expanding direction of two fold lines connected with adjacent three points in the contour of the UV glue paving area or the non-UV glue paving area, wherein the intersection point of the two parallel lines is the inward shrinking point or the outward expanding point. If the inland point or the outlying point is within the outline, indicating that the point is the correct inland point or the outlying point; if the pinch point or flare point is not within the contour, then the opposite direction is indicated, the same distance reversed is the correct pinch point or flare point.
The angular bisector method and the broken line parallel lines can accurately find the inward contraction points and the outward expansion points, so that the UV glue laying area and the non-UV glue laying area are accurately positioned.
S6: and setting a flaw detection area to detect the UV glue laying area, and detecting flaws in a flaw area threshold range. Detection of flaws such as bubbles and orange peels can be achieved in the UV glue paving area, and a flaw position diagram detected in the flaw detection area in the UV glue paving area is shown in fig. 13.
S7: and setting a UV glue detection area to detect the non-UV glue paving area, and detecting the UV glue in the area threshold range of the UV glue. The detection of whether the UV glue is dripped or not can be realized in a non-UV glue laying area, and a schematic diagram of the position of the UV glue detected in a UV glue detecting area in the non-UV glue laying area is shown in fig. 14.
Referring to fig. 15, specifically, the step of setting a UV glue detection area to detect the non-UV glue laying area includes the following steps:
s71: and aligning the plane coordinates of the standard CAD drawing of the whole circuit board and the plane coordinates of the initial RGB image of the circuit board to the same coordinate system. Alignment is realized through the component under the same coordinate system in order to realize alignment, realizes the detection location to non-UV glue laying area, improves the accuracy that UV glued the detection.
S72: and acquiring all pattern contours of the non-UV glue laying area, wherein the pattern contours comprise the outer contours of the non-UV glue laying area, and element contours and non-element contours in the non-UV glue laying area.
S73: and dividing the hierarchical relationship among the graphic outlines, namely the father-son relationship, according to the positions of the graphic outlines. The method specifically comprises the following steps: retrieving all the graphic outlines, dividing the graphic outlines into two levels, and placing the external outlines of the non-UV glue laying areas on a father tag; placing the element profile and the non-element profile in the non-UV glue laying area on a sub-label; if a certain non-UV glue laying area exists in the non-UV glue laying area, the certain non-UV glue laying area is placed on the parent label, and the element outline and the non-element outline in the certain non-UV glue laying area are placed on the child label until no other non-UV glue laying areas exist in the non-UV glue laying area.
Since there may be a case where the non-UV glue spreading area is nested in the UV glue spreading area on the actual circuit board, it is not preferable to select only the outer contour of the non-UV glue spreading area. By dividing all the graphic outlines into two levels and combining the mode of the exclusion parameters set by the user, the non-UV glue laying area can be more accurately divided.
S74: and sequencing all the graphic outlines according to the parent-child relationship.
S75: and the UV glue detection areas are sequentially detected according to the sorting sequence.
The second embodiment also provides a UV glue detection device based on a circuit board, where the UV glue detection device is operated to implement the steps of the UV glue detection method based on the circuit board. Referring to fig. 16, the UV gel detection apparatus includes:
an image acquisition and division module: the method comprises the steps of acquiring an initial RGB image of a whole circuit board, dividing the initial RGB image into N x M sub-areas, and acquiring an RGB image in each sub-area, wherein N is the number of rows and M is the number of columns;
reference area UV glue extraction module: the method comprises the steps of selecting a reference template area on an initial RGB image, and extracting colors of the reference template area to obtain UV glue in the reference template area;
UV glue laying area extraction module: the method comprises the steps of carrying out contour extraction on each sub-region in the initial RGB image according to the parameters of color extraction, and then carrying out binarization processing to obtain the UV glue paving region and the contour thereof;
non-UV glue laying area extraction module: the method comprises the steps of filling the outline of the UV glue paving area to obtain a non-UV glue paving area;
tolerance non-detection region construction module: the method comprises the steps that a fence area is built between the UV glue paving area and the non-UV glue paving area, wherein the fence area is a tolerance non-detection area and is not detected;
UV glue lays regional flaw detection module: the method comprises the steps of setting a flaw detection area to detect the UV glue laying area, and detecting flaws in a flaw area conforming threshold range;
non-UV glues and lays regional UV and glues detection module: the UV glue detection area detection device is used for setting a UV glue detection area to detect the non-UV glue paving area, and detecting UV glue in the area threshold range of the UV glue.
According to the circuit board-based UV glue detection scheme method, an initial RGB image of the whole circuit board is obtained through an image obtaining and dividing module, the initial RGB image is divided into N x M sub-areas, and RGB images in each sub-area are obtained, wherein N is the number of rows and M is the number of columns; selecting a reference template area on the initial RGB image through a reference area UV glue extraction module, and carrying out color extraction on the reference template area to obtain UV glue in the reference template area; applying the parameters of color extraction to each sub-region in the initial RGB image through a UV glue paving region extraction module to perform contour extraction and then performing binarization processing to obtain the UV glue paving region and region contours; filling the outline of the UV glue paving area through a non-UV glue paving area extraction module to obtain a non-UV glue paving area; constructing a fence area between the UV glue laying area and the non-UV glue laying area through a tolerance non-detection area construction module, wherein the fence area is a tolerance non-detection area and is not detected; a flaw detection area is arranged through a flaw detection module of the UV glue paving area to detect flaws within a flaw area threshold value; the UV glue detection module is used for setting a UV glue detection area to detect the non-UV glue paving area, and detecting the UV glue in the area threshold range of the UV glue.
According to the circuit board-based UV glue detection equipment in the second embodiment, parameters of UV glue color extraction in the reference template area are obtained, the parameters are applied to an initial RGB image of the whole circuit board to carry out contour extraction, then binarization processing is carried out to obtain a UV glue paving area and a contour of the UV glue paving area, the UV glue paving area is conveniently distinguished from vision, the contour of the UV glue paving area is filled, a non-UV glue paving area is obtained, the positioning division of the UV glue paving area and the non-UV glue paving area on the circuit board is achieved, the partition detection of defects is achieved, the detection of defects such as bubbles and orange peel in the UV glue paving area can be achieved, the detection of whether drip leakage exists in the UV glue in the non-UV glue paving area is also achieved, the accuracy and the detection efficiency of the UV glue detection are improved, and the detection of a large amount of surface defects of the circuit board is remarkably achieved. The detection interference between the UV glue paving area and the non-UV glue paving area in the detection process is prevented by arranging the tolerance non-detection area, and the accuracy and the detection efficiency of the UV glue detection are further improved.
On the basis of the above embodiment 2, performing color extraction on the reference template area, and obtaining the UV glue in the reference template area includes the following steps: HSV conversion is carried out on the RGB image of the reference template area, and a converted component histogram is obtained; carrying out equalization treatment on the component histogram to obtain an equalization histogram; and clustering and enhancing the equalization histogram to obtain the UV glue in the reference template area.
On the basis of the embodiment 2, the equalization histogram is subjected to clustering enhancement by a K-means clustering algorithm integrated with an rgb2ind function, wherein the K-means clustering algorithm integrated with the rgb2ind function has the following formula:
wherein k represents a kth cluster; mu (mu) k Representing the average value of pixel values in a kth cluster, wherein when k is an odd number, the kth cluster is a UV glue color cluster; when k is even, the kth cluster is a non-UV glue color cluster; i.e. when k=1, the first cluster is a UV glue color cluster; when k=2, the second cluster is a non-UV glue color cluster, and with continuous iteration, the pixel values in the UV glue color cluster or the non-UV glue color cluster are changed; n represents the number of pixel points in the UV glue color cluster or the non-UV glue color cluster, C k Represents the region where the kth cluster is located, x j Representing the pixel value of the j-th point in the UV glue color cluster or non-UV glue color cluster.
On the basis of the above embodiment 2, constructing a fence area between the UV glue laying area and the non-UV glue laying area includes the steps of: determining a first retraction point to retract the outline of the UV glue laying area; determining a first expansion point to expand the outline of the UV glue paving area; and constructing a fence area through the first inward contraction point and the first outward expansion point.
On the basis of the above embodiment 2, constructing a fence area between the UV glue laying area and the non-UV glue laying area includes the steps of: determining a second shrinking point to shrink the outline of the non-UV glue laying area; determining a second expansion point to expand the outline of the non-UV glue paving area; and constructing a fence area through the second inward shrinking point and the second outward expanding point.
On the basis of the above embodiment 2, the method for determining the first pinch point includes the following steps: determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue paving area; determining a first retraction point along the retraction direction by taking each contour point as a salient point based on the set retraction distance of each contour point; judging whether each first shrinkage point is positioned in the outline of the UV glue paving area, and if the current first shrinkage point is positioned in the outline, determining the current first shrinkage point as a correct first shrinkage point; if the current first pinch point is not located in the outline, determining the correct first pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current first pinch point.
On the basis of the above embodiment 2, the method for determining the first expansion point includes the following steps: determining the outward expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue paving area; determining a first expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point; judging whether each first expansion point is positioned in the outline of the UV glue paving area, and if the current first expansion point is positioned in the outline, determining the current first expansion point as a correct first expansion point; if the current first expansion point is not located in the outline, determining the correct first expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current first expansion point.
On the basis of the above embodiment 2, the method for determining the second retraction point includes the following steps: determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue paving area; determining a second retraction point along the retraction direction by taking each profile point as a salient point based on the set retraction distance of each profile point; judging whether each second shrinkage point is positioned in the outline of the non-UV glue paving area, and if the current second shrinkage point is positioned in the outline, determining the current second shrinkage point as a correct second shrinkage point; and if the current second pinch point is not positioned in the outline, determining the correct second pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current second pinch point.
On the basis of the above embodiment 2, the method for determining the second expansion point includes the following steps: determining the outward expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue paving area; determining a second expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point; judging whether each second expansion point is positioned in the outline of the non-UV glue paving area, and if the current second expansion point is positioned in the outline, determining the current second expansion point as a correct second expansion point; if the current second expansion point is not located in the outline, determining a correct second expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current second expansion point.
On the basis of the above embodiment 2, filling the contour of the UV glue spreading area to obtain a non-UV glue spreading area includes the following steps: acquiring all initial connected domains in the UV glue laying area through a bidirectional scanning algorithm; traversing the binarized image of the UV glue paving area, and endowing each pixel point in the initial connected area with a digital label; performing union processing on the array storing the digital tag to obtain a true connected domain; merging contour points of all the true connected domains to obtain a merged contour; and filling the merging contours to obtain a non-UV glue laying area.
Based on the above embodiment 2, the union process is specifically as follows: and combining the different digital labels belonging to the same initial connected domain, so that the digital labels of all the pixel points in the same initial connected domain are consistent.
On the basis of the above embodiment 2, when the combined contour is a single image contour, filling is performed in a line scanning manner; and when the combined contour is a multi-image contour, filling is carried out in a mode of dividing the level from large to small in area.
On the basis of the above embodiment 2, setting a UV glue detection area to detect the non-UV glue laying area includes the following steps: aligning the plane coordinates of the standard CAD drawing of the whole circuit board and the plane coordinates of the initial RGB image of the circuit board to the same coordinate system; acquiring all pattern contours of the non-UV glue laying area, wherein the pattern contours comprise an outer contour of the non-UV glue laying area, and an element contour and a non-element contour in the non-UV glue laying area; dividing the hierarchical relationship among the graphic outlines, namely the father-son relationship, according to the positions of the graphic outlines; sequencing all the graphic outlines according to the father-son relationship; and the UV glue detection areas are sequentially detected according to the sorting sequence.
On the basis of the above embodiment 2, the hierarchical relationship between the graphic outlines, that is, the parent-child relationship, is divided according to the positions of the respective graphic outlines, specifically including the following: retrieving all the graphic outlines and dividing the graphic outlines into two levels, placing the external outlines of the non-UV glue laying areas on a father tag, and placing the element outlines and the non-element outlines in the non-UV glue laying areas on a child tag; if a certain non-UV glue laying area exists in the non-UV glue laying area, the certain non-UV glue laying area is placed on the parent label, and the element outline and the non-element outline in the certain non-UV glue laying area are placed on the child label until no other non-UV glue laying areas exist in the non-UV glue laying area.
The third embodiment also provides a computer readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method for detecting UV glue based on a circuit board.
The storage medium stores program instructions capable of implementing all the methods described above, wherein the program instructions may be stored in the storage medium in the form of a software product, and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes, or a terminal device such as a computer, a server, a mobile phone, a tablet, or the like.
The processor may also be referred to as a CPU (Central Processing Unit ). The processor may be an integrated circuit chip having signal processing capabilities. The processor may also be:
DSP (digital Signal processor, which is a processor composed of large-scale or very large-scale integrated circuit chips for accomplishing certain signal processing tasks, has been developed gradually to meet the demands of high-speed real-time signal processing tasks, with the development of integrated circuit technology and digital signal processing algorithms, the implementation methods of digital signal processors have been continuously changed, and the processing functions have been continuously improved and expanded.)
ASIC (Application Specific Integrated Circuit, application specific integrated circuit, i.e. application specific integrated circuit, refers to an integrated circuit designed and manufactured to meet the requirements of a specific user and the needs of a specific electronic system.
FPGAs (field programmable gate arrays, field Programmable Gate Array) are a product of further development on the basis of programmable devices such as PALs (Programmable Array Logic ), GAL (generic array logic, general array logic) and the like. The programmable device is used as a semi-custom circuit in the field of Application Specific Integrated Circuits (ASICs), which not only solves the defect of custom circuits, but also overcomes the defect of limited gate circuits of the original programmable device.
It should be appreciated that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.

Claims (16)

1. The UV glue detection method based on the circuit board is characterized by comprising the following steps of:
acquiring an initial RGB image of the whole circuit board;
selecting a reference template area on the initial RGB image, and carrying out color extraction on the reference template area to obtain UV glue in the reference template area;
performing contour extraction on the initial RGB image according to the parameters of the color extraction, and performing binarization processing to obtain the UV glue paving area and the contour thereof;
filling the outline of the UV glue paving area to obtain a non-UV glue paving area;
constructing a fence area between the UV glue laying area and the non-UV glue laying area, wherein the fence area is not detected;
setting a flaw detection area to detect the UV glue laying area, and detecting flaws in a flaw area threshold range;
and setting a UV glue detection area to detect the non-UV glue paving area, and detecting the UV glue in the area threshold range of the UV glue.
2. The method for detecting UV glue on a circuit board according to claim 1, wherein the step of extracting the color of the reference template area to obtain the UV glue in the reference template area comprises the steps of:
HSV conversion is carried out on the RGB image of the reference template area, and a converted component histogram is obtained;
carrying out equalization treatment on the component histogram to obtain an equalization histogram;
and clustering and enhancing the equalization histogram to obtain the UV glue in the reference template area.
3. The method for detecting the UV glue based on the circuit board according to claim 2, wherein the equalization histogram is subjected to clustering enhancement through a K-means clustering algorithm integrated with an rgb2ind function, and the K-means clustering algorithm integrated with the rgb2ind function has the following formula:
wherein k represents a kth cluster; mu (mu) k Representing the average value of pixel values in a kth cluster, wherein when k is an odd number, the kth cluster is a UV glue color cluster; when k is even, the kth cluster is a non-UV glue color cluster; i.e. when k=1, the first cluster is a UV glue color cluster; when k=2, the second cluster is a non-UV glue color cluster, and with continuous iteration, the pixel values in the UV glue color cluster or the non-UV glue color cluster are changed; n represents the number of pixel points in the UV glue color cluster or the non-UV glue color cluster, C k Represents the region where the kth cluster is located, x j Representing the pixel value of the j-th point in the UV glue color cluster or non-UV glue color cluster.
4. The method of circuit board-based UV glue inspection according to claim 1, wherein constructing a fence area between the UV glue placement area and the non-UV glue placement area comprises the steps of:
determining a first retraction point to retract the outline of the UV glue laying area;
determining a first expansion point to expand the outline of the UV glue paving area;
and constructing a fence area through the first inward contraction point and the first outward expansion point.
5. The method of circuit board-based UV glue inspection according to claim 1, wherein constructing a fence area between the UV glue placement area and the non-UV glue placement area comprises the steps of:
determining a second shrinking point to shrink the outline of the non-UV glue laying area;
determining a second expansion point to expand the outline of the non-UV glue paving area;
and constructing a fence area through the second inward shrinking point and the second outward expanding point.
6. The method for detecting UV gel based on a circuit board according to claim 4, wherein the method for determining the first pinch point comprises the steps of:
determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue paving area;
Determining a first retraction point along the retraction direction by taking each contour point as a salient point based on the set retraction distance of each contour point;
judging whether each first shrinkage point is positioned in the outline of the UV glue paving area, and if the current first shrinkage point is positioned in the outline, determining the current first shrinkage point as a correct first shrinkage point; if the current first pinch point is not located in the outline, determining the correct first pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current first pinch point.
7. The method for detecting UV glue based on a circuit board according to claim 4, wherein the method for determining the first flare point comprises the following steps:
determining the outward expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the UV glue paving area;
determining a first expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point;
judging whether each first expansion point is positioned in the outline of the UV glue paving area, and if the current first expansion point is positioned in the outline, determining the current first expansion point as a correct first expansion point; if the current first expansion point is not located in the outline, determining the correct first expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current first expansion point.
8. The method for detecting UV gel based on a circuit board according to claim 5, wherein the method for determining the second shrink point comprises the steps of:
determining the retraction direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue paving area;
determining a second retraction point along the retraction direction by taking each profile point as a salient point based on the set retraction distance of each profile point;
judging whether each second shrinkage point is positioned in the outline of the non-UV glue paving area, and if the current second shrinkage point is positioned in the outline, determining the current second shrinkage point as a correct second shrinkage point; and if the current second pinch point is not positioned in the outline, determining the correct second pinch point along the opposite direction of the pinch direction based on the pinch distance by the outline point corresponding to the current second pinch point.
9. The method for detecting UV glue based on a circuit board according to claim 5, wherein the method for determining the second expansion point comprises the following steps:
determining the outward expansion direction of each contour point according to the angular bisectors of at least every three adjacent contour points in the non-UV glue paving area;
determining a second expansion point along the expansion direction by taking each contour point as a concave point based on the set expansion distance of each contour point;
Judging whether each second expansion point is positioned in the outline of the non-UV glue paving area, and if the current second expansion point is positioned in the outline, determining the current second expansion point as a correct second expansion point; if the current second expansion point is not located in the outline, determining a correct second expansion point along the opposite direction of the expansion direction based on the expansion distance by the outline point corresponding to the current second expansion point.
10. The method for detecting UV glue on a circuit board according to claim 1, wherein filling the contour of the UV glue spreading area to obtain a non-UV glue spreading area comprises the steps of:
acquiring all initial connected domains in the UV glue laying area through a bidirectional scanning algorithm;
traversing the binarized image of the UV glue paving area, and endowing each pixel point in the initial connected area with a digital label;
performing union processing on the array storing the digital tag to obtain a true connected domain;
merging contour points of all the true connected domains to obtain a merged contour;
and filling the merging contours to obtain a non-UV glue laying area.
11. The method for detecting UV glue based on a circuit board according to claim 10, wherein the merging and collecting process is specifically as follows: and combining the different digital labels belonging to the same initial connected domain, so that the digital labels of all the pixel points in the same initial connected domain are consistent.
12. The method for detecting UV glue on a circuit board according to claim 10 or 11, wherein when the combined contour is a single image contour, filling is performed in a line scanning manner; and when the combined contour is a multi-image contour, filling is carried out in a mode of dividing the level from large to small in area.
13. The method for detecting UV glue based on a circuit board according to claim 1, wherein the step of setting a UV glue detection area to detect the non-UV glue spreading area comprises the steps of:
aligning the plane coordinates of the standard CAD drawing of the whole circuit board and the plane coordinates of the initial RGB image of the circuit board to the same coordinate system;
acquiring all pattern contours of the non-UV glue laying area, wherein the pattern contours comprise an outer contour of the non-UV glue laying area, and an element contour and a non-element contour in the non-UV glue laying area;
dividing the hierarchical relationship among the graphic outlines, namely the father-son relationship, according to the positions of the graphic outlines;
sequencing all the graphic outlines according to the father-son relationship;
and the UV glue detection areas are sequentially detected according to the sorting sequence.
14. The method for detecting UV glue on a circuit board according to claim 13, wherein dividing the hierarchical relationship between the graphic outlines, namely, the parent-child relationship, according to the positions of the graphic outlines comprises the following steps:
Retrieving all graphic outlines and dividing them into two level hierarchies, placing the external outline of the non-UV glue-laid area on the parent label,
placing the element profile and the non-element profile in the non-UV glue laying area on a sub-label;
if a certain non-UV glue laying area exists in the non-UV glue laying area, the certain non-UV glue laying area is placed on the parent label, and the element outline and the non-element outline in the certain non-UV glue laying area are placed on the child label until no other non-UV glue laying areas exist in the non-UV glue laying area.
15. UV glues check out test set based on circuit board, a serial communication port, include
An image acquisition and division module: the method comprises the steps of acquiring an initial RGB image of a whole circuit board, dividing the initial RGB image into N x M sub-areas, and acquiring an RGB image in each sub-area, wherein N is the number of rows and M is the number of columns;
reference area UV glue extraction module: the method comprises the steps of selecting a reference template area on an initial RGB image, and extracting colors of the reference template area to obtain UV glue in the reference template area;
UV glue laying area extraction module: the method comprises the steps of carrying out contour extraction on each sub-region in the initial RGB image according to the parameters of color extraction, and then carrying out binarization processing to obtain the UV glue paving region and the contour thereof;
non-UV glue laying area extraction module: the method comprises the steps of filling the outline of the UV glue paving area to obtain a non-UV glue paving area;
tolerance non-detection region construction module: the method comprises the steps that a fence area is built between the UV glue paving area and the non-UV glue paving area, wherein the fence area is a tolerance non-detection area and is not detected;
UV glue lays regional flaw detection module: the method comprises the steps of setting a flaw detection area to detect the UV glue laying area, and detecting flaws in a flaw area conforming threshold range;
non-UV glues and lays regional UV and glues detection module: the UV glue detection area detection device is used for setting a UV glue detection area to detect the non-UV glue paving area, and detecting UV glue in the area threshold range of the UV glue.
16. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the circuit board based UV glue detection method of any of claims 1-14.
CN202310912587.2A 2023-07-25 2023-07-25 Method, equipment and storage medium for detecting UV glue based on circuit board Active CN116630325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310912587.2A CN116630325B (en) 2023-07-25 2023-07-25 Method, equipment and storage medium for detecting UV glue based on circuit board

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310912587.2A CN116630325B (en) 2023-07-25 2023-07-25 Method, equipment and storage medium for detecting UV glue based on circuit board

Publications (2)

Publication Number Publication Date
CN116630325A true CN116630325A (en) 2023-08-22
CN116630325B CN116630325B (en) 2023-10-13

Family

ID=87592516

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310912587.2A Active CN116630325B (en) 2023-07-25 2023-07-25 Method, equipment and storage medium for detecting UV glue based on circuit board

Country Status (1)

Country Link
CN (1) CN116630325B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150227816A1 (en) * 2014-02-10 2015-08-13 Huawei Technologies Co., Ltd. Method and apparatus for detecting salient region of image
CN105223208A (en) * 2015-09-23 2016-01-06 深圳市繁维科技有限公司 A kind of circuit board detecting template and preparation method thereof, circuit board detecting method
CN110838135A (en) * 2019-10-31 2020-02-25 上海工程技术大学 PCB bare board image registration method
CN112330688A (en) * 2020-11-02 2021-02-05 腾讯科技(深圳)有限公司 Image processing method and device based on artificial intelligence and computer equipment
CN113516619A (en) * 2021-04-09 2021-10-19 重庆大学 Product surface flaw identification method based on image processing technology
US20220027657A1 (en) * 2020-07-24 2022-01-27 Beihang University Image object detection method, device, electronic device and computer readable medium
CN114266700A (en) * 2021-12-13 2022-04-01 浙江工业大学 Rapid zooming method for irregular contour
CN115908269A (en) * 2022-10-26 2023-04-04 中科慧远视觉技术(北京)有限公司 Visual defect detection method and device, storage medium and computer equipment
CN115980012A (en) * 2023-02-09 2023-04-18 欧朗电子科技有限公司 Medical detection circuit board gluing multi-angle detection system and detection method thereof

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150227816A1 (en) * 2014-02-10 2015-08-13 Huawei Technologies Co., Ltd. Method and apparatus for detecting salient region of image
CN105223208A (en) * 2015-09-23 2016-01-06 深圳市繁维科技有限公司 A kind of circuit board detecting template and preparation method thereof, circuit board detecting method
CN110838135A (en) * 2019-10-31 2020-02-25 上海工程技术大学 PCB bare board image registration method
US20220027657A1 (en) * 2020-07-24 2022-01-27 Beihang University Image object detection method, device, electronic device and computer readable medium
CN112330688A (en) * 2020-11-02 2021-02-05 腾讯科技(深圳)有限公司 Image processing method and device based on artificial intelligence and computer equipment
CN113516619A (en) * 2021-04-09 2021-10-19 重庆大学 Product surface flaw identification method based on image processing technology
CN114266700A (en) * 2021-12-13 2022-04-01 浙江工业大学 Rapid zooming method for irregular contour
CN115908269A (en) * 2022-10-26 2023-04-04 中科慧远视觉技术(北京)有限公司 Visual defect detection method and device, storage medium and computer equipment
CN115980012A (en) * 2023-02-09 2023-04-18 欧朗电子科技有限公司 Medical detection circuit board gluing multi-angle detection system and detection method thereof

Also Published As

Publication number Publication date
CN116630325B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
CN110210409B (en) Method and system for detecting form frame lines in form document
CN107909138B (en) Android platform-based circle-like particle counting method
CN115082419B (en) Blow-molded luggage production defect detection method
Chen et al. A double-threshold image binarization method based on edge detector
CN109978839B (en) Method for detecting wafer low-texture defects
CN112232391B (en) Dam crack detection method based on U-net network and SC-SAM attention mechanism
CN102930268B (en) A kind of for polluting and the accurate positioning method of DataMatrix code in various visual angles situation
CN108596166A (en) A kind of container number identification method based on convolutional neural networks classification
CN109858325B (en) Table detection method and device
CN106897994A (en) A kind of pcb board defect detecting system and method based on layered image
CN108447050A (en) A kind of Surface Flaw dividing method based on super-pixel
CN110188778B (en) Residential area element outline regularization method based on image extraction result
CN105184770B (en) A kind of soldered ball positioning and its parameter identification method for ball grid array pin chip
CN110097596A (en) A kind of object detection system based on opencv
CN111382658B (en) Road traffic sign detection method in natural environment based on image gray gradient consistency
CN113658092A (en) Aluminum electrolytic capacitor defect detection method based on image processing
CN116777877A (en) Circuit board defect detection method, device, computer equipment and storage medium
Veksler Dense features for semi-dense stereo correspondence
CN107507130A (en) A kind of quickly QFN chip pins image obtains and amplification method
CN108182707B (en) Chessboard grid calibration template under incomplete collection condition and automatic identification method thereof
CN104268550A (en) Feature extraction method and device
CN116630325B (en) Method, equipment and storage medium for detecting UV glue based on circuit board
CN111738936A (en) Image processing-based multi-plant rice spike length measuring method
CN103955929B (en) Image local edge pattern and non-edge mode judging method and judgment means
CN107615333B (en) Image speckle 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