A Defect Detection Method and System for Aluminum Alloy CNC Products Based on Structured Light Scanning

By combining structured light scanning technology with adaptive light source adjustment and multi-exposure fusion, the problem of balancing efficiency and accuracy in the inspection of aluminum alloy CNC products has been solved, achieving efficient and reliable defect detection and reducing the false positive rate and cost.

CN120927673BActive Publication Date: 2026-01-30HENGSHUI HEPING ALUMINUM TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511100335.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-07
Publication Date
2026-01-30
Estimated Expiration
2045-08-07

AI Technical Summary

Technical Problem

Existing testing methods struggle to balance efficiency, accuracy, and cost, and are unable to effectively detect complex three-dimensional surface defects in aluminum alloy CNC products, especially high-gloss surface and internal defects.

Method used

A structured light scanning method is adopted, which uses texture direction perception and matrix light source dynamic angle adjustment, combined with a light intensity-wavelength adaptive scheme of saturated pixel level, to generate a multi-exposure parameter sequence, perform multi-exposure grayscale weighted fusion, obtain a complete 3D point cloud, and combine it with a convolutional neural network for defect detection.

Benefits of technology

It enables efficient and reliable inspection of aluminum alloy CNC products, reduces mirror glare, improves point cloud integrity and defect identification accuracy, and reduces misjudgment and excessive scrap.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120927673B_ABST
    Figure CN120927673B_ABST
Patent Text Reader

Abstract

This invention relates to the field of 3D vision measurement, specifically to a method and system for defect detection of aluminum alloy CNC products based on structured light scanning. The aluminum alloy CNC product defect detection system based on structured light scanning includes: an image acquisition and analysis module, an adaptive lighting control module, a point cloud reconstruction module, a defect detection module, and a report generation module. This invention significantly reduces specular glare on highly reflective aluminum alloy surfaces by using texture direction perception and dynamic angle adjustment of a matrix light source, combined with a saturated pixel-level intensity-wavelength adaptive scheme. Furthermore, with multi-exposure grayscale weighted fusion, it can obtain uniformly contrasted, stripe-free images in a single scan. Within the same scanning time, it improves the point cloud integrity rate compared to a fixed lighting scheme, providing a more reliable 3D data foundation for subsequent defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of three-dimensional vision measurement, specifically to a method and system for defect detection of aluminum alloy CNC products based on structured light scanning. Background Technology

[0002] Due to its high specific strength, good heat dissipation, and easy machinability, aluminum alloy has become an important structural material in industries such as aerospace, new energy vehicles, and consumer electronics. Typical aluminum alloy CNC precision parts often have complex three-dimensional curved surfaces and high surface finish requirements. Any tiny scratches, dents, chipping, or dimensional deviations can lead to assembly mismatch, airtightness failure, or rejection due to appearance issues. Therefore, manufacturing companies generally need to achieve full-size, full-surface, sub-50µm level non-destructive testing of aluminum alloy CNC parts on high-speed production lines.

[0003] Existing inspection solutions mainly include manual visual inspection, contact coordinate measuring machine (CMM), 2D machine vision, and industrial CT. Manual visual inspection relies on experience, is prone to missing defects, and is inefficient. CMM has high precision but is slow and easily scratches soft metal surfaces. 2D vision can only obtain projection information and is difficult to judge surface concavity and convexity defects. Although industrial CT can detect internal defects, the equipment is expensive, the inspection cycle is long, and radiation is limited. With the increasing demand for digital factories and automated quality inspection, the above methods are all difficult to balance between efficiency, accuracy, and cost.

[0004] Structured light 3D scanning technology can project coded stripes and reconstruct high-density point clouds using camera parallax, offering advantages such as non-contact operation, high resolution, and fast measurement speed. In recent years, it has been gradually applied to the dimensional inspection of metal parts. However, the high reflectivity of aluminum alloy surfaces makes stripes prone to overexposure and distortion, and anisotropic knife marks cause the reflection direction to change with the surface position. Conventional structured light systems cannot guarantee stripe contrast and point cloud integrity. At the same time, large-sized parts require rapid multi-view stitching and intelligent defect recognition, which also places higher demands on optical control, data processing, and defect judgment strategies.

[0005] Therefore, in order to solve the above problems, this invention proposes a defect detection method and system for aluminum alloy CNC products based on structured light scanning, so as to achieve efficient, reliable and closed-loop quality control of aluminum alloy CNC products. Summary of the Invention

[0006] This invention significantly reduces specular glare on highly reflective aluminum alloy surfaces by using texture direction perception and dynamic angle adjustment of matrix light sources, combined with a light intensity-wavelength adaptive scheme based on saturated pixel grading. With multi-exposure grayscale weighted fusion, it can obtain a striped image with uniform contrast and no overexposure in a single scan. In the same scanning time, it can improve the point cloud integrity rate compared with a fixed illumination scheme, providing a more reliable three-dimensional data foundation for subsequent defect detection.

[0007] A defect detection method for aluminum alloy CNC products based on structured light scanning includes:

[0008] Low-brightness uniform illumination is applied to the product to be tested and images are acquired. The direction gradient histogram and gray-level co-occurrence matrix are used to analyze the surface processing texture of the product to be tested and obtain the main direction angle of the processing texture of the product to be tested. At the same time, the saturation pixel ratio of the structured light stripes in the image is statistically analyzed, and the reflection risk of the irradiated area is classified according to a preset threshold.

[0009] Based on the main direction angle of the processed texture, the emission angle of each unit in the matrix light source is dynamically adjusted, and the light source intensity and wavelength are set according to the reflection risk classification to generate a multi-exposure parameter sequence.

[0010] Under the control of the multi-exposure parameter sequence, multi-frequency multi-phase-shift structured light stripes are projected and corresponding images are acquired simultaneously. The acquired multi-exposure images are then subjected to grayscale weighted fusion to obtain an image sequence without overexposure stripes. The complete three-dimensional point cloud of the product to be inspected is then decoded and obtained. Conventional rigid body registration is then performed between the three-dimensional point cloud and the CAD model.

[0011] Three-dimensional geometric features, including curvature and normal variations, are extracted from the registered point cloud. At the same time, two-dimensional texture grayscale features of the registered point cloud are calculated. The three-dimensional geometric features and two-dimensional texture grayscale features are fused and input into the defect detection model to determine whether the product to be inspected has defects and to identify the specific defect type.

[0012] Based on CAD semantics, the point cloud is divided into assembly surface area and appearance surface area. The corresponding tolerance library is called to determine whether each defect instance is acceptable, reworkable, or scrapped, and an inspection report containing the defect location, type, and judgment result is generated.

[0013] Preferably, the orientation gradient histogram and gray-level co-occurrence matrix are used to analyze the surface texture direction of the product to be inspected, and the main orientation angle of the texture is obtained. The specific operation is as follows:

[0014] The acquired low-brightness uniformly illuminated images are preprocessed by grayscale conversion, filtering, and contrast enhancement.

[0015] The preprocessed image is divided into several sub-blocks according to a fixed grid.

[0016] Calculate the gradient histogram in the 0-180° direction within each sub-block, and construct gray-level co-occurrence matrices in the horizontal, vertical and 45° directions respectively, and extract energy, contrast and correlation indicators.

[0017] The statistical results obtained from the directional gradient histogram and gray-level co-occurrence matrix are normalized, and the scores of each direction are calculated according to the preset weighting rules. The direction with the highest score is selected as the local texture direction of the sub-block.

[0018] After mapping all local texture directions to spherical vectors and averaging them, outliers are removed by morphological smoothing to obtain the main direction angle of the processed texture of the product to be inspected.

[0019] Preferably, the proportion of saturated pixels in the structured light stripes in the image is statistically analyzed, and the reflection risk of the irradiated area is classified according to a preset threshold. The specific operation is as follows:

[0020] A single fixed saturation grayscale threshold is set for the stripe brightness to determine whether a single pixel is overexposed, and first and second ratio thresholds are preset to distinguish between high risk, medium risk, and low risk.

[0021] According to the correspondence between the matrix light source and the camera field of view, the low-brightness uniform illumination image is divided into illumination sub-regions that correspond one-to-one with each emission unit; in each illumination sub-region, the number of pixels with gray values ​​higher than the saturation gray value threshold is counted, and the total number of pixels in the sub-region is recorded.

[0022] The saturated pixel ratio of the sub-region is obtained by dividing the number of saturated pixels by the total number of pixels. When the saturated pixel ratio is not lower than the first ratio threshold, the illuminated sub-region is marked as high reflectivity risk. When the saturated pixel ratio is between the first ratio threshold and the second ratio threshold, it is marked as medium reflectivity risk. When the saturated pixel ratio is lower than the second ratio threshold, it is marked as low reflectivity risk.

[0023] Preferably, based on the main direction angle of the processed texture, the emission angle of each unit in the matrix light source is dynamically adjusted, and the specific operation is as follows:

[0024] The surface of the product to be tested is divided into several irradiation sub-regions, and each irradiation sub-region is uniquely associated with an emission unit in a matrix light source.

[0025] For each irradiated sub-region, the CAD model is called to obtain the unit normal vector n of the surface of that sub-region.

[0026] Based on the principal direction angle θ of the processed texture, a reference tangential vector t parallel to the texture direction is generated in the tangential plane of the sub-region, where t is a unit vector and satisfies... ;

[0027] Assuming the default incident direction vector of the light source is v, calculate the specular reflection direction vector. ;

[0028] The target launch angle is calculated based on the specular reflection direction vector r and the reference tangential vector t:

[0029] Step 1: Within the mechanically accessible angle range allowed by the launching unit, select all incident direction vectors. The angle between this angle and the mirror reflection direction vector r is not less than the preset safety deviation angle. ;

[0030] Step 2: For all incident direction vectors that satisfy the conditions in Step 1 In the process, the vector with the smallest angle to the reference tangential vector t is selected and denoted as the final incident direction vector. ;

[0031] Step 3: Rotate the default incident direction vector v to the final incident direction vector. The required rotation angle is defined as the target launch angle of the launching unit; if the target launch angle exceeds the mechanical limit of the launching unit, the target launch angle is limited to the achievable limit range.

[0032] The target emission angles determined by all emission units are summarized to generate a set of light source control parameters.

[0033] Preferably, the light source intensity and wavelength are set according to the reflection risk classification to generate a multi-exposure parameter sequence, as follows:

[0034] Establish a parameter comparison table: preset a set of light intensity levels and wavelength combinations for high reflection risk, medium reflection risk, and low reflection risk, and set at least two sets of complementary exposure times for each risk level;

[0035] Based on the risk level label of each irradiation sub-region, the sub-region index and the corresponding risk level are mapped to the parameter lookup table;

[0036] For high-reflection-risk sub-regions, select the lowest light intensity level and prioritize the use of near-infrared wavelengths;

[0037] For the high-risk sub-region of central reflection, select a medium light intensity level and use a short wavelength of visible light;

[0038] For the low-reflection-risk sub-region, select the highest light intensity level and use the entire visible light spectrum;

[0039] For each risk level, at least two sets of exposure time parameters are generated for the same combination of light intensity and wavelength, based on the complementary principle of "low light intensity long exposure" and "high light intensity short exposure", to cover the dynamic range of brightness.

[0040] Light intensity, wavelength, and exposure time are packaged according to the order of the irradiated sub-regions to form a multi-exposure parameter sequence for all emitting units.

[0041] Preferably, the acquired multi-exposure images are subjected to grayscale weighted fusion to obtain an image sequence without overexposure stripes. The specific operation is as follows:

[0042] Step S1: Perform pixel-level registration on two complementary exposure images with the same fringe phase to make the high-intensity-short exposure frame and the low-intensity-long exposure frame completely correspond in space.

[0043] Step S2: Based on the exposure time and light intensity of the two frames, calculate the grayscale weight coefficient of the corresponding pixels: pixels whose grayscale value is close to the saturation threshold are given a lower weight, and pixels whose grayscale value is in the central area of ​​the effective grayscale range are given a higher weight.

[0044] The gray levels of corresponding pixels in two frames are weighted and summed according to the aforementioned weights, and the summation result is cropped to the gray level range allowed by the image to generate an image without overexposure stripes;

[0045] Step S3: Repeat the above registration, weight calculation and weighted summation steps for all phase frames in the same multi-phase stripe image sequence to obtain a complete image sequence without overexposure stripes.

[0046] Preferably, the defect detection model is based on a convolutional neural network and includes an input layer, a feature extraction layer group consisting of multiple levels of convolutional layers and pooling layers, at least one fully connected hidden layer, and an output layer. The input layer receives a multi-channel feature tensor formed by splicing three-dimensional geometric features and two-dimensional grayscale texture features and normalizes it. The feature extraction layer group extracts local spatial features through convolution operations and downsamples them through pooling layers to enhance translation invariance and noise reduction capabilities. The fully connected hidden layer performs nonlinear mapping on the high-dimensional feature vector after convolution processing and performs feature dimensionality reduction. The output layer uses the Softmax function to generate probability distributions for each defect category and the no-defect category, which are used to determine whether the product to be detected has a defect and to give the defect type.

[0047] A structured light scanning-based defect detection system for aluminum alloy CNC products includes:

[0048] The image acquisition and analysis module is used to apply low-brightness uniform illumination to the product to be inspected and acquire images. It uses the directional gradient histogram and gray-level co-occurrence matrix to analyze the surface texture direction of the product to be inspected and obtain the main direction angle of the texture. At the same time, it calculates the saturation pixel ratio of the structured light stripes in the image and classifies the reflection risk of the irradiated area according to a preset threshold.

[0049] An adaptive lighting control module is used to dynamically adjust the emission angle of each unit in the matrix light source according to the main direction angle of the processed texture, and set the light source intensity and wavelength according to the reflection risk classification to generate a multi-exposure parameter sequence.

[0050] The point cloud reconstruction module is used to project multi-frequency multi-phase-shift structured light stripes and simultaneously acquire corresponding images under the control of the multi-exposure parameter sequence. It performs grayscale weighted fusion on the acquired multi-exposure images to obtain an image sequence without overexposure stripes, and then decodes and acquires the complete three-dimensional point cloud of the product to be inspected. It also performs conventional rigid body registration between the three-dimensional point cloud and the CAD model.

[0051] The defect detection module is used to extract three-dimensional geometric features, including curvature and normal changes, from the registered point cloud, and to calculate the two-dimensional texture grayscale features of the registered point cloud. The three-dimensional geometric features and the two-dimensional texture grayscale features are fused and input into the defect detection model to determine whether the product to be inspected has defects and to identify the specific defect type.

[0052] The report generation module is used to divide the point cloud into assembly surface area and appearance surface area according to CAD semantics, call the corresponding tolerance library to determine whether each defect instance is acceptable, reworkable or scrapped, and generate an inspection report containing the defect location, type and judgment result.

[0053] The present invention has the following advantages:

[0054] 1. This invention significantly reduces specular glare on highly reflective aluminum alloy surfaces by using texture direction perception and dynamic angle adjustment of matrix light sources, combined with a light intensity-wavelength adaptive scheme based on saturated pixel grading. With multi-exposure grayscale weighted fusion, it can obtain a striped image with uniform contrast and no overexposure in a single scan. In the same scanning time, it can improve the point cloud integrity rate compared with a fixed lighting scheme, providing a more reliable three-dimensional data foundation for subsequent defect detection.

[0055] 2. This invention effectively distinguishes between machining textures such as tool marks and real defects by deeply fusing three-dimensional geometric features such as curvature and normal variation with two-dimensional grayscale texture features in a convolutional network. The detection results are then mapped to functional areas such as assembly surfaces and appearance surfaces according to CAD semantics, and differential thresholds are used to determine whether the parts are acceptable, require rework, or should be scrapped. This two-layer strategy of "feature fusion + functional tolerance" reduces the misjudgment rate of tool marks and scratches on complex curved parts, ensuring assembly accuracy while avoiding excessive scrapping. Attached Figure Description

[0056] Figure 1 This is a schematic diagram of the structure of the aluminum alloy CNC product defect detection system based on structured light scanning used in an embodiment of the present invention. Detailed Implementation

[0057] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this invention.

[0058] Example 1: A defect detection method for aluminum alloy CNC products based on structured light scanning, comprising:

[0059] Low-brightness uniform illumination is applied to the product under test, and images are acquired. The orientation gradient histogram and gray-level co-occurrence matrix are used to analyze the surface texture direction of the product under test, and the main orientation angle of the texture is obtained. These textures may originate from milling, turning, or other processing techniques. By confirming the main orientation angle of the texture, we can help adjust the emission angle of the light source to match the structured light stripes with the texture direction, thereby avoiding interference between the stripes and texture directions and ensuring image clarity. At the same time, the saturation pixel ratio of the structured light stripes in the image is statistically analyzed, and the reflection risk of the irradiated area is classified according to a preset threshold.

[0060] Based on the main direction angle of the processed texture, the emission angle of each unit in the matrix light source is dynamically adjusted, and the light source intensity and wavelength are set according to the reflection risk classification to generate a multi-exposure parameter sequence.

[0061] Under the control of the multi-exposure parameter sequence, multi-frequency multi-phase-shift structured light stripes are projected and corresponding images are acquired simultaneously. The acquired multi-exposure images are then subjected to grayscale weighted fusion to obtain an image sequence without overexposure stripes. The complete three-dimensional point cloud of the product to be inspected is then decoded and obtained. Conventional rigid body registration is then performed between the three-dimensional point cloud and the CAD model.

[0062] Three-dimensional geometric features, including curvature and normal variations, are extracted from the registered point cloud. At the same time, two-dimensional texture grayscale features of the registered point cloud are calculated. The three-dimensional geometric features and two-dimensional texture grayscale features are fused and input into the defect detection model to determine whether the product to be inspected has defects and to identify the specific defect type.

[0063] The process involves extracting 3D geometric features, including curvature and normal variation, from the registered point cloud, while simultaneously calculating 2D texture grayscale features of the registered point cloud. The specific steps are as follows: First, a neighborhood search is performed on the registered 3D point cloud. Based on each point and its spatial nearest neighbors, a local surface is fitted, the principal curvature value of that point is calculated, and the curvature magnitude is recorded. Within the same neighborhood, the angle difference of the normal direction of each point is calculated, and the degree of normal variation is represented by the statistical measure of the angle difference, thus obtaining curvature and normal variation features. Subsequently, the registered point cloud is projected into a depth map and a grayscale map according to the scanning viewpoint. The grayscale gradient magnitude and direction are calculated for the grayscale map, and texture grayscale features such as energy, contrast, and correlation are extracted using the grayscale co-occurrence matrix. Finally, the curvature features, normal variation features, and the grayscale texture features are concatenated according to spatial coordinate consistency to form a set of multi-scale fusion features for each point or surface, providing input for the subsequent defect detection model.

[0064] The system reads the set of faces related to functional attributes from the CAD model and maps the registered 3D point cloud to assembly face point sets and appearance face point sets according to face identifiers. Then, it calls a pre-established tolerance library for each functional area to obtain the form and position error threshold and surface defect threshold. Next, it iterates through all defect instances output by the defect detection model, matches them to their respective functional areas, and compares the defect size, depth, or residual value with the threshold corresponding to that area. When the measured value of the defect does not exceed the threshold, it is judged as acceptable; when it exceeds the threshold but falls within the reworkable range, it is judged as reworkable; when it exceeds the reworkable range, it is judged as scrapped. Finally, the judgment results, along with the defect location and defect type, are written into the inspection report for subsequent quality traceability and process decision-making.

[0065] The tolerance library is established as follows: First, the product surface is divided into assembly surface area and appearance surface area based on the semantic tags of the CAD model. Then, design tolerances, industry / customer standards, and first-piece measured data are summarized for each area. Three threshold levels are set according to the principle of "most stringent for assembly surface, second most stringent for appearance surface"—acceptable, reworkable, and scrapped. Among them, the assembly surface has the smallest threshold for form and position error and defect depth because it directly affects the assembly accuracy, while the appearance surface is allowed slightly more lenient scratch depth or local pits. All thresholds are written to the database in key-value pairs, with a version number and effective date. After the inspection is completed, the system writes back the actual defect data and calculates the rework rate and scrap rate. When the statistical results deviate from the target range, the threshold review and update are triggered to ensure that the tolerance library remains effective as process and quality requirements iterate.

[0066] The orientation gradient histogram and gray-level co-occurrence matrix are used to analyze the surface texture of the product under inspection and obtain the main orientation angle of the texture. The specific operation is as follows:

[0067] Preprocessing is performed on the acquired low-brightness uniformly illuminated images. The preprocessing includes grayscale conversion, noise filtering, and contrast enhancement to improve the signal-to-noise ratio of subsequent texture analysis.

[0068] The preprocessed image is divided into several sub-blocks according to a fixed-size grid, and a unique coordinate index is assigned to each sub-block for spatial mapping of subsequent orientation results;

[0069] Within each sub-block, the gradient accumulation value within the range of 0-180 degrees is statistically calculated based on the pixel gradient magnitude and orientation information to generate an orientation gradient histogram, which is used to reflect the main texture energy distribution of the sub-block.

[0070] For the same sub-block, gray-level co-occurrence matrices are constructed in the horizontal, vertical and 45° diagonal directions respectively, and three directional sensitivity indicators, energy, contrast and correlation, are calculated to supplement the directional judgment of weak texture or low contrast areas.

[0071] The statistical results obtained from the directional gradient histogram and gray-level co-occurrence matrix are normalized, and weights are applied to each directional angle according to the weighting rule of "texture energy priority, co-occurrence correlation correction". Then, the direction with the largest weight and the largest voting method is selected as the local texture main direction of the sub-block. The weighting rule and voting threshold are stored in the algorithm parameter table and can be fixed after being calibrated according to different aluminum alloy surface roughness lines. The weighting rule of "texture energy priority, co-occurrence correlation correction" can be understood as "two-step screening and one-step fine-tuning". First, the texture energy (i.e., gradient accumulation value) of each direction in the directional gradient histogram is calculated for each sub-block. The energy essentially reflects the surface tool marks in that direction. The intensity of the energy is determined by the direction of the highest energy, which is then selected as the candidate main texture direction. Subsequently, the correlation index of the same sub-block in the horizontal, vertical, and 45° directions is extracted using the gray-level co-occurrence matrix. The higher the correlation, the more ordered the gray-level distribution, indicating that the stripes in that direction are more continuous and there is less noise. If the correlation of the candidate direction is lower than that of the adjacent direction, the weight of the energy value is finely adjusted according to the correlation difference, allowing the adjacent direction to "overtake". Finally, the direction with the highest weight after energy correction is selected as the main texture direction of the sub-block. In short, the strongest texture direction is first "coarsely selected" by energy, and then the low-quality high-energy items are eliminated by "fine-tuning" with co-occurrence correlation. This preserves the knife-mark intensity information and avoids misjudgment caused by noise or local reflection.

[0072] After mapping the local principal directions of all sub-blocks to spherical coordinates, candidate global direction angles are obtained using spherical vector averaging. Then, morphological opening and closing operations are performed on the candidate results to eliminate outlier directions, and finally, the principal direction angle of the processing texture of the product to be inspected is determined.

[0073] The proportion of saturated pixels in the structured light stripes in the image is statistically analyzed, and the reflection risk of the illuminated area is classified according to a preset threshold. The specific operation is as follows:

[0074] A single fixed saturation grayscale threshold is set for the stripe brightness to determine whether a single pixel is overexposed, and first and second ratio thresholds are preset to distinguish between high risk, medium risk, and low risk.

[0075] According to the correspondence between the matrix light source and the camera field of view, the low-brightness uniform illumination image is divided into illumination sub-regions that correspond one-to-one with each emission unit; in each illumination sub-region, the number of pixels with gray values ​​higher than the saturation gray value threshold is counted, and the total number of pixels in the sub-region is recorded.

[0076] The saturated pixel ratio of the sub-region is obtained by dividing the number of saturated pixels by the total number of pixels. When the saturated pixel ratio is not lower than the first ratio threshold, the illuminated sub-region is marked as high reflectivity risk. When the saturated pixel ratio is between the first ratio threshold and the second ratio threshold, it is marked as medium reflectivity risk. When the saturated pixel ratio is lower than the second ratio threshold, it is marked as low reflectivity risk.

[0077] Based on the main direction angle of the processed texture, the emission angle of each unit in the matrix light source is dynamically adjusted, as follows:

[0078] The surface of the product to be tested is divided into several irradiation sub-regions, and each irradiation sub-region is uniquely associated with an emission unit in a matrix light source.

[0079] For each irradiated sub-region, the CAD model is called to obtain the unit normal vector n of the surface of that sub-region.

[0080] Based on the principal direction angle θ of the processed texture, a reference tangential vector t parallel to the texture direction is generated in the tangential plane of the sub-region, where t is a unit vector and satisfies... ;

[0081] Let v be the default incident direction vector of the light source (pointing towards the surface). Calculate the mirror reflection direction vector according to the well-known geometric optics law that "the angle of incidence equals the angle of reflection". ;

[0082] The target launch angle is calculated based on the specular reflection direction vector r and the reference tangential vector t:

[0083] Step 1: Within the mechanically accessible angle range allowed by the launching unit, select all incident direction vectors. The angle between this angle and the mirror reflection direction vector r is not less than the preset safety deviation angle. ;

[0084] Step 2: For all incident direction vectors that satisfy the conditions in Step 1 In the process, the vector with the smallest angle to the reference tangential vector t is selected and denoted as the final incident direction vector. ;

[0085] Step 3: Rotate the default incident direction vector v to the final incident direction vector. The required rotation angle is defined as the target launch angle of the launching unit; if the target launch angle exceeds the mechanical limit of the launching unit, the target launch angle is limited to the achievable limit range.

[0086] The target emission angles determined by all emission units are summarized to generate a set of light source control parameters.

[0087] Based on the reflection risk classification, the light source intensity and wavelength are set to generate a multi-exposure parameter sequence. The specific operation is as follows:

[0088] Establish a parameter comparison table: preset a set of light intensity levels and wavelength combinations for high reflection risk, medium reflection risk, and low reflection risk, and set at least two sets of complementary exposure times for each risk level;

[0089] Based on the risk level label of each irradiation sub-region, the sub-region index and the corresponding risk level are mapped to the parameter lookup table;

[0090] For high-reflection-risk sub-regions, select the lowest light intensity level and prioritize the use of near-infrared wavelengths;

[0091] For the high-risk sub-region of central reflection, select a medium light intensity level and use a short wavelength of visible light;

[0092] For the low-reflection-risk sub-region, select the highest light intensity level and use the entire visible light spectrum;

[0093] For each risk level, at least two sets of exposure time parameters are generated for the same combination of light intensity and wavelength, based on the complementary principle of "long exposure for low light intensity" and "short exposure for high light intensity," to cover the brightness dynamic range. The complementary principle of "long exposure for low light intensity" and "short exposure for high light intensity" means that, under the same fringe phase, two frames are captured using two sets of reciprocal parameters. In the first frame, the light source power is adjusted to the lower limit of the setting, and the exposure time is appropriately extended to capture details in the shadows without overexposure. In the second frame, the light source power is adjusted to the upper limit of the setting, and the exposure time is shortened to one-tenth to one-hundredth of the first frame (based on the camera's adjustable range) to avoid overexposure in bright areas while preserving highlight information. After pixel-level registration, the two frames are fused according to grayscale weights: pixels closer to the upper limit of saturation are sampled more from the first frame, and pixels with medium or darker brightness are sampled more from the second frame, thus synthesizing a fringe pattern that is neither overexposed nor underexposed throughout the entire grayscale dynamic range, providing a complete and reliable data foundation for subsequent phase decoding.

[0094] Light intensity, wavelength, and exposure time are packaged according to the order of the irradiated sub-regions to form a multi-exposure parameter sequence for all emitting units.

[0095] The acquired multi-exposure images are subjected to grayscale weighted fusion to obtain an image sequence without overexposure stripes. The specific operation is as follows:

[0096] Step S1: Perform pixel-level registration on two complementary exposure images with the same fringe phase to make the high-intensity-short exposure frame and the low-intensity-long exposure frame completely correspond in space.

[0097] Step S2: Based on the exposure time and light intensity of the two frames, calculate the grayscale weight coefficient of the corresponding pixels: pixels whose grayscale value is close to the saturation threshold are given a lower weight, and pixels whose grayscale value is in the central area of ​​the effective grayscale range are given a higher weight.

[0098] The gray levels of corresponding pixels in two frames are weighted and summed according to the aforementioned weights, and the summation result is cropped to the gray level range allowed by the image to generate an image without overexposure stripes;

[0099] Step S3: Repeat the above registration, weight calculation and weighted summation steps for all phase frames in the same multi-phase stripe image sequence to obtain a complete image sequence without overexposure stripes.

[0100] The defect detection model is based on a convolutional neural network and includes an input layer, a feature extraction layer group consisting of multiple levels of convolutional and pooling layers, at least one fully connected hidden layer, and an output layer. The input layer receives a multi-channel feature tensor formed by concatenating three-dimensional geometric features and two-dimensional grayscale texture features and normalizes it. The feature extraction layer group extracts local spatial features through convolution operations and downsamples them through pooling layers to enhance translation invariance and noise reduction capabilities. The fully connected hidden layer performs nonlinear mapping on the high-dimensional feature vector after convolution and performs feature dimensionality reduction. The output layer uses the Softmax function to generate probability distributions for each defect category and the no-defect category, which are used to determine whether the product to be detected has a defect and to give the defect type.

[0101] The specific steps for training the defect detection model are as follows:

[0102] Obtain several model training samples labeled with defect categories. Each training sample contains the 3D geometric features, 2D grayscale texture features, and corresponding defect labels of the registered point cloud. Then, randomly divide all training samples into a training set and a validation set. Use the training set to perform iterative training on the parameter-initialized defect detection model, and use the validation set as input after each round of training to obtain the validation accuracy and loss value. Set termination conditions, including the validation accuracy reaching a preset threshold or the validation loss not decreasing significantly for several consecutive rounds. When the validation result meets any termination condition, output the trained defect detection model. If not, continue to use the training set to iteratively update the defect detection model until the termination condition is met.

[0103] Example 2: A defect detection system for aluminum alloy CNC products based on structured light scanning, such as... Figure 1 As shown, it includes:

[0104] The image acquisition and analysis module is used to apply low-brightness uniform illumination to the product to be inspected and acquire images. It uses the directional gradient histogram and gray-level co-occurrence matrix to analyze the surface texture direction of the product to be inspected and obtain the main direction angle of the texture. At the same time, it calculates the saturation pixel ratio of the structured light stripes in the image and classifies the reflection risk of the irradiated area according to a preset threshold.

[0105] An adaptive lighting control module is used to dynamically adjust the emission angle of each unit in the matrix light source according to the main direction angle of the processed texture, and set the light source intensity and wavelength according to the reflection risk classification to generate a multi-exposure parameter sequence.

[0106] The point cloud reconstruction module is used to project multi-frequency multi-phase-shift structured light stripes and simultaneously acquire corresponding images under the control of the multi-exposure parameter sequence. It performs grayscale weighted fusion on the acquired multi-exposure images to obtain an image sequence without overexposure stripes, and then decodes and acquires the complete three-dimensional point cloud of the product to be inspected. It also performs conventional rigid body registration between the three-dimensional point cloud and the CAD model.

[0107] The defect detection module is used to extract three-dimensional geometric features, including curvature and normal changes, from the registered point cloud, and to calculate the two-dimensional texture grayscale features of the registered point cloud. The three-dimensional geometric features and the two-dimensional texture grayscale features are fused and input into the defect detection model to determine whether the product to be inspected has defects and to identify the specific defect type.

[0108] The report generation module is used to divide the point cloud into assembly surface area and appearance surface area according to CAD semantics, call the corresponding tolerance library to determine whether each defect instance is acceptable, reworkable or scrapped, and generate an inspection report containing the defect location, type and judgment result.

[0109] It should be understood that those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims. Parts not described in detail in this specification are prior art known to those skilled in the art.

Claims

1. A method for detecting defects in an aluminum alloy CNC product based on structured light scanning, characterized in that, The method comprises the following steps: Apply low-brightness uniform light to the product to be detected and collect images, analyze the surface processing texture direction of the product to be detected by using a histogram of oriented gradients and a gray level co-occurrence matrix, and obtain the main direction angle of the processing texture of the product to be detected; meanwhile, the saturation pixel proportion of the structured light stripe in the image is counted, and the irradiation area is classified according to a preset threshold; Based on the main direction angle of the processing texture, the emission angle of each unit in the matrix light source is dynamically adjusted, and the light source intensity and wavelength are set according to the reflection risk classification to generate a multi-exposure parameter sequence; Under the control of the multi-exposure parameter sequence, a multi-frequency and multi-phase structured light stripe is projected, and the corresponding image is collected synchronously, the multi-exposure images obtained are subjected to gray weighted fusion to obtain a non-overexposed stripe image sequence, and then the complete three-dimensional point cloud of the product to be detected is obtained by decoding; The three-dimensional point cloud and the CAD model are subjected to regular rigid body registration; Three-dimensional geometric features including curvature and normal variation are extracted from the registered point cloud, and the two-dimensional texture gray features of the registered point cloud are calculated; The three-dimensional geometric features and the two-dimensional texture gray features are fused and input into a defect detection model to determine whether the product to be detected has defects and identify the specific defect type; According to the CAD semantics, the point cloud is divided into assembly surface regions and appearance surface regions, a corresponding tolerance library is called to determine whether each defect instance is acceptable, needs to be repaired or needs to be scrapped, and a detection report containing the defect position, type and determination result is generated; Based on the main direction angle of the processing texture, the emission angle of each unit in the matrix light source is dynamically adjusted, and the specific operation is as follows: The surface of the product to be detected is divided into a plurality of irradiation sub-regions, and each irradiation sub-region is uniquely corresponding to one emission unit in the matrix light source; For each irradiation sub-region, the unit normal vector n of the surface of the sub-region is obtained by calling the CAD model; According to the angle of the main direction of the processing texture θ, a reference tangential vector t parallel to the texture direction is generated in the tangent plane of the sub-zone, where t is a unit vector and satisfies ; Let the default incident direction vector of the light source be v, and calculate the mirror reflection direction vector ; The target emission angle is calculated based on the mirror reflection direction vector r and the reference tangent vector t: Step one: select all incident direction vectors within the mechanically accessible angle range allowed by the transmitting unit , so that the angle between them and the mirror reflection direction vector r is not less than the preset safety deviation angle ; Step two: select the incident direction vector with the minimum angle with the reference tangent vector t as the final incident direction vector Step two: select the incident direction vector with the minimum angle with the reference tangent vector t as the final incident direction vector ; Step three: rotate the default incident direction vector v to the final incident direction vector The required rotation angle is defined as the target emission angle of the emission unit; if the target emission angle exceeds the mechanical limit of the emission unit, the target emission angle is limited within the reachable limit range; The target emission angles determined by all the emission units are collected to generate a light source control parameter set; According to the reflection risk classification, the light source intensity and wavelength are set to generate a multi-exposure parameter sequence, and the specific operation is as follows: A parameter reference table is established: a group of light intensity levels and wavelength combinations are preset for high reflection risk, medium reflection risk and low reflection risk, and at least two sets of complementary exposure time are set for each risk level; Based on the risk level label of each irradiation sub-region, the sub-region index and the corresponding risk level are mapped to the parameter reference table; For the high reflection risk sub-region, the lowest light intensity level is selected and the near-infrared wavelength is used; For the medium reflection risk sub-region, the medium light intensity level is selected and the visible light short wavelength is used; For the low reflection risk sub-region, the highest light intensity level is selected and the visible light full band is used; For each risk level, at least two sets of exposure time parameters are generated for the same light intensity and wavelength combination according to the principle of "low light intensity long exposure" and "high light intensity short exposure" to cover the dynamic range of brightness; The light intensity, wavelength and exposure time are packaged according to the irradiation sub-region arrangement order to form a multi-exposure parameter sequence for all the emission units.

2. The structured light scanning based aluminum alloy CNC product defect detection method according to claim 1, wherein, The direction gradient histogram and the gray level co-occurrence matrix are used to analyze the surface processing texture of the product to be detected, and the main direction angle of the processing texture of the product to be detected is obtained, and the specific operation is as follows: The collected low-brightness uniform light image is subjected to grayscale, filtering and contrast enhancement preprocessing; The preprocessed image is divided into a plurality of subblocks according to a fixed grid; The 0-180° direction gradient histogram is calculated in each subblock, and the gray level co-occurrence matrix of the horizontal, vertical and 45° direction is constructed, and the energy, contrast and correlation indexes are extracted; The statistical results of the direction gradient histogram and the gray level co-occurrence matrix are normalized, the scores of each direction are calculated according to the preset weighting rule, and the direction with the maximum score is selected as the local texture direction of the subblock; The local texture directions are mapped into spherical vectors, and the average is calculated, and the outliers are removed by morphological smoothing, so that the main direction angle of the processing texture of the product to be detected is obtained.

3. The structured light scanning based aluminum alloy CNC product defect detection method according to claim 2, wherein, The saturation pixel proportion of the structured light stripe in the image is counted, and the irradiation area is classified according to the preset threshold, and the specific operation is as follows: A single fixed saturation gray threshold is set for the stripe brightness to determine whether a single pixel is overexposed, and first and second proportion thresholds are set in advance to distinguish high risk, medium risk and low risk; According to the corresponding relationship between the matrix light source and the camera field of view, the low-brightness uniform light image is divided into irradiation subzones corresponding to each emission unit; in each irradiation subzone, the number of pixels with a gray value higher than the saturation gray threshold is counted, and the total number of pixels in the subzone is recorded; The saturation pixel proportion of the structured light stripe in the image is counted, and the irradiation area is classified according to the preset threshold, and the specific operation is as follows: Step S1: The two complementary exposure images of the same stripe phase are pixel-level registered, so that the high light intensity-short exposure frame and the low light intensity-long exposure frame correspond completely in space; 4. The structured light scanning based aluminum alloy CNC product defect detection method according to claim 3, wherein, Step S2: According to the exposure time and light intensity of the two frames, the gray weight coefficient of the corresponding pixels is calculated: the pixel with the gray value close to the saturation threshold is given a lower weight, and the pixel with the gray value in the central region of the effective gray range is given a higher weight; The gray values of the corresponding pixels of the two frames are weighted and summed according to the aforementioned weight, and the summation result is clipped to the allowed gray range of the image to generate a non-overexposed stripe image; Step S3: Repeat the above registration, weight calculation and weighted summation steps for all phase frames in the same multi-phase stripe image sequence to obtain a complete non-overexposed stripe image sequence. ​ ​ 5. The structured light scanning based aluminum alloy CNC product defect detection method according to claim 4, wherein, The defect detection model is established based on a convolutional neural network and includes an input layer, a feature extraction layer group composed of multiple convolutional layers and pooling layers, at least one fully connected hidden layer, and an output layer. The input layer is used to receive a multi-channel feature tensor formed by splicing three-dimensional geometric features and two-dimensional gray texture features and perform normalization processing thereon. The feature extraction layer group extracts local spatial features through convolutional operation and down-samples through the pooling layer to enhance translation invariance and noise reduction capability. The fully connected hidden layer performs nonlinear mapping on the high-dimensional feature vector after convolutional processing and executes feature dimension reduction. The output layer generates a probability distribution of each defect category and a non-defect category using a Softmax function, which is used to determine whether the product to be detected has defects and give the defect type.

6. An aluminum alloy CNC product defect detection system based on structured light scanning, characterized by, The system is applied to the aluminum alloy CNC product defect detection method based on structured light scanning in any one of claims 1-5, comprising: an image acquisition and analysis module for applying low-brightness uniform light to the product to be detected and acquiring images, analyzing the surface processing texture direction of the product to be detected using a histogram of oriented gradients and a gray level co-occurrence matrix, and obtaining the main direction angle of the processing texture of the product to be detected; at the same time, the saturation pixel proportion of the structured light stripe in the image is counted, and the irradiation area is classified according to the reflection risk according to a preset threshold; an adaptive lighting control module for dynamically adjusting the emission angle of each unit in the matrix light source according to the main direction angle of the processing texture, and setting the light source intensity and wavelength according to the reflection risk classification to generate a multi-exposure parameter sequence; a point cloud reconstruction module for projecting multi-frequency and multi-phase structured light stripes under the control of the multi-exposure parameter sequence and synchronously acquiring corresponding images, performing gray weighted fusion on the acquired multi-exposure images to obtain a non-overexposed stripe image sequence, and then decoding to obtain the complete three-dimensional point cloud of the product to be detected; performing regular rigid body registration on the three-dimensional point cloud and the CAD model; a defect detection module for extracting three-dimensional geometric features including curvature and normal variation from the registered point cloud, and calculating two-dimensional texture gray features of the registered point cloud; inputting the three-dimensional geometric features and two-dimensional texture gray features after fusion into the defect detection model to determine whether the product to be detected has defects and identify the specific defect type; a report generation module for dividing the point cloud into assembly surface area and appearance surface area according to CAD semantics, calling the corresponding tolerance library to determine whether each defect instance is acceptable, repairable or scrap, and generating a detection report containing defect position, type and determination result.

Citation Information

Patent Citations

  • 3D visual detection system based on structured light imaging

    CN112067626A

  • Metal luster area-based steel wire rope defect detection method

    CN114049316A