A method for accurate counting of oxide lead frames

CN117710355BActive Publication Date: 2026-08-14SHENZHEN RUIYANG JINGSHI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

1、引线框架为堆叠放置,部分产品之间无间隙或间隙很小,无法直接分割,从而造成计数困难

Benefits of technology

本发明针对现有技术存在的缺陷和不足自主研发设计了一种通过对采集图像划分区域后,进行图像离散化处理,并通过提取离散化图像中竖线与引线框架相交产生的边缘点对,利用边缘点对的厚度与引线框架的理论厚度比对完成第一次筛选后,通过点与引线框架拟合直线的距离偏移进行第二次筛选,并将两次筛选得到的边缘点对在各列竖向上的数量采用投票表决加置信度的方法确定最终识别的引线框架的数量,有效提高了堆叠氧化情况下计数精准度的氧化引线框架精确计数方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117710355B_ABST
    Figure CN117710355B_ABST
Patent Text Reader

Abstract

This invention discloses a method for accurately counting oxide lead frames. The method includes the following steps: S1, image acquisition; S2, determining the ROI detection area; S3, solving the filtered gradient image; S4, gradient image discretization; S5, extracting edge point pairs; S6, performing a first screening based on the thickness of the edge point pairs; S7, performing a second screening based on the distance between the fitted straight line and the edge point pair; S8, calculating the confidence score and outputting the counting result. This invention discretizes the image, extracts edge point pairs generated by the intersection of vertical lines and lead frames, performs a first screening by comparing the thickness of the edge point pairs with the theoretical thickness of the lead frame, performs a second screening based on the distance offset between the points and the fitted straight line of the lead frame, and uses a voting and confidence score method to determine the final number of identified lead frames. This effectively improves the counting accuracy in stacked oxide conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of algorithms, and in particular to a method for accurate counting of oxide leadframes. Background Technology

[0002] Leadframes, as the chip carriers of integrated circuits, are a crucial basic material in the electronics and information industry. Initially, counting them involved industrial workers manually flipping and counting them one by one. This process easily caused product damage and contamination, and the repetitive nature of the operation led to visual fatigue, affecting the accuracy of the counting. With the rise and development of machine vision technology, solutions using industrial cameras to capture leadframe images and employing image processing algorithms for automatic counting have gradually replaced manual counting. Previously, image processing methods for leadframe counting typically involved first binarizing the image, then extracting the minimum bounding rectangle for each product, and finally calculating the number of leadframes in each image by counting the number of minimum bounding rectangles.

[0003] For ideal leadframes, this counting method offers high accuracy. However, when leadframe products are tightly stacked and their surfaces are oxidized, accurate binarization cannot be used to segment each product for precise counting. In practical industrial applications, this situation of tightly stacked leadframe products with oxidized surfaces is very frequent, specifically: 1. The lead frames are stacked, and some products have no gap or very small gaps between them, making it impossible to directly divide them, which makes counting difficult.

[0004] 2. Due to poor management or prolonged exposure to the elements, some lead frames have oxidized on their surface, which appears as messy interference points and blocks under industrial camera imaging.

[0005] Therefore, a method for accurately counting lead frames is needed in this environment. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to address the shortcomings of the prior art by providing an accurate counting method for oxide lead frames. This method involves dividing the acquired image into regions, discretizing the image, extracting edge point pairs generated by the intersection of vertical lines and lead frames in the discretized image, comparing the thickness of the edge point pairs with the theoretical thickness of the lead frames to complete the first screening, and then performing a second screening by measuring the distance offset between the points and the fitted straight lines of the lead frames. Finally, the number of edge point pairs obtained from the two screenings in each column is used to determine the final number of identified lead frames by a voting and confidence method. This method effectively improves the counting accuracy in stacked oxide conditions.

[0007] The technical solution adopted in this invention is as follows: A method for accurate counting of oxide lead frames, comprising the following steps: S1. Image Acquisition: Images of the lead frame are captured using a CCD camera; S2. Determine the ROI detection area: Take a rectangular area as the detection area from the lead frame image acquired in step S1. Define the horizontal direction as the X direction and the vertical direction as the Y direction in the image. S3. Solve for the filtered gradient image: The filtered gradient image of the detection region obtained in step S2 is obtained. A third-order Sobel operator is used to filter the X and Y directions of the detection region image. The filtering formula is as follows. ,in, Represents the gradient image of the filter. This represents the image before filtering. Represents the Sobel operator in the X direction. Represents the Sobel operator in the Y direction; S4. Gradient image discretization processing: In the gradient image after filtering in step S3, N columns of vertical lines extending in the Y direction are extracted at equal intervals along the X direction as the analysis object, where N is a configuration parameter and is determined according to the size of the detection area in step 2. S5. Extract edge point pairs: Define the upper and lower edge points where the N vertical lines extracted in step S5 intersect with the leader frame as a pair of edge points; at the same time, search for edges from dark to light along the Y direction on the vertical line image from top to bottom to determine the upper edge point, and then continue to search for edges from light to dark to determine the lower edge point; after finding the lower edge point, search for edges from dark to light again, and so on iteratively until all the upper and lower edge points of the leader frame on the vertical line are found, and repeat the above actions until edge point pairs on the N vertical lines are extracted; S6. First screening of thickness based on edge points: Perform the first screening of edge point pairs on the N vertical lines extracted in step 5, and calculate the distance between the upper edge point and the lower edge point in the edge point pair. ,in This represents the Y-coordinate value of the lower edge point. This represents the Y-coordinate value of the upper edge point, when or At that time, the edge points of this group are removed, among which, This indicates the minimum allowable thickness of the lead frame. This indicates the maximum allowable thickness of the lead frame, and the process is repeated until the first screening of the edge point pairs extracted in step S5 is completed. S7. Second screening using fitted line distance: For the edge point pairs selected in the first screening step 6, perform least squares line fitting along the same lead frame direction (i.e., the X direction). Calculate the distance from each point in each edge point pair to the fitted line. Remove edge point pairs whose distance exceeds a set threshold D. The formula for the fitted line is y = k*x + b, where K is the slope of the least squares fitted line. b is the intercept d is the distance from the point to the fitted line. Where x and y represent the X and Y coordinates of the point, respectively. and These represent the average values ​​of the X and Y coordinates, respectively. S8. Calculate the confidence score and output the counting result: Count the number of edge point pairs remaining in each column of images in step 7. At this time, the number of edge point pairs in a column can represent the number of lead frames in that column. If the number of edge point pairs in each column is inconsistent, a voting method plus confidence score is adopted. Finally, the number with the highest confidence score is taken as the final number of lead frames identified.

[0008] Preferably, in step S1, the CCD camera captures images from the front of the stacked lead frame; the CCD camera has 5 million pixels and a resolution of 2448*2048.

[0009] Preferably, the coordinates of the detection area in step S2 are (X, Y, Width, Height), where X is the coordinate line corresponding to the side of the detection area in the Y direction, Y is the coordinate line corresponding to the side of the detection area in the X direction, Width is the width value of the detection area image, and Height is the height value of the detection area image. The width and height of the detection area are not greater than the width and height values ​​of the image acquired in step S1.

[0010] Preferably, in step S5, the edge from dark to light is searched from top to bottom along the Y direction. The point is determined as the upper edge point when the absolute value of the gray value of the point is greater than the set threshold T1, based on the points in the image with gray values ​​greater than 0 in step S4.

[0011] Preferably, the value of T1 ranges from 15 to 25 pixel units.

[0012] Preferably, in step S5, the search continues for edges from bright to dark. Based on the points in the image with gray values ​​less than 0 in step S4, when the absolute value of the gray value of a point is less than the set threshold T2, the point is determined to be the lower edge point.

[0013] Preferably, the value of T2 ranges from 15 to 25 pixel units.

[0014] Preferably, in step S6, the values ​​of H1 and H2 are determined based on the thickness of the lead frame. Since the thickness of the lead frame is in the range of 10 to 15 pixels, the value of H1 is in the range of 5 to 10 pixels, and the value of H2 is in the range of 15 to 25 pixels.

[0015] Preferably, in step S7, the threshold D is the offset distance coefficient of the point relative to the fitted straight line, and the value of D is no more than 5 pixel units.

[0016] The beneficial effects of this invention are as follows: This invention addresses the shortcomings and deficiencies of existing technologies by independently developing and designing an oxide lead frame accurate counting method. This method involves dividing the acquired image into regions, discretizing the image, extracting edge point pairs generated by the intersection of vertical lines and lead frames in the discretized image, comparing the thickness of the edge point pairs with the theoretical thickness of the lead frame to complete the first screening, and then performing a second screening by measuring the distance offset between the points and the fitted straight line of the lead frame. Finally, the number of edge point pairs obtained from the two screenings in each vertical column is determined using a voting and confidence method to determine the final number of identified lead frames. This method effectively improves the counting accuracy in stacked oxide conditions.

[0017] This invention is applied to the accurate counting of lead frames under stacked and oxidized conditions. It achieves the requirement for accurate counting of lead frames in actual industrial environments where they are stacked with no gaps or very small gaps, and the product surface is oxidized, thus meeting the application requirements of practical industrial scenarios. Specifically, this invention first captures an image of the stacked lead frames from directly in front of them. The image represents the lead frames as multiple straight lines extending horizontally. Due to stacking gaps or oxidation, the straight lines representing the lead frames in the image may overlap. After obtaining the captured image, this invention determines the ROI detection area. The area of ​​the detection area can be determined as a percentage of the actual counting requirements, such as using 90% of the captured image as the detection area. Within the detection area, a planar coordinate system is used as the basis for subsequent calculations and analyses, defining the horizontal direction as the X direction and the vertical direction as the Y direction. After determining the detection area and coordinate system, a third-order Sobel operator is used to filter the X and Y directions of the detection area image to obtain the gradient image corresponding to the detection area for subsequent search analysis. After obtaining the gradient image through filtering, the gradient image is discretized within the detection area. The discretization method involves taking N vertical lines extending along the Y direction within the detection area, with the N vertical lines arranged at equal intervals. The number of these lines can be determined according to the required detection accuracy, such as 50 lines. The main purpose of discretization is to reduce the quality requirements of the image. That is, it is only necessary that most of the products in the extracted N vertical lines have gaps and minimal oxidation. This largely avoids the influence of products stacked without gaps and oxidation, thus increasing the accuracy and compatibility of the processing.After the gradient image is discretized, the vertical lines extending along the Y direction will inevitably intersect with the lines representing the lead frame in the detection area image. Therefore, in principle, the number of lead frames in the image can be represented by calculating the number of intersections between each of the N vertical lines and the lines representing the lead frame. However, due to stacking gaps and oxidation effects, counting errors may occur. Therefore, before counting, the thickness of the intersection along the Y direction is compared with the theoretical thickness of the lead frame for the first screening. The screening method is to search from top to bottom in each column of vertical lines. By observing the changes in gray values ​​in the image, when the gray value changes from dark to bright, the edge of the gray value change is determined as the upper edge point. The search continues downward, and when the image gray value changes from bright to dark, the edge of the gray value change is determined as the lower edge point. The upper edge point and the lower edge point form a set of edge points. Yes, this process is repeated until all edge point pairs on the current vertical line are extracted. Then, edge point pairs on the next vertical line are extracted. After all edge point pairs on N vertical lines have been extracted, the thickness of each edge point pair is calculated using the Y-coordinate values ​​of the upper and lower edge points. Since the thickness of the lead frame is fixed, ranging from 10 to 15 pixel units, a comparison threshold is determined based on the thickness range of the lead frame, such as H1 = 8 pixel units and H2 = 20 pixel units. When the calculated thickness of an edge point pair is less than H1 or greater than H2, it indicates that the thickness of the intersection point corresponding to the edge point pair is not within the thickness range of the lead frame. Therefore, this edge point pair is filtered out and not counted in subsequent iterations. This process is repeated until all extracted edge point pairs have been filtered, and then the edge point pairs after the first filtering are determined. To further improve counting accuracy, this invention employs least-squares linear fitting on the edge point pairs after the first screening along the same lead frame direction (i.e., the X direction). Then, the distance from each edge point pair to the fitted line is calculated, and point pairs with a distance greater than a set threshold D are removed. Ideally, the fitted line represents the extension direction of the lead frame, so the edge point pairs should overlap with the fitted line. Therefore, the farther the distance between edge point pairs, the less likely they are to be on the lead frame, and they can be screened out. The threshold D, representing the offset distance coefficient of a point relative to the fitted line, is set based on the lead frame thickness factor. For example, D can be set to 3 pixels. By performing a second screening on the edge point pairs whose distance from the fitted line is greater than D, the counting efficiency is further improved.After the second screening, the remaining edge point pairs are statistically counted using a combination of voting and confidence level. For example, in the 50 extracted images, 48 ​​images have 18 edge point pairs, 1 image has 17 edge point pairs, and 1 image has 16 edge point pairs. Therefore, the confidence level for 18 lead frames is 48 / 50 = 0.96, while the confidence levels for 17 and 16 lead frames are both 1 / 50 = 0.02. The highest confidence level is 0.96 for 18, thus determining the final number of identified lead frames to be 18. Attached Figure Description

[0018] Figure 1 This is a block diagram illustrating the algorithm principle of the present invention.

[0019] Figure 2 This is a schematic diagram of the images acquired in this invention.

[0020] Figure 3 This is a schematic diagram of the gradient map of the image after filtering acquired in this invention.

[0021] Figure 4 This is a schematic diagram of the detection region and discretization state in the gradient graph after filtering according to the present invention.

[0022] Figure 5 For the present invention Figure 4 A magnified view of a portion of the image. Detailed Implementation

[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0024] It should be noted that all directional indications in the embodiments of the present invention, such as up, down, left, right, front, back, etc., are only used to explain the relative positional relationship and movement of the components in a specific posture. If the specific posture changes, the directional indication will also change accordingly.

[0025] In this invention, unless otherwise explicitly specified and limited, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral part; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0026] like Figures 1 to 5 As shown, a method for accurate counting of oxide leadframes includes the following steps: S1. Image Acquisition: Images of the lead frame are captured using a CCD camera; S2. Determine the ROI detection area: Take a rectangular area as the detection area from the lead frame image acquired in step S1. Define the horizontal direction as the X direction and the vertical direction as the Y direction in the image. S3. Solve for the filtered gradient image: The filtered gradient image of the detection region obtained in step S2 is obtained. A third-order Sobel operator is used to filter the X and Y directions of the detection region image. The filtering formula is as follows. ,in, Represents the gradient image of the filter. This represents the image before filtering. Represents the Sobel operator in the X direction. Represents the Sobel operator in the Y direction; S4. Gradient image discretization processing: In the gradient image after filtering in step S3, N columns of vertical lines extending in the Y direction are extracted at equal intervals along the X direction as the analysis object, where N is a configuration parameter and is determined according to the size of the detection area in step 2. S5. Extract edge point pairs: Define the upper and lower edge points where the N vertical lines extracted in step S5 intersect with the leader frame as a pair of edge points; at the same time, search for edges from dark to light along the Y direction on the vertical line image from top to bottom to determine the upper edge point, and then continue to search for edges from light to dark to determine the lower edge point; after finding the lower edge point, search for edges from dark to light again, and so on iteratively until all the upper and lower edge points of the leader frame on the vertical line are found, and repeat the above actions until edge point pairs on the N vertical lines are extracted; S6. First screening of thickness based on edge points: Perform the first screening of edge point pairs on the N vertical lines extracted in step 5, and calculate the distance between the upper edge point and the lower edge point in the edge point pair. ,in This represents the Y-coordinate value of the lower edge point. This represents the Y-coordinate value of the upper edge point, when or At that time, the edge points of this group are removed, among which, This indicates the minimum allowable thickness of the lead frame. This indicates the maximum allowable thickness of the lead frame, and the process is repeated until the first screening of the edge point pairs extracted in step S5 is completed. S7. Second screening using fitted line distance: For the edge point pairs selected in the first screening step 6, perform least squares line fitting along the same lead frame direction (i.e., the X direction). Calculate the distance from each point in each edge point pair to the fitted line. Remove edge point pairs whose distance exceeds a set threshold D. The formula for the fitted line is y = k*x + b, where K is the slope of the least squares fitted line. b is the intercept d is the distance from the point to the fitted line. Where x and y represent the X and Y coordinates of the point, respectively. and These represent the average values ​​of the X and Y coordinates, respectively. S8. Calculate the confidence score and output the counting result: Count the number of edge point pairs remaining in each column of images in step 7. At this time, the number of edge point pairs in a column can represent the number of lead frames in that column. If the number of edge point pairs in each column is inconsistent, a voting method plus confidence score is adopted. Finally, the number with the highest confidence score is taken as the final number of lead frames identified.

[0027] This invention is applied to the accurate counting of lead frames under stacked and oxidized conditions. It achieves the requirement for accurate counting of lead frames in actual industrial environments where they are stacked with no gaps or very small gaps, and the product surface is oxidized, thus meeting the application requirements of practical industrial scenarios. Specifically, this invention first captures an image of the stacked lead frames from directly in front of them. The image represents the lead frames as multiple straight lines extending horizontally. Due to stacking gaps or oxidation, the straight lines representing the lead frames in the image may overlap. After obtaining the captured image, this invention determines the ROI detection area. The area of ​​the detection area can be determined as a percentage of the actual counting requirements, such as using 90% of the captured image as the detection area. Within the detection area, a planar coordinate system is used as the basis for subsequent calculations and analyses, defining the horizontal direction as the X direction and the vertical direction as the Y direction. After determining the detection area and coordinate system, a third-order Sobel operator is used to filter the X and Y directions of the detection area image to obtain the gradient image corresponding to the detection area for subsequent search analysis. After obtaining the gradient image through filtering, the gradient image is discretized within the detection area. The discretization method involves taking N vertical lines extending along the Y direction within the detection area, with the N vertical lines arranged at equal intervals. The number of these lines can be determined according to the required detection accuracy, such as 50 lines. The main purpose of discretization is to reduce the quality requirements of the image. That is, it is only necessary that most of the products in the extracted N vertical lines have gaps and minimal oxidation. This largely avoids the influence of products stacked without gaps and oxidation, thus increasing the accuracy and compatibility of the processing.After the gradient image is discretized, the vertical lines extending along the Y direction will inevitably intersect with the lines representing the lead frame in the detection area image. Therefore, in principle, the number of lead frames in the image can be represented by calculating the number of intersections between each of the N vertical lines and the lines representing the lead frame. However, due to stacking gaps and oxidation effects, counting errors may occur. Therefore, before counting, the thickness of the intersection along the Y direction is compared with the theoretical thickness of the lead frame for the first screening. The screening method is to search from top to bottom in each column of vertical lines. By observing the changes in gray values ​​in the image, when the gray value changes from dark to bright, the edge of the gray value change is determined as the upper edge point. The search continues downward, and when the image gray value changes from bright to dark, the edge of the gray value change is determined as the lower edge point. The upper edge point and the lower edge point form a set of edge points. Yes, this process is repeated until all edge point pairs on the current vertical line are extracted. Then, edge point pairs on the next vertical line are extracted. After all edge point pairs on N vertical lines have been extracted, the thickness of each edge point pair is calculated using the Y-coordinate values ​​of the upper and lower edge points. Since the thickness of the lead frame is fixed, ranging from 10 to 15 pixel units, a comparison threshold is determined based on the thickness range of the lead frame, such as H1 = 8 pixel units and H2 = 20 pixel units. When the calculated thickness of an edge point pair is less than H1 or greater than H2, it indicates that the thickness of the intersection point corresponding to the edge point pair is not within the thickness range of the lead frame. Therefore, this edge point pair is filtered out and not counted in subsequent iterations. This process is repeated until all extracted edge point pairs have been filtered, and then the edge point pairs after the first filtering are determined. To further improve counting accuracy, this invention employs least-squares linear fitting on the edge point pairs after the first screening along the same lead frame direction (i.e., the X direction). Then, the distance from each edge point pair to the fitted line is calculated, and point pairs with a distance greater than a set threshold D are removed. Ideally, the fitted line represents the extension direction of the lead frame, so the edge point pairs should overlap with the fitted line. Therefore, the farther the distance between edge point pairs, the less likely they are to be on the lead frame, and they can be screened out. The threshold D, representing the offset distance coefficient of a point relative to the fitted line, is set based on the lead frame thickness factor. For example, D can be set to 3 pixels. By performing a second screening on the edge point pairs whose distance from the fitted line is greater than D, the counting efficiency is further improved.After the second screening, the remaining edge point pairs are statistically counted using a combination of voting and confidence level. For example, in the 50 extracted images, 48 ​​images have 18 edge point pairs, 1 image has 17 edge point pairs, and 1 image has 16 edge point pairs. Therefore, the confidence level for 18 lead frames is 48 / 50 = 0.96, while the confidence levels for 17 and 16 lead frames are both 1 / 50 = 0.02. The highest confidence level is 0.96 for 18, thus determining the final number of identified lead frames to be 18. Example 1

[0028] like Figures 2 to 3 As shown, in one embodiment of the present invention, in step S1, the CCD camera captures an image from the front of the stacked lead frames; the horizontally extending lines in the captured image represent the image corresponding to each lead frame; the CCD camera has 5 million pixels and a resolution of 2448*2048.

[0029] like Figure 4 As shown in the embodiment of the present invention, the coordinates of the detection area in step S2 are (X, Y, Width, Height), where X is the coordinate line corresponding to the side of the detection area in the Y direction, Y is the coordinate line corresponding to the side of the detection area in the X direction, Width is the width value of the detection area image, and Height is the height value of the detection area image. The width and height of the detection area are not greater than the width and height values ​​of the image acquired in step S1. Simultaneously, the detection area must cover all the images represented by the lead frames in the acquired image along the Y direction to avoid missing the number of lead frames during counting. In step S4 of the present invention, N columns of vertical lines extending in the Y direction are extracted at equal intervals along the X direction as the analysis object, where N is a configuration parameter. Based on the size of the detection area in step 2, N can be 50 lines. Example 2

[0030] like Figure 5 As shown in the figure, in one embodiment of the present invention, in step S5, the search for edges from dark to light along the Y direction from top to bottom is performed. Based on the points in the image with grayscale values ​​greater than 0 identified in step S4, if the absolute value of the grayscale value of such a point is greater than a set threshold T1, that point is determined to be an upper edge point. The value of T1 ranges from 15 to 25 pixels. In step S5, the search for edges from light to dark continues. Based on the points in the image with grayscale values ​​less than 0 identified in step S4, if the absolute value of the grayscale value of such a point is less than a set threshold T2, that point is determined to be a lower edge point. The value of T2 ranges from 15 to 25 pixels. In this embodiment, the values ​​of T1 and T2 can be 20 pixels. Example 3

[0031] like Figure 5 As shown in the embodiment of the present invention, the values ​​of H1 and H2 in step S6 are determined based on the thickness of the lead frame. Since the thickness of the lead frame ranges from 10 to 15 pixels, the value range of H1 is 5 to 10 pixels, and the value range of H2 is 15 to 25 pixels. In the imaging of this embodiment, the thickness of the lead frame is generally around 10 to 15 pixels, so H1=8 and H2=20 can be taken. d, y1, and y2 are the distances between edge point pairs calculated by the search (this distance can represent the thickness of the lead frame). If the distance is not within the range of [8, 20], it indicates that the group of points has been affected by oxidation or other interference, and therefore the group of points is discarded. Example 4

[0032] like Figure 5 As shown, in one embodiment of the present invention, the threshold D in step S7 is the offset distance coefficient of the point relative to the fitted line, and the value of D is no greater than 5 pixel units. Taking N=10 as an example, 10 sets of points will be searched to fit the line; if the XY coordinates of the searched points are as follows (14, 20), (29, 22), (34, 21), (48, 23), (63, 19), (77, 28), (93, 20), (108, 20), (123, 21), (138, 23), then the calculation process is as follows: , Substituting the slope and intercept formulas, we get the slope k = 0.0038 and the intercept b = 21.2021, thus obtaining the line y = 0.0038x + 21.2021. Then, we calculate the distance from each point to the line. The distances from each point to the line are 1.25, 0.68, 0.33, 1.62, 2.44, 6.51, 1.55, 1.61, 0.67, and 1.27, respectively. Taking the threshold D=3, the distance from point (77, 28) to the line is 6.51, which is greater than D, so the point is removed.

[0033] The embodiments of this invention are merely illustrative of specific implementation methods and are not intended to limit the scope of protection. Those skilled in the art can make modifications based on these embodiments; therefore, all equivalent changes or modifications made in accordance with the scope of this invention's patent claims fall within the scope of this invention's patent claims.

Claims

1. A method for accurately counting oxide lead frames, characterized in that, Includes the following steps: S1. Image Acquisition: Images of the lead frame are captured using a CCD camera; S2. Determine the ROI detection area: Take a rectangular area as the detection area in the lead frame image acquired in step S1. Define the horizontal direction as the X direction and the vertical direction as the Y direction in the image. S3. Solve for the filtered gradient image: The filtered gradient image of the detection region obtained in step S2 is obtained. A third-order Sobel operator is used to filter the X and Y directions of the detection region image. The filtering formula is as follows. ,in, This represents the filtered gradient image. This represents the image before filtering. This represents the Sobel operator in the X direction. This represents the Sobel operator in the Y direction. ; S4. Gradient image discretization processing: In the gradient image after filtering in step S3, N columns of vertical lines extending in the Y direction are extracted at equal intervals along the X direction as the analysis object, where N is a configuration parameter and is determined according to the size of the detection area in step 2. S5. Extract edge point pairs: Define the upper and lower edge points where the N vertical lines extracted in step S4 intersect with the leader frame as a pair of edge points; at the same time, search for edges from dark to light along the Y direction on the vertical line image from top to bottom to determine the upper edge point, and then continue to search for edges from light to dark to determine the lower edge point; after finding the lower edge point, search for edges from dark to light again, and so on iteratively until all the upper and lower edge points of the leader frame on the vertical line are found. Then repeat the search along the Y direction on other vertical lines until edge point pairs on the N vertical lines are extracted. S6. First screening of thickness based on edge points: Perform the first screening of edge point pairs on the N vertical lines extracted in step 5, and calculate the distance between the upper edge point and the lower edge point in the edge point pair. ,in Show the Y coordinate value of the lower edge point. This represents the Y-coordinate value of the upper edge point, when or At that time, the edge points of this group are removed, among which, This indicates the minimum allowable thickness of the lead frame. This indicates the maximum allowable thickness of the lead frame, and the process is repeated until the first screening of the edge point pairs extracted in step S5 is completed. S7. Second screening using fitted line distance: For the edge point pairs selected in the first screening step 6, perform least squares line fitting along the same leader frame direction (X direction). Calculate the distance from each point in each edge point pair to the fitted line. Remove edge point pairs with a distance greater than a set threshold D. The formula for the fitted line is y = k*x + b, where the slope of the least squares fitted line is... b is the intercept d is the distance from the point to the fitted line. Where x and y represent the X and Y coordinates of the point, respectively. and These represent the average values ​​of the X and Y coordinates, respectively. S8. Calculate the confidence score and output the counting result: Count the number of edge point pairs remaining in each column of images in step 7. At this time, the number of edge point pairs in a column can represent the number of lead frames in that column. If the number of edge point pairs in each column is inconsistent, a voting method plus confidence score is adopted. Finally, the number with the highest confidence score is taken as the final number of lead frames identified.

2. The method for accurately counting oxide lead frames according to claim 1, characterized in that: In step S1, the CCD camera captures images from the front of the stacked lead frames; the CCD camera has 5 million pixels and a resolution of 2448*2048.

3. The method for accurately counting oxide lead frames according to claim 1, characterized in that: In step S2, the coordinates of the detection area are (X, Y, Width, Height), where X is the coordinate line corresponding to the side of the detection area in the Y direction, Y is the coordinate line corresponding to the side of the detection area in the X direction, Width is the width value of the detection area image, and Height is the height value of the detection area image. The width and height of the detection area are not greater than the width and height values ​​of the image acquired in step S1.

4. The method for accurate counting of oxide lead frames according to claim 1, characterized in that: In step S5, the edge from dark to light is searched from top to bottom along the Y direction. The point is determined as the upper edge point when the absolute value of the gray value of the point is greater than the set threshold T1, based on the points in the image with gray values ​​greater than 0 in step S4.

5. The method for accurately counting oxide lead frames according to claim 4, characterized in that: The value of T1 ranges from 15 to 25 pixel units.

6. The method for accurately counting oxide lead frames according to claim 1, characterized in that: In step S5, the search continues for edges from bright to dark. Based on the points in the image with gray values ​​less than 0 in step S4, when the absolute value of the gray value of a point is less than the set threshold T2, the point is determined to be the lower edge point.

7. The method for accurately counting oxide lead frames according to claim 6, characterized in that: The value of T2 ranges from 15 to 25 pixel units.

8. The method for accurately counting oxide lead frames according to claim 1, characterized in that: In step S6, the values ​​of H1 and H2 are determined based on the thickness of the lead frame. Since the thickness of the lead frame is in the range of 10 to 15 pixels, the value of H1 is in the range of 5 to 10 pixels, and the value of H2 is in the range of 15 to 25 pixels.

9. The method for accurately counting oxide lead frames according to claim 1, characterized in that: In step S7, the threshold D is the offset distance coefficient of the point relative to the fitted straight line, and the value of D is no more than 5 pixel units.

Citation Information

Patent Citations

  • Integrated chip lead frame counting stacking device

    CN203095251U

  • Lead frame inspection device

    JP2001021328A