A 3D printing defect monitoring method
By generating a distribution matrix and a gray-level co-occurrence matrix, and combining the gray-level histogram and gradient angle, the problems of low detection efficiency and false positives and false negatives in existing 3D printing defect monitoring methods are solved, and efficient and accurate defect monitoring is achieved.
Patent Information
- Application Number
- CN202511543733.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2045-10-28
AI Technical Summary
Existing 3D printing defect monitoring methods suffer from low detection efficiency, high subjectivity, and difficulty in distinguishing between normal textures and defect areas, leading to false detections or missed detections. Furthermore, existing methods fail to fully integrate image information, making it difficult to accurately distinguish defect areas.
By acquiring the grayscale histogram and gradient angle of the 3D printed image, a distribution matrix is generated. Combined with the grayscale co-occurrence matrix, the defect characteristics of the pixels are reflected by the weighting coefficients and gradient angles, thus achieving accurate monitoring of defects.
It improves the accuracy and consistency of defect monitoring, enhances adaptability to different materials and processes, reduces false positives and false negatives, and improves detection efficiency.
Smart Images

Figure CN121033015B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of 3D printing technology, and more specifically to a method for monitoring defects in 3D printing. Background Technology
[0002] 3D printing (additive manufacturing) technology, with its unique advantage of rapidly prototyping complex structural parts, has been widely and deeply applied in many fields such as aerospace, medical devices, and automotive manufacturing. However, the 3D printing process is prone to various defects, such as peeling defects caused by poor interlayer bonding, voids formed by uneven melting of printing materials, and deviations in dimensional accuracy. These defects directly affect the performance, lifespan, and reliability of the product, seriously restricting the further promotion of 3D printing technology in demanding scenarios. Therefore, efficient and accurate defect monitoring of 3D printed products has become a key link in ensuring the quality of 3D printing.
[0003] Currently, the main methods for monitoring defects in 3D printing are manual visual inspection and traditional machine vision-based inspection methods, but both have significant shortcomings. On the one hand, manual visual inspection relies on the experience of inspectors, which is not only inefficient and difficult to adapt to the pace of large-scale production, but also highly subjective, with different inspectors having different judgment standards, making it impossible to guarantee the consistency and accuracy of the inspection results. On the other hand, although traditional machine vision inspection methods (such as algorithms based on simple grayscale threshold segmentation and edge detection) have achieved a certain degree of automation, the surface of 3D printed products often has complex textures (such as the inherent stacking texture of the printed layers, the natural grayscale changes in different material areas, etc.). The grayscale and texture features of normal textures and defective areas have a high degree of overlap, making it difficult for these methods to accurately distinguish between "normal structures" and "defective structures," which easily leads to false detections or missed detections.
[0004] Further analysis from a technical perspective reveals that existing methods have a core shortcoming in the image feature representation and defect identification stages: in terms of image feature representation, the fusion and utilization of the gray-scale distribution characteristics and gradient information of pixels in 3D printed images are insufficient, making it difficult to accurately characterize the "specialness" of a single pixel in the overall image (i.e., the potential possibility that the pixel belongs to a defect).
[0005] In summary, there is an urgent need for a 3D printing defect monitoring method that can fully integrate image information and accurately distinguish between normal and defective areas to address the shortcomings of existing technologies. Summary of the Invention
[0006] To address the above problems, this invention proposes a method for detecting defects in 3D printing.
[0007] The technical solution of the present invention is: a 3D printing defect monitoring method comprising the following steps:
[0008] S1. Obtain a production image when 3D printing is completed;
[0009] S2. Generate a distribution matrix for each pixel based on the grayscale histogram of the produced image and the gradient angle of each pixel.
[0010] S3. Based on the feature matrix and pixel distribution matrix of the production image, determine the defects in the production image.
[0011] Furthermore, S2 includes the following sub-steps:
[0012] S21. Perform boundary filling on the production image and determine the gradient angle of each pixel in the production image after boundary filling.
[0013] S22. Calculate the specific weight coefficient of each pixel based on the grayscale histogram of the production image;
[0014] S23. Generate a distribution matrix for the pixels based on the feature weight coefficients and gradient angles of the pixels.
[0015] The beneficial effects of the above-mentioned further solutions are as follows: In this invention, the gradient calculation error of the image edge pixels is first avoided by boundary filling, the edge effect is eliminated, and the accuracy of the gradient angle is ensured; then, the specific weight coefficient of each pixel is calculated based on the gray-level histogram to quantify the importance of the pixel in the gray-level distribution; the feature fusion of gray-level weight and gradient direction is realized, and the generated distribution matrix can more accurately reflect the defect-related features of the pixel.
[0016] Furthermore, S22 includes the following sub-steps:
[0017] S221. Construct a grayscale histogram for the production image;
[0018] S222. In the grayscale histogram, extract the frequency of occurrence of the grayscale level of each pixel in the grayscale histogram;
[0019] S223. Calculate the percentage index of a pixel based on the frequency of occurrence of its gray level in the gray histogram.
[0020] S224. The ratio between the pixel percentage index and the sum of all percentage indices is used as the specific weight index of the pixel.
[0021] The beneficial effects of the above-mentioned further scheme are as follows: In this invention, the gray-level histogram is used to statistically analyze the gray-level distribution, and the frequency of occurrence of each pixel's gray-level is extracted to quantify the proportion characteristics of the pixel's gray-level; finally, the proportion index is compared with the sum of all proportion indices to obtain a normalized specific weight index, so that the weights of different pixels are comparable.
[0022] Furthermore, in S223, the first The percentage index of each pixel The expression is:
[0023] ;
[0024] in, Indicates the first The frequency of occurrence of the gray level of each pixel in the gray-level histogram. This represents the total number of pixels in the produced image. Represents the logarithmic function. Indicates the first The number of pixels covered by the gray level of a given pixel. Indicates the first The grayscale value of each pixel This indicates the maximum grayscale value of the produced image.
[0025] Furthermore, S23 includes the following sub-steps:
[0026] S231. Extract the maximum and minimum specific weight coefficients;
[0027] S232. Calculate the ratio between the specific weight coefficient of a pixel and the maximum specific weight coefficient, and the ratio between the minimum specific weight coefficient and the specific weight coefficient of the pixel;
[0028] S233. Using the two ratios of the pixels and the gradient angle as inputs to the exponential function, a distribution matrix is generated for the pixels.
[0029] The beneficial effects of the above-mentioned further solutions are as follows: In this invention, the upper and lower limits of the weights are clearly defined by the maximum / minimum weight coefficients, so that the ratio calculation can reflect the relative size of the pixel weights; by combining the gradient angle and the exponential function, the relative relationship of the weights is fused with the gradient direction features, and the generated distribution matrix can more meticulously characterize the defect-related features of the pixels and enhance the ability to distinguish defects.
[0030] Furthermore, in S233, the pixel distribution matrix The expression is:
[0031] ;
[0032] in, Represents an exponential function. This represents the ratio between a specific weight coefficient of a pixel and the maximum specific weight coefficient. This represents the ratio between the minimum specific weight coefficient and the specific weight coefficient of the pixel. This represents the gradient angle of a pixel.
[0033] Furthermore, S3 includes the following sub-steps:
[0034] S31. Generate a gray-level co-occurrence matrix for the production image;
[0035] S32. Extract the maximum singular value of the gray-level co-occurrence matrix as the overall monitoring coefficient of the production image;
[0036] S33. Extract the maximum singular value of the pixel distribution matrix and use it as the defect monitoring coefficient of the pixel.
[0037] S34. When the ratio between the defect monitoring coefficient of a pixel and the overall monitoring coefficient of the production image is greater than the threshold, the pixel is determined to be a defect.
[0038] The beneficial effects of the above-mentioned further solutions are as follows: In this invention, the gray-level co-occurrence matrix is a matrix describing the spatial correlation of gray-level values within a local region, and its core reflects the texture pattern. The gray-level co-occurrence matrix can effectively capture the texture and gray-level spatial relationship of an image, and its maximum singular value can represent the normal feature benchmark of the entire image; the maximum singular value of the pixel distribution matrix can highlight the abnormal features of local pixels; by comparing the ratio with the threshold, accurate comparison between abnormal and normal features is achieved, reducing false positives and false negatives.
[0039] The beneficial effects of this invention are:
[0040] (1) Considering that 3D printing defects can simultaneously cause abnormal grayscale distribution and abnormal local structural orientation, this invention utilizes the grayscale statistical differences captured by the grayscale histogram and uses the gradient angle to characterize the directional characteristics of pixels, providing structural basis for cracks and stacking faults; it solves the problem that a single feature (such as edge detection alone) cannot fully describe complex defects, and greatly improves the integrity of defect features.
[0041] (2) By fusing multiple features, this invention can adapt to defect monitoring of different 3D printing processes such as fused deposition modeling and selective laser melting, as well as defect monitoring of different materials such as metals and plastics, thus enhancing the versatility of the monitoring method. Attached Figure Description
[0042] Figure 1 This is a flowchart of a 3D printing defect monitoring method. Detailed Implementation
[0043] The embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0044] like Figure 1 As shown, the present invention provides a 3D printing defect monitoring method, comprising the following steps:
[0045] S1. Obtain a production image when 3D printing is completed;
[0046] S2. Generate a distribution matrix for each pixel based on the grayscale histogram of the produced image and the gradient angle of each pixel.
[0047] S3. Based on the feature matrix and pixel distribution matrix of the production image, determine the defects in the production image.
[0048] In this embodiment of the invention, S2 includes the following sub-steps:
[0049] S21. Perform boundary filling on the production image and determine the gradient angle of each pixel in the production image after boundary filling.
[0050] S22. Calculate the specific weight coefficient of each pixel based on the grayscale histogram of the production image;
[0051] S23. Generate a distribution matrix for the pixels based on the feature weight coefficients and gradient angles of the pixels.
[0052] In this invention, 3D printing defects (such as stacking faults, voids, over-melting, and unmelted inclusions) can simultaneously cause abnormal grayscale distribution (e.g., high brightness in over-melted areas and low grayscale in void areas), abnormal local structural orientation (e.g., the gradient direction of cracks is perpendicular to normal layer textures), and disruption of spatial texture consistency (e.g., inclusion areas break the regular symbiosis of layer textures). Gradient angles characterize the directional characteristics of pixel edges / textures, providing a structural basis for directional defects such as cracks and stacking faults.
[0053] First, boundary filling is used to avoid gradient calculation errors of edge pixels in the image, eliminating edge effects and ensuring the accuracy of gradient angles. Then, specific weight coefficients of each pixel are calculated based on the gray-level histogram to quantify the importance of pixels in gray-level distribution. The feature fusion of gray-level weights and gradient directions is realized, and the generated distribution matrix can more accurately reflect the defect-related features of pixels.
[0054] In this embodiment of the invention, S22 includes the following sub-steps:
[0055] S221. Construct a grayscale histogram for the production image;
[0056] S222. In the grayscale histogram, extract the frequency of occurrence of the grayscale level of each pixel in the grayscale histogram;
[0057] S223. Calculate the percentage index of a pixel based on the frequency of occurrence of its gray level in the gray histogram.
[0058] S224. The ratio between the pixel percentage index and the sum of all percentage indices is used as the specific weight index of the pixel.
[0059] In this invention, grayscale histograms are used to statistically analyze grayscale distribution, and the frequency of occurrence of each pixel's grayscale level is extracted to quantify the proportion of pixel grayscale levels. Finally, the proportion index is compared with the sum of all proportion indices to obtain a normalized specific weight index, making the weights of different pixels comparable.
[0060] In this embodiment of the invention, in S223, the first... The percentage index of each pixel The expression is:
[0061] ;
[0062] in, Indicates the first The frequency of occurrence of the gray level of each pixel in the gray-level histogram. This represents the total number of pixels in the produced image. Represents the logarithmic function. Indicates the first The number of pixels covered by the gray level of a given pixel. Indicates the first The grayscale value of each pixel This indicates the maximum grayscale value of the produced image.
[0063] By using logarithmic functions to smooth and amplify anomalies (such as small changes in the frequency or percentage of pixels at a certain gray level in a defective area, which are significantly enhanced by logarithmic operations), gray-level anomalies are made easier to capture.
[0064] In this embodiment of the invention, S23 includes the following sub-steps:
[0065] S231. Extract the maximum and minimum specific weight coefficients;
[0066] S232. Calculate the ratio between the specific weight coefficient of a pixel and the maximum specific weight coefficient, and the ratio between the minimum specific weight coefficient and the specific weight coefficient of the pixel;
[0067] S233. Using the two ratios of the pixels and the gradient angle as inputs to the exponential function, a distribution matrix is generated for the pixels.
[0068] In this invention, the upper and lower limits of the weights are clearly defined by the maximum / minimum weight coefficients, so that the ratio calculation can reflect the relative magnitude of the pixel weights; by combining the gradient angle and the exponential function, the relative relationship of the weights is fused with the gradient direction features, and the generated distribution matrix can more meticulously characterize the defect-related features of the pixels, thereby enhancing the ability to distinguish defects.
[0069] In this embodiment of the invention, in S233, the pixel distribution matrix The expression is:
[0070] ;
[0071] in, Represents an exponential function. This represents the ratio between a specific weight coefficient of a pixel and the maximum specific weight coefficient. This represents the ratio between the minimum specific weight coefficient and the specific weight coefficient of the pixel. This represents the gradient angle of a pixel.
[0072] In this embodiment of the invention, S3 includes the following sub-steps:
[0073] S31. Generate a gray-level co-occurrence matrix for the production image;
[0074] S32. Extract the maximum singular value of the gray-level co-occurrence matrix as the overall monitoring coefficient of the production image;
[0075] S33. Extract the maximum singular value of the pixel distribution matrix and use it as the defect monitoring coefficient of the pixel.
[0076] S34. When the ratio between the defect monitoring coefficient of a pixel and the overall monitoring coefficient of the production image is greater than the threshold, the pixel is determined to be a defect.
[0077] In this invention, the gray-level co-occurrence matrix (GLCM) is a matrix that describes the spatial correlation of gray-level values within a local region, and its core reflects the texture pattern. The GLCM can effectively capture the texture and gray-level spatial relationship of an image, and its maximum singular value can represent the normal feature benchmark of the entire image; the maximum singular value of the pixel distribution matrix can highlight the abnormal features of local pixels; by comparing the ratio with the threshold, accurate comparison between abnormal and normal features is achieved, reducing false positives and false negatives.
[0078] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.
Claims
1. A method for monitoring defects in 3D printing, characterized in that, Includes the following steps: S1. Obtain a production image when 3D printing is completed; S2. Generate a distribution matrix for each pixel based on the grayscale histogram of the produced image and the gradient angle of each pixel. S3. Based on the feature matrix and pixel distribution matrix of the production image, determine the defects in the production image; S2 includes the following sub-steps: S21. Perform boundary filling on the production image and determine the gradient angle of each pixel in the production image after boundary filling. S22. Calculate the specific weight coefficient of each pixel based on the grayscale histogram of the production image; S23. Generate a distribution matrix for the pixels based on the feature weight coefficients and gradient angles of the pixels; S23 includes the following sub-steps: S231. Extract the maximum and minimum specific weight coefficients; S232. Calculate the ratio between the specific weight coefficient of a pixel and the maximum specific weight coefficient, and the ratio between the minimum specific weight coefficient and the specific weight coefficient of the pixel; S233. Using the two ratios of the pixels and the gradient angle as inputs to the exponential function, generate a distribution matrix for the pixels. S3 includes the following sub-steps: S31. Generate a gray-level co-occurrence matrix for the production image; S32. Extract the maximum singular value of the gray-level co-occurrence matrix as the overall monitoring coefficient of the production image; S33. Extract the maximum singular value of the pixel distribution matrix and use it as the defect monitoring coefficient of the pixel. S34. When the ratio between the defect monitoring coefficient of a pixel and the overall monitoring coefficient of the production image is greater than the threshold, the pixel is determined to be a defect.
2. The 3D printing defect monitoring method according to claim 1, characterized in that, S22 includes the following sub-steps: S221. Construct a grayscale histogram for the production image; S222. In the grayscale histogram, extract the frequency of occurrence of the grayscale level of each pixel in the grayscale histogram; S223. Calculate the percentage index of a pixel based on the frequency of occurrence of its gray level in the gray histogram. S224. The ratio between the pixel percentage index and the sum of all percentage indices is used as the specific weight index of the pixel.
3. The 3D printing defect monitoring method according to claim 2, characterized in that, In S223, the first The percentage index of each pixel The expression is: ; in, Indicates the first The frequency of occurrence of the gray level of each pixel in the gray-level histogram. This represents the total number of pixels in the produced image. Represents the logarithmic function. Indicates the first The number of pixels covered by the gray level of a given pixel. Indicates the first The grayscale value of each pixel This indicates the maximum grayscale value of the produced image.
4. The 3D printing defect monitoring method according to claim 1, characterized in that, In S233, the pixel distribution matrix The expression is: ; in, Represents an exponential function. This represents the ratio between a specific weight coefficient of a pixel and the maximum specific weight coefficient. This represents the ratio between the minimum specific weight coefficient and the specific weight coefficient of the pixel. This represents the gradient angle of a pixel.
Citation Information
Patent Citations
Defect type identification method and system of multi-strategy fusion deep learning network model
CN114419007A
Carton printing defect detection method and system based on visual identification
CN119624971A