Defect detection method, device, equipment and storage medium
By calculating the grayscale data of the region of interest and edge amplitude images in the pad image data, it is determined whether the shape of the semi-slot of the pad is in compliance with the preset conditions, and the problems of poor detection effect, unstable and poor compatibility in the prior art are solved, and defect detection of efficient, stable and compatible are achieved.
Patent Information
- Application Number
- CN202210032634.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-12
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-01-12
AI Technical Summary
In the prior art, defect detection effect is poor, unstable and poor compatibility, especially when the sharp corners of the half-slot holes of the detection pad are missing or damaged, it is difficult to achieve efficient detection.
By calculating the region of interest in the image data of the detection object, the grayscale data of the edge amplitude image is obtained, and the target defects exist based on these data, specifically, including determining whether the shapes of sharp corners and gaps meet preset conditions.
Accurate defect detection of the half-slot position of the pad is achieved, detection efficiency and stability are improved, and compatibility is significantly improved.
Smart Images

Figure CN114529511B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a defect detection method, device, equipment and storage medium. Background Art
[0002] Wireless communication modules (referred to as modules) need to be inspected for surface defects before leaving the factory. One of the inspections is for the pads at the bottom of the module, such as whether there are dirt, green oil, tinning, damage, missing or other defects on the surface of the pads. Ordinary pads have regular shapes, and the above defects are not difficult to detect. However, there is also a special pad that has a half-slot hole, that is, it has two sharp corners, and it is difficult to detect if the sharp corners are missing or damaged.
[0003] Existing detection scheme 1: Detection is achieved by manually observing the pad with the help of a high-magnification electronic magnifying glass, which is not only time-consuming and inefficient, but also prone to missed detection.
[0004] Existing detection scheme 2: By making a shape model of good pads, and then using machine vision to compare the shapes of other pads with the shape of the model one by one, the defects are detected according to the similarity score obtained by the final comparison. There are two shortcomings: 1. If the missing part of the sharp corner is relatively small, and the missing part accounts for too low a proportion of the overall shape of a single pad, then the similarity score obtained by shape matching is still very high, more than 95%, so it is difficult to achieve the detection effect when the missing sharp corners are relatively small; 2. In the same module, there are a large number of pads of the same shape. Due to the influence of the processing technology, the shapes of each pad may not be exactly the same. Then the shape model made by this method in the early stage is difficult to guarantee that it is applicable to all pads of this shape. Therefore, this detection method is unstable and has poor compatibility. Summary of the invention
[0005] In view of this, an object of the embodiments of the present invention is to provide a defect detection method, device, equipment and storage medium to solve the problems of poor detection effect, instability and poor compatibility in the prior art.
[0006] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a defect detection method, comprising:
[0007] Calculate and obtain a region of interest in the image data of the detected object;
[0008] Calculating and obtaining an edge amplitude image of the image data of the detection object;
[0009] Obtaining grayscale data of the edge amplitude image in the region of interest according to the region of interest and the edge amplitude image;
[0010] It is determined whether the inspection object has a target defect according to the grayscale data of the edge amplitude image in the region of interest.
[0011] In addition, the detection object is a pad, and the region of interest is a region corresponding to a half slot hole of the pad; the half slot hole includes two sharp corners and a gap between the two sharp corners;
[0012] The step of determining whether the inspection object has a target defect according to the grayscale data of the edge amplitude image in the region of interest comprises:
[0013] If it is determined according to the grayscale data of the edge amplitude image in the region of interest that two sharp corners of the half-slot hole that meet the preset shape condition exist in the region of interest, and there is the gap that meets the preset gap condition between the two sharp corners in the region of interest, it is determined that the inspection object does not have the target defect;
[0014] If there are no two sharp corners of the half-slot hole that meet the preset shape conditions and / or there is no gap that meets the preset gap conditions in the region of interest, it is determined that the target defect exists in the inspection object.
[0015] In addition, the region of interest is rectangular and is the two sharp corners of the half slot and the region between the two sharp corners;
[0016] The grayscale data of the edge amplitude image in the region of interest is an average grayscale sequence on a cross section parallel to the long side of the region of interest.
[0017] In addition, judging whether there are two sharp corners of the half-slot hole meeting a preset shape condition in the region of interest according to the grayscale data of the edge amplitude image in the region of interest includes:
[0018] The ranges at the two sharp corner positions are calculated respectively; the range is the difference between the maximum grayscale value and the minimum grayscale value at the corresponding sharp corner position;
[0019] Whether there are two sharp corners of the half-slot hole that meet the preset shape condition is determined according to the ratio of the absolute values of the extreme differences at the positions of the two sharp corners.
[0020] In addition, judging whether there are two sharp corners of the half-slot hole meeting the preset shape condition according to the ratio of the absolute values of the extreme differences at the positions of the two sharp corners includes:
[0021] If the ratio is less than a first threshold, it is determined that there are no two sharp corners of the half slot hole that meet the preset shape condition;
[0022] If the ratio is greater than a second threshold, it is determined that there are no two sharp corners of the half slot hole that meet the preset shape condition;
[0023] The first threshold and the second threshold are derivatives of each other, and the first threshold is smaller than the second threshold.
[0024] In addition, judging whether there is a gap between the two sharp corners in the region of interest that meets a preset gap condition includes:
[0025] If the minimum value of the average grayscale sequence in the area between the two sharp corners is less than the third threshold, it is determined that the gap that meets the preset gap condition exists.
[0026] In a second aspect, an embodiment of the present invention further provides a defect detection method, which is applied to a defect detection system, and the method includes:
[0027] Capturing a detection object and acquiring image data of the detection object;
[0028] Execute the defect detection method as described in the first aspect to determine whether the detection object has a target defect;
[0029] If the target defect exists, the material is discarded; if the target defect does not exist, the inspection object is sent to the subsequent process.
[0030] In a third aspect, an embodiment of the present invention further provides a defect detection device, including:
[0031] An area of interest calculation module, used to calculate and obtain an area of interest in the image data of the detection object;
[0032] An amplitude image calculation module, used for calculating and obtaining an edge amplitude image of the image data of the detection object;
[0033] A grayscale data extraction module, used for obtaining grayscale data of the edge amplitude image in the region of interest according to the region of interest and the edge amplitude image;
[0034] The defect judgment module is used to determine whether the inspection object has a target defect according to the grayscale data of the edge amplitude image in the region of interest.
[0035] In a fourth aspect, an embodiment of the present invention further provides a detection device, the device comprising: a memory and a processor, the memory storing a computer program, and the processor running the computer program to implement the defect detection method as described in the first aspect.
[0036] In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the defect detection method as described in the first aspect of the present invention.
[0037] The embodiment of the present invention obtains the grayscale data of the edge amplitude image in the area of interest of the image data of the detection object, and determines whether the detection object has a target defect based on the grayscale data of the edge amplitude image in the area of interest, and focuses the detection position to, for example, the half-slot hole position of the pad, so as to accurately detect whether the corresponding position has a target defect. Not only is the amount of calculation small, but also the detection efficiency is high, the detection stability and compatibility are excellent. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a schematic diagram of the structure of a defect detection system provided by an embodiment of the present invention;
[0039] Figure 2 is a flow chart of a defect detection method provided by an embodiment of the present invention;
[0040] Figure 3a is a color image schematic diagram of a solder pad provided by an embodiment of the present invention;
[0041] Figure 3b is a schematic diagram of a grayscale image of a pad provided by an embodiment of the present invention;
[0042] Figure 3c is a schematic diagram of an edge amplitude image of a pad provided by an embodiment of the present invention;
[0043] Figure 3d is a schematic diagram of an edge amplitude image of a half-slot hole structure of a pad provided by an embodiment of the present invention;
[0044] Figure 4a 1 is a schematic diagram of an edge amplitude image of a sharp corner defect of a half-slot hole structure of a pad provided by an embodiment of the present invention and a schematic diagram of an average grayscale sequence;
[0045] Figure 4b 1 is a schematic diagram of an edge amplitude image of a half-slot hole structure of a pad with a missing sharp corner and a schematic diagram of an average grayscale sequence provided by an embodiment of the present invention;
[0046] Figure 4c is an image schematic diagram of a sharp corner defect of a half-slot hole structure of a pad provided by an embodiment of the present invention;
[0047] Figure 5 is a flow chart of a defect detection method of a defect detection system provided by an embodiment of the present invention;
[0048] Figure 6is a schematic structural diagram of a defect detection device provided by an embodiment of the present invention;
[0049] Figure 7 It is a schematic diagram of the structure of a detection device provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described through implementation methods with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] Figure 1 1 is a schematic diagram of the structure of the defect detection system provided by an embodiment of the present invention. The system includes: a host 100, an image acquisition device 110, a coaxial light source 120, and a mechanical arm 130. The host 100 is connected to the image acquisition device 110, the coaxial light source 120, and the mechanical arm 130 in communication. The image acquisition device 110 can be an industrial camera and a lens, which is not specifically limited here. The mechanical arm 130 grabs the detection object 140, such as a wireless communication module, and notifies the host 100 after the detection position is in place. The host 100 controls the coaxial light source 120 to light up and then controls the image acquisition device 110 to capture the image of the module and transmit the image data of the module back to the host 100. The host 100 processes the image data of the module and determines whether the module is a qualified product. If it is a qualified product, the mechanical arm 130 is controlled to send the module to the subsequent process flow. If it is a defective product, the mechanical arm 130 is controlled to throw the material, such as sending the defective module to the defective product collection tray.
[0052] Figure 2 is a flow chart of a defect detection method provided by an embodiment of the present invention. The technical solution of this embodiment can be applied to defect detection of products with specific morphological features, and is particularly applicable to defect detection of half-slot holes of wireless communication modules. The method can be executed by a defect detection device provided by an embodiment of the present invention. The device can be implemented in software and / or hardware and configured in a detection device application. The detection device can be Figure 1 The host shown. The detection equipment includes but is not limited to: PC, tablet computer, notebook computer, etc., which is not specifically limited in this embodiment. Figure 2 As shown, the method specifically comprises the following steps:
[0053] Step 201: Calculate and obtain a region of interest in the image data of the detection object.
[0054] For example, the detection object may be a pad of a wireless communication module. The pad has a half-slot structure. The half-slot includes two sharp corners and a gap between the two sharp corners. Image data of the pad may be collected by an industrial camera and a lens. The image of the pad may be a collected image, such as Figure 3a As shown. The grayscale image data of the pad can be obtained by processing the image data of the pad. Figure 3b As shown, a grayscale image of the pad is obtained after processing the acquired color image of the pad.
[0055] The half slot of the pad includes two sharp corners and a gap between the two sharp corners. The region of interest may be the area corresponding to the half slot of the pad. The region of interest (ROI) is obtained according to the image data of the pad and the morphological characteristics of the half slot of the pad. The region of interest is the area where the half slot of the pad is located, such as Figure 3d As shown. The region of interest of the pad is rectangular and includes two sharp corners of the half slot hole and the gap between the two sharp corners. It should be noted that the region of interest of the pad can be obtained according to the acquired color image data, so as to obtain a more accurate region of interest, but it is not limited to this.
[0056] Step 202: Calculate and obtain an edge amplitude image of the image data of the detection object.
[0057] Specifically, the edge amplitude image of the detection object can be calculated based on the grayscale image data of the detection object. For example, the edge amplitude image of the pad can be calculated based on the grayscale image data of the pad, such as Figure 3c By calculating the first-order derivative of the grayscale image of the pad, its edge amplitude image can be obtained. By calculating the edge amplitude image, the edge contour of the pad pattern can be retained while removing the image with a similar grayscale value.
[0058] Step 203: Obtaining grayscale data of the edge amplitude image in the region of interest according to the region of interest and the edge amplitude image.
[0059] Optionally, the grayscale data of the edge amplitude image in the region of interest may be an average grayscale sequence on a cross section parallel to the long side of the region of interest. For example, the average grayscale sequence of a half slot of the pad may be as follows: Figure 4a As shown. The grayscale image of the smooth half-slot hole can be obtained by taking the average grayscale sequence on the cross section parallel to the long side of the region of interest as the grayscale data of the edge amplitude image in the region of interest. It can be understood that the grayscale data can also be other grayscale data suitable for characterizing the characteristics of the detection object, and no specific limitation is made here.
[0060] Step 204: Determine whether the inspection object has a target defect based on the grayscale data of the edge amplitude image in the region of interest.
[0061] Whether the morphological features of the inspection object are complete and meet the requirements is determined based on the grayscale data of the edge amplitude image in the region of interest. Taking the half-slot hole structure of the pad as an example, when the morphological features of the two sharp corners of the half-slot hole and the gap between the two sharp corners are detected and they are consistent with the morphological features of the half-slot hole, it is considered that the inspected half-slot hole has no defects, otherwise it is considered that the half-slot hole has defects. However, it is not limited to this, and the morphological features of the inspection object can also be other shape structures, such as an inspection object with multiple sharp points.
[0062] Optionally, in the defect detection method for the half-slot hole structure of the pad, step 204 of determining whether the detection object has a target defect based on the grayscale data of the edge amplitude image in the region of interest may include: judging whether there are two sharp corners of the half-slot hole that meet the preset shape condition in the region of interest and judging whether there is a gap that meets the preset gap condition between the two sharp corners in the region of interest based on the grayscale data of the edge amplitude image in the region of interest; if there are two sharp corners of the half-slot hole that meet the preset shape condition, and there is a gap that meets the preset gap condition between the two sharp corners in the region of interest, then it is determined that the detection object does not have the target defect; if there are no two sharp corners of the half-slot hole that meet the preset shape condition in the region of interest, and / or there is no gap that meets the preset gap condition, then it is determined that the detection object has the target defect, thereby judging whether there is a half-slot hole structure of the pad in the image.
[0063] Specifically, judging whether there are two sharp corners of a half-slot hole meeting the preset shape condition in the region of interest according to the grayscale data of the edge amplitude image in the region of interest may include: respectively calculating the ranges at the two sharp corner positions; the range is the difference between the maximum grayscale value and the minimum grayscale value at the corresponding sharp corner position; judging whether there are two sharp corners of a half-slot hole meeting the preset shape condition according to the ratio of the absolute values of the ranges at the two sharp corner positions. Further, judging whether there are two sharp corners of a half-slot hole meeting the preset shape condition according to the ratio of the absolute values of the ranges at the two sharp corner positions may include: if the ratio is less than a first threshold, determining that there are no two sharp corners of a half-slot hole meeting the preset shape condition; if the ratio is greater than a second threshold, determining that there are no two sharp corners of a half-slot hole meeting the preset shape condition; if the ratio is greater than or equal to the first threshold, or the ratio is less than or equal to the second threshold, determining that there are two sharp corners of a half-slot hole meeting the preset shape condition. Wherein, the first threshold and the second threshold are derivatives of each other, and the first threshold is less than the second threshold.
[0064] like Figure 4a The average grayscale sequence of a half-slot structure shown is Figure 4aThe curve in the figure. There is a peak on each side and a trough in the middle. The two peaks correspond to the grayscale data of the two sharp corners of the half slot. The range of the left sharp corner is L It is equal to the difference between the maximum grayscale value and the minimum grayscale value of the left peak, and the range of the right corner is Range. R It is equal to the difference between the maximum grayscale value and the minimum grayscale value of the right peak. The ratio of the extreme difference between the left and right corners is Rate. L With Range R The ratio of the absolute values of the two corners. The first threshold is, for example, one third, and the second threshold is, for example, 3. The first threshold and the second threshold are derivatives of each other. When the ratio is greater than 1, determine whether the ratio is greater than the second threshold, for example, whether it is greater than 3. If it is greater than 3, it is considered that the heights of the two corners do not match. If it is less than or equal to 3, it is considered that the heights of the two corners match, and the shapes of the two corners meet the requirements. When the ratio is less than 1, determine whether the ratio is less than one third. If it is less than the first threshold, it is considered that the heights of the two corners do not match. If the ratio is greater than or equal to one third, it is considered that the heights of the two corners match. The first threshold and the second threshold can be set based on experience. This embodiment does not limit the specific values. The first threshold can be an integer or a decimal. By using appropriate first and second thresholds, it is possible to more accurately determine whether the heights of the two corners match the two corners of a qualified half-slot hole, thereby accurately detecting defects such as broken corners. Figure 4b , 4c As shown, the left corner is missing. If any one of the two corners is missing, or both corners are missing, it is considered that the half-slot hole structure has defects. It can be understood that when the ratio of the two corners (also known as the slope) meets the above conditions, the height of the corner can also be calculated by calculating the height difference between the peak and the trough of any corner, and further judged that the height of the corner also meets the requirements.
[0065] Determining whether there is a gap that meets the preset gap condition between two sharp corners in the region of interest may include: if the minimum value of the average grayscale sequence in the region between the two sharp corners is less than a third threshold, it is determined that there is a gap that meets the preset gap condition. The grayscale value of the blank area (i.e., the gap) between the two sharp corners should be less than a certain standard value (i.e., the third threshold). The third threshold is, for example, 1. When the minimum value of the average grayscale sequence in the region between the two sharp corners is less than 1, it is determined that there is a gap that meets the preset condition. Otherwise, if the minimum value of the average grayscale sequence in the region between the two sharp corners is greater than or equal to 1, it is determined that there is no gap that meets the preset condition. The third threshold can be set based on experience, and the present embodiment does not impose specific restrictions on its value.
[0066] Compared with the prior art, this embodiment has at least the following positive effects:
[0067] The embodiment of the present invention obtains the grayscale data of the edge amplitude image in the area of interest of the image data of the detection object, and determines whether the detection object has a target defect based on the grayscale data of the edge amplitude image in the area of interest, and focuses the detection position to, for example, the half-slot hole position of the pad, so as to accurately detect whether the corresponding position has a target defect. Not only is the amount of calculation small, but also the detection efficiency is high, the detection stability and compatibility are excellent.
[0068] Figure 5 A flowchart of a defect detection method provided by an embodiment of the present invention is applied to Figure 1 Defect detection system shown. Figure 1 as well as Figure 5 , the method comprises the following steps:
[0069] Step 501: Capture a detection object and acquire image data of the detection object.
[0070] Specifically, the host 100 controls the mechanical arm 130 to grab the detection object 140, and controls the image acquisition device 110 to acquire image data of the detection object 140. The host 100 communicates with the image acquisition device 110 and acquires the image data of the detection object 140.
[0071] Step 502: Execute the defect detection method described in the first embodiment to determine whether the detection object has a target defect.
[0072] The host 100 executes the defect detection method of the first embodiment to determine whether the detection object 140 has a target defect. If the target defect exists, step 503 is executed, and if the target defect does not exist, step 504 is executed.
[0073] Step 503: throwing the material.
[0074] The host 100 controls the robot arm 130 to throw the material.
[0075] Step 504: Send the detected object to the subsequent process.
[0076] The host 100 controls the robot arm 130 to send the inspection object to the subsequent process.
[0077] Compared with the prior art, this embodiment has at least the following positive effects:
[0078] The embodiment of the present invention obtains the grayscale data of the edge amplitude image in the region of interest of the image data of the detection object, determines whether the detection object has a target defect based on the grayscale data of the edge amplitude image in the region of interest, and focuses the detection position to, for example, the half-slot hole position of the pad, so as to accurately detect whether the corresponding position has a target defect. It not only has a small amount of calculation, but also has high detection efficiency, good detection stability and compatibility. And the defect detection is performed by the defect detection system to further improve the detection efficiency.
[0079] Figure 6 is a structural block diagram of a defect detection device provided in this embodiment. The embodiment of the present invention also provides a defect detection device 600, which is configured in a detection device, and the detection device can be Figure 1 The host in the detection system shown is used to execute the defect detection method provided by any of the above embodiments. The device 600 includes: an area of interest calculation module 601, an amplitude image calculation module 602, a grayscale data extraction module 603 and a defect judgment module 604.
[0080] The region of interest calculation module 601 is used to calculate the region of interest in the image data of the detection object.
[0081] The amplitude image calculation module 602 is used to calculate and obtain the edge amplitude image of the image data of the detection object.
[0082] The grayscale data extraction module 603 is used to obtain the grayscale data of the edge amplitude image in the region of interest according to the region of interest and the edge amplitude image.
[0083] The defect judgment module 604 is used to determine whether the inspection object has a target defect according to the grayscale data of the edge amplitude image in the region of interest.
[0084] Optionally, the detection object may be a pad, and the region of interest may be a region corresponding to a half-slot hole of the pad; the half-slot hole includes two sharp corners and a gap between the two sharp corners.
[0085] The defect judgment module 606 may include a sharp corner detection submodule, a space detection submodule, and a judgment submodule.
[0086] The sharp corner detection submodule is used to determine whether there are two sharp corners of the half-slot hole that meet the preset shape condition in the region of interest according to the grayscale data of the edge amplitude image in the region of interest.
[0087] The space detection submodule is used to determine whether there is a gap that meets the preset gap condition between the two sharp corners of the half-slot hole that meets the preset shape condition in the region of interest.
[0088] The judgment submodule is used to determine that the target defect does not exist in the inspection object if the gap that meets the preset gap condition exists, and to determine that the target defect exists in the inspection object if the two sharp corners of the half-slot hole that meet the preset shape condition do not exist in the area of interest, and / or the gap that meets the preset gap condition does not exist.
[0089] Optionally, the region of interest is rectangular and is the two sharp corners of the half slot and the region between the two sharp corners. The grayscale data of the edge amplitude image in the region of interest is an average grayscale sequence on a section parallel to the long side of the region of interest.
[0090] Optionally, the sharp corner detection submodule is used to calculate the extreme differences at the two sharp corner positions respectively; and to judge whether there are two sharp corners of the half-slot hole that meet the preset shape condition according to the ratio of the absolute values of the extreme differences at the two sharp corner positions, wherein the extreme difference is the difference between the maximum grayscale value and the minimum grayscale value at the corresponding sharp corner positions. Further, the sharp corner detection submodule is used to determine that there are no two sharp corners of the half-slot hole that meet the preset shape condition if the ratio is less than a first threshold value; and to determine that there are no two sharp corners of the half-slot hole that meet the preset shape condition if the ratio is greater than a second threshold value; wherein the first threshold value and the second threshold value are derivatives of each other, and the first threshold value is less than the second threshold value.
[0091] The space detection submodule is used to determine that the gap that meets the preset gap condition exists if the minimum value of the average grayscale sequence in the area between the two sharp corners is less than a third threshold.
[0092] Compared with the prior art, the detection device of this embodiment has at least the following positive effects:
[0093] The embodiment of the present invention obtains the grayscale data of the edge amplitude image in the area of interest of the image data of the detection object, and determines whether there is a target defect in the detection object based on the grayscale data of the edge amplitude image in the area of interest, and focuses the detection position to, for example, the half-slot hole position of the pad, so as to accurately detect whether there is a target defect in the corresponding position. Not only is the amount of calculation small, but also the detection efficiency is high, the detection stability and compatibility are excellent.
[0094] The embodiment of the present invention also provides a detection device. Figure 7 As shown, the device includes: a memory 702, a processor 701;
[0095] The memory 702 stores instructions that can be executed by the at least one processor 701 , and the instructions are executed by the at least one processor 701 to implement the defect detection method described in the aforementioned embodiment.
[0096] The detection device includes one or more processors 701 and a memory 702. Figure 7 A processor 701 is taken as an example. The processor 701 and the memory 702 may be connected via a bus or other means. Figure 7 In the example, the bus connection is used. The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The processor 701 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory 702, that is, realizing the above-mentioned defect detection method.
[0097] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function. In addition, the memory 702 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0098] One or more modules are stored in the memory 702 , and when executed by one or more processors 701 , the defect detection method in any of the above method implementations is executed.
[0099] The above-mentioned device can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0100] Compared with the prior art, the detection device of this embodiment obtains the grayscale data of the edge amplitude image in the area of interest of the image data of the detection object, and determines whether there is a target defect in the detection object based on the grayscale data of the edge amplitude image in the area of interest, and focuses the detection position to, for example, the half-slot hole position of the pad, so as to accurately detect whether there is a target defect in the corresponding position. It not only has a small amount of calculation, but also has high detection efficiency, good detection stability and compatibility.
[0101] An embodiment of the present invention further relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.
[0102] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions for making a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0103] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.
Claims
1. A defect detection method, characterized in that: include: Calculate and obtain a region of interest in the image data of the detected object; Calculating and obtaining an edge amplitude image of the image data of the detection object; Obtaining grayscale data of the edge amplitude image in the region of interest according to the region of interest and the edge amplitude image; Determining whether the inspection object has a target defect according to the grayscale data of the edge amplitude image in the region of interest; The detection object is a pad, and the region of interest is a region corresponding to a half-slot hole of the pad; the half-slot hole includes two sharp corners and a gap between the two sharp corners; The step of determining whether the inspection object has a target defect according to the grayscale data of the edge amplitude image in the region of interest comprises: If it is determined according to the grayscale data of the edge amplitude image in the region of interest that two sharp corners of the half-slot hole that meet the preset shape condition exist in the region of interest, and there is the gap that meets the preset gap condition between the two sharp corners in the region of interest, it is determined that the target defect does not exist in the inspection object; If there are no two sharp corners of the half-slot hole meeting the preset shape condition and / or no gap meeting the preset gap condition in the region of interest, it is determined that the target defect exists in the inspection object; Wherein, the region of interest is rectangular and is the two sharp corners of the half slot hole and the area between the two sharp corners; The grayscale data of the edge amplitude image in the region of interest is an average grayscale sequence on a cross section parallel to the long side of the region of interest; judging whether there are two sharp corners of the half-slot hole that meet the preset shape condition in the region of interest according to the grayscale data of the edge amplitude image in the region of interest, including: The ranges at the two sharp corner positions are calculated respectively; the range is the difference between the maximum grayscale value and the minimum grayscale value at the corresponding sharp corner position; Whether there are two sharp corners of the half-slot hole that meet the preset shape condition is determined according to the ratio of the absolute values of the extreme differences at the positions of the two sharp corners.
2. The defect detection method according to claim 1, characterized in that: The step of judging whether there are two sharp corners of the half-slot hole meeting a preset shape condition according to the ratio of the absolute values of the extreme differences at the positions of the two sharp corners includes: If the ratio is less than a first threshold, it is determined that there are no two sharp corners of the half slot hole that meet the preset shape condition; If the ratio is greater than a second threshold, it is determined that there are no two sharp corners of the half slot hole that meet the preset shape condition; The first threshold and the second threshold are derivatives of each other, and the first threshold is smaller than the second threshold.
3. The defect detection method according to claim 1, characterized in that: Determining whether there is a gap between the two sharp corners in the region of interest that meets a preset gap condition includes: If the minimum value of the average grayscale sequence in the area between the two sharp corners is less than the third threshold, it is determined that the gap that meets the preset gap condition exists.
4. A defect detection method, characterized in that: Applied to a defect detection system, the method comprises: Capturing a detection object and acquiring image data of the detection object; Execute the defect detection method according to any one of claims 1 to 3 to determine whether the detection object has a target defect; If the target defect exists, the material is discarded; if the target defect does not exist, the inspection object is sent to the subsequent process.
5. A defect detection device, characterized in that: include: An area of interest calculation module, used for calculating an area of interest in the image data of the detection object; wherein the detection object may be a pad, and the area of interest may be an area corresponding to a half-slot hole of the pad; the half-slot hole includes two sharp corners and a gap between the two sharp corners; An amplitude image calculation module, used for calculating and obtaining an edge amplitude image of the image data of the detection object; A grayscale data extraction module, used for obtaining grayscale data of an edge amplitude image in the region of interest according to the region of interest and the edge amplitude image; the region of interest is rectangular and is the two sharp corners of the half-slot hole and the area between the two sharp corners; the grayscale data of the edge amplitude image in the region of interest is an average grayscale sequence on a section parallel to the long side of the region of interest; A defect judgment module is used to determine whether the detection object has a target defect according to the grayscale data of the edge amplitude image in the region of interest; the defect judgment module includes: a sharp corner detection submodule, a space detection submodule and a judgment submodule; wherein, The sharp corner detection submodule is used to determine whether there are two sharp corners of the half-slot hole that meet the preset shape condition in the region of interest according to the grayscale data of the edge amplitude image in the region of interest; the sharp corner detection submodule is used to respectively calculate the range at the positions of the two sharp corners; and determine whether there are two sharp corners of the half-slot hole that meet the preset shape condition according to the ratio of the absolute values of the range at the positions of the two sharp corners, wherein the range is the difference between the maximum grayscale value and the minimum grayscale value at the corresponding sharp corner positions; The space detection submodule is used for determining whether there is a gap meeting a preset gap condition between the two sharp corners of the half-slot hole meeting the preset shape condition in the region of interest if the two sharp corners of the half-slot hole meeting the preset shape condition exist; The judgment submodule is used to determine that the target defect does not exist in the inspection object if the gap that meets the preset gap condition exists, and to determine that the target defect exists in the inspection object if the two sharp corners of the half-slot hole that meet the preset shape condition do not exist in the area of interest, and / or the gap that meets the preset gap condition does not exist.
6. A detection device, characterized in that: The device comprises: a memory and a processor, the memory stores a computer program, and the processor runs the computer program to implement the defect detection method according to any one of claims 1 to 3.
7. A computer-readable storage medium, characterized in that: Used to store a computer-readable program, wherein the computer-readable program is used for a computer to execute the defect detection method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Deformed steel bar surface defect detection method and system based on machine vision
CN110223296A