Product surface defect detection method and system
Through the 2.5D imaging system and background blur differential method, the problem of low accuracy of product surface defect detection is solved, and more efficient and accurate defect detection is achieved, especially in identifying subtle defects and reducing background noise.
Patent Information
- Application Number
- CN202411148595.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-08-21
AI Technical Summary
In the prior art, the product surface defect detection accuracy is low, the manual detection efficiency is low, the traditional 2D image detection is greatly affected by shooting angle and lighting, and the deep learning model has reduced the ability to detect specific defects with small sample sizes.
The 2.5D image set is obtained by using a 2.5D imaging system, and the high-speed line scanning camera and high-speed stripe line scanning light source are used, combined with the background blur differential method, a uniform distribution map of surface brightness is generated, and morphological corrosion and expansion operations are performed to eliminate background noise and improve defects. Accuracy of detection.
It improves the accuracy and efficiency of product surface defect detection, can better identify subtle defects, reduce background interference, enhance the contrast of defects, and improve the accuracy of detection.
Smart Images

Figure CN118671004B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of defect detection, and in particular to a method and system for detecting surface defects of products. Background Art
[0002] Appearance inspection is one of the key quality control steps in the manufacturing process of some products (e.g., cylindrical batteries), and is usually divided into three main methods: manual inspection, traditional 2D image inspection, and deep learning-based inspection.
[0003] Manual inspection relies on the visual judgment of workers to identify defects, which is inefficient, and long-term repetitive work can easily lead to visual fatigue of the operator, affecting the accuracy of judgment; traditional 2D image detection technology uses a high-resolution camera to capture images of the battery surface and uses image processing technology to identify defects. 2D image detection is greatly affected by the shooting angle and lighting conditions, which may result in poor imaging quality of defects, making some subtle or low-contrast defects difficult to accurately identify; deep learning detection methods automatically identify and classify defects on the battery surface by training algorithm models. Deep learning models usually require a large amount of labeled data for training. For specific defects with a small sample size, the detection capability may be reduced.
[0004] Currently, no effective solution has been proposed for the problem of low accuracy in product surface defect detection in related technologies. Summary of the invention
[0005] The embodiments of the present application provide a product surface defect detection method, system, electronic device and storage medium to at least solve the problem of low accuracy of product surface defect detection in the related art.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting surface defects of a product, the method comprising:
[0007] Acquire a 2.5D image set of the target object by a 2.5D imaging system, wherein the 2.5D imaging system includes a high-speed line scanning camera and a high-speed stripe line scanning light source;
[0008] Performing background removal on the images in the 2.5D image set to obtain a main 2.5D image set of the target object;
[0009] An average image is obtained from the subject's 2.5D image set, and surface defect detection of the target object is performed based on the average image based on the background fuzzy difference method. The average image is synthesized by images obtained by the light source at different phases and is a surface brightness uniform distribution image of the target object.
[0010] In some embodiments, the surface defect detection of the target object based on the average image based on the background fuzzy difference method includes:
[0011] Based on the morphological corrosion operation and the morphological dilation operation, generating a first corrosion map and a background difference map according to the average map;
[0012] The background difference image is binarized, and an AND operation is performed on the first corrosion image and the binarized background difference image to obtain defect data of the target object.
[0013] In some embodiments, generating a first corrosion map according to the average map includes:
[0014] Binarizing the average image to obtain a target mask image;
[0015] Filling internal holes of the target mask to obtain a mask without holes;
[0016] Based on the morphological erosion operation, the first erosion map is obtained according to the hole-free mask map.
[0017] In some embodiments, generating a background difference map according to the average map includes:
[0018] Performing the morphological dilation operation on the average image to obtain a dilated image;
[0019] Performing the morphological erosion operation on the dilation image to obtain a second erosion image;
[0020] The background difference map is generated according to the absolute difference values of pixels between the second erosion map and the average map.
[0021] In some embodiments, the surface defect data includes coordinate data of the defect in the average map, and the method further includes:
[0022] Acquire a 3D point cloud image of the target object;
[0023] Aligning the 3D point cloud image with the average image, and obtaining 3D coordinate data of the defect in the 3D point cloud image according to the alignment result and the coordinate data of the defect in the average image;
[0024] Based on the 3D coordinate data, 3D data of the surface defects of the target object are obtained from the 3D point cloud image.
[0025] In some embodiments, the coordinate data of the defect in the average image includes a defect circumscribed rectangular frame of the defect in the average image, and 2.5D coordinate data of the defect circumscribed rectangular frame;
[0026] The aligning the 3D point cloud image with the average image, and obtaining the 3D coordinate data of the defect in the 3D point cloud image according to the alignment result and the coordinate data of the defect in the average image comprises:
[0027] Generating a first main body circumscribed rectangular frame of the target object according to the main body 2.5D image set;
[0028] Performing background removal on the 3D point cloud image to obtain a second main body circumscribed rectangular frame of the target object;
[0029] The 3D coordinate data of the defect circumscribed rectangular frame in the 3D point cloud image is determined according to the 2.5D coordinate data, the first main body circumscribed rectangular frame and the second main body circumscribed rectangular frame.
[0030] In some embodiments, the method further comprises:
[0031] comparing the defect data with a preset defect threshold,
[0032] If the defect data is less than or equal to the preset defect threshold, the target object is a qualified product.
[0033] If the defect data is greater than a preset defect threshold, the target object is a defective product.
[0034] In a second aspect, an embodiment of the present application provides a product surface defect detection system, the system comprising: an acquisition module, a processing module and a detection module, wherein:
[0035] The acquisition module is used to acquire a 2.5D image set of the target object through a 2.5D imaging system, wherein the 2.5D imaging system includes a high-speed line scanning camera and a high-speed stripe line scanning light source;
[0036] The processing module is used to remove the background of the images in the 2.5D image set to obtain a main 2.5D image set of the target object;
[0037] The detection module is used to obtain an average image from the main body 2.5D image set, and based on the background fuzzy difference method, perform surface defect detection on the target object according to the average image. The average image is synthesized by images obtained by the light source at different phases and is a surface brightness uniform distribution image of the target object.
[0038] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the product surface defect detection method as described in the first aspect above is implemented.
[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the product surface defect detection method as described in the first aspect above.
[0040] Compared with the related art, the product surface defect detection method provided in the embodiment of the present application obtains a 2.5D image set of the target object through a 2.5D imaging system. The 2.5D imaging system includes a high-speed line scan camera and a high-speed stripe line scan light source. The background of the images in the 2.5D image set is removed to obtain a main 2.5D image set of the target object, and an average image is obtained from the main 2.5D image set. Based on the background fuzzy difference method, surface defect detection of the target object is performed according to the average image. The average image is synthesized by images obtained by the light source at different phases, and is a surface brightness uniform distribution image of the target object, which solves the problem of low accuracy in product surface defect detection. The 2.5D image set obtained by the 2.5D imaging system has good imaging effect for subtle defects. Defects are detected by the background fuzzy difference method, which can remove background noise from the image, increase the contrast of the defects, and improve the accuracy of defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0042] Figure 1 is a flow chart of a method for detecting surface defects of a product according to an embodiment of the present application;
[0043] Figure 2 is a flow chart of a background blur difference detection method according to an embodiment of the present application;
[0044] Figure 3 is a flow chart of a product surface defect detection method according to an embodiment of the present application;
[0045] Figure 4 is a structural block diagram of a product surface defect detection system according to an embodiment of the present application;
[0046] Figure 5 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0048] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0049] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0050] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0051] This embodiment provides a method for detecting product surface defects. Figure 1 is a flow chart of a method for detecting product surface defects according to an embodiment of the present application. Figure 1 As shown, the process includes the following steps:
[0052] Step S101 , obtaining a 2.5D image set of a target object through a 2.5D imaging system, wherein the 2.5D imaging system includes a high-speed line scan camera and a high-speed stripe line scan light source.
[0053] The high-speed line scan camera is used to obtain an image of the object to be scanned. The light source used in the 2.5D imaging system is a dedicated high-speed stripe line scan light source, which can emit stripe light while changing the phase to achieve high-speed changes in the stripes, thereby achieving synchronization with the high-speed shooting of the camera. The 2.5D imaging system may also include a controller for controlling the line scan light source and the high-speed line scan camera.
[0054] A 2.5D image set of the target object surface is obtained through a 2.5D imaging system. The 2.5D image set includes an average image, a specular reflection image, a diffuse reflection image, a gloss ratio image, a depth map and a shape map. The average image is obtained by decoding and synthesizing images obtained at different phases of the light source, and is a surface brightness uniform distribution map obtained based on images at different angles.
[0055] Step S102: performing background removal on the images in the 2.5D image set to obtain a main 2.5D image set of the target object.
[0056] The 2.5D image set is preprocessed, including removing the background and extracting the main area of the target object, ensuring that the image only contains information about the target object itself, and calculating the position and size of the circumscribed rectangle of the main area of the target object.
[0057] In traditional single 2D image processing, background removal requires complex steps to distinguish the main contour of the target object. In this embodiment, images with less background interference can be selected from the 2.5D image set to quickly extract the main area of the target object through simple binarization, and the extracted main area of the target object is applicable to all images in the group, thereby maintaining the consistency of processing and improving processing efficiency.
[0058] Step S103, obtaining an average image from the main 2.5D image set, and performing surface defect detection on the target object based on the average image based on the background fuzzy difference method. The average image is synthesized by images obtained by the light source at different phases and is a surface brightness uniform distribution image of the target object.
[0059] It should be noted that the average image is the average image after removing the background and extracting the main area of the target object.
[0060] In some embodiments, the surface defect detection of the target object based on the average image based on the background fuzzy difference method in step S103 includes:
[0061] Step S1031 , based on the morphological erosion operation and the morphological dilation operation, a first erosion map and a background difference map are generated according to the average map.
[0062] In some embodiments, generating the first corrosion map according to the average map in step S1031 includes:
[0063] Step S201, binarize the average image to obtain a target mask image.
[0064] The target mask is obtained by binarizing the average image after removing the background with a preset threshold:
[0065]
[0066] Among them, f b (m,n) is the average image, thresh is the preset binarization threshold, and M(m,n) is the battery mask.
[0067] Step S202, filling the internal holes of the target mask to obtain a mask without holes.
[0068] Since the mask may contain internal holes, it is necessary to fill the internal holes to obtain a mask without holes.
[0069] Step S203, based on the morphological erosion operation, a first erosion image is obtained according to the mask image without holes.
[0070] The range of the mask M(m,n) is reduced by the morphological corrosion operation to obtain the first corrosion map M'(m,n):
[0071]
[0072] In some embodiments, generating a background difference image according to the average image in step S1031 includes:
[0073] Step S204, performing a morphological dilation operation on the average image to obtain a dilated image.
[0074] For the average graph f b (m,n) performs a morphological expansion operation to eliminate internal black spots and obtain the expansion image f1(m,n):
[0075]
[0076] Step S205, performing a morphological erosion operation on the dilated image to obtain a second eroded image.
[0077] Perform morphological corrosion operation on the expansion image f1(m,n) to obtain the corrosion image f2(m,n):
[0078]
[0079] Step S206, generating a background difference map according to the absolute pixel differences between the second erosion map and the average map.
[0080] Calculate the corrosion map f2(m,n) and the average map f after removing the background b The absolute value of the difference between (m,n) is used to obtain the background difference image f dif :
[0081] f dif =|f2(m,n)-f b (m,n)|
[0082] Step S1032, binarizing the background difference image, and performing an AND operation on the first corrosion image and the binarized background difference image to obtain defect data of the target object.
[0083] According to the preset defect threshold, the background difference image f dif Perform binarization, perform AND operation on the binarization result and the first corrosion map M'(m,n), and extract the defect map f bin, get the defect data. Figure 2 It is a flow chart of a background blur difference detection method according to an embodiment of the present application.
[0084] The surface defect data includes but is not limited to the defect location and size. This embodiment detects defects by using a background fuzzy difference method, which can remove background noise from the image, increase the contrast of the defect, and help detect surface defects more accurately. Background fuzzy processing can reduce the details and texture of the background, reduce the interference of the background on defect detection, and improve the accuracy of detection.
[0085] In some embodiments, the surface defect data includes coordinate data of the defect in the average map, and the method further includes:
[0086] Step S1035, obtaining a 3D point cloud image of the target object;
[0087] Step S1036, aligning the 3D point cloud image with the average image, and obtaining the 3D coordinate data of the defect in the 3D point cloud image based on the alignment result and the coordinate data of the defect in the average image.
[0088] To measure non-3D defect information, such as scratch length and solder joint area of cylindrical batteries, only the defect image f bin To perform simple statistical processing and measure 3D defect information, such as the actual depth of scratches, pits, and solder joints of cylindrical batteries, it is necessary to obtain their 3D information for depth measurement.
[0089] In the point cloud image, it is difficult to locate slight and small defects due to the influence of noise and fluctuation accuracy. High-precision 3D cameras are expensive. Therefore, in this embodiment, 2.5D images are used to locate defects, which are then aligned with the 3D point cloud image for defect measurement. Figure 3 It is a flow chart of a product surface defect detection method according to an embodiment of the present application.
[0090] The resolution of the 2.5D image is different from that of the 3D point cloud image, and the position of the target object in the image is also different. The defect coordinates of the 2.5D image need to be mapped to the 3D point cloud image.
[0091] In some embodiments, the coordinate data of the defect in the average image includes the defect circumscribed rectangular frame of the defect in the average image, and the 2.5D coordinate data of the defect circumscribed rectangular frame; step S1036 specifically includes:
[0092] Step S401 : generating a first main body circumscribed rectangular frame of a target object according to a main body 2.5D image set.
[0093] Step S402: removing the background of the 3D point cloud image to obtain a second main body circumscribed rectangular frame of the target object.
[0094] Step S403, determining the 3D coordinate data of the defect circumscribed rectangular frame in the 3D point cloud image according to the 2.5D coordinate data, the first main body circumscribed rectangular frame and the second main body circumscribed rectangular frame.
[0095] Optionally, the acquired 3D point cloud image is denoised and the main area of the target object is extracted, and the circumscribed rectangular frame of the main area of the target object is calculated, with a width and a length of w respectively. 3d ,h 3d At the same time, the width and length of the bounding rectangle of the target object main area in the average image are calculated as w 2.5d ,h 2.5d The width and length of the defect circumscribed rectangle are w d ,h d , the coordinates of the upper left corner are (m d , n d ). The defect coordinates in the 2.5D average image are mapped to the 3D point cloud image:
[0096]
[0097] (m' d , n' d ) is the mapping coordinate of the upper left corner of the defect circumscribed rectangular box in the 3D point cloud image, w' d , h' d are the width and length of the defect's circumscribed rectangle, respectively.
[0098] Step S1037, based on the 3D coordinate data, obtaining 3D data of surface defects of the target object from the 3D point cloud image.
[0099] It should be noted that for mapping the 2.5D image defect coordinates to the 3D point cloud, the image can also be aligned by feature point matching, and then the coordinates can be converted. After the defect is located in the 3D point cloud, the point cloud distance value can be used to calculate the required defect depth information.
[0100] In some embodiments, the method further comprises:
[0101] The defect data is compared with a preset defect threshold. If the defect data is less than or equal to the preset defect threshold, the target object is a qualified product. If the defect data is greater than the preset defect threshold, the target object is a failed product.
[0102] When the target item is a product that needs to be tested for compliance, the length, width, and depth information of each type of defect extracted is calculated and compared with the standard threshold of the test. If it is lower than the standard threshold, it is considered a qualified product, and if it is higher than the standard threshold, it is considered an unqualified product.
[0103] Through the above steps S101 to S103, a 2.5D image set of the target object is obtained by using a 2.5D imaging system. The 2.5D imaging system includes a high-speed line scan camera and a high-speed stripe line scan light source. The background of the images in the 2.5D image set is removed to obtain a main 2.5D image set of the target object. An average image is obtained from the main 2.5D image set. Based on the background fuzzy difference method, surface defect detection of the target object is performed according to the average image. The average image is synthesized by images obtained by the light source at different phases, and is a surface brightness uniform distribution image of the target object, which solves the problem of low accuracy in product surface defect detection. The 2.5D image set obtained by the 2.5D imaging system has good imaging effect for subtle defects. Defects are detected by using the background fuzzy difference method, which can remove background noise from the image, increase the contrast of the defects, and improve the accuracy of defect detection.
[0104] The main area of the target object is quickly extracted by selecting images with less background interference from the 2.5D image set through simple binarization. The extracted main area of the target object is applicable to all images in the group, which maintains the consistency of processing and improves the processing efficiency.
[0105] The average image is used for defect detection. The average image shows the changes in the concave and convex surfaces of the battery with high contrast, which distinguishes the defective area from the normal surface, improving the recognition accuracy and efficiency of height difference defects that are difficult to detect with conventional plane images.
[0106] The defects detected by the 2.5D image are mapped to the 3D point cloud map to obtain the 3D information of the defects, and further perform qualitative and quantitative analysis of the defects.
[0107] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0108] This embodiment also provides a product surface defect detection system, which is used to implement the above embodiments and preferred implementations, and will not be repeated here. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0109] Figure 4 is a structural block diagram of a product surface defect detection system according to an embodiment of the present application, such as Figure 4 As shown, the system includes: an acquisition module 51, a processing module 52 and a detection module 53.
[0110] The acquisition module 51 is used to acquire a 2.5D image set of the target object through a 2.5D imaging system, where the 2.5D imaging system includes a high-speed line scanning camera and a high-speed stripe line scanning light source.
[0111] The processing module 52 is used to remove the background of the images in the 2.5D image set to obtain a main 2.5D image set of the target object.
[0112] The detection module 53 obtains an average image from the main body 2.5D image set, and performs surface defect detection on the target object based on the average image based on the background fuzzy difference method. The average image is synthesized by images obtained by the light source at different phases and is a surface brightness uniform distribution image of the target object.
[0113] In some of the embodiments, the detection module 53 includes: a difference module and a defect determination module.
[0114] The difference module is used to generate a first corrosion map and a background difference map according to the average map based on the morphological corrosion operation and the morphological dilation operation.
[0115] The defect determination module is used to binarize the background difference image and perform an AND operation on the first corrosion image and the binarized background difference image to obtain defect data of the target object.
[0116] In some of the embodiments, the difference module includes: a binarization module, a filling module and a first corrosion module.
[0117] The binarization module is used to binarize the average image to obtain the target mask image.
[0118] The filling module is used to fill the internal holes of the target mask to obtain a mask without holes.
[0119] The first corrosion module is used to obtain a first corrosion map according to a hole-free mask map based on a morphological corrosion operation.
[0120] In some of these embodiments, the differential module includes: a dilation module, a second corrosion module and a difference module.
[0121] The dilation module is used to perform a morphological dilation operation on the average image to obtain a dilated image.
[0122] The second corrosion module is used to perform a morphological corrosion operation on the expansion image to obtain a second corrosion image.
[0123] The difference module is used to generate a background difference map according to the absolute difference of pixels between the second erosion map and the average map.
[0124] In some of the embodiments, the surface defect data includes coordinate data of the defect in the average map, and the system further includes: a point cloud generation module, a mapping module and a 3D data acquisition module.
[0125] The point cloud generation module is used to obtain the 3D point cloud image of the target object.
[0126] The mapping module is used to align the 3D point cloud image with the average image, and obtain the 3D coordinate data of the defect in the 3D point cloud image based on the alignment result and the coordinate data of the defect in the average image.
[0127] The 3D data acquisition module is used to acquire 3D data of surface defects of the target object from the 3D point cloud image based on the 3D coordinate data.
[0128] In some embodiments, the coordinate data of the defect in the average image includes the defect circumscribed rectangular frame of the defect in the average image, and the 2.5D coordinate data of the defect circumscribed rectangular frame; the mapping module includes: a first frame module, a second frame module and a coordinate determination module.
[0129] The first frame module is used to generate a first main body circumscribed rectangular frame of the target object according to the main body 2.5D image set.
[0130] The second frame module is used to remove the background of the 3D point cloud image to obtain a second main body circumscribed rectangular frame of the target object;
[0131] The coordinate determination module is used to determine the 3D coordinate data of the defect circumscribed rectangular frame in the 3D point cloud image according to the 2.5D coordinate data, the first main body circumscribed rectangular frame and the second main body circumscribed rectangular frame.
[0132] In some of the embodiments, the system further includes: a judgment module.
[0133] The judgment module is used to compare the defect data with a preset defect threshold. If the defect data is less than or equal to the preset defect threshold, the target object is a qualified product. If the defect data is greater than the preset defect threshold, the target object is a failed product.
[0134] Through the above system, the acquisition module 51 acquires a 2.5D image set of the target object through a 2.5D imaging system, the 2.5D imaging system includes a high-speed line scan camera and a high-speed stripe line scan light source, the processing module 52 removes the background of the image in the 2.5D image set to obtain a main 2.5D image set of the target object, and the detection module 53 acquires an average image from the main 2.5D image set, and performs surface defect detection on the target object according to the average image based on the background fuzzy difference method. The average image is synthesized by images acquired by the light source at different phases, and is a surface brightness uniform distribution image of the target object, which solves the problem of low accuracy in detecting surface defects of the object. The 2.5D image set acquired by the 2.5D imaging system has a good imaging effect for subtle defects, and defects are detected by the background fuzzy difference method, which can remove background noise from the image, increase the contrast of the defects, and improve the accuracy of defect detection.
[0135] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0136] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0137] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0138] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0139] S1, acquiring a 2.5D image set of a target object through a 2.5D imaging system, wherein the 2.5D imaging system includes a high-speed line scanning camera and a high-speed stripe line scanning light source.
[0140] S2, performing background removal on the images in the 2.5D image set to obtain a main 2.5D image set of the target object.
[0141] S3, obtains the average image from the subject 2.5D image set, and performs surface defect detection on the target object based on the average image based on the background fuzzy difference method. The average image is synthesized by images obtained at different phases of the light source and is a uniform distribution image of the surface brightness of the target object.
[0142] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0143] In one embodiment, Figure 5 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 5 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 5 As shown. The electronic device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a product surface defect detection method is implemented.
[0144] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0145] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0146] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for detecting surface defects of a product, characterized in that: The method comprises: Acquire a 2.5D image set of the target object by a 2.5D imaging system, wherein the 2.5D imaging system includes a high-speed line scanning camera and a high-speed stripe line scanning light source; Performing background removal on the images in the 2.5D image set to obtain a main 2.5D image set of the target object; An average image is obtained from the 2.5D image set of the subject, and surface defect detection of the target object is performed based on the average image based on the background fuzzy difference method to obtain defect data of the target object, wherein the average image is synthesized by images obtained by the light source at different phases and is a surface brightness uniform distribution image of the target object; Acquire a 3D point cloud image of the target object, align the 3D point cloud image with the average image, and obtain 3D coordinate data of the defect in the 3D point cloud image according to the alignment result and the coordinate data of the defect in the average image; Based on the 3D coordinate data, 3D data of the surface defects of the target object are obtained from the 3D point cloud image.
2. The method according to claim 1, characterized in that The surface defect detection of the target object based on the background fuzzy difference method according to the average image includes: Based on the morphological corrosion operation and the morphological dilation operation, generating a first corrosion map and a background difference map according to the average map; The background difference image is binarized, and an AND operation is performed on the first corrosion image and the binarized background difference image to obtain defect data of the target object.
3. The method according to claim 2, characterized in that Generating a first corrosion map according to the average map comprises: Binarizing the average image to obtain a target mask image; Filling internal holes of the target mask to obtain a mask without holes; Based on the morphological erosion operation, the first erosion map is obtained according to the hole-free mask map.
4. The method according to claim 2, characterized in that: Generating a background difference map according to the average map includes: Performing the morphological dilation operation on the average image to obtain a dilated image; Performing the morphological erosion operation on the dilation image to obtain a second erosion image; The background difference map is generated according to the absolute difference values of pixels between the second erosion map and the average map.
5. The method according to claim 1, characterized in that The coordinate data of the defect in the average image includes a defect circumscribed rectangular frame of the defect in the average image, and 2.5D coordinate data of the defect circumscribed rectangular frame; The aligning the 3D point cloud image with the average image, and obtaining the 3D coordinate data of the defect in the 3D point cloud image according to the alignment result and the coordinate data of the defect in the average image comprises: Generating a first main body circumscribed rectangular frame of the target object according to the main body 2.5D image set; Performing background removal on the 3D point cloud image to obtain a second main body circumscribed rectangular frame of the target object; The 3D coordinate data of the defect circumscribed rectangular frame in the 3D point cloud image is determined according to the 2.5D coordinate data, the first main body circumscribed rectangular frame and the second main body circumscribed rectangular frame.
6. The method according to claim 2, characterized in that The method further comprises: comparing the defect data with a preset defect threshold, If the defect data is less than or equal to the preset defect threshold, the target object is a qualified product. If the defect data is greater than a preset defect threshold, the target object is a defective product.
7. A product surface defect detection system, characterized in that: The system comprises: an acquisition module, a processing module and a detection module, wherein: The acquisition module is used to acquire a 2.5D image set of the target object through a 2.5D imaging system, wherein the 2.5D imaging system includes a high-speed line scanning camera and a high-speed stripe line scanning light source; The processing module is used to remove the background of the images in the 2.5D image set to obtain a main 2.5D image set of the target object; The detection module is used to obtain an average image from the 2.5D image set of the subject, and perform surface defect detection on the target object based on the average image based on the background fuzzy difference method, wherein the average image is synthesized by images obtained by the light source at different phases and is a surface brightness uniform distribution image of the target object; obtain a 3D point cloud image of the target object, align the 3D point cloud image with the average image, and obtain the 3D coordinate data of the defect in the 3D point cloud image based on the alignment result and the coordinate data of the defect in the average image; and obtain the 3D data of the surface defect of the target object from the 3D point cloud image based on the 3D coordinate data.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the product surface defect detection method according to any one of claims 1 to 6 is implemented.
9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the product surface defect detection method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Wood defect automatic detection method and system and storage medium thereof
CN113066079A
Confidential propagation of range image mapping in autonomous machine applications
CN115701623A
Battery shell appearance defect image processing method and device
CN116228684A
Defect detection method and device and storage medium
CN116503388A
Point cloud target detection method and device, and electronic equipment
CN116883973A
