Hardware defect detection method, apparatus and device
By using seed growth algorithm in hardware defect detection, combined with grayscale image and derivative analysis, the problem of low detection accuracy in the prior art is solved, and more efficient and accurate hardware defect detection is achieved.
Patent Information
- Application Number
- PCT/CN2023/133004
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-30
- Filing Date
- 2023-11-21
- Publication Date
- 2025-03-06
AI Technical Summary
In the prior art, the accuracy of hardware defect detection is not high enough, especially in the presence of noise, and it is difficult to accurately extract defect areas.
The hardware defect detection method based on the seed growth algorithm is adopted to detect the defect area of the hardware by obtaining the grayscale image of the hardware, generating seed points, and growing them based on these seed points. This method combines the characteristics of hardware to generate several lines on the grayscale image, obtain the derivative of the pixel points, determine the seed points, and perform regional growth according to the grayscale value threshold.
It improves the accuracy and efficiency of hardware defect detection, reduces the misidentification of non-defective areas, and ensures accurate detection of defect areas.
Smart Images

Figure CN2023133004_06032025_PF_FP_ABST
Abstract
Description
Hardware defect detection method, device and equipment Technical Field
[0001] The present invention relates to the field of hardware defect detection, and in particular to a method, device and equipment for detecting hardware defects. Background Art
[0002] If there are defects on the surface of the hardware, it will at least affect its use and at worst pose a safety hazard. Take the circuit board as an example, such as the battery protection board. The battery protection board can be used to protect the battery from problems such as over-discharge, overcharging, overcurrent and short circuit. Some defects that may appear on the surface of the battery protection board, such as cracks, will cause the battery protection board to fail, which will reduce the life of the battery and even cause a safety accident. Therefore, it is of great significance to detect hardware defects in advance.
[0003] In the process of implementing the present invention, the inventors found that the prior art has the following problems:
[0004] The accuracy of conventional CCD camera detection is not high enough, especially when considering the noise on the hardware surface that affects defect detection. In particular, there are more noise points on the battery protection board, which makes it even more difficult to accurately extract the defective area. Therefore, the existing technology cannot solve the problem of hardware defect detection well.
[0005] Summary of the Invention
[0006] In order to solve the problem of insufficient accuracy in hardware defect detection in the above-mentioned prior art problems, the purpose of the present invention is to provide a method, device and equipment for detecting hardware defects with higher efficiency and higher detection accuracy.
[0007] To achieve the above-mentioned object of the invention, an embodiment of the present invention provides a method for detecting hardware defects, comprising the following steps:
[0008] Get hardware grayscale image;
[0009] Based on the hardware grayscale image, generating a plurality of seed points;
[0010] Performing region growing based on the seed point to obtain a defective region of the hardware;
[0011] The step of generating the seed point includes:
[0012] generating a plurality of lines of the hardware grayscale image, the lines corresponding to pixel bands on the hardware grayscale image;
[0013] Derivative of the grayscale values between adjacent pixels in the pixel strip;
[0014] The pixel points whose derivative values are greater than the derivative threshold are set as candidate seed points;
[0015] The seed point is determined according to the candidate seed point.
[0016] As a further improvement of the present invention, the step of generating a plurality of lines of the hardware grayscale image includes:
[0017] The type of the line is determined according to the shape of the hardware and / or the type of defect to be detected, wherein the defect type includes cracks and scratches.
[0018] As a further improvement of the present invention, the defect type detected is a crack, and the crack extends substantially along a first direction on the hardware;
[0019] The steps of generating a plurality of lines of the hardware grayscale image include:
[0020] A plurality of lines passing through the grayscale image of the hardware are generated, wherein the plurality of lines divide the hardware in a second direction intersecting the first direction.
[0021] As a further improvement of the present invention, the length of the hardware along the first direction is a first length;
[0022] The steps of generating a plurality of lines of the hardware grayscale image include:
[0023] A plurality of lines of the grayscale image of the hardware are generated, wherein the plurality of lines divide the hardware into a plurality of equal parts along the first length.
[0024] As a further improvement of the present invention, the step of performing region growing based on the seed point includes:
[0025] Performing region growth on the seed point based on criterion 1 and criterion 2, dividing the pixel points in the hardware grayscale image that meet the growth requirements into a defect set, wherein criterion 1 is that the grayscale value of the current pixel point is less than the crack grayscale threshold, and criterion 2 is that the difference between the grayscale value of the current pixel point and the grayscale value of the seed point is less than the difference threshold;
[0026] The step of performing region growing on the seed point based on criteria one and criteria two includes:
[0027] Detect the undetected pixel points adjacent to the current seed point to see if they meet the first and second criteria. If they meet both criteria, use the adjacent pixel point as a new seed point to continue growing until all seed points are grown.
[0028] As a further improvement of the present invention, the step of performing region growing based on the seed point to obtain the defective region of the hardware further includes:
[0029] Acquiring crack determination conditions, wherein the crack determination conditions include a height threshold and an aspect ratio threshold;
[0030] Performing region growing based on the seed point to obtain several defect-like regions;
[0031] Generate a minimum regular rectangle and a minimum circumscribed rectangle of the defect-like area;
[0032] If the height of the minimum regular rectangle is greater than the length threshold, and the width-to-length ratio of the minimum circumscribed rectangle is greater than the width-to-length ratio threshold, the corresponding defect-like region is a defect region.
[0033] As a further improvement of the present invention, the defect type detected is a scratch;
[0034] The steps of generating a plurality of lines of the hardware grayscale image include:
[0035] A plurality of lines of the hardware grayscale image are generated, wherein the plurality of lines cover the entire hardware grayscale image as evenly as possible.
[0036] As a further improvement of the present invention, the step of performing region growing based on the seed point includes:
[0037] Based on criteria two and three, the seed point is regionally grown, and the pixel points in the hardware grayscale image that meet the growth requirements are divided into a defect set, wherein criteria two is that the difference between the grayscale value of the current pixel point and the grayscale value of the seed point is less than the difference threshold, and criteria three is that the grayscale value of the current pixel point is greater than the scratch grayscale threshold.
[0038] As a further improvement of the present invention, the hardware in the hardware grayscale image is a rectangle;
[0039] The steps of generating a plurality of lines of the hardware grayscale image include:
[0040] A plurality of straight lines passing through the hardware grayscale image along the length direction are generated, each of the straight lines corresponding to a row of pixel points along the length direction of the hardware grayscale image.
[0041] As a further improvement of the present invention, the step of performing a derivation of the grayscale values between adjacent pixels in the pixel strip includes:
[0042] Calculate the difference between each pixel point on the pixel strip and its adjacent pixel point on the left, and its adjacent pixel point on the right, and the quotient of the two differences is the derivative corresponding to the pixel point.
[0043] As a further improvement of the present invention, the step of determining the seed point according to the candidate seed point further includes:
[0044] Setting the candidate seed point as the seed point;
[0045] or,
[0046] A pixel whose grayscale value is lower than a minimum grayscale threshold or higher than a maximum grayscale threshold among a plurality of adjacent pixel points in the pixel band where the candidate seed point is located is set as the seed point.
[0047] To achieve one of the above-mentioned objectives, an embodiment of the present invention provides a hardware defect detection device, comprising:
[0048] Acquisition module, used to obtain hardware grayscale images;
[0049] A seed point generation module, configured to generate a plurality of seed points based on the hardware grayscale image;
[0050] A defect region generating module, configured to perform region growing based on the seed point to obtain a defect region of the hardware;
[0051] The seed point generation module is further configured to:
[0052] generating a plurality of lines of the hardware grayscale image, the lines corresponding to pixel bands on the hardware grayscale image;
[0053] Derivative of the grayscale values between adjacent pixels in the pixel strip;
[0054] The pixel point whose derivative value is greater than the derivative threshold is set as the candidate seed point;
[0055] The seed point is determined according to the candidate seed point.
[0056] To achieve one of the above-mentioned objectives, an embodiment of the present invention provides a hardware defect detection device, comprising:
[0057] Loading and unloading stations, which are used to load and unload hardware;
[0058] A conveyor line connects the loading and unloading stations and transfers hardware;
[0059] An inspection station, located on or to the side of the conveyor line, is provided. The inspection stations are configured to detect various hardware defects. The inspection stations employ the aforementioned hardware defect detection method to inspect the hardware and upload the inspection data.
[0060] The inspection station is equipped with a transport mechanism, which moves the hardware to the inspection station and transfers the hardware to the conveyor line for inspection or unloading of the next process after the inspection is completed.
[0061] As a further improvement of the present invention, the hardware is a battery protection board, and the inspection station includes an appearance defect inspection station and an electrical performance inspection station.
[0062] To achieve one of the above-mentioned objects of the invention, an embodiment of the present invention provides a readable storage medium storing a computer program. When the computer program is executed by a processing module, the steps in the above-mentioned method for detecting hardware defects can be implemented.
[0063] Compared with the prior art, the present invention has the following beneficial effects: the hardware defect detection method, device and equipment detect defective areas based on a seed growth algorithm, and in combination with the characteristics of the hardware, by obtaining the derivatives of a number of strip pixel points based on a number of lines, and then determining the appropriate seed points in the hardware scene, and then growing based on the seed points; on the one hand, the defective area is accurately generated, making the defective area determination more efficient, and on the other hand, the generated effect is good, and it is not easy to miss or identify non-defective areas as defective areas, so the detection method and device can not only improve the detection efficiency of hardware defects, but also improve the detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] FIG1 is a flow chart of a method for detecting hardware defects according to an embodiment of the present invention;
[0065] FIG2 is a schematic diagram of a detection image according to an embodiment of the present invention;
[0066] FIG3 is a flow chart of a specific embodiment of step S20 in FIG1 ;
[0067] FIG4 is a schematic diagram of an embodiment of the present invention for generating a plurality of lines;
[0068] FIG5 is a schematic diagram of another embodiment of the present invention for generating a plurality of lines;
[0069] FIG6 is a schematic diagram of yet another embodiment of the present invention for generating a plurality of lines;
[0070] FIG7 is a flowchart of a specific embodiment of step S30 in FIG1 ;
[0071] FIG8 is a schematic diagram showing a detected defect region as a crack according to the first embodiment of the present invention;
[0072] FIG9 is a schematic diagram showing a minimum right rectangle and a minimum circumscribed rectangle for a defect-like region according to an embodiment of the present invention;
[0073] FIG10 is a schematic diagram of an implementation method of generating a plurality of lines according to the second embodiment of the present invention;
[0074] FIG11 is a schematic diagram of another implementation method of generating a plurality of lines according to the second embodiment of the present invention;
[0075] FIG12 is a schematic diagram showing a second embodiment of the present invention where a defective area is detected as a scratch;
[0076] FIG13 is a module diagram of a hardware defect detection device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0077] The present invention will be described in detail below with reference to the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional changes made by those skilled in the art based on these embodiments are all within the scope of protection of the present invention.
[0078] An embodiment of the present invention provides a method, apparatus, and device for detecting hardware defects with higher efficiency and higher detection accuracy.
[0079] In this example, hardware surface defects are detected. These defects can be detected by analyzing images captured by optical equipment. Defects described below primarily include two types: cracks and scratches. Cracks are lines on the surface of a material that resemble a break, while scratches are marks left on the surface by other harder objects.
[0080] Hardware can be a circuit board, wafer, chip, housing, or other tangible product. For example, the battery protection board on the circuit board mentioned in the background technology is primarily used to monitor the battery status and its top surface is generally rectangular. Hardware can also be an optical lens, optical glass, or display product, such as the glass sheet or lens of a camera lens, which is generally circular.
[0081] Correspondingly, the hardware, using a circuit board as an example, focuses more on cracks. Of course, scratches can also be detected on circuit boards, as scratches can damage traces on the circuit board surface. Taking an optical lens as an example, the hardware focuses more on scratches. Cracks are characterized by a darker color than crack-free areas, which is reflected in a lower grayscale value on a grayscale image. Scratches are characterized by a lighter color than scratch-free areas, which is reflected in a higher grayscale value on a grayscale image.
[0082] The following is divided into two embodiments for explanation, wherein embodiment 1 takes the defect type of crack as an example for explanation, embodiment 2 takes the defect type of scratch as an example for explanation, and the hardware of embodiment 1 is explained by taking the circuit board as an example, and the more specific circuit board can be a battery protection board.
[0083] Example 1
[0084] The following describes a method for detecting hardware defects provided in Example 1 of the present invention in conjunction with the accompanying drawings. Although the present application provides method operation steps as shown in the following implementation manner or flowchart, based on conventional or no creative labor, the execution order of the steps in the method that do not logically have necessary causal relationships is not limited to the execution order provided in the implementation manner of the present application.
[0085] A hardware defect detection method according to this embodiment, as shown in FIG1 , includes the following steps S10 to S30:
[0086] Step S10: Acquire a hardware grayscale image;
[0087] Step S20: generating a plurality of seed points based on the hardware grayscale image;
[0088] Step S30: performing region growing based on the seed point to obtain the defective region of the hardware.
[0089] Below, these three steps are explained in detail.
[0090] Step S10
[0091] Step S10 may include the following steps S11-S14, or may further include step S15 as needed.
[0092] Step S11: Acquire a detection image.
[0093] Among them, the detection image is an image including the hardware to be detected, and in addition to the hardware to be detected, the image may also include other background areas. The black area shown in Figure 2 is the circuit board, and the other white or light-colored content is the background area.
[0094] Step S12: Identify the detection image and extract the position and angle of the hardware in the detection image.
[0095] Taking Figure 2 as an example, the inspection image contains content other than the circuit board, and the angle of the circuit board is not fixed. The bottom edge of the circuit board is not parallel to the bottom edge of the inspection image. Therefore, in order to prevent the background area from affecting the subsequent defect extraction, the circuit board needs to be separated from other background areas. Here, the image recognition method is used to extract the position and angle of the hardware.
[0096] Step S13: extracting a hardware image from the detection image according to the position and angle of the hardware.
[0097] The hardware image only includes the hardware, and the background area in Figure 2 is removed. Taking the upper surface of the hardware in Figure 2 as an example, which is a rectangle, it can be rotated so that the bottom edge is horizontal based on the angle in step S12.
[0098] Step S14: generating a grayscale image based on the hardware image.
[0099] The grayscale image obtained here may be the hardware grayscale image described in step S10.
[0100] In addition, the grayscale image obtained in step S14 can be followed by step S15:
[0101] Step S15: enhancing the contrast of the grayscale image by an image enhancement method based on logarithmic transformation to generate a hardware grayscale image.
[0102] In this embodiment, the hardware is a circuit board. The hard plastic material of the circuit board surface makes the contrast of the defect targeted by Example 1, namely the crack defect, unclear. Therefore, step S15 is added to enhance the contrast between the defect area and the background content outside the defect area in the grayscale image to obtain the final hardware grayscale image. The logarithmic transformation formula is as follows:
[0103] s=clog(1+r), where c is a constant and r≥0.
[0104] Step S20
[0105] Step S20 may be as shown in FIG3 , including the following steps S21 - S24 .
[0106] Step S21: generating a plurality of lines of the hardware grayscale image, wherein the lines correspond to pixel bands on the hardware grayscale image.
[0107] Here, several lines may be generated based on the following steps S211-S212, or may further include step S213:
[0108] Step S211: Determine the type of the line according to the shape of the hardware and / or the type of defect to be detected.
[0109] In step S211, there are three specific cases:
[0110] (1) determining the type of the line according to the shape of the hardware;
[0111] (2) determining the type of the line according to the type of defect to be detected;
[0112] (3) Determine the type of the line based on the shape of the hardware and the type of defect to be detected.
[0113] For the first case, taking Figures 4, 5, and 6 as examples, if the hardware is rectangular, the lines are straight lines; if the sides of the hardware are wavy, the lines are also wavy; if the hardware is circular, the lines are also circular. The specific purpose of this setting is to select lines that match the shape of the hardware based on the shape of the hardware.
[0114] In the second case, considering the crack defect targeted by Example 1, cracks generally grow in a specific direction, i.e., they have a certain directionality. Here, the crack extends substantially along the first direction on the hardware. Since cracks are not straight lines, the term "substantially" means that the crack may exhibit some curvature or inclination, but it substantially extends along the first direction. For example, on a rectangular circuit board, the crack generally develops along the width. Therefore, in the second case, the line preferably needs to be able to cut the crack, and the line here does not need to be parallel to the crack's extension direction.
[0115] For the third case, that is, combining the first and second cases mentioned above, the effect is a combination of the two.
[0116] Step S212: generating a plurality of lines passing through the grayscale image of the hardware, wherein the plurality of lines divide the hardware in a second direction intersecting the first direction.
[0117] That is, the generated lines can cut the cracks on the hardware as much as possible. Preferably, the first direction is perpendicular to the second direction, for example, the first direction is the longitudinal direction and the second direction is the transverse direction.
[0118] In addition, the length of the hardware along the first direction is the first length; taking the hardware in Figure 4 as a rectangle as an example, the first direction is the width direction, and the first length is the width; taking the hardware in Figure 5 as an irregular shape as an example, the first direction is the width direction similar to the rectangle, and the first length is the width similar to the rectangle; taking the hardware in Figure 6 as a circle as an example, the first direction is the radius direction, and the first length is the radius or diameter.
[0119] Step S213: generating a plurality of lines of the grayscale image of the hardware, wherein the plurality of lines divides the hardware into a plurality of equal parts along the first length.
[0120] The number of lines can be n, dividing the image into n+1 equal regions, where n ≥ 1. The purpose of equal division is to ensure that, when n = 1, the image is divided into two halves at the center, and the lines intersect the cracks as closely as possible. When n > 1, for example, the image is divided into three equal regions, this prevents a crack at one location from being inconspicuous and affecting detection. The ability to perform detection at multiple locations, covering as much of the image as possible, helps improve detection accuracy.
[0121] Here, taking the hardware in Figure 4 as an example, which is a rectangle and the lines are straight lines, the hardware grayscale image can be divided into multiple equal-sized rectangular strips; taking the hardware in Figure 5 as an example, which is an irregular shape and the lines are wavy lines, the hardware grayscale image can be divided into multiple equal-sized wavy strips; taking the hardware in Figure 6 as an example, which is a circle and the lines are circular lines, the first length is divided into several equal parts, that is, equal parts of the radius (or diameter), for example, the radius is divided into 3 equal parts in Figure 6, and 3 concentric circles are obtained.
[0122] Here, taking FIG. 4 as an example, and combining it with the third case above, that is, considering that the hardware in the hardware grayscale image is a rectangle and the defect in this embodiment is a crack, the generation process of several lines is described:
[0123] A plurality of straight lines passing through the hardware grayscale image along the length direction are generated, each of the straight lines corresponding to a row of pixel points along the length direction of the hardware grayscale image.
[0124] Here, the image is divided into n+1 regions by n straight lines. The position of these n straight lines in the hardware grayscale image, and the row of pixels where each line is located, is a pixel band, and finally these n pixel bands are extracted.
[0125] Step S22: Derivative the grayscale values between adjacent pixels in the pixel band.
[0126] Step S22 specifically includes:
[0127] Calculate the difference between each pixel point on the pixel strip and its adjacent pixel point on the left, and its adjacent pixel point on the right, and the quotient of the two differences is the derivative corresponding to the pixel point.
[0128] Step S23: setting the pixel points whose derivative values are greater than the derivative threshold as the seed points to be selected;
[0129] A point with a larger derivative value corresponds to a pixel mutation at that position, and a defect such as a crack or scratch may occur at that position. The candidate seed point is a possible seed point.
[0130] Step S24: Determine the seed point according to the candidate seed points.
[0131] Step S24 includes two implementation modes, one of which is:
[0132] Setting the candidate seed point as the seed point;
[0133] Another embodiment is:
[0134] The pixel whose grayscale value is lower than the minimum grayscale threshold or higher than the maximum grayscale threshold among the plurality of adjacent pixels in the pixel band where the candidate seed point is located is set as the seed point. In addition, in some embodiments, the pixel with the lowest grayscale value or the pixel with the highest grayscale value can be selected as the seed point.
[0135] The candidate seed point obtained in step S23 is the pixel point at the position where the pixel has a mutation, which may be at the edge of a crack or scratch. The pixel mutation at the pixel point inside the defect may be relatively small. Therefore, in this embodiment, a seed point that is closer to the defect is sought near the candidate seed point. The meaning of nearby can be that in this pixel band, the m pixel points to the left of the candidate seed point and the m pixel points to the right are all regarded as nearby pixel points.
[0136] For example, for cracks, the grayscale value inside the crack is generally lower, so the grayscale value is lower than the minimum grayscale threshold, and the pixel point with a lower grayscale value is selected as the seed point.
[0137] For example, for scratches, the grayscale value inside the crack is generally higher, so the grayscale value is higher than the maximum grayscale threshold and the pixel point with a higher grayscale value is selected as the seed point.
[0138] Step S30
[0139] Step S30 may be as shown in FIG7 , including the following steps S31 - S35 .
[0140] Step S31: Based on criterion one and criterion two, the seed point is regionally grown, and the pixel points in the hardware grayscale image that meet the growth requirements are divided into a defect set, wherein criterion one is that the grayscale value of the current pixel point is less than the crack grayscale threshold, and criterion two is that the difference between the grayscale value of the current pixel point and the grayscale value of the seed point is less than the difference threshold.
[0141] Step S32: Acquire crack determination conditions, wherein the crack determination conditions include a height threshold and a width-to-length ratio threshold.
[0142] In this embodiment 1, based on the general morphology of the crack, two judgment conditions, namely the height threshold and the width-to-length ratio threshold, are determined. The crack is generally slender and may even penetrate the entire circuit board in the first direction, such as the fracture from top to bottom of the rectangular plate in Figure 4. All length thresholds are used to judge whether the crack defect is long enough, and the width-to-length ratio threshold is used to judge whether the crack defect is thin enough. When these two threshold judgment conditions are met, it is a crack defect.
[0143] Step S33: performing region growing based on the seed point to obtain a plurality of defect-like regions;
[0144] Based on the above criteria one and two, the seed growth algorithm is applied to the hardware grayscale image to search for pixels close to the seed point pixel. Each search compares the pixels adjacent to the current seed point that have not been detected. For example, if all the pixels adjacent to a seed point are not detected, then the adjacent pixels are the 8 pixels around the seed point. These pixels are checked to see if they meet criteria one and two. If they meet both criteria, they are used as new seed points to continue growing. All seed points are grown until the growth is completed.
[0145] Here, as shown in FIG8 , a corresponding mask image is generated, in which all pixels in the area grown based on the seed point are 1, and all other pixels are 0.
[0146] Step S34: generating a minimum regular rectangle and a minimum circumscribed rectangle of the defect-like area.
[0147] Step S35: determining whether the height of the minimum regular rectangle is greater than a height threshold, and whether the aspect ratio of the minimum circumscribed rectangle is greater than the aspect ratio threshold.
[0148] The minimum regular rectangle and minimum enclosing rectangle can be respectively referred to as shown in FIG9 , wherein one side of the minimum regular rectangle is parallel to the first direction, and the minimum enclosing rectangle is the minimum rectangle circumscribing the defect-like region. The height threshold and the height of the minimum regular rectangle can refer to the height in FIG9 ; the aspect ratio threshold and the aspect ratio of the minimum enclosing rectangle can refer to the ratio of width to length in FIG9 .
[0149] If the height of the minimum regular rectangle is greater than the height threshold, and the aspect ratio of the minimum circumscribed rectangle is greater than the aspect ratio threshold, that is, both conditions are met, then the corresponding defect-like area is a defect area.
[0150] On the contrary, if at least one of the above two conditions is not met, it will be regarded as noise, that is, a non-defective area.
[0151] The final mask image is shown in Figure 8. Only the second area on the left is the defect area, that is, the crack area running through the width direction. The other areas generated by the seed points are all noise areas.
[0152] Example 2
[0153] The difference between Example 2 and Example 1 is that the defect type is different. The defect type detected in Example 2 is a scratch. Except for the following description of some differences, the implementation of other undescribed parts can refer to the description of Example 1.
[0154] Step S21 of Example 1 is specifically as follows in Example 2:
[0155] A plurality of lines of the hardware grayscale image are generated, wherein the plurality of lines cover the entire hardware grayscale image as evenly as possible.
[0156] Here, the meaning of "try your best" is that it can be either absolute uniformity or non-absolute, relative uniformity on the whole, such as the uniformity of Figures 4, 5, and 6 in Example 1, or the uniformity of inclined lines, as shown in Figure 10, or a U-shaped line can evenly divide the entire hardware grayscale image, as shown in Figure 11.
[0157] Because scratches may appear at any position and in any form in the hardware grayscale image, a number of lines should cover all positions of the entire hardware grayscale image as evenly as possible, which is conducive to detecting defects at various positions.
[0158] In addition, step S31 of embodiment 1 is replaced by:
[0159] Based on criteria two and three, the seed point is regionally grown, and the pixel points in the hardware grayscale image that meet the growth requirements are divided into a defect set, wherein criteria two is that the difference between the grayscale value of the current pixel point and the grayscale value of the seed point is less than the difference threshold, and criteria three is that the grayscale value of the current pixel point is greater than the scratch grayscale threshold.
[0160] Here, based on the fact that the grayscale value of the scratch is higher than that of the non-scratched area, the above-mentioned criteria 2 and 3 are adopted. Correspondingly, the other steps of step S30 are also adjusted in response to the scratch. For example, step S32 is replaced by: obtaining the scratch determination condition. Scratches are generally long and thin, so the scratch determination condition may also include a height threshold and a width-to-length ratio threshold. However, the scratch does not necessarily extend along the first direction, so the height threshold of the determination condition corresponding to the scratch can be smaller, and the width-to-length ratio threshold can also be smaller. The specific values can be measured based on experiments.
[0161] The final mask image is shown in Figure 12. Only the middle area is the defect area, that is, the scratch area extending in the left and right directions. The rest of the areas generated by the seed points are noise areas.
[0162] Compared with the prior art, this embodiment has the following beneficial effects:
[0163] The hardware defect detection method and device detect defective areas based on a seed growth algorithm, and in combination with the characteristics of the hardware, determine the appropriate seed points in the hardware scene by obtaining the derivatives of a number of strip-shaped pixel points based on a number of lines, and then grow based on the seed points; on the one hand, the defective areas are accurately generated, making the determination of defective areas more efficient; on the other hand, the generated effect is good, and it is not easy to miss or identify non-defective areas as defective areas. Therefore, the detection method and device can not only improve the detection efficiency of hardware defects, but also improve the detection accuracy.
[0164] Hardware defect detection device
[0165] In one embodiment, a hardware defect detection device is provided, as shown in FIG13 . The hardware defect detection device includes modules, and the specific functions of each module are as follows:
[0166] Acquisition module, used to obtain hardware grayscale images;
[0167] A seed point generation module, configured to generate a plurality of seed points based on the hardware grayscale image;
[0168] A defect region generating module, configured to perform region growing based on the seed point to obtain a defect region of the hardware;
[0169] The seed point generation module is further configured to:
[0170] generating a plurality of lines of the hardware grayscale image, the lines corresponding to pixel bands on the hardware grayscale image;
[0171] Derivative of the grayscale values between adjacent pixels in the pixel strip;
[0172] The pixel point whose derivative value is greater than the derivative threshold is set as the candidate seed point;
[0173] The seed point is determined according to the candidate seed point.
[0174] It should be noted that for details not disclosed in the hardware defect detection device of the embodiment of the present invention, please refer to the details disclosed in the hardware defect detection method of the embodiment of the present invention.
[0175] Those skilled in the art will understand that the module diagram is merely an example of a hardware defect detection device and does not constitute a limitation on the terminal device of the hardware defect detection device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the hardware defect detection device may also include input and output devices, network access equipment, buses, etc.
[0176] The hardware defect detection apparatus may also include a computing device such as a computer, laptop, PDA, or cloud server, as well as a processing module, a storage module, and a computer program stored in the storage module and executable on the processing module, such as the aforementioned hardware defect detection method program. When the processing module executes the computer program, the steps of each of the aforementioned hardware defect detection method embodiments are implemented, such as the steps shown in Figures 1, 3, and 7.
[0177] Hardware defect detection equipment
[0178] In one embodiment, a hardware defect detection device is provided, comprising:
[0179] Loading and unloading stations, which are used to load and unload hardware;
[0180] A conveyor line connects the loading and unloading stations and transfers hardware;
[0181] An inspection station, located on or to the side of the conveyor line, is provided. The inspection stations are configured to detect various hardware defects. The inspection stations employ the aforementioned hardware defect detection method to inspect the hardware and upload the inspection data.
[0182] The inspection station is equipped with a transport mechanism, which moves the hardware to the inspection station and transfers the hardware to the conveyor line for inspection or unloading of the next process after the inspection is completed.
[0183] In one embodiment, the hardware is a battery protection board, and the inspection station includes an appearance defect inspection station and an electrical performance inspection station.
[0184] In addition, the present invention also proposes an electronic device, which includes a storage module and a processing module. When the processing module executes the computer program, it can implement the steps in the above-mentioned hardware defect detection method, that is, implement the steps in any one of the technical solutions in the above-mentioned hardware defect detection method.
[0185] The electronic device may be a part integrated into a hardware defect detection device, or a local terminal device, or a part of a cloud server.
[0186] The processing module can be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processing module is the control center of the hardware defect detection device, connecting the various components of the entire hardware defect detection device using various interfaces and circuits.
[0187] The storage module can be used to store the computer programs and / or modules. The processing module implements various functions of the hardware defect detection device by running or executing the computer programs and / or modules stored in the storage module and calling the data stored in the storage module. The storage module can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc. In addition, the storage module can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0188] For example, the computer program may be divided into one or more modules / units, which are stored in a storage module and executed by a processing module to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the hardware defect detection device.
[0189] Furthermore, an embodiment of the present invention provides a readable storage medium storing a computer program, which, when executed by a processing module, can implement the steps in the above-mentioned circuit board defect detection method, that is, implement the steps in any one of the technical solutions in the above-mentioned circuit board defect detection method.
[0190] If the integrated module of the circuit board defect detection method is implemented as a software functional unit and sold or used as a standalone product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention can also implement all or part of the process steps of the above-mentioned method embodiments by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium and, when executed by the processing module, can implement the steps of each of the above-mentioned method embodiments.
[0191] The computer program includes computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. It should be noted that the content of the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0192] It should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation method can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
[0193] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for detecting hardware defects, characterized in that: The steps include: Get the hardware grayscale image; Based on the hardware grayscale image, generating a plurality of seed points; Performing region growing based on the seed point to obtain a defect region of the hardware; The step of generating the seed point includes: generating a plurality of lines of the hardware grayscale image, the lines corresponding to pixel bands on the hardware grayscale image; Derivatively calculating the grayscale values between adjacent pixels of the pixel band; The pixel points whose derivative values are greater than the derivative threshold are set as the seed points to be selected; The seed point is determined according to the candidate seed point.
2. The method for detecting hardware defects according to claim 1, characterized in that: The steps of generating a plurality of lines of the hardware grayscale image include: The type of the line is determined according to the shape of the hardware and / or the type of defect that needs to be detected, wherein the type of defect includes cracks and scratches.
3. The method for detecting hardware defects according to claim 2, characterized in that: The defect type detected is a crack, and the crack extends substantially along a first direction on the hardware; The steps of generating a plurality of lines of the hardware grayscale image include: A plurality of lines passing through the grayscale image of the hardware are generated, wherein the plurality of lines divide the hardware in a second direction intersecting the first direction.
4. The method for detecting hardware defects according to claim 3, characterized in that: The length of the hardware along the first direction is a first length; The steps of generating a plurality of lines of the hardware grayscale image include: A plurality of lines are generated through the grayscale image of the hardware, wherein the plurality of lines divide the hardware into a plurality of equal parts along the first length.
5. The method for detecting hardware defects according to claim 3, characterized in that: The step of performing region growing based on the seed point comprises: Based on criterion one and criterion two, the seed point is subjected to regional growth, and the pixel points in the hardware grayscale image that meet the growth requirements are divided into a defect set, wherein criterion one is that the grayscale value of the current pixel point is less than the crack grayscale threshold, and criterion two is that the difference between the grayscale value of the current pixel point and the grayscale value of the seed point is less than the difference threshold; The step of performing region growth on the seed point based on criteria one and criteria two includes: Detect the pixel points adjacent to the current seed point and not detected to see whether they meet the first criterion and the second criterion. If they meet both criteria, use the adjacent pixel point as a new seed point to continue growing until all seed points have been grown.
6. The method for detecting hardware defects according to claim 3, characterized in that: The step of performing region growth based on the seed point to obtain the defect region of the hardware also includes: Acquiring crack determination conditions, wherein the crack determination conditions include a height threshold and a width-to-length ratio threshold; Performing region growing based on the seed point to obtain a number of defect-like regions; Generate a minimum regular rectangle and a minimum circumscribed rectangle of the defect-like area; If the height of the smallest regular rectangle is greater than the height threshold, and the width-to-length ratio of the smallest circumscribed rectangle is greater than the width-to-length ratio threshold, the corresponding defect-like region is a defect region.
7. The method for detecting hardware defects according to claim 2, characterized in that: The defect type detected is scratches; The steps of generating a plurality of lines of the hardware grayscale image include: generating a plurality of lines of the hardware grayscale image, wherein the plurality of lines covers the entire hardware grayscale image as evenly as possible; The step of performing region growing based on the seed point comprises: Based on criteria two and three, the seed point is regionally grown, and the pixel points in the hardware grayscale image that meet the growth requirements are divided into a defect set, wherein criteria two is that the difference between the grayscale value of the current pixel point and the grayscale value of the seed point is less than the difference threshold, and criteria three is that the grayscale value of the current pixel point is greater than the scratch grayscale threshold.
8. The method for detecting hardware defects according to claim 2, characterized in that: The hardware in the hardware grayscale image is a rectangle; The steps of generating a plurality of lines of the hardware grayscale image include: A plurality of straight lines passing through the hardware grayscale image along the length direction are generated, each of the straight lines corresponding to a row of pixel points along the length direction on the hardware grayscale image.
9. The method for detecting hardware defects according to claim 1, characterized in that: The step of performing a derivation of the grayscale values between adjacent pixels in the pixel band comprises: The difference between each pixel point on the pixel strip and the adjacent pixel point on the left side of the pixel point and the adjacent pixel point on the right side of the pixel point is calculated, and the quotient of the two differences is the derivative corresponding to the pixel point.
10. The method for detecting hardware defects according to claim 1, characterized in that: The step of determining the seed point according to the candidate seed point further comprises: Setting the to-be-selected seed point as the seed point; or, A pixel whose grayscale value is lower than a minimum grayscale threshold or higher than a maximum grayscale threshold among a plurality of adjacent pixel points in the pixel band where the candidate seed point is located is set as the seed point.
11. A hardware defect detection device, characterized in that: include: Acquisition module, used to acquire hardware grayscale images; A seed point generation module, used to generate a number of seed points based on the hardware grayscale image; A defect region generating module, used for performing region growth based on the seed point to obtain the defect region of the hardware; Wherein, the seed point generation module is also used for: generating a plurality of lines of the hardware grayscale image, the lines corresponding to pixel bands on the hardware grayscale image; Derivatively calculating the grayscale values between adjacent pixels of the pixel band; The pixel point whose derivative value is greater than the derivative threshold is set as the seed point to be selected; The seed point is determined according to the candidate seed point.
12. A hardware defect detection device, characterized in that: include: Loading and unloading stations, which are used to load and unload hardware; A conveyor line, which connects the loading and unloading stations and transfers the hardware; An inspection station, which is located on the conveyor line or on the side of the conveyor line. There are several inspection stations for realizing the inspection of several kinds of hardware defects. The inspection stations adopt the hardware defect inspection method as claimed in claim 1 to inspect the hardware and upload the inspection data; The inspection station is equipped with a transport mechanism, which moves the hardware to the inspection station and transfers the hardware to the conveyor line for inspection or unloading of the next process after the inspection is completed.
13. The hardware defect detection device according to claim 12, characterized in that: The hardware is a battery protection board, and the inspection stations include an appearance defect inspection station and an electrical performance inspection station.
14. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processing module, the steps in the method for detecting hardware defects according to claim 1 can be implemented.
Citation Information
Patent Citations
Mini LED wafer appearance defect detection method based on optical detection
CN115290663A
Pole piece defect detection method, device and equipment and computer storage medium
CN116012330A
Scratch defect detection method and device, storage medium and electronic equipment
CN116468687A
Elevator door anomaly detection method based on video image analysis
CN116664552A
Method and apparatus for detecting a screen, and electronic device
US20210174489A1
Cited By
Visual detection method for slag inclusion defect in crankshaft casting process
CN119991651A
Cable detection method and computer readable storage medium
CN121169798A