Defect detection method and device, equipment and storage medium
By acquiring multiple image data with different brightness and combining light source information to determine the normal vector map and reflectivity map, the defect detection model and image analysis method are used to solve the problem of low accuracy in object surface defect detection in traditional visual detection, and high-quality imaging and high-accuracy defect detection are achieved.
Patent Information
- Application Number
- CN202510382778.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-04
AI Technical Summary
Traditional vision detection technology cannot achieve high-quality imaging of object surfaces, resulting in low accuracy in detecting object surface defects.
By acquiring at least three image data with different brightness distributions, combining light source information to determine the normal vector map and reflectivity map, and using defect detection models and image analysis methods to comprehensively determine the defect information on the surface of the object.
High-quality imaging of the surface of the object is achieved, the accuracy and reliability of defect detection are improved, and the cost of manual detection is reduced.
Smart Images

Figure CN120259258A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical fields of image processing and computer vision, and particularly to a defect detection method, apparatus, device, and storage medium. Background Art
[0002] Detecting defects in the appearance of objects is one of the important ways to ensure product quality. For example, for cigarette products, due to differences in raw and auxiliary materials and inadequate maintenance of filter rod forming machines, etc., during the production process of cigarette filter rods, appearance quality defects such as glue holes, uneven cuts, cut stains, and shrinkage heads often occur. In order to prevent defective cigarettes from entering the market, it is very important to detect the surface of cigarette filter rods.
[0003] In traditional technologies, visual inspection technologies are usually used to analyze defects on the surface of objects, but they cannot achieve high-quality imaging of the object surface, and there is a problem of low accuracy in detecting defects on the object surface. Summary of the Invention
[0004] Based on this, it is necessary to provide a defect detection method, apparatus, device, and storage medium for the above technical problems, which can improve the accuracy of detecting defects on the object surface.
[0005] In a first aspect, this application provides a defect detection method, including:
[0006] Obtain image data of the surface of an object to be detected; wherein, the image data includes at least two images with different brightness distributions;
[0007] Determine a normal vector map and a reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when obtaining the image data;
[0008] Input the reflectivity map into a defect detection model to obtain first defect information on the surface of the object to be detected;
[0009] Perform image analysis on the normal vector map to obtain second defect information on the surface of the object to be detected;
[0010] Determine target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0011] In one embodiment, the obtaining of the image data of the surface of the object to be detected includes:
[0012] Partition the surface of the object to be detected to obtain at least three distribution regions;
[0013] Control the light source to illuminate different distribution areas in sequence, and when the light source illuminates each distribution area, control the image acquisition device to acquire the corresponding image.
[0014] In one embodiment, the image analysis of the normal vector map to obtain the second defect information on the surface of the object to be detected includes:
[0015] Perform differential processing on the normal vector map to obtain the gradient map corresponding to the normal vector map;
[0016] Perform convolution processing on the gradient map to obtain the curvature map corresponding to the gradient map;
[0017] Determine the second defect information according to the curvature values of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type.
[0018] In one embodiment, the determining the second defect information according to the curvature values of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type includes:
[0019] Determine at least one connected region and the regional curvature value of each connected region according to the curvature values of each pixel point in the curvature map; wherein, the difference between the curvature values of each pixel point in each connected region is less than a preset difference;
[0020] Compare the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain a comparison result;
[0021] According to the comparison result, use the target connected region in which the regional curvature value of each connected region falls within the curvature range corresponding to the candidate defect type and the defect type corresponding to the target connected region as the second defect information.
[0022] In one embodiment, the target defect information includes a target defect type and a target defect region; the determining the target defect information on the surface of the object to be detected according to the first defect information and the second defect information includes:
[0023] Determine the common defect information of the first defect information and the second defect information;
[0024] Use the defect region in the common defect information as the target defect region on the surface of the object to be detected; and,
[0025] Use the defect type corresponding to the target defect region in the common defect information as the target defect type of the target defect region.
[0026] In one embodiment, the light source information includes the incident light angle; determining the normal vector map and the reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data includes:
[0027] Determining the light source direction vectors corresponding to different incident light angles according to the incident light angles corresponding to the images with different brightness distributions in the image data;
[0028] Determining the normal vector map of the surface of the object to be detected according to the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data;
[0029] Determining the reflectivity map of the surface of the object to be detected according to the normal vector map, and the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0030] In one embodiment, the object to be detected is a cigarette filter rod.
[0031] In a second aspect, the present application further provides a defect detection device, including:
[0032] An acquisition module, configured to acquire image data of the surface of an object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0033] A first determination module, configured to determine the normal vector map and the reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data;
[0034] A detection module, configured to input the reflectivity map into a defect detection model to obtain first defect information on the surface of the object to be detected;
[0035] An analysis module, configured to perform image analysis on the normal vector map to obtain second defect information on the surface of the object to be detected;
[0036] A second determination module, configured to determine target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0037] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0038] Acquiring image data of the surface of an object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0039] Determine the normal vector map and reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data;
[0040] Input the reflectivity map into the defect detection model to obtain the first defect information on the surface of the object to be detected;
[0041] Perform image analysis on the normal vector map to obtain the second defect information on the surface of the object to be detected;
[0042] Determine the target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0043] In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0044] Acquire the image data of the surface of the object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0045] Determine the normal vector map and reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data;
[0046] Input the reflectivity map into the defect detection model to obtain the first defect information on the surface of the object to be detected;
[0047] Perform image analysis on the normal vector map to obtain the second defect information on the surface of the object to be detected;
[0048] Determine the target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0049] In a fifth aspect, the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0050] Acquire the image data of the surface of the object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0051] Determine the normal vector map and reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data;
[0052] Input the reflectivity map into the defect detection model to obtain the first defect information on the surface of the object to be detected;
[0053] Perform image analysis on the normal vector map to obtain the second defect information on the surface of the object to be detected;
[0054] Determine the target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0055] In the above defect detection method, device, equipment and storage medium, image data on the surface of an object to be detected is acquired; according to the image data and the light source information of the light source used when acquiring the image data, a normal vector map and a reflectivity map of the surface of the object to be detected are determined; the reflectivity map is input into a defect detection model to obtain first defect information on the surface of the object to be detected; image analysis is performed on the normal vector map to obtain second defect information on the surface of the object to be detected; according to the first defect information and the second defect information, the target defect information on the surface of the object to be detected is determined. In the above solution, on the one hand, at least three images with different brightness distributions on the surface of the object to be detected can be acquired, and the acquired images can more accurately reflect the actual situation of the surface of the object to be detected, realizing high-quality imaging of the surface of the object to be detected and facilitating the improvement of the accuracy of defect detection on the object surface; on the other hand, the defect information on the surface of the object to be detected is determined by two methods, namely, the detection model and image analysis, so that the determined defect information is more accurate, further improving the accuracy of defect detection on the object surface. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0057] Figure 1 It is a schematic structural diagram of a defect detection system in an embodiment;
[0058] Figure 2 It is a schematic flowchart of a defect detection method in an embodiment;
[0059] Figure 3 It is a schematic flowchart of acquiring image data on the surface of an object to be detected in an embodiment;
[0060] Figure 4 It is a schematic flowchart of acquiring second defect information on the surface of an object to be detected in an embodiment;
[0061] Figure 5 It is a schematic flowchart of determining second defect information on the surface of an object to be detected in another embodiment;
[0062] Figure 6 It is a schematic flowchart of determining target defect information on the surface of an object to be detected in an embodiment;
[0063] Figure 7 Schematic flow chart for determining the normal vector map and reflectivity map of the surface of an object to be detected in one embodiment;
[0064] Figure 8 Schematic flow chart of the defect detection method in another embodiment;
[0065] Figure 9 Structural block diagram of the defect detection device in one embodiment;
[0066] Figure 10 Internal structure diagram of a computer device in one embodiment. Detailed implementation manners
[0067] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to 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 used to limit the present application.
[0068] The defect detection method provided by the embodiments of the present application can be applied to an application environment as Figure 1 shown. Specifically, it can be applied to an application scenario for defect detection of the end face of cigarette filters.
[0069] Figure 1 The structural schematic diagram of the defect detection system is shown. Among them, the defect detection system includes an image acquisition device, a light source and a terminal. The image acquisition device can be two color area array cameras, which are respectively deployed on both sides of the end face of the cigarette filter. The light source can be a four-zone ring-shaped white light emitting diode (LED) light source. Taking the object to be detected as a cigarette filter as an example for description. Two color area array cameras are respectively deployed on the two end faces of the cigarette filter, and the color area array cameras image through the middle part of the ring light. When the relative positions of the color area array cameras, the LED light source and the cigarette filter remain unchanged, the same cigarette filter is irradiated with four-zone ring-shaped light sources in 4 different directions at preset time intervals (for example, 50 ms), and 4 images of the cigarette filter with different brightness distributions can be captured.
[0070] The color camera is communicatively connected to the terminal, for example, it can be communicatively connected through a gigabit network cable. The color camera transmits the images of the cigarette filter with different brightness distributions collected to the terminal, and the terminal analyzes the filter defects based on the images of the cigarette filter with different brightness distributions, and can visually display the defect detection results.
[0071] Among them, the terminal can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc.
[0072] In an exemplary embodiment, as Figure 2 shown, a defect detection method is provided. Taking the method applied to the Figure 1 terminal in
[0073] S201, obtain the image data of the surface of the object to be detected.
[0074] Exemplarily, the object to be detected can be an object with object surface defect detection, including but not limited to manufacturing products, product parts, product materials, and packaging, etc. For example, electronic products, vehicle body parts, ceramic and glass products, steel and cigarette filters, etc.
[0075] The image data of the surface of the object to be detected can be collected by controlling an image acquisition device. The acquisition device can be one or more cameras, and the collected image data includes at least three images with different brightness distributions. In this way, the collected image data can better reflect the actual situation of the surface of the object to be detected, facilitating more accurate detection of the defects on the surface of the object to be detected.
[0076] S202, determine the normal vector map and reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data.
[0077] Exemplarily, the light source information of the light source used when acquiring the image data includes but is not limited to the incident angle and incident intensity of the light source.
[0078] The normal vector map and reflectivity map of the surface of the image to be detected can be determined according to the image data and the incident angle and incident intensity of the light source used when acquiring the image data. For example, according to the relationship formula between the pixel value of the image data, the incident angle, the incident intensity, and the normal vector of the surface of the object to be detected, based on the known pixel value, incident angle, and incident intensity of the image data, the normal vector of the surface of the object to be detected can be calculated, and then the normal vector map of the surface of the object to be detected can be constructed according to the normal vector of the surface of the object to be detected; and based on the relationship formula between the normal vector of the surface of the object to be detected and the reflectivity, the reflectivity vector of the surface of the object to be detected can be calculated, and then the reflectivity map can be constructed according to the reflectivity vector of the surface of the object to be detected.
[0079] In some alternative implementation manners, a neural network model can also be trained according to sample data, so that the neural network model learns the relationship between the image data of the surface of the object to be detected, the light source information of the light source used when acquiring the image data, and the normal vector map and reflectivity map of the surface of the object to be detected; when determining the normal vector map and reflectivity map of the surface of the object to be detected, the image data of the surface of the object to be detected and the light source information of the light source used when acquiring the image data can be directly input into the neural network model to output the normal vector map and reflectivity map of the surface of the object to be detected, thereby improving the efficiency of determining the normal vector map and reflectivity map of the surface of the object to be detected. Among them, the neural network model can be one of a convolutional neural network, a recurrent neural network, a generative adversarial network, and a deep autoencoder, or a combination of multiple ones.
[0080] S203: Input the reflectivity map into a defect detection model to obtain first defect information on the surface of the object to be detected.
[0081] Exemplarily, before performing image analysis on the reflectivity map, denoising and image enhancement can be performed on the reflectivity map in advance to improve the quality of the reflectivity map.
[0082] The defect detection model can be a classification network model. For example, it can be a Yolo classification network. The reflectivity map can be input into the defect detection model to obtain first defect information on the surface of the object to be detected. Among them, the first defect information can include the defect area and defect type on the surface of the object to be detected. Taking the object to be detected as a cigarette filter rod as an example, the defect types include but are not limited to glue holes, uneven cuts, cut stains, and shrinkage heads.
[0083] Among them, the Yolo classification network can be pre-trained. For example, it can be trained with sample image data as training data and the corresponding defect area and defect type of the sample data as label data to obtain the initial Yolo classification network.
[0084] S204: Perform image analysis on the normal vector map to obtain second defect information on the surface of the object to be detected.
[0085] Similarly, before performing image analysis on the normal vector map, denoising and image enhancement can be performed on the normal vector map in advance to improve the quality of the normal vector map.
[0086] Furthermore, the characteristic information of the normal vector map can be extracted. For example, the characteristic information such as the angle change characteristic, the modulus length change characteristic, and the texture characteristic of the normal vector can be extracted. According to the result of the feature extraction, a segmentation threshold is set, and the normal vector map is segmented into a defect region and a non-defect region based on the segmentation threshold; furthermore, according to the characteristics of the defect region (such as shape, size, texture, etc.), a classification algorithm (such as a support vector machine, a decision tree, a neural network, etc.) is used to classify the defect to obtain second defect information. Among them, the second defect information includes the defect type and the defect region.
[0087] Similarly, if the object to be detected is a cigarette filter rod, the defect types can be glue holes, uneven cuts, cut stains, and shrinkage heads, etc.
[0088] S205. Determine the target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0089] Exemplarily, in order to improve the reliability of defect detection, the first defect information and the second defect information can be used for mutual verification. For example, the intersection of the first defect information and the second defect information can be used as the target defect information on the surface of the object to be detected. In this way, the problem of inaccurate defect detection caused by using a single method for defect detection is avoided.
[0090] Optionally, the image data and the target defect information can be displayed in a visual form.
[0091] In the above defect detection method, the image data on the surface of the object to be detected is obtained; according to the image data and the light source information of the light source used when obtaining the image data, the normal vector map and the reflectivity map on the surface of the object to be detected are determined; the reflectivity map is input into the defect detection model to obtain the first defect information on the surface of the object to be detected; the normal vector map is subjected to image analysis to obtain the second defect information on the surface of the object to be detected; according to the first defect information and the second defect information, the target defect information on the surface of the object to be detected is determined. In the above solution, on the one hand, at least three images with different brightness distributions on the surface of the object to be detected can be obtained, and the obtained images can more accurately reflect the actual situation on the surface of the object to be detected, realizing high-quality imaging of the surface of the object to be detected and facilitating improving the accuracy of object surface defect detection; on the other hand, the defect information on the surface of the object to be detected is determined by two methods of a detection model and image analysis, making the determined defect information more accurate and further improving the accuracy of object surface defect detection.
[0092] In some alternative implementation manners, when obtaining the image data on the surface of the object to be detected, in order to obtain image data with more detailed data, the surface of the object to be detected can be regionally divided, and targeted image acquisition is performed for each divided region.
[0093] Based on this, seeFigure 3 , Figure 3 A flow schematic diagram for obtaining image data of the surface of an object to be detected is provided, which specifically includes the following steps:
[0094] S301, partition the surface of the object to be detected to obtain at least three distribution regions.
[0095] Exemplarily, the surface of the object to be detected can be partitioned to obtain at least three distribution regions. For example, the surface to be detected can be divided into a preset number of distribution regions with equal areas, or it can also be divided into a preset number of distribution regions with unequal areas. Taking the object to be detected as a cigarette filter rod as an example, the end face of the cigarette filter rod can be divided into 4 fan-shaped regions with equal areas. Among them, the preset number can be set according to actual needs, and no specific limitation is made on the preset number here.
[0096] S302, control the light source to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, control the image acquisition device to acquire the corresponding image.
[0097] Exemplarily, the light source can be controlled to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, control the image acquisition device to acquire the corresponding image. Taking the object to be detected as a cigarette filter rod as an example for illustration, for example, the 4 divided regions are respectively labeled as region 1, region 2, region 3, and region 4. Taking one end of the cigarette filter rod as an example for illustration, the other end uses the same method to acquire the image data of the end face of the filter rod.
[0098] When the light source illuminates region 1, control the image acquisition device to acquire the image of the end face of the cigarette filter rod to obtain image 1; when the light source illuminates region 2, control the image acquisition device to acquire the image of the end face of the cigarette filter rod to obtain image 2; when the light source illuminates region 3, control the image acquisition device to acquire the image of the end face of the cigarette filter rod to obtain image 3; when the light source illuminates region 4, control the image acquisition device to acquire the image of the end face of the cigarette filter rod to obtain image 4; in this way, 4 images with different brightness distributions are obtained, and these 4 images with different brightness distributions are used as image data.
[0099] In the embodiment of the present application, by partitioning the surface of the object to be detected, controlling the light source to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, controlling the image acquisition device to acquire the corresponding image, more detailed information on the surface of the object to be detected can be obtained, which is convenient for subsequent defect information on the surface of the object to be detected, thereby improving the accuracy of defect information detection.
[0100] In some optional implementations, a curvature map may be obtained by performing image processing on a normal vector map of the surface of the object to be inspected, and then defect information of the surface of the object to be inspected may be determined according to the curvature value of each pixel point in the curvature map.
[0101] Based on this, see Figure 4 , Figure 4 A schematic diagram of a process for obtaining second defect information on the surface of an object to be detected is provided, which specifically includes the following steps:
[0102] S401, performing differentiation processing on the normal vector image to obtain a gradient image corresponding to the normal vector image.
[0103] For example, the normal vector map can be differentiated to obtain a gradient map corresponding to the normal vector map. The gradient map includes gradient amplitude and gradient direction. The gradient amplitude reflects the speed of change of the pixel value at a certain position in the image. The larger the gradient amplitude, the more drastic the change at that position, which usually corresponds to the edge or contour area in the image. The gradient direction can reflect the contour direction of the surface of the object in the image.
[0104] S402, performing convolution processing on the gradient image to obtain a curvature image corresponding to the gradient image.
[0105] Furthermore, the gradient map can be convolved to obtain a curvature map corresponding to the gradient map. The curvature map is used to describe the curvature (i.e., degree of curvature) of pixel brightness or color changes in an image. By calculating the curvature value of each pixel in the image and performing clustering or threshold segmentation based on the curvature value, the image can be segmented into different regions.
[0106] S403: Determine second defect information according to the curvature value of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type.
[0107] Furthermore, based on the curvature value of each pixel in the curvature map and the curvature range corresponding to the candidate defect type, it can be determined whether there are pixels falling within the curvature range corresponding to the candidate defect type, and then whether each pixel is a defect area.
[0108] For example, if there is a pixel whose curvature value falls within the curvature range corresponding to the head shrinkage defect type, it can be determined that the defect type corresponding to the pixel is head shrinkage. Furthermore, the defect area corresponding to the candidate defect type can be determined based on the pixel points that fall within the curvature range corresponding to the same candidate defect type. For example, the area connected by the pixel points that fall within the curvature range corresponding to the head shrinkage defect type is used as the defect area. In this way, the second defect information can be determined based on the determined defect type and defect area.
[0109] In the embodiments of the present application, by using the curvature values of the pixels in the curvature map and the curvature ranges corresponding to the candidate defect types, the defect type corresponding to each pixel can be accurately determined, and the defect region corresponding to each defect type can be accurately determined, thereby improving the accuracy of the determined second defect information.
[0110] Further, the curvature values of the pixels in the curvature map can be compared with the curvature ranges corresponding to the candidate defect types to determine the connected regions corresponding to the pixels with the same curvature value. Then, based on the curvature values and the connected regions, the defect type corresponding to each pixel and the defect region corresponding to the defect type can be determined.
[0111] Based on this, referring to Figure 5 , Figure 5 FIG. provides another schematic flow chart for determining the second defect information on the surface of the object to be detected, which specifically includes the following steps:
[0112] S501, according to the curvature values of the pixels in the curvature map, determine at least one connected region and the regional curvature value of each connected region.
[0113] Exemplarily, in order to improve the quality of the curvature image, the curvature image can be first smoothed to reduce the influence of noise.
[0114] Furthermore, the smoothed curvature image can be converted into a binary image. Then, by setting a suitable threshold, the pixels with curvature values greater than the threshold can be set as the foreground (usually represented by white), and the pixels with curvature values less than the threshold can be set as the background (usually represented by black). For example, for the curvature image of the filter rod end face, the curvature values of the normal regions are relatively low, while the curvature values of the defect regions are relatively high. The defect regions and the normal regions can be distinguished by setting a preset threshold.
[0115] Further, a connected region labeling algorithm (such as the seed filling algorithm, the scan line algorithm, etc.) can be used to determine at least one connected region according to the curvature values of the pixels in the curvature map. For example, starting from a foreground pixel, all the foreground pixels connected to it with similar curvature values can be marked as the same connected region and assigned a unique label value. In this way, each connected region in the image can be separated. Among them, the difference between the curvature values of the pixels in each connected region is less than a preset difference. For example, the preset difference can be set to 0 or a very small value, which is used to indicate that the curvature values are approximately equal. The regional curvature value of each connected region can be the average value of the curvature values of the pixels in each connected region, or the numerical range composed of the curvature values of the pixels in the connected region.
[0116] S502, compare the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain a comparison result.
[0117] Exemplarily, taking the object to be detected as a cigarette filter rod as an example, the candidate defect types include but are not limited to glue holes, uneven cuts, cut stains, and shrinkage at the head. The curvature range corresponding to each candidate defect type can be determined according to experimental data.
[0118] The regional curvature value of each connected region can be compared with the curvature range corresponding to the candidate defect type to determine whether the curvature value of each connected region falls within the curvature range corresponding to the candidate defect type, and a comparison result is obtained. Among them, the comparison result can be the connected regions that fall within the curvature ranges corresponding to the respective candidate defect types.
[0119] S503, according to the comparison result, use the target connected regions in each connected region where the regional curvature value falls within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected region, as the second defect information.
[0120] Exemplarily, according to the comparison result, the target connected regions in each connected region where the regional curvature value falls within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected region, can be used as the second defect information. For example, assuming that there are two regional curvature values in each connected region that fall within the curvature ranges corresponding to the two candidate defect types of cut stains and shrinkage at the head respectively, then these two connected regions can be used as target connected region 1 and target connected region 2 respectively; if target connected region 1 corresponds to cut stains and target connected region 2 corresponds to shrinkage at the head, then target connected region 1 can be associated with the cut stain defect type, and target connected region 2 can be associated with the shrinkage at the head defect type to obtain the second defect information. In this way, the second defect information can reflect the cut stain defect type and the corresponding defect region, and reflect the shrinkage at the head defect type and the corresponding defect region.
[0121] In the embodiments of the present application, by comparing the curvature values of the pixels in the curvature map with the curvature ranges corresponding to the candidate defect types to determine the connected regions corresponding to the pixels with the same curvature value, and then determining the defect type corresponding to each pixel and the defect region corresponding to the defect type according to the curvature value and the connected region, the determined defect type and the defect region corresponding to the defect type can be made more accurate.
[0122] In some optional implementation manners, the target defect information may include the target defect type and the target defect region, or may only include the target defect type, or only include the target defect region, which can be set according to the defect recognition requirements. The embodiments of the present application will be described with the target defect information including the target defect type and the target defect region.
[0123] See Figure 6 , Figure 6A flow diagram for determining target defect information on the surface of an object to be detected is provided, specifically including the following steps:
[0124] S601. Determine the common defect information of the first defect information and the second defect information.
[0125] Exemplarily, by comparing the first defect information and the second defect information, the common defect information in the first defect information and the second defect information can be extracted. Among them, the common defect information includes the common defect area and the defect type. For example, if there is the same defect area in the first defect information and the second defect information, and if the defect type indicating the same defect area in the first defect information is the same as the defect type indicating the same defect area in the second defect information, then the defect area and the corresponding defect type are used as the common defect information. If the defect type indicating the same defect area in the first defect information is different from the defect type indicating the same defect area in the second defect information, then the defect area and the corresponding defect type cannot be used as the common defect information.
[0126] S602. Use the defect area in the common defect information as the target defect area on the surface of the object to be detected; and use the defect type corresponding to the target defect area in the common defect information as the target defect type of the target defect area.
[0127] Exemplarily, the defect area in the common defect information can be used as the target defect area on the surface of the object to be detected, and the defect type corresponding to the target defect area in the common defect information can be used as the target defect type of the target defect area. Among them, the defect area in the common defect information can be one or more, and the defect types corresponding to the defect areas in the common defect information can be the same or different.
[0128] In the embodiments of the present application, by determining the common defect information of the first defect information and the second defect information, and then determining the target defect type of the target defect area according to the common defect information, compared with the method of using single defect detection, the target defect type of the determined target defect area can be made more reliable, thereby improving the accuracy of defect detection on the surface of the object to be detected.
[0129] In some optional implementation manners, the relationship among the image data, the light source information, the normal vector, and the reflectivity is as follows:
[0130]
[0131] where T ij is the pixel value of the i-th row and j-th column of each image with different brightness distributions, is the normal vector of the i-th row in the normal vector map, N i is the reflectivity of the i-th row in the reflectivity map, Lj The incident light angle of the light source used to capture images with different brightness distributions, l j The incident light intensity of the light source used to capture images with different brightness distributions. Among them, N i and L j can be 4×1 unit vectors, and the incident light intensity and the direction of the light source can be represented by the constant 1.
[0132] Based on the relationship between the image data, light source information, normal vector, and reflectivity, the photometric stereo algorithm can be used to determine the normal vector map and reflectivity map of the surface of the object to be detected.
[0133] Based on this, referring to Figure 7 , Figure 7 a schematic flow chart for determining the normal vector map and reflectivity map of the surface of the object to be detected is provided, specifically including the following steps:
[0134] S701, according to the incident light angles corresponding to the images with different brightness distributions in the image data, determine the light source direction vectors corresponding to different incident light angles.
[0135] Exemplarily, a three-dimensional coordinate system can be established based on the plane where the object to be detected is located. Among them, the x-axis and y-axis are on the horizontal plane, and the z-axis is perpendicular to the horizontal plane and upward. Furthermore, the angle between the incident light and the normal of the surface of the object to be detected can be obtained , and the angle between the projection of the incident light on the horizontal plane and the positive direction of the x-axis ; assuming the light source direction vector is , according to the trigonometric function relationship , the light source direction vectors corresponding to different incident light angles can be determined according to the incident light angles corresponding to the images with different brightness distributions in the image data.
[0136] S702, according to the pixel values and light source direction vectors corresponding to the images with different brightness distributions in the image data, determine the normal vector map of the surface of the object to be detected.
[0137] Exemplarily, the vector T i corresponding to the pixel values of each image in the image data can be determined, and the matrix L = [L1, L2, L3, L4] corresponding to the light source direction vectors of the light sources used to capture each image can be determined. The normal vector in the normal vector map can be determined through the following calculation formula:
[0138]
[0139] Among them, is the normal vector of the i-th row in the normal vector map. Furthermore, the normal vector map can be determined according to the normal vectors of each row.
[0140] S703. Determine the reflectivity map of the surface of the object to be detected according to the normal vector map, as well as the pixel values and light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0141] Furthermore, the vector T corresponding to the pixel value of each image in the image data can be determined. i , and determine the matrix L = [L1, L2, L3, L4] corresponding to the light source vectors of the light sources used to collect each image. Furthermore, according to the normal vectors of each row in the normal vector map, and the vector T corresponding to the pixel value of each image in the image data i and the matrix L = [L1, L2, L3, L4] corresponding to the light source direction vectors, determine the reflectivity in the reflectivity map of the surface of the object to be detected based on the following calculation formula:
[0142]
[0143] where N i is the reflectivity of the i-th row in the reflectivity map. Furthermore, the reflectivity map can be determined according to the reflectivities of each row.
[0144] In the embodiments of the present application, according to the image data and the light source information of the light source used to obtain the image data, the normal vector map and the reflectivity map of the surface of the object to be detected are determined, which is convenient for subsequent defect detection on the surface of the object to be detected.
[0145] In some optional implementation manners, refer to Figure 8 , Figure 8 , a flowchart of another defect detection method is provided, which specifically includes the following steps:
[0146] S801. Divide the surface of the object to be detected into at least three distribution regions.
[0147] S802. Control the light source to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, control the image acquisition device to collect the corresponding image to obtain the image data of the surface of the object to be detected.
[0148] S803. Determine the light source direction vectors corresponding to different incident light angles according to the incident light angles corresponding to the images with different brightness distributions in the image data.
[0149] S804. Determine the normal vector map of the surface of the object to be detected according to the pixel values and light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0150] S805. Determine the reflectivity map of the surface of the object to be detected according to the normal vector map, as well as the pixel values and light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0151] S806, input the reflectivity map into the defect detection model to obtain the first defect information on the surface of the object to be detected.
[0152] S807, perform differential processing on the normal vector map to obtain the gradient map corresponding to the normal vector map.
[0153] S808, perform convolution processing on the gradient map to obtain the curvature map corresponding to the gradient map.
[0154] S809, determine at least one connected region and the regional curvature value of each connected region according to the curvature values of the pixels in the curvature map.
[0155] S810, compare the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain the comparison result.
[0156] S811, according to the comparison result, use the target connected regions in which the regional curvature values of the connected regions fall within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected regions, as the second defect information.
[0157] S812, determine the common defect information of the first defect information and the second defect information.
[0158] S813, use the defect regions in the common defect information as the target defect regions on the surface of the object to be detected; and, use the defect type corresponding to the target defect regions in the common defect information as the target defect type of the target defect regions.
[0159] In the embodiments of the present application, the imaging quality of the surface of the object to be detected is improved. Through the integration of deep learning and image analysis, the accuracy of defect detection on the surface of the object to be detected is improved, and it can be applied to the real-time monitoring of the production quality of filter rods and cigarettes during the production process of filter rods and cigarette tipping. It solves the problem of manual detection in traditional detection methods and reduces the labor cost.
[0160] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.
[0161] Based on the same inventive concept, an embodiment of the present application further provides a defect detection device for implementing the above-mentioned defect detection method. The implementation solutions provided by this device for solving problems are similar to those recorded in the above method. Therefore, the specific limitations in one or more embodiments of the defect detection device provided below can refer to the limitations on the defect detection method in the above text and will not be elaborated here.
[0162] In an exemplary embodiment, as Figure 9 shown, a defect detection device is provided, including:
[0163] An acquisition module 10, configured to acquire image data of the surface of an object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0164] A first determination module 20, configured to determine a normal vector map and a reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data;
[0165] A detection module 30, configured to input the reflectivity map into a defect detection model to obtain first defect information on the surface of the object to be detected;
[0166] An analysis module 40, configured to perform image analysis on the normal vector map to obtain second defect information on the surface of the object to be detected;
[0167] A second determination module 50, configured to determine target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0168] The above-mentioned defect detection device acquires image data of the surface of the object to be detected; determines a normal vector map and a reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data; inputs the reflectivity map into a defect detection model to obtain first defect information on the surface of the object to be detected; performs image analysis on the normal vector map to obtain second defect information on the surface of the object to be detected; and determines target defect information on the surface of the object to be detected according to the first defect information and the second defect information. On the one hand, the above solution can acquire at least three images with different brightness distributions on the surface of the object to be detected, and the acquired images can more accurately reflect the actual situation of the surface of the object to be detected, realizing high-quality imaging of the surface of the object to be detected and facilitating the improvement of the accuracy of defect detection on the object surface; on the other hand, by using two methods, namely the detection model and image analysis, to determine the defect information on the surface of the object to be detected, the determined defect information is more accurate, further improving the accuracy of defect detection on the object surface.
[0169] In one of the embodiments, the acquisition module 10 is specifically configured to:
[0170] Partition the surface of the object to be detected to obtain at least three distribution regions; control the light source to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, control the image acquisition device to acquire the corresponding image.
[0171] In one embodiment, the analysis module 40 specifically includes:
[0172] A differential unit for performing differential processing on the normal vector map to obtain a gradient map corresponding to the normal vector map;
[0173] A convolution unit for performing convolution processing on the gradient map to obtain a curvature map corresponding to the gradient map;
[0174] A determination unit for determining the second defect information according to the curvature values of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type.
[0175] In one embodiment, the determination unit specifically is used for:
[0176] According to the curvature values of each pixel point in the curvature map, determine at least one connected region and the regional curvature value of each connected region; wherein, the difference between the curvature values of each pixel point in each connected region is less than a preset difference; compare the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain a comparison result; according to the comparison result, use the target connected region in which the regional curvature value of each connected region falls within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected region, as the second defect information.
[0177] In one embodiment, the target defect information includes the target defect type and the target defect region; the second determination module 50 specifically is used for:
[0178] Determine the common defect information of the first defect information and the second defect information;
[0179] Use the defect region in the common defect information as the target defect region on the surface of the object to be detected; and, use the defect type corresponding to the target defect region in the common defect information as the target defect type of the target defect region.
[0180] In one embodiment, the light source information includes the incident light angle; the first determination module 20 specifically is used for:
[0181] Determine the light source direction vectors corresponding to different incident light angles according to the incident light angles corresponding to the images with different brightness distributions in the image data; determine the normal vector map of the surface of the object to be detected according to the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data; determine the reflectivity map of the surface of the object to be detected according to the normal vector map, as well as the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0182] In one embodiment, the object to be detected is a cigarette filter rod.
[0183] Each module in the above defect detection device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor in the computer device in hardware form or be independent of it, or can be stored in the memory in the computer device in software form, so as to facilitate the processor to call and execute the operations corresponding to each of the above modules.
[0184] In an exemplary embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 10 shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used for the processor to exchange information with external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, near field communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a XXX method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, a touchpad, or a mouse, etc.
[0185] Those skilled in the art can understand, Figure 10The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.
[0186] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0187] Obtain image data on the surface of the object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0188] According to the image data and the light source information of the light source used when obtaining the image data, determine the normal vector map and reflectivity map of the surface of the object to be detected;
[0189] Input the reflectivity map into the defect detection model to obtain the first defect information on the surface of the object to be detected;
[0190] Perform image analysis on the normal vector map to obtain the second defect information on the surface of the object to be detected;
[0191] According to the first defect information and the second defect information, determine the target defect information on the surface of the object to be detected.
[0192] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0193] Partition the surface of the object to be detected to obtain at least three distribution regions; control the light source to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, control the image acquisition device to acquire the corresponding image.
[0194] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0195] Perform differential processing on the normal vector map to obtain the gradient map corresponding to the normal vector map; perform convolution processing on the gradient map to obtain the curvature map corresponding to the gradient map; according to the curvature values of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type, determine the second defect information.
[0196] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0197] Determine at least one connected region and the regional curvature value of each connected region according to the curvature values of each pixel point in the curvature map; wherein, the difference between the curvature values of each pixel point in each connected region is less than a preset difference; compare the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain a comparison result; according to the comparison result, use the target connected region in which the regional curvature value of each connected region falls within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected region, as the second defect information.
[0198] In one embodiment, the target defect information includes the target defect type and the target defect region; when the processor executes the computer program, the following steps are further implemented:
[0199] Determine the common defect information of the first defect information and the second defect information;
[0200] Use the defect region in the common defect information as the target defect region on the surface of the object to be detected; and, use the defect type corresponding to the target defect region in the common defect information as the target defect type of the target defect region.
[0201] In one embodiment, the light source information includes the incident light angle; when the processor executes the computer program, the following steps are further implemented:
[0202] Determine the light source direction vector corresponding to different incident light angles according to the incident light angles corresponding to the images with different brightness distributions in the image data; determine the normal vector map of the surface of the object to be detected according to the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data; determine the reflectivity map of the surface of the object to be detected according to the normal vector map, and the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0203] In one embodiment, the object to be detected is a cigarette filter rod.
[0204] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0205] Obtain the image data of the surface of the object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0206] Determine the normal vector map and the reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when obtaining the image data;
[0207] Input the reflectivity map into the defect detection model to obtain the first defect information of the surface of the object to be detected;
[0208] Perform image analysis on the normal vector map to obtain second defect information on the surface of the object to be detected;
[0209] Determine the target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0210] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
[0211] Partition the surface of the object to be detected to obtain at least three distribution regions; control the light source to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, control the image acquisition device to acquire the corresponding image.
[0212] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
[0213] Perform differential processing on the normal vector map to obtain the gradient map corresponding to the normal vector map; perform convolution processing on the gradient map to obtain the curvature map corresponding to the gradient map; determine the second defect information according to the curvature values of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type.
[0214] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
[0215] Determine at least one connected region and the regional curvature value of each connected region according to the curvature values of each pixel point in the curvature map; wherein, the difference between the curvature values of each pixel point in each connected region is less than the preset difference; compare the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain a comparison result; according to the comparison result, use the target connected region in which the regional curvature value of each connected region falls within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected region, as the second defect information.
[0216] In one embodiment, the target defect information includes a target defect type and a target defect region; when the computer program is executed by the processor, the following steps are further implemented:
[0217] Determine the common defect information of the first defect information and the second defect information;
[0218] Use the defect region in the common defect information as the target defect region on the surface of the object to be detected; and use the defect type corresponding to the target defect region in the common defect information as the target defect type of the target defect region.
[0219] In one embodiment, the light source information includes the incident light angle; when the computer program is executed by the processor, the following steps are further implemented:
[0220] Determine the light source direction vectors corresponding to different incident light angles according to the incident light angles corresponding to the images with different brightness distributions in the image data; determine the normal vector map of the surface of the object to be detected according to the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data; determine the reflectivity map of the surface of the object to be detected according to the normal vector map, and the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0221] In one embodiment, the object to be detected is a cigarette filter rod.
[0222] In one embodiment, a computer program product is provided, including a computer program, which when executed by a processor implements the following steps of any of the above embodiments:
[0223] Obtain the image data of the surface of the object to be detected; wherein, the image data includes at least three images with different brightness distributions;
[0224] Determine the normal vector map and the reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when obtaining the image data;
[0225] Input the reflectivity map into a defect detection model to obtain the first defect information on the surface of the object to be detected;
[0226] Perform image analysis on the normal vector map to obtain the second defect information on the surface of the object to be detected;
[0227] Determine the target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0229] Partition the surface of the object to be detected to obtain at least three distribution regions; control the light source to illuminate different distribution regions in sequence, and when the light source illuminates each distribution region, control the image acquisition device to acquire the corresponding image.
[0230] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0231] Perform differential processing on the normal vector map to obtain the gradient map corresponding to the normal vector map; perform convolution processing on the gradient map to obtain the curvature map corresponding to the gradient map; determine the second defect information according to the curvature values of the pixel points in the curvature map and the curvature range corresponding to the candidate defect types.
[0232] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0233] Determine at least one connected region and the regional curvature value of each connected region according to the curvature values of the pixels in the curvature map; wherein, the difference between the curvature values of the pixels in each connected region is less than a preset difference; compare the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain a comparison result; according to the comparison result, use the target connected region in which the regional curvature value of each connected region falls within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected region as the second defect information.
[0234] In one embodiment, the target defect information includes a target defect type and a target defect region; when the computer program is executed by the processor, the following steps are further implemented:
[0235] Determine the common defect information of the first defect information and the second defect information;
[0236] Use the defect region in the common defect information as the target defect region on the surface of the object to be detected; and use the defect type corresponding to the target defect region in the common defect information as the target defect type of the target defect region.
[0237] In one embodiment, the light source information includes the incident light angle; when the computer program is executed by the processor, the following steps are further implemented:
[0238] Determine the light source direction vector corresponding to different incident light angles according to the incident light angles corresponding to the images with different brightness distributions in the image data; determine the normal vector map of the surface of the object to be detected according to the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data; determine the reflectivity map of the surface of the object to be detected according to the normal vector map, and the pixel values and the light source direction vectors corresponding to the images with different brightness distributions in the image data.
[0239] In one embodiment, the object to be detected is a cigarette filter rod.
[0240] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. 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 methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.
[0241] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope recorded in the present application.
[0242] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A defect detection method, characterized in that, The method includes: Obtaining image data of the surface of an object to be detected; wherein, the image data includes at least three images with different brightness distributions; Determining a normal vector map and a reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when obtaining the image data; Inputting the reflectivity map into a defect detection model to obtain first defect information of the surface of the object to be detected; Performing image analysis on the normal vector map to obtain second defect information of the surface of the object to be detected; Determining target defect information of the surface of the object to be detected according to the first defect information and the second defect information.
2. The method according to claim 1, characterized in that The obtaining of the image data of the surface of the object to be detected includes: Dividing the surface of the object to be detected into regions to obtain at least three distribution regions; Controlling the light source to illuminate different distribution regions in sequence, and controlling an image acquisition device to acquire corresponding images when the light source illuminates each distribution region.
3. The method according to claim 1, characterized in that, The performing of image analysis on the normal vector map to obtain second defect information of the surface of the object to be detected includes: Performing differential processing on the normal vector map to obtain a gradient map corresponding to the normal vector map; Performing convolution processing on the gradient map to obtain a curvature map corresponding to the gradient map; Determining second defect information according to the curvature values of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type.
4. The method according to claim 3, wherein The determining of second defect information according to the curvature values of each pixel point in the curvature map and the curvature range corresponding to the candidate defect type includes: Determining at least one connected region and the regional curvature value of each connected region according to the curvature values of each pixel point in the curvature map; wherein, the difference between the curvature values of each pixel point in each connected region is less than a preset difference; Comparing the regional curvature value of each connected region with the curvature range corresponding to the candidate defect type to obtain a comparison result; According to the comparison result, taking the target connected regions in which the regional curvature values of each connected region fall within the curvature range corresponding to the candidate defect type, and the defect type corresponding to the target connected regions, as the second defect information.
5. The method according to any one of claims 1 to 4, characterized in that, The target defect information includes a target defect type and a target defect region; the determining of the target defect information of the surface of the object to be detected according to the first defect information and the second defect information includes: Determining the common defect information of the first defect information and the second defect information; Taking the defect region in the common defect information as the target defect region of the surface of the object to be detected; and Taking the defect type corresponding to the target defect region in the common defect information as the target defect type of the target defect region.
6. The method according to any one of claims 1-4, characterized in that The light source information includes the incident light angle; the determining of the normal vector map and the reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when obtaining the image data includes: Determining the light source direction vectors corresponding to different incident light angles according to the incident light angles respectively corresponding to the images with different brightness distributions in the image data; Determine the normal vector map of the surface of the object to be detected according to the pixel values and the light source direction vectors respectively corresponding to the images with different brightness distributions in the image data; Determine the reflectivity map of the surface of the object to be detected according to the normal vector map, and the pixel values and the light source direction vectors respectively corresponding to the images with different brightness distributions in the image data.
7. The method according to any one of claims 1 to 4, characterized in that The object to be detected is a cigarette filter rod.
8. A defect detection device, characterized in that, The device includes: An acquisition module, configured to acquire image data of the surface of an object to be detected; wherein, the image data includes at least three images with different brightness distributions; A first determination module, configured to determine the normal vector map and the reflectivity map of the surface of the object to be detected according to the image data and the light source information of the light source used when acquiring the image data; A detection module, configured to input the reflectivity map into a defect detection model to obtain first defect information on the surface of the object to be detected; An analysis module, configured to perform image analysis on the normal vector map to obtain second defect information on the surface of the object to be detected; A second determination module, configured to determine target defect information on the surface of the object to be detected according to the first defect information and the second defect information.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Brushless fan controller PCB appearance defect detection method based on machine vision
CN122199420A
Brushless fan controller PCB appearance defect detection method based on machine vision
CN122199420B