Electronic component visual recognition method and system

By establishing a learning module through visual recognition methods, statistical parameters before and after core pack dispensing are collected, and threshold detection is used to detect core pack tilt, image sequence, and dispensing anomalies. This solves the shortcomings of existing core pack detection technologies and improves product quality and production efficiency.

CN115170478BActive Publication Date: 2026-05-12HUNAN YUNYAN INTELLIGENT EQUIP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN YUNYAN INTELLIGENT EQUIP CO LTD
Filing Date
2022-06-10
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing core pack inspection methods cannot effectively detect abnormal core pack tilting, abnormal image sequence, and abnormal core pack dripping after dispensing, leading to substandard product quality and potential losses.

Method used

A visual recognition method is adopted. By establishing a learning module, parameters before and after the core bag is dotted are statistically analyzed to obtain parameters such as the position and area of ​​the core bag body, the area of ​​the white area, and the area of ​​the droplet. Threshold detection is used to detect core bag tilt, image sequence, and droplet anomalies, including ROI operation, angle detection, droplet position and area detection, etc.

Benefits of technology

This improved the accuracy of core package testing, prevented the scrapping of substandard products, and ensured product quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170478B_ABST
    Figure CN115170478B_ABST
Patent Text Reader

Abstract

The application provides an electronic component visual identification method, comprising the following steps: S1, establishing a learning module for counting parameters before and after a core package point liquid, counting the parameters before and after the core package point liquid; S2, judging whether the learned quantity satisfies or not: if yes, entering step S3, if no, returning to step S1; S3, carrying out threshold extraction on the counted parameters, and detecting according to the extracted threshold. Through the learning module for counting parameters before and after a core package point liquid, the parameters before and after the core package point liquid are counted, and the core package drop detection is carried out according to the counted parameters, so that the product quality can be ensured, and the loss caused by the unqualified product scrapping can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic component inspection technology, and in particular to a method for detecting liquid in the core of electronic components using visual recognition. Background Technology

[0002] During the manufacturing process of electronic components, it is necessary to perform electrolyte dispensing on the core package inside the electronic component. The electrolyte dispensing operation directly affects some physical property parameters of the electronic component.

[0003] Chinese patented invention: An X-Ray inspection system and method for lithium battery cell pack structure (Publication (Announcement) No.: CN106945890B), discloses an inspection method for lithium battery cell packs. It uses a conveyor and loading / unloading device to feed the lithium battery cell packs into an X-Ray inspection device. The assembly-line conveyor system combined with an inductive switch increases inspection efficiency. By employing a stable rotating placement rack, continuous 360-degree inspection of the lithium battery cell packs without blind spots can be achieved, increasing the accuracy of the inspection data. Different functional areas are set up for flexible and quick use, effectively improving the efficiency of the entire lithium battery production process. A fully enclosed protective cover effectively isolates X-Ray radiation. The inspection includes wrinkles, twists, number of electrode layers, and electrode tab height. However, it still has some shortcomings:

[0004] Existing core pack testing methods lack effective means to detect the dispensing effect of the core pack. In particular, when the core pack exhibits abnormal tilting, abnormal image sequence, or abnormal dispensing after dispensing, product quality cannot be guaranteed, and products are prone to being rejected and resulting in losses.

[0005] To address this, a visual recognition method and system for electronic components is proposed. Summary of the Invention

[0006] In view of this, the present invention aims to provide a method and system for visual recognition of electronic components to solve or alleviate the technical problems existing in the prior art, and at least provide a beneficial option.

[0007] The technical solution of this invention is implemented as follows: a visual recognition method and system for electronic components, comprising the following steps:

[0008] S1. Establish a learning module for statistical analysis of parameters before and after cored fluid dispensing, and statistically analyze parameters before and after dry cored fluid dispensing.

[0009] S2. Determine if the learned quantity satisfies the requirement: if it does, proceed to step S3; otherwise, return to step S1.

[0010] S3. Extract thresholds from the statistically obtained parameters and perform detection based on the extracted thresholds.

[0011] A further preferred embodiment: In step S1, when the learning module statistically analyzes the parameters of the core fluid before and after injection, it includes the following steps:

[0012] S11. Input images of the core pack before and after liquid droplet application;

[0013] S12, Extract the position of the core package body;

[0014] S13. Obtain the core package body area;

[0015] S14. Extract the white portion of the core package;

[0016] S15. Obtain the area of ​​the white region;

[0017] S16. Extract the bottom position of the core package;

[0018] S17. Obtain the core droplet area.

[0019] A further preferred embodiment: In step S13, when obtaining the core package body area, the maximum area of ​​the contour is obtained through the contourArea function, and the maximum area is used as the learning parameter for the core package body area.

[0020] A further preferred embodiment: In step S15, when obtaining the area of ​​the white region, the area of ​​the white region contour is obtained through the contourArea function and the maximum value is selected. The maximum value is used as the learning value for the area of ​​the core-enclosed white region.

[0021] A further preferred embodiment: In step S3, when performing detection based on the extracted threshold, the following steps are included:

[0022] S31. Input images of the core pack before and after the liquid droplet;

[0023] S32, ROI operation;

[0024] S33, Locate the core package body;

[0025] S34, Angle detection operation;

[0026] S35. Operation to locate the white area before dripping;

[0027] S36. Image sequence anomaly detection operation;

[0028] S37, Droplet location extraction operation;

[0029] S38, Droplet area detection operation.

[0030] A further preferred embodiment: In S34, during the angle detection operation, the boundary points on the left and right sides of the contour are extracted, and the boundary points are fitted into a straight line to obtain the slope of the straight line. The angle deviation on the left and right sides is obtained based on the slope and compared with the angle deviation threshold.

[0031] During the angle detection operation, the maximum area of ​​the core package body is detected. If the area of ​​the core package body is greater than the core package body area threshold, and the angle deviation on both the left and right sides is greater than the angle deviation threshold, then the core package angle is judged to be abnormal.

[0032] If the core package body area is less than the core package body area threshold, then the angle deviation on either the left or right side is greater than the angle deviation threshold, indicating an abnormal core package angle.

[0033] A further preferred embodiment: In step S36, during the image sequence anomaly detection operation, the maximum area of ​​the core-enclosed white region is obtained and then compared with the core-enclosed white region threshold. If it is less than the threshold, it indicates that the image sequence is abnormal.

[0034] A further preferred embodiment: In step S38, during the droplet area detection operation, it detects whether there is no droplet or a small amount of droplet at the bottom of the core package, and rejects those with no droplet or a small amount of droplet.

[0035] The bottom droplet area obtained in step S38 is compared with the droplet area threshold. If the droplet area is less than the threshold, the core package droplet is abnormal.

[0036] This invention also provides a visual recognition system for electronic components, including a learning module, a detection module, and a judgment module:

[0037] The learning module is used to statistically analyze parameters before and after the dry core is coated with the liquid.

[0038] The detection module is used to detect the dry core pack based on the parameter thresholds before and after the dry core pack is filled with liquid;

[0039] The determination module is used to determine whether there are abnormalities in core pack tilting, image sequence, or core pack dripping after the dry core pack has been dotted with liquid.

[0040] The present invention also provides an electronic device, including a processor and a memory, the memory storing computer-readable instructions, which, when executed by the processor, perform the steps in the above method.

[0041] The embodiments of the present invention have the following advantages due to the adoption of the above technical solutions:

[0042] This invention establishes a learning module for statistical analysis of parameters before and after core fluid dispensing. By statistically analyzing these parameters and performing core fluid dispensing detection based on the obtained parameters, product quality can be guaranteed, and losses caused by defective or scrapped products can be avoided.

[0043] The above overview is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of the invention will become readily apparent from the accompanying drawings and the following detailed description. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a flowchart of the learning steps of the learning module of this invention;

[0046] Figure 2 This is a flowchart of the detection process after the core package is dispensed according to the present invention;

[0047] Figure 3 A schematic diagram of a core pack without any liquid dripping;

[0048] Figure 4 This is a schematic diagram of the core pack after the liquid has been dispensed. Detailed Implementation

[0049] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the spirit or scope of the invention. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.

[0050] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0051] Example 1

[0052] like Figure 1-4 As shown, this embodiment of the invention provides a method and system for visual recognition of electronic components, including the following steps:

[0053] S1. Establish a learning module for statistical analysis of parameters before and after cored fluid dispensing, and statistically analyze parameters before and after dry cored fluid dispensing.

[0054] S2. Determine if the learned quantity satisfies the requirement: if it does, proceed to step S3; otherwise, return to step S1.

[0055] S3. Extract thresholds from the statistically obtained parameters and perform detection based on the extracted thresholds.

[0056] In this embodiment, specifically: in step S1, when the learning module statistically analyzes the parameters of the core fluid before and after injection, it includes the following steps:

[0057] S11. Input images of the core pack before and after liquid droplet application;

[0058] S12, Extract the position of the core package body;

[0059] S13. Obtain the core package body area;

[0060] S14. Extract the white portion of the core package;

[0061] S15. Obtain the area of ​​the white region;

[0062] S16. Extract the bottom position of the core package;

[0063] S17. Obtain the core droplet area.

[0064] In this embodiment, specifically: in S13, when obtaining the core package body area, the maximum area of ​​the contour is obtained through the contourArea function, and the maximum area is used as the learning parameter of the core package body area.

[0065] In this embodiment, specifically: in S15, when obtaining the area of ​​the white region, the area of ​​the white region contour is obtained through the contourArea function and the maximum value is selected. The maximum value is used as the learning value of the area of ​​the core-enclosed white region.

[0066] In this embodiment, specifically, step S3, when performing detection based on the extracted threshold, includes the following steps:

[0067] S31. Input images of the core pack before and after the liquid droplet;

[0068] S32, ROI operation;

[0069] S33, Locate the core package body;

[0070] S34, Angle detection operation;

[0071] S35. Operation to locate the white area before dripping;

[0072] S36. Image sequence anomaly detection operation;

[0073] S37, Droplet location extraction operation;

[0074] S38, Droplet area detection operation.

[0075] In this embodiment, specifically: during the angle detection operation in S34, the boundary points on the left and right sides of the contour are extracted, and the boundary points are fitted into a straight line to obtain the slope of the straight line. The angle deviation on the left and right sides is obtained based on the slope and compared with the angle deviation threshold.

[0076] During the angle detection operation, the maximum area of ​​the core package body is detected. If the area of ​​the core package body is greater than the core package body area threshold, and the angle deviation on both the left and right sides is greater than the angle deviation threshold, then the core package angle is judged to be abnormal.

[0077] If the core package body area is less than the core package body area threshold, then the angle deviation on either the left or right side is greater than the angle deviation threshold, indicating an abnormal core package angle.

[0078] In this embodiment, specifically: during the image sequence anomaly detection operation in S36, the maximum area of ​​the core white region is obtained and then compared with the core white region threshold. If it is less than the threshold, it indicates that the image sequence is abnormal.

[0079] In this embodiment, specifically: during the drip area detection operation in S38, it is detected whether there is no drip or a small amount of drip at the bottom of the core package, and those with no drip or a small amount of drip are rejected.

[0080] The bottom droplet area obtained in step S38 is compared with the droplet area threshold. If the droplet area is less than the threshold, the core package droplet is abnormal.

[0081] This invention also provides a visual recognition system for electronic components, including a learning module, a detection module, and a judgment module:

[0082] The learning module is used to statistically analyze parameters before and after the dry core is coated with the liquid.

[0083] The detection module is used to detect the dry core pack based on the parameter thresholds before and after the dry core pack is filled with liquid;

[0084] The determination module is used to determine whether there are abnormalities in core pack tilting, image sequence, or core pack dripping after the dry core pack has been dotted with liquid.

[0085] The present invention also provides an electronic device, including a processor and a memory, the memory storing computer-readable instructions, which, when executed by the processor, perform the steps in the above method.

[0086] Example 2

[0087] The present invention also provides operational data for dripping liquid onto the core package according to the steps of Embodiment 1:

[0088] 1. Binarization Image Method

[0089] 1.1 Threshold Method

[0090] First, use the cvtColor function to convert the color image to a grayscale image.

[0091] Then use the threshold function to binarize the grayscale image based on the threshold.

[0092] 1.2 Color Gamut Method

[0093] First, use the cvtColor function to convert the color image into a color gamut image.

[0094] Then use the inRange function to binarize the color gamut image based on the threshold.

[0095] The operation and threshold for finding the white area of ​​the core package body are as follows:

[0096] cv::Scalar lower(0, 200, 0);

[0097] cv::Scalar upper(255, 255, 255);

[0098] cv::inRange(hls, lower, upper, hlsMask);

[0099] 2. Binary Image Processing Methods

[0100] 2.1 Morphological approach

[0101] The erode function is used to perform erosion on a binary image to remove isolated small points, burrs, and small bridges.

[0102] The dilate function is used to dilate a binary image, filling in small holes and fitting small cracks.

[0103] Use the morphologyEx function to perform morphological operations directly;

[0104] The core-packet body boundary image screening operation and threshold are as follows:

[0105] cv::Mat kernel = cv::getStructuringElement(cv::MORPH_RECT,cv::Size(151,111));

[0106] cv::morphologyEx(mask, open, cv::MORPH_OPEN, kernel);

[0107] 2.2 FloodFill Method

[0108] Use the floodFill function to fill a binary image.

[0109] The core-package body binary image filtering operation and threshold are as follows:

[0110] cv::Mat mask1 = ~mask;

[0111] cv::floodFill(mask1, cv::Point(0,0),cv::Scalar(0));

[0112] cv::floodFill(mask1, cv::Point(mask.cols - 1,0),cv::Scalar(0));

[0113] cv::floodFill(mask1, cv::Point(0,mask.rows - 1),cv::Scalar(0));

[0114] cv::floodFill(mask1, cv::Point(mask.cols - 1,mask.rows - 1),cv::Scalar(0));

[0115] mask += mask1;

[0116] Contour extraction

[0117] Use the findContours function to extract contours from a binary image.

[0118] The core package body contour extraction operation and parameters are as follows:

[0119] std::vector <std::vector <cv::point>>contours;

[0120] std::vector <cv::vec4i>hierarchy

[0121] cv::findContours(open, contours, hierarchy, cv::RETR_EXTERNAL,

[0122] cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

[0123] Statistical learning process

[0124] 1. Overall Process Introduction

[0125] The thresholds required for detection are learned statistically. These include thresholds for the core capsule body area, the area of ​​the white region before core capsule dispensing, the bottom position of the core capsule, and the dispensing area. The learning process is as follows:

[0126] 2. Introduction to Learning Steps

[0127] 2.1 Extracting the location of the core package body

[0128] The following are the operations and thresholds for obtaining binary images using the threshold function:

[0129] cv::threshold(gray, mask, 70, 255, cv::THRESH_BINARY);

[0130] Fill the binary image using the floodFill function.

[0131] cv::Mat mask1 = ~mask;

[0132] cv::floodFill(mask1, cv::Point(0,0),cv::Scalar(0));

[0133] cv::floodFill(mask1, cv::Point(mask.cols - 1,0),cv::Scalar(0));

[0134] cv::floodFill(mask1, cv::Point(0,mask.rows - 1),cv::Scalar(0));

[0135] cv::floodFill(mask1, cv::Point(mask.cols - 1,mask.rows - 1),cv::Scalar(0));

[0136] mask += mask1;

[0137] The binary image is filtered using the morphologyEx function.

[0138] cv::Mat kernel = cv::getStructuringElement(cv::MORPH_RECT,cv::Size(151,111));

[0139] cv::morphologyEx(mask, open, cv::MORPH_OPEN, kernel);

[0140] Obtain the core envelope contour using the findContours function.

[0141] std::vector <std::vector <cv::point>>contours;

[0142] std::vector <cv::vec4i>hierarchy

[0143] cv::findContours(open,contours,hierarchy,cv::RETR_EXTERNAL,

[0144] cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

[0145] 2.2 Obtaining the core package body area

[0146] The maximum area of ​​the contour is obtained through the contourArea function, and this maximum area is used as a learning parameter for the core envelope body area.

[0147] double maxArea = 0;

[0148] for(auto contour : contours){

[0149] double area = cv::contourArea(contour);

[0150] if (area > maxArea) {

[0151] maxArea = area;

[0152] }

[0153] }

[0154] 2.3 Extract the white portion of the core package.

[0155] The following are the steps and thresholding for extracting the white region from a binary image using the color gamut:

[0156] cv::Mat hls;

[0157] cv::cvtColor(image, hls, cv::COLOR_BGR2HLS);

[0158] cv::Scalar lower(0, 200, 0);

[0159] cv::Scalar upper(255, 255, 255);

[0160] cv::Mat hlsMask;

[0161] cv::inRange(hls, lower, upper, hlsMask);

[0162] The outline of the white area is obtained using the findContours function.

[0163] std::vector <std::vector <cv::point>>contours;

[0164] std::vector <cv::vec4i>hierarchy

[0165] cv::findContours(open, contours, hierarchy, cv::RETR_EXTERNAL,

[0166] cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

[0167] 2.4 Obtain the area of ​​the white region of the core package

[0168] The `contourArea` function is used to obtain the area of ​​the white region's outline, and the maximum value is selected. This maximum value is used as a learning value for the area of ​​the white region within the core.

[0169] double maxArea = 0;

[0170] for(auto contour : contours){

[0171] double area = cv::contourArea(contour);

[0172] if (area > maxArea) {

[0173] maxArea = area;

[0174] }

[0175] }

[0176] 2.5. Obtain the area at the bottom of the core package.

[0177] Use the absdiff function to perform a difference operation on the two images before and after the droplet application.

[0178] cv::Mat diff;

[0179] cv::absdiff(firstImage,secondImage,diff);

[0180] Use the threshold function to perform image binarization.

[0181] cv::Mat roiGray;

[0182] cv::cvtColor(diff, roiGray, cv::COLOR_BGR2GRAY);

[0183] cv::Mat roiMask;

[0184] cv::threshold(roiGray, roiMask,40, 255, cv::THRESH_BINARY);

[0185] Morphological operations are performed using the morphologyEx function.

[0186] cv::Mat open;

[0187] cv::Mat kernel = cv::getStructuringElement(

[0188] cv::MORPH_RECT, cv::Size(5,5));

[0189] cv::morphologyEx(roiMask, open, cv::MORPH_OPEN, kernel);

[0190] Use the findContours function to extract contours.

[0191] std::vector <std::vector <cv::point>>contours;

[0192] std::vector <cv::vec4i>hierarchy

[0193] cv::findContours(open, contours, hierarchy, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

[0194] The rectangular region with the largest area is obtained as the learning parameter for the bottom position of the core package.

[0195] cv::Rect maxRect;

[0196] double maxArea = 0;

[0197] for(auto contour : contours){

[0198] double area = cv::contourArea(contour);

[0199] if (area > maxArea) {

[0200] maxArea = area;

[0201] maxRect = cv::boundingRect(contour);

[0202] }

[0203] }

[0204] 2.6 Obtaining the droplet area

[0205] The maximum area of ​​the contour is obtained as a learning parameter for the droplet area.

[0206] double maxArea = 0;

[0207] for(auto contour : contours){

[0208] double area = cv::contourArea(contour);

[0209] if (area > maxArea) {

[0210] maxArea = area;

[0211] }

[0212] }

[0213] 2.7 Threshold extraction for statistical learning parameters

[0214] Depending on the testing requirements, some learning parameters require maximum values, while others require minimum values. After extraction, the extracted thresholds can be used as the testing thresholds. This dynamically adapts to different product models.

[0215] double entityAreaMin = 99999999;

[0216] double whiteAreaMax = 0;

[0217] double rectXMin = 99999999;

[0218] double rectYMin = 99999999;

[0219] double rectWidthMax = 0;

[0220] double rectHeightMax = 0;

[0221] double blackAreaMin = 99999999;

[0222] for(auto result: calcResults){

[0223] if(entityAreaMin>result[0]){

[0224] entityAreaMin = result[0];

[0225] }

[0226] if(whiteAreaMax <result[1]){

[0227] whiteAreaMax = result[1];

[0228] }

[0229] if(rectXMin>result[2]){

[0230] rectXMin = result[2];

[0231] }

[0232] if(rectYMin>result[3]){

[0233] rectYMin = result[3];

[0234] }

[0235] if (rectWidthMax) <result[4]){

[0236] rectWidthMax = result[4];

[0237] }

[0238] if(rectHeightMax <result[5]){

[0239] rectHeightMax = result[5];

[0240] }

[0241] if(blackAreaMin>result[6]){

[0242] blackAreaMin = result[6];

[0243] }

[0244] }

[0245] Testing process

[0246] 1. Overall Process Introduction

[0247] The main defects detected are three types: abnormal core pack tilting, abnormal image sequence, and abnormal core pack liquid dripping. The detection process is as follows:

[0248] 2. Introduction to the testing steps

[0249] 2.1 ROI Operation

[0250] When a camera takes a picture, it cannot guarantee that only the core envelope will be captured. The first step in recognition is to define the Region of Interest (ROI) in the image, extracting only the core envelope portion for recognition. The ROI range parameter is passed in via interface selection (Region of Interest). In machine vision and image processing, the region to be processed from the image is outlined using rectangles, circles, ellipses, irregular polygons, etc., and is called the Region of Interest (ROI). Various operators and functions are commonly used in machine vision software such as Halcon, OpenCV, and Matlab to obtain the ROI and perform further image processing.

[0251] 2.2 Locating the Core Packet Body

[0252] The following are the operations and thresholds for obtaining binary images using the threshold function:

[0253] cv::threshold(gray, mask, 70, 255, cv::THRESH_BINARY);

[0254] Fill the binary image using the floodFill function.

[0255] cv::Mat mask1 = ~mask;

[0256] cv::floodFill(mask1, cv::Point(0,0),cv::Scalar(0));

[0257] cv::floodFill(mask1, cv::Point(mask.cols - 1,0),cv::Scalar(0));

[0258] cv::floodFill(mask1, cv::Point(0,mask.rows - 1),cv::Scalar(0));

[0259] cv::floodFill(mask1, cv::Point(mask.cols - 1,mask.rows - 1),cv::Scalar(0));

[0260] mask += mask1;

[0261] The binary image is filtered using the morphologyEx function.

[0262] cv::Mat kernel = cv::getStructuringElement(cv::MORPH_RECT,cv::Size(151,111));

[0263] cv::morphologyEx(mask, open, cv::MORPH_OPEN, kernel);

[0264] Obtain the core envelope contour using the findContours function.

[0265] std::vector <std::vector <cv::point>>contours;

[0266] std::vector <cv::vec4i>hierarchy

[0267] cv::findContours(open, contours, hierarchy, cv::RETR_EXTERNAL,

[0268] cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

[0269] The contourArea function is used to obtain the area of ​​the contour and then filter out the contour with the largest area.

[0270] The boundingRect function is used to obtain the rectangular position of the outline.

[0271] double maxArea = 0;

[0272] cv::Rect maxRect;

[0273] for(auto contour : contours){

[0274] double area = cv::contourArea(contour);

[0275] if (area > maxArea) {

[0276] maxArea = area;

[0277] maxRect = cv::boundingRect(contour);

[0278] }

[0279] }、

[0280] 2.3 Angle Detection Operation

[0281] Test instructions:

[0282] Angle detection checks the left and right tilt of the core package and rejects those that are severely tilted.

[0283] Implementation method:

[0284] Extract the boundary points on the left and right sides of the contour, fit the boundary points into a straight line, obtain the slope of the straight line, and compare the angle deviation of the left and right sides with the angle deviation threshold based on the slope.

[0285] If the core packet is present in the background, it will affect the extraction of angles on both sides. Therefore, during angle detection, the maximum area of ​​the core packet itself also needs to be detected. If the core packet area is greater than the core packet area threshold, the angle deviation on both sides must be greater than the angle deviation threshold for the core packet angle to be judged as abnormal. If the core packet area is less than the core packet area threshold, the angle deviation on either side will be greater than the angle deviation threshold for the core packet angle to be judged as abnormal.

[0286] std::vector <cv::point>leftPoints;

[0287] std::vector <cv::point>rightPoints;

[0288] cv::Vec4f leftLinePara;

[0289] cv::Vec4f rightLinePara;

[0290] cv::fitLine(leftPoints,leftLinePara,cv::DIST_L2,0,1e-2, 1e-2);

[0291] cv::fitLine(rightPoints,rightLinePara,cv::DIST_L2,0,1e-2,1e-2)

[0292] 2.4 Locating the location of the white area before dripping

[0293] The following are the steps and thresholding for extracting the white region from a binary image using the color gamut:

[0294] cv::Mat hls;

[0295] cv::cvtColor(image, hls, cv::COLOR_BGR2HLS);

[0296] cv::Scalar lower(0, 200, 0);

[0297] cv::Scalar upper(255, 255, 255);

[0298] cv::Mat hlsMask;

[0299] cv::inRange(hls, lower, upper, hlsMask);

[0300] The outline of the white area is obtained using the findContours function.

[0301] std::vector <std::vector <cv::point>>contours;

[0302] std::vector <cv::vec4i>hierarchy

[0303] cv::findContours(open, contours, hierarchy, cv::RETR_EXTERNAL,

[0304] cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

[0305] The `contourArea` function is used to obtain the area of ​​the white region outline and then filter out the maximum value.

[0306] double maxArea = 0;

[0307] for(auto contour : contours){

[0308] double area = cv::contourArea(contour);

[0309] if (area > maxArea) {

[0310] maxArea = area;

[0311] }

[0312] }

[0313] 2.5 Image Sequence Anomaly Detection Operation

[0314] Detection Instructions: During detection, images before and after the core packet is dropped are processed simultaneously. Sequence anomaly detection mainly detects images lost due to camera frame drops or network issues, where the two images being detected do not belong to the same core packet (image before the previous core packet was dropped + image before the current core packet was dropped, image after the previous core packet was dropped + image before the current core packet was dropped, image after the previous core packet was dropped + current core packet + image after the current core packet was dropped). In such cases, it is necessary to restore the initial state.

[0315] Detection implementation: Obtain the maximum area of ​​the white region within the core and compare it with a threshold for the white region within the core. If it is less than the threshold, it indicates that the image order is abnormal.

[0316] 2.6 Extraction operation at the droplet location

[0317] Use the absdiff function to perform a difference operation on the two images before and after the droplet application.

[0318] cv::Mat diff;

[0319] cv::absdiff(firstImage,secondImage,diff);

[0320] Use the threshold function to perform image binarization.

[0321] cv::Mat roiGray;

[0322] cv::cvtColor(diff, roiGray, cv::COLOR_BGR2GRAY);

[0323] cv::Mat roiMask;

[0324] cv::threshold(roiGray, roiMask,40, 255, cv::THRESH_BINARY);

[0325] Morphological operations are performed using the morphologyEx function.

[0326] cv::Mat open;

[0327] cv::Mat kernel = cv::getStructuringElement(

[0328] cv::MORPH_RECT, cv::Size(5,5));

[0329] cv::morphologyEx(roiMask, open, cv::MORPH_OPEN, kernel);

[0330] Use a threshold to extract the bottom position of the core (only the bottom part is retained in the binarized image).

[0331] cv::Mat tmp = cv::Mat(open.size(),open.type(),cv::Scalar::all(0));

[0332] cv::rectangle( tmp , cv::Rect(rectX, rectY, rectWidth, rectHeight),cv::Scalar::all(255),-1);

[0333] cv::bitwise_and(open, tmp, open);

[0334] Use the findContours function to extract contours.

[0335] std::vector <std::vector <cv::point>>contours;

[0336] std::vector <cv::vec4i>hierarchy

[0337] cv::findContours(open, contours, hierarchy, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

[0338] The `contourArea` function is used to obtain the area of ​​the white region outline and then filter out the maximum value.

[0339] double maxArea = 0;

[0340] for(auto contour : contours){

[0341] double area = cv::contourArea(contour);

[0342] if (area > maxArea) {

[0343] maxArea = area;

[0344] }

[0345] }

[0346] 2.7 Droplet Area Detection Operation

[0347] Test instructions:

[0348] Check the bottom of the core package for any absence of liquid droplets or minimal liquid droplets; reject any core packages with no or minimal liquid droplets.

[0349] Testing procedures:

[0350] The bottom droplet area obtained in the previous step is compared with the droplet area threshold. If the droplet area is less than the threshold, the core packet droplet is abnormal.

[0351] This invention establishes a learning module for statistical analysis of parameters before and after core fluid dispensing, statistically analyzes parameters before and after core fluid dispensing, and performs core fluid dispensing detection based on the statistically obtained parameters. This ensures product quality and avoids losses caused by defective and scrapped products.

[0352] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope disclosed in the present invention, and these should all be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims. < / cv::point> < / cv::point> < / cv::point> < / cv::point> < / cv::point> < / cv::point> < / cv::point> < / cv::point> < / cv::point>

Claims

1. A method for visual recognition of electronic components, characterized in that, Includes the following steps: S1. Establish a learning module for statistical analysis of parameters before and after cored fluid dispensing, and statistically analyze parameters before and after dry cored fluid dispensing. S2. Determine if the learned quantity satisfies the requirement: if it does, proceed to step S3; otherwise, return to step S1. S3. Threshold extraction is performed on the statistically obtained parameters, and detection is performed based on the extracted thresholds; In S1, when the learning module statistically analyzes the parameters before and after the core fluid dispensing, it includes the following steps: S11. Input images of the core pack before and after liquid droplet application; S12, Extract the position of the core package body; S13. Obtain the core package body area; S14. Extract the white portion of the core package; S15. Obtain the area of ​​the white region; S16. Extract the bottom position of the core package; S17. Obtain the core droplet area; In step S3, when performing detection based on the extracted threshold, the following steps are included: S31. Input images of the core pack before and after the liquid droplet; S32, ROI operation; S33, Locate the core package body; S34, Angle detection operation; S35. Operation to locate the white area before dripping; S36. Image sequence anomaly detection operation; S37, Droplet location extraction operation; S38. Droplet area detection operation; In S34, during the angle detection operation, the boundary points on the left and right sides of the contour are extracted, and the boundary points are fitted into a straight line to obtain the slope of the straight line. The angle deviation on the left and right sides is obtained based on the slope and compared with the angle deviation threshold. During the angle detection operation, the maximum area of ​​the core package body is detected. If the area of ​​the core package body is greater than the core package body area threshold, and the angle deviation on both the left and right sides is greater than the angle deviation threshold, then the core package angle is judged to be abnormal. If the core package body area is less than the core package body area threshold, then the angle deviation on either the left or right side is greater than the angle deviation threshold, and the core package angle is judged to be abnormal. In step S36, during the image sequence anomaly detection operation, the maximum area of ​​the core white region is obtained and then compared with the core white region threshold. If it is less than the threshold, it indicates that the image sequence is abnormal. In S38, during the droplet area detection operation, it is detected whether there is no droplet or a small amount of droplet at the bottom of the core package, and those with no droplet or a small amount of droplet are rejected. The bottom droplet area obtained in step S38 is compared with the droplet area threshold. If the droplet area is less than the threshold, the core package droplet is abnormal.

2. The method for visual recognition of electronic components according to claim 1, characterized in that: In step S13, when obtaining the core package body area, the maximum area of ​​the contour is obtained through the contourArea function, and the maximum area is used as the learning parameter for the core package body area.

3. The method for visual recognition of electronic components according to claim 1, characterized in that: In step S15, when obtaining the area of ​​the white region, the area of ​​the white region contour is obtained through the contourArea function and the maximum value is selected. The maximum value is used as the learning value of the area of ​​the core-enclosed white region.

4. An electronic component visual recognition system, used to implement the electronic component recognition method according to any one of claims 1-3, characterized in that, It includes a learning module, a detection module, and a judgment module: The learning module is used to statistically analyze parameters before and after the dry core is coated with the liquid. The detection module is used to detect the dry core pack based on the parameter thresholds before and after the dry core pack is filled with liquid; The determination module is used to determine whether there are abnormalities in core pack tilting, image sequence, or core pack dripping after the dry core pack has been dotted with liquid.

5. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-readable instructions that, when executed by the processor, perform the steps of the method as described in any one of claims 1-3.