Metal part defect identification method and system based on image processing technology

Through the method based on image processing technology, a three-dimensional model of metal parts is constructed to identify structural curvature and surface texture defects, solving the problems of low manual detection efficiency and lack of depth information in the existing technology, and achieving efficient and accurate defect detection.

CN120064296AInactive Publication Date: 2025-05-30WEIHAI DEZHI MACHINERY TECHNOLOGY CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510360235.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-05-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing metal component defect image processing technology relies on manual detection, is inefficient and susceptible to subjective factors, and the two-dimensional imaging technology lacks in-depth information, making it difficult to meet the detection needs of complex defects.

Method used

Using an image processing technology method, by acquiring multi-angle images of metal parts, image enhancement and structure detection, a three-dimensional model is constructed, and structural curvature and surface texture defects are identified.

Benefits of technology

It improves the accuracy and completeness of defect detection of metal parts, reduces the dependence of manual inspection, and ensures the reliability and efficiency of inspection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120064296A_ABST
    Figure CN120064296A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a metal part defect identification method and system based on an image processing technology. The method comprises the following steps: obtaining a to-be-detected metal part; performing wide-frequency-band reflection spectrum scanning on the to-be-detected metal part to obtain a material of the to-be-detected metal part; and carrying out sinusoidal reflection judgment on the material of the to-be-detected metal part to obtain reflection data of the to-be-detected metal part. Through the data processing technology, the image processing technology and the three-dimensional modeling technology, variable light source image scanning is carried out on the metal part, image enhancement is carried out on the image of the metal part, and therefore the three-dimensional model of the metal part is constructed, defect recognition is carried out on the metal part, and the accuracy of defect detection of the metal part is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly to a method and system for identifying defects of metal parts based on image processing technology. Background Art

[0002] The surface of metal parts usually has high reflectivity, and its reflection property is between diffuse reflection and specular reflection. That is, uneven illumination will seriously affect the image quality, making it difficult to identify defect features; the optical characteristics of specific metal part defects (such as scratches) have obvious directivity and will only appear at specific illumination angles, being completely invisible at other angles; in addition, water stains and oil stains on the surface of metal parts will form bright spots after drying, which are easily confused with real defects such as circular dents; the types of defects of metal parts are complex and diverse, including scratches, cracks, pores, and inclusions; the existing image processing technologies for metal part defects mainly rely on manual inspection, which is inefficient and easily affected by subjective factors; single bright-field or dark-field illumination is difficult to meet the detection requirements for complex defects, and two-dimensional imaging technology lacks depth information, resulting in poor detection effects for defects with concave-convex structures and a high missed detection rate. Summary of the Invention

[0003] Based on this, it is necessary to provide a method and system for identifying defects of metal parts based on image processing technology to solve at least one of the above technical problems.

[0004] To achieve the above object, a method for identifying defects of metal parts based on image processing technology, the method includes the following steps:

[0005] Step S1: Obtain the metal part to be tested; perform broadband reflection spectrum scanning on the metal part to be tested to obtain the material of the metal part to be tested; perform sine reflection judgment on the material of the metal part to be tested to obtain the reflection data of the metal material to be tested;

[0006] Step S2: According to the reflection data of the metal material to be tested, use a variable light source scanning device to modulate the metal part with multi-wavelength light sources and collect multi-angle images of the metal part to obtain multi-angle images of the metal part;

[0007] Step S3: Perform pixel enhancement at multiple image points on the multi-angle images of the metal part to generate multi-angle enhanced images of the part; perform phase detection on the structural relationship of the part on the multi-angle enhanced images of the part and measure the parameters of the part structure to obtain part structure data; perform surface texture level recognition on the multi-angle enhanced images of the part to obtain surface texture feature data; construct a three-dimensional model of the metal part to be tested based on the part structure data and the surface texture feature data;

[0008] Step S4: Identify the bending degree of the component structure of the three-dimensional model of the metal component to be tested, measure the bending degree co-occurrence matrix of the component structure bending degree to obtain the bending degree co-occurrence matrix; detect the component structure bending degree defects according to the bending degree co-occurrence matrix to obtain the component structure defect data; identify the surface texture defects of the three-dimensional model of the metal component to be tested to obtain the surface texture defect data; output the component structure defect data and the surface texture defect data as a metal component defect report.

[0009] The present invention can provide an accurate material information basis for subsequent image acquisition by obtaining the metal part to be measured and determining its material, and at the same time performing material reflection judgment to obtain the material reflection data of the metal to be measured. Based on the accurate material reflection data, the reasonable setting of light source parameters in the subsequent image acquisition process can be ensured, thereby effectively improving the quality and accuracy of image acquisition, laying a reliable data foundation for the subsequent defect identification link, avoiding image acquisition errors caused by material property differences, and ensuring the efficiency and reliability of the entire defect identification process. According to the material reflection data of the metal to be measured, a variable light source scanning device is used to perform multi-angle image acquisition on the metal part, and comprehensive and high-quality multi-angle images of the metal part can be obtained. This multi-angle image acquisition method can fully capture the appearance characteristics of the metal part from different perspectives, including structural details and surface textures, etc., providing a rich and accurate image data source for subsequent image processing and defect identification, ensuring that the subsequent analysis process can be based on comprehensive image information, thereby effectively improving the accuracy and integrity of defect identification. Image enhancement is performed on the multi-angle images of the metal part to generate multi-angle enhanced images of the part, which can effectively improve the clarity and contrast of the images, making the structural details and surface texture features of the part more obvious and easy to identify. Furthermore, component structure detection is performed on the multi-angle enhanced images of the part and the parameters of the component structure are measured to obtain component structure data, and surface texture feature extraction is performed to obtain surface texture feature data. These operations can accurately obtain the structural and texture feature information of the metal part. Based on the component structure data and surface texture feature data, a three-dimensional model of the metal part to be measured is constructed, which can realize the all-round and three-dimensional modeling of the metal part, completely presenting the internal and external structures and surface features of the part, providing a highly restored and accurate three-dimensional model basis for subsequent defect identification, making defect identification more accurate and comprehensive, and being able to cover all parts and details of the part. Component structure curvature identification is performed on the three-dimensional model of the metal part to be measured, and component structure curvature defects are detected to obtain component structure defect data, and surface texture defect identification is performed to obtain surface texture defect data, which can accurately locate and quantify the structural and surface defect conditions of the metal part. Outputting the component structure defect data and surface texture defect data as a defect report of the metal part can provide detailed, accurate and clearly directional defect information for subsequent quality assessment, repair decision-making and process improvement, facilitating relevant personnel to quickly understand the defect status of the part and take corresponding measures, effectively improving the quality detection efficiency and reliability of the metal part, and ensuring the performance and safety of the metal part in practical applications. Therefore, the present invention uses data processing technology, image processing technology and three-dimensional modeling technology to realize variable light source image scanning of metal parts, enhance metal part images, and construct a three-dimensional model of metal parts, thereby improving the accuracy of metal part defect detection.

[0010] Preferably, step S1 includes the following steps:

[0011] Step S11: Obtain the metal part to be tested;

[0012] Step S12: Use a metallurgical microscope to perform material detection on the metal part to be tested, and set the measurement time to 120 - 150 seconds and the measurement accuracy to ±0.1% to obtain the material of the metal part to be tested;

[0013] Step S13: Use the metallurgical microscope again to perform reflection spectrum measurement on the material of the metal part to be tested. Set the measurement wavelength range of the spectral analyzer to 400 - 700 nanometers, the integration time to 50 - 60 milliseconds, and the sampling interval to 1 nanometer;

[0014] Step S14: Perform three repeated measurements on the measured reflection spectrum, with a measurement interval of 2 seconds each time. Take the arithmetic mean of the three measurement results as the final reflection spectrum data to generate material reflection spectrum data;

[0015] Step S15: Calculate the average reflectivity of the metal part to be tested based on the material reflection spectrum data to obtain the reflection data of the metal material to be tested.

[0016] In the present invention, by obtaining the metal part to be tested, the accuracy and consistency of the detection object are ensured; by using a metallurgical microscope and setting the measurement time to 120 - 150 seconds and the measurement accuracy to ±0.1%, the material of the metal part to be tested can be accurately detected, ensuring the high precision and reliability of the material detection result; by setting the measurement wavelength range of the spectral analyzer to 400 - 700 nanometers, the integration time to 50 - 60 milliseconds, and the sampling interval to 1 nanometer, the visible light band can be comprehensively covered and the reflection spectrum information can be accurately collected, ensuring the integrity and accuracy of the reflection spectrum data; by performing three repeated measurements on the reflection spectrum, with a measurement interval of 2 seconds each time, and taking the arithmetic mean as the final reflection spectrum data, the measurement error can be effectively reduced, the stability and reliability of the data can be improved, and the generated material reflection spectrum data can accurately reflect the reflection characteristics of the metal part to be tested; by calculating the average reflectivity of the metal part to be tested based on the material reflection spectrum data, the surface reflection characteristics of the metal part can be accurately characterized, ensuring the scientificity and effectiveness of the detection process.

[0017] Preferably, step S2 includes the following steps:

[0018] Step S21: According to the reflection data of the metal material to be tested, select a variable light source scanning device, and set the light source of the variable light source scanning device to three different wavelengths, namely 450 - 500 nanometers, 550 - 600 nanometers, and 650 - 700 nanometers;

[0019] Step S22: Scan the device with a variable light source and set the light source intensity to 50 - 60%, 70 - 80%, and 90 - 100%, corresponding to light sources of three different wavelengths respectively;

[0020] Step S23: Collect multi - angle images of the metal parts. The collection angles include 0°, 45°, and 90°. Each angle is irradiated with light sources of three different wavelengths respectively;

[0021] Step S24: At each angle, use a metallurgical microscope to collect images, set the resolution to 1080×1080 to 2048×2048 pixels, and set the exposure time to 10 - 15 milliseconds;

[0022] Step S25: Collect nine images under different conditions and mark them with different conditions to obtain multi - angle images of the metal parts.

[0023] The present invention selects a variable light source scanning device according to the reflection data of the metal material to be measured and sets three different wavelengths (450 - 500 nm, 550 - 600 nm, 650 - 700 nm). It can select an appropriate light source wavelength according to the reflection characteristics of the metal parts, ensuring the matching of the light source and the material reflection characteristics during the image collection process, thereby improving the contrast and clarity of the images; setting the light source intensities to 50 - 60%, 70 - 80%, and 90 - 100% respectively, corresponding to light sources of three different wavelengths, can adjust the light source intensity according to the characteristics of light sources of different wavelengths, further optimizing the image collection conditions and ensuring high - quality image data can be obtained at different wavelengths; collecting multi - angle (0°, 45°, 90°) images of the metal parts and irradiating each angle with light sources of three different wavelengths can comprehensively capture the image information of the metal parts under different lighting conditions and perspectives, avoiding information loss caused by a single angle or a single - wavelength light source; at each angle, using a metallurgical microscope to collect images, setting the resolution to 1080×1080 to 2048×2048 pixels, and setting the exposure time to 10 - 15 milliseconds can ensure that the collected images have high resolution and appropriate exposure, guaranteeing the clear presentation of image details; collecting nine images under different conditions and marking them with different conditions can clearly distinguish the images under different collection conditions, facilitating subsequent image processing and analysis, and ensuring the integrity and traceability of the image data.

[0024] Preferably, step S3 includes the following steps:

[0025] Step S31: Traverse the pixel points of the multi - angle images of the metal parts and extract the values of each pixel point to obtain the pixel values of the metal parts;

[0026] Step S32: Grayscale the pixel values of the metal component, where the weight of the red channel is set to 0.299, the weight of the green channel is set to 0.587, and the weight of the blue channel is set to 0.114, to obtain a multi-angle grayscale image;

[0027] Step S33: Extract all pixel grayscale values of the multi-angle grayscale image, and perform a difference calculation on the pixel grayscale values to obtain the pixel grayscale difference;

[0028] Step S34: Set the pixel grayscale difference threshold to 20. If the pixel grayscale difference is greater than or equal to 20, retain the pixel point; if the pixel grayscale difference is less than 20, remove the pixel point;

[0029] Step S35: Enhance the contrast of the removed pixel points to generate a multi-angle enhanced image of the component;

[0030] Step S36: Detect the component structure of the multi-angle enhanced image of the component, and measure the parameters of the component structure to obtain component structure data; extract the surface texture feature of the multi-angle enhanced image of the component to obtain surface texture feature data;

[0031] Step S37: Construct a three-dimensional model of the metal component to be tested based on the component structure data and the surface texture feature data.

[0032] Through traversing the pixel points of the multi-angle images of the metal component and extracting the values of each pixel point, the present invention can completely obtain the original pixel information of the image; by grayscaling the pixel values of the metal component and converting the color image into a grayscale image using the weighting coefficients (red channel weight 0.299, green channel weight 0.587, blue channel weight 0.114), it can effectively reduce the data volume while retaining the key information of the image; by extracting all pixel grayscale values of the multi-angle grayscale image and performing a difference calculation, it can quantify the grayscale change between images at different angles; by setting the pixel grayscale difference threshold to 20 and screening the pixel grayscale difference, retaining the pixel points with a grayscale difference greater than or equal to 20 and removing those less than 20, it can effectively remove the noise and redundant information in the image and highlight the key features in the image; by enhancing the contrast of the screened pixel points, it can further improve the clarity and recognizability of the image, providing a high-quality image basis for subsequent structure detection and texture feature extraction; by detecting the component structure of the multi-angle enhanced image of the component and simultaneously extracting the surface texture feature of the component to obtain the surface texture feature data, it can comprehensively obtain the geometric structure and surface texture information of the metal component; by constructing a three-dimensional model of the metal component to be tested based on the component structure data and the surface texture feature data, it can completely restore the three-dimensional shape and surface features of the metal component.

[0033] Preferably, step S36 includes the following steps:

[0034] Step S361: Perform edge detection on the multi-angle enhanced image of the component, and mark the component edge information of the multi-angle enhanced image of the component to obtain a component edge marked image;

[0035] Step S362: Extract the inner and outer contours of the component from the component edge marked image, divide the component inner and outer contours into component structures, and calculate the length, width, and area of the component structure to obtain component structure data;

[0036] Step S363: Divide the multi-angle enhanced image of the component, and set the divided pixels to 4×4 to 8×8 to obtain a component block image;

[0037] Step S364: Traverse the pixel gray values of the component block image, and calculate the standard deviation and variance of its pixel gray values to obtain block pixel gray feature values;

[0038] Step S365: Determine the pixel gray gradient of the block pixel gray feature values, and map the pixel gray gradient to surface texture feature data.

[0039] The present invention performs edge detection on the multi-angle enhanced image of the component and marks the component edge information, which can accurately identify the edge features of metal components and ensure the accuracy of structure detection; extracts the inner and outer contours of the component edge marked image, divides the component structure, and calculates the length, width, and area of the component structure, which can accurately divide the geometric structure of metal components, quantify its size parameters, and provide an accurate structural basis for 3D model construction and defect recognition; divides the multi-angle enhanced image of the component, sets the divided pixels to 4×4 to 8×8, and by dividing the image into small blocks, can localize the image information, improve the efficiency and accuracy of image feature extraction; traverses the pixel gray values of the component block image, calculates the standard deviation and variance of its pixel gray values, which can quantify the gray change characteristics of each block, reflect the local texture complexity and consistency of the image, and provide data support for surface texture feature extraction; determines the pixel gray gradient of the block pixel gray feature values and maps the pixel gray gradient to surface texture feature data, which can convert the gray feature values into intuitive texture feature data, comprehensively reflect the texture information on the surface of metal components, and provide rich texture details for defect recognition.

[0040] Preferably, step S37 includes the following steps:

[0041] Step S371: Determine the three-dimensional dimensions of the metal component according to the extracted component structure data, where the length is L millimeters, the width is W millimeters, and the height is H millimeters;

[0042] Step S372: Create a blank 3D model framework using 3D modeling software, and set the length, width, and height of the model to L, W, and H respectively to obtain a metal part size model;

[0043] Step S373: Determine the texture roughness, direction, and uniformity of the surface of the metal part according to the surface texture feature data;

[0044] Step S374: Adjust the texture roughness of the metal part size model, and set the areas with roughness values greater than 0.5 to high texture depth and the areas less than 0.5 to low texture depth;

[0045] Step S375: Adjust the texture direction of the metal part size model, and set the areas with directionality values greater than 0.7 to strongly directional textures and the areas less than 0.3 to non-directional textures;

[0046] Step S376: Adjust the texture uniformity of the metal part size model, and set the areas with uniformity values greater than 0.8 to uniform textures and the areas less than 0.2 to non-uniform textures;

[0047] Step S377: Smooth the surface of the model, and set the number of smoothing iterations to 5 times to obtain a 3D model of the metal part to be tested.

[0048] The invention determines the three-dimensional size (length L mm, width W mm, height H mm) of the metal parts according to the extracted component structure data, can accurately quantify the geometric shape of the parts, provide an accurate size basis for the creation of the three-dimensional model, and ensure the size consistency between the model and the actual parts; a blank three-dimensional model frame is created by using three-dimensional modeling software, and the length, width and height of the model are set to L, W and H respectively, to obtain the metal parts size model, and the initial model frame can be constructed based on the accurate size data, and a standardized geometric carrier is provided for subsequent texture feature mapping, so as to ensure the accuracy of model construction; the texture roughness, direction and uniformity of the surface of the metal parts are determined according to the surface texture feature data, and the texture characteristics of the surface of the parts can be fully characterized, so as to ensure that the texture characteristics are consistent with the actual parts surface; the texture roughness of the metal parts size model is adjusted, and the area with a roughness value greater than 0.5 is set to a high texture depth, and the area with a roughness value less than 0. 5 is set as low texture depth, which can accurately distinguish the depth difference of surface texture, enhance the model's ability to reproduce the details of the surface texture of parts and components, and improve the realism of the model; the texture direction of the metal part size model is adjusted, and the area with a directionality value greater than 0.7 is set as a strong directional texture, and the area with a directionality value less than 0.3 is set as a non-directional texture, which can accurately reflect the directional characteristics of the surface texture of the parts and components, further optimize the model's expression of texture direction, and enhance the model's detail expression; the texture uniformity of the metal part size model is adjusted, and the area with a uniformity value greater than 0.8 is set as a uniform texture, and the area with a uniformity value less than 0.2 is set as a non-uniform texture, which can effectively distinguish the uniform and non-uniform areas of the texture, so that the model can more realistically reflect the texture distribution state of the surface of the parts and components, and improve the accuracy of the model; the model surface is smoothed, and the number of smoothing iterations is set to 5 times to obtain the three-dimensional model of the metal part to be tested. This step can eliminate minor flaws and noise on the model surface, optimize the surface quality of the model, and ensure that the model has better stability and reliability in subsequent defect identification.

[0049] Preferably, step S4 comprises the following steps:

[0050] Step S41: identifying the curvature of the component structure on the three-dimensional model of the metal component to be tested, and measuring the curvature co-occurrence matrix of the component structure curvature to obtain the curvature co-occurrence matrix;

[0051] Step S42: Detect component structure curvature defects according to the curvature co-occurrence matrix to obtain component structure defect data;

[0052] Step S43: performing surface texture defect recognition on the three-dimensional model of the metal component to be tested to obtain surface texture defect data;

[0053] Step S44: Classify the component structure defect data and the surface texture defect data by defect type, and label the defect type to obtain defect type labeled data;

[0054] Step S45: Perform data visualization based on the defect type labeled data to obtain a metal component defect report.

[0055] The present invention identifies the component structure curvature of the three-dimensional model of the metal component to be measured, measures the curvature co-occurrence matrix of the component structure curvature, and obtains the curvature co-occurrence matrix, which can quantitatively describe the characteristics of the component structure curvature and provide accurate quantitative data for subsequent defect detection, thereby realizing the accurate identification of curvature defects; detects the component structure curvature defects according to the curvature co-occurrence matrix to obtain component structure defect data, which can accurately identify the curvature defects in the component structure based on the quantitative data and ensure the accuracy and reliability of defect detection; identifies the surface texture defects of the three-dimensional model of the metal component to be measured to obtain surface texture defect data, which can comprehensively detect the texture defects on the surface of the metal component, such as scratches and cracks, and provide complete surface texture defect information for subsequent defect classification and report generation; classifies the component structure defect data and the surface texture defect data by defect type and labels the defect type to obtain defect type labeled data, which can accurately classify and label the detected defects and provide detailed classification information for the generation of defect reports; performs data visualization according to the defect type labeled data to obtain a metal component defect report, which can intuitively display the location, type and severity of the defects, facilitate technicians to quickly understand the defect status of the components, and thus improve the efficiency and accuracy of defect handling.

[0056] Preferably, step S41 includes the following steps:

[0057] Step S411: Perform component structure mesh division on the three-dimensional model of the metal component to be measured, and set the side length of the structure mesh unit to 1.0 - 1.5 mm;

[0058] Step S412: For each structure mesh unit, calculate the change rate of its normal vector as the local curvature of the unit; normalize the local curvature value to the range of 0 to 1, where 0 represents no curvature and 1 represents the maximum curvature;

[0059] Step S413: Perform threshold segmentation on the normalized curvature data, and set the curvature threshold to 0.5;

[0060] Step S414: Mark the areas with curvature greater than 0.5 as potential curvature areas, and extract the coordinates and curvature values of these areas;

[0061] Step S415: Initialize the curvature value variable to accumulate the curvature values of all grid cells in this area; traverse all grid cells in this area, and accumulate the curvature value of each grid cell into the above variable; calculate the total number of grid cells in this area, divide the accumulated value by the total number of grid cells to obtain the average curvature; initialize the standard deviation variable to accumulate the squares of the differences between the curvature of each grid cell and the average curvature.

[0062] Step S416: Traverse all grid cells in this area, calculate the squares of the differences between the curvature of each grid cell and the average curvature, and accumulate them into the above variable; divide the accumulated value by the total number of grid cells, calculate the square root of the above result to obtain the standard deviation; if the average curvature of a certain area is greater than 0.8 and the standard deviation is less than 0.1, it is determined that there is a bending defect in this area.

[0063] Step S417: Record the coordinates, average curvature, and standard deviation of the area with bending defects to obtain the component structure defect data.

[0064] The present invention performs component structure grid division on the three-dimensional model of the metal component to be tested, and sets the side length of the structure grid cell to 1.0 - 1.5 mm, which can decompose the complex three-dimensional structure into multiple small units, facilitating subsequent accurate local curvature calculation for each unit; for each structure grid cell, calculate the change rate of its normal vector as the local curvature of the cell, and normalize the local curvature value to the range of 0 to 1, where 0 represents no bending and 1 represents the maximum bending, which can realize the quantization and standardization of local curvature and facilitate subsequent threshold segmentation; perform threshold segmentation on the normalized curvature data, set the curvature threshold to 0.5, which can quickly screen out the areas with bending defects and improve the efficiency of defect recognition; mark the areas with curvature greater than 0.5 as potential bending areas, and extract the coordinates and curvature values of these areas, which can accurately locate the positions of potential bending defects and provide a basis for subsequent detailed analysis; initialize the curvature value variable to accumulate the curvature values of all grid cells in this area and calculate the average curvature, and at the same time initialize the standard deviation variable to calculate the degree of dispersion of the curvature, which can quantitatively statistically analyze the curvature of the potential bending area and provide data support for further judging whether it is a defect; traverse all grid cells in the potential bending area, calculate the squares of the differences between the curvature of each grid cell and the average curvature, and accumulate them into the standard deviation variable, and finally calculate the standard deviation, which can accurately measure the degree of dispersion of the curvature in this area and provide a more accurate basis for judging bending defects; if the average curvature of a certain area is greater than 0.8 and the standard deviation is less than 0.1, it is determined that there is a bending defect in this area, and record the coordinates, average curvature, and standard deviation of the area with bending defects to obtain the component structure defect data, which can accurately identify and record the detailed information of bending defects.

[0065] Preferably, step S42 includes the following steps:

[0066] Step S421: Perform component surface meshing on the three-dimensional model of the metal component to be measured, and set the side length of the surface mesh cells to 0.5 - 1.0 mm;

[0067] Step S422: For each surface mesh cell, extract the gray value of its surface texture;

[0068] Step S423: Calculate the gray-level co-occurrence matrix of each mesh cell, set the offset distance of the gray-level co-occurrence matrix to 1 pixel, and the directions to 0°, 45°, 90°, and 135°;

[0069] Step S424: For each direction, count the frequency of occurrence of the gray values of adjacent pixel pairs to obtain the gray-level co-occurrence matrix;

[0070] Step S425: Perform matrix contrast measurement on the gray-level co-occurrence matrix to generate surface texture measurement parameters;

[0071] Step S426: Determine the texture defect area of the three-dimensional model of the metal component to be measured according to the surface texture measurement parameters, and record the area coordinates and contrast of the texture defect to obtain surface texture defect data.

[0072] The present invention performs surface meshing on the three-dimensional model of the metal component to be measured, sets the side length of the surface mesh cells to 0.5 - 1.0 mm, and can decompose the complex surface structure into uniform mesh cells; extracts the gray value of the surface texture of each surface mesh cell, and can obtain the texture gray information of each cell; calculates the gray-level co-occurrence matrix of each mesh cell, sets the offset distance to 1 pixel, and the directions to 0°, 45°, 90°, and 135°, and can comprehensively count the gray value distribution of adjacent pixel pairs and capture the texture features in different directions; counts the frequency of occurrence of the gray values of adjacent pixel pairs for each direction, and can quantitatively describe the gray-level spatial relationship of the image texture; performs matrix contrast measurement on the gray-level co-occurrence matrix, and can quantify the contrast features of the texture and provide key indicators for texture defect recognition; determines the texture defect area according to the surface texture measurement parameters, and records the area coordinates and contrast, and can accurately locate and quantify the texture defect.

[0073] In this specification, a metal component defect recognition system based on image processing technology is also provided for performing the above-mentioned metal component defect recognition method based on image processing technology. The metal component defect recognition system based on image processing technology includes:

[0074] A metal component material detection module, which is used to obtain the metal component to be tested; determine the material of the metal component to be tested, and perform material reflection judgment on the material of the metal component to be tested to obtain the material reflection data of the metal component to be tested;

[0075] A multi-angle image acquisition module, which is used to perform multi-angle image acquisition on the metal component through a variable light source scanning device according to the material reflection data of the metal component to be tested, and obtain the multi-angle image of the metal component;

[0076] A metal component three-dimensional model module, which is used to enhance the multi-angle image of the metal component to generate a multi-angle enhanced image of the component; perform component structure detection on the multi-angle enhanced image of the component, and measure the parameters of the component structure to obtain the component structure data; extract the surface texture feature of the component from the multi-angle enhanced image of the component to obtain the surface texture feature data; construct a three-dimensional model of the metal component to be tested based on the component structure data and the surface texture feature data;

[0077] A metal component defect identification module, which is used to identify the bending degree of the component structure of the three-dimensional model of the metal component to be tested, detect the bending degree defect of the component structure, and obtain the component structure defect data; identify the surface texture defect of the three-dimensional model of the metal component to be tested, and obtain the surface texture defect data; output the component structure defect data and the surface texture defect data as a metal component defect report.

[0078] Through the metal component material detection module, the metal component to be tested is obtained and its material is determined. At the same time, material reflection judgment is carried out to obtain the material reflection data of the metal component to be tested, which can provide an accurate material information basis for subsequent image acquisition. Based on the accurate material reflection data, the reasonable setting of light source parameters in the subsequent image acquisition process can be ensured, thereby effectively improving the quality and accuracy of image acquisition, laying a reliable data foundation for the subsequent defect recognition link, avoiding image acquisition errors caused by material property differences, and ensuring the efficiency and reliability of the entire defect recognition process. Through the multi-angle image acquisition module, according to the material reflection data of the metal component to be tested, the variable light source scanning device is used to perform multi-angle image acquisition on the metal component, and comprehensive and high-quality multi-angle images of the metal component can be obtained. This multi-angle image acquisition method can fully capture the appearance characteristics of the metal component from different perspectives, including structural details and surface textures, etc., providing a rich and accurate image data source for subsequent image processing and defect recognition, ensuring that the subsequent analysis process can be based on comprehensive image information, thereby effectively improving the accuracy and integrity of defect recognition. Through the metal component three-dimensional model module, the multi-angle images of the metal component are enhanced to generate enhanced multi-angle images of the component, which can effectively improve the clarity and contrast of the images, making the structural details and surface texture features of the component more obvious and easy to identify. Furthermore, the component structure is detected on the enhanced multi-angle images of the component and the parameters of the component structure are measured to obtain component structure data, and the surface texture feature extraction is carried out to obtain surface texture feature data. These operations can accurately obtain the structural and texture feature information of the metal component. Based on the component structure data and surface texture feature data, a three-dimensional model of the metal component to be tested is constructed, which can realize the all-round and three-dimensional modeling of the metal component, completely presenting the internal and external structures and surface features of the component, providing a highly restored and accurate three-dimensional model basis for subsequent defect recognition, making defect recognition more accurate and comprehensive, and being able to cover all parts and details of the component. Through the metal component defect recognition module, the component structure curvature is recognized on the three-dimensional model of the metal component to be tested, and the component structure curvature defect is detected to obtain component structure defect data, and the surface texture defect is recognized to obtain surface texture defect data, which can accurately locate and quantify the structural and surface defect conditions of the metal component. The component structure defect data and surface texture defect data are output as a metal component defect report, which can provide detailed, accurate and clearly directional defect information for subsequent quality assessment, repair decision-making and process improvement, facilitating relevant personnel to quickly understand the defect status of the component and take corresponding measures, effectively improving the quality detection efficiency and reliability of the metal component, and ensuring the performance and safety of the metal component in practical applications.Therefore, through data processing technology, image processing technology, and 3D modeling technology, the present invention realizes variable light source image scanning of metal components, enhances the images of metal components, and constructs 3D models of metal components, thereby improving the accuracy of defect detection of metal components. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] Figure 1 FIG. is a schematic flow chart of the steps of a method for identifying defects in metal components based on image processing technology;

[0080] Figure 2 is Figure 1 a detailed implementation step flow chart of step S2 in

[0081] Figure 3 is Figure 1 a detailed implementation step flow chart of step S3 in

[0082] The realization, functional features, and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0083] The technical method of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.

[0084] In addition, the accompanying drawings are only schematic diagrams of the present invention and are not necessarily drawn to scale. The same reference numerals in the drawings represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor methods and / or microcontroller methods.

[0085] It should be understood that although the terms "first", "second", etc. may be used here to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, the first unit can be called the second unit, and similarly the second unit can be called the first unit. The term "and / or" used here includes any and all combinations of one or more of the listed related items.

[0086] To achieve the above object, please refer to Figures 1 to 3, a method for defect recognition of metal parts based on image processing technology, the method comprising the following steps:

[0087] Step S1: Obtain the metal part to be tested; determine the material of the metal part to be tested, and perform a material reflection judgment on the material of the metal part to be tested to obtain the material reflection data of the metal material to be tested;

[0088] Step S2: According to the material reflection data of the metal material to be tested, and use a variable light source scanning device to collect multi-angle images of the metal part to obtain multi-angle images of the metal part;

[0089] Step S3: Enhance the multi-angle images of the metal part to generate multi-angle enhanced images of the part; perform part structure detection on the multi-angle enhanced images of the part, and measure the parameters of the part structure to obtain part structure data; extract the surface texture features of the part from the multi-angle enhanced images of the part to obtain surface texture feature data; construct a three-dimensional model of the metal part to be tested based on the part structure data and the surface texture feature data;

[0090] Step S4: Identify the bending degree of the part structure of the three-dimensional model of the metal part to be tested, and detect the bending degree defect of the part structure to obtain part structure defect data; identify the surface texture defect of the three-dimensional model of the metal part to be tested to obtain surface texture defect data; output the part structure defect data and the surface texture defect data as a metal part defect report.

[0091] The present invention can provide an accurate material information basis for subsequent image acquisition by obtaining the metal part to be tested and determining its material, and at the same time performing material reflection judgment to obtain the reflection data of the metal material to be tested. Based on the accurate material reflection data, the reasonable setting of the light source parameters can be ensured during the subsequent image acquisition process, thereby effectively improving the quality and accuracy of image acquisition, laying a reliable data foundation for the subsequent defect identification link, avoiding image acquisition errors caused by material property differences, and ensuring the efficiency and reliability of the entire defect identification process. According to the reflection data of the metal material to be tested, the variable light source scanning device is used to perform multi-angle image acquisition on the metal part, and comprehensive and high-quality multi-angle images of the metal part can be obtained. This multi-angle image acquisition method can fully capture the appearance characteristics of the metal part from different perspectives, including structural details and surface textures, etc., providing a rich and accurate image data source for subsequent image processing and defect identification, ensuring that the subsequent analysis process can be based on comprehensive image information, and thus effectively improving the accuracy and integrity of defect identification. Image enhancement is performed on the multi-angle images of the metal part to generate multi-angle enhanced images of the part, which can effectively improve the clarity and contrast of the images, making the structural details and surface texture features of the part more obvious and easy to identify. Furthermore, component structure detection is performed on the multi-angle enhanced images of the part and the parameters of the component structure are measured to obtain component structure data, and surface texture feature extraction is performed to obtain surface texture feature data. These operations can accurately obtain the structural and texture feature information of the metal part. Based on the component structure data and surface texture feature data, a three-dimensional model of the metal part to be tested is constructed, which can realize the all-round and three-dimensional modeling of the metal part, completely presenting the internal and external structures and surface characteristics of the part, providing a highly restored and accurate three-dimensional model basis for subsequent defect identification, making defect identification more accurate and comprehensive, and being able to cover all parts and details of the part. Component structure curvature identification is performed on the three-dimensional model of the metal part to be tested, and component structure curvature defects are detected to obtain component structure defect data, and surface texture defect identification is performed to obtain surface texture defect data, which can accurately locate and quantify the structural and surface defect conditions of the metal part. The component structure defect data and surface texture defect data are output as a defect report of the metal part, which can provide detailed, accurate and clearly directional defect information for subsequent quality assessment, repair decision-making and process improvement, facilitating relevant personnel to quickly understand the defect status of the part and take corresponding measures, effectively improving the quality detection efficiency and reliability of the metal part, and ensuring the performance and safety of the metal part in practical applications. Therefore, the present invention uses data processing technology, image processing technology and three-dimensional modeling technology to realize variable light source image scanning of metal parts, enhance the images of metal parts, and construct a three-dimensional model of metal parts, thereby improving the accuracy of metal part defect detection.

[0092] In the embodiments of the present invention, with reference to Figure 1 As shown, in this example, the method for identifying defects of metal parts based on image processing technology includes the following steps:

[0093] Step S1: Obtain the metal part to be measured; perform broadband reflection spectrum scanning on the metal part to be measured to obtain the material of the metal part to be measured; perform sine reflection judgment on the material of the metal part to be measured to obtain the reflection data of the metal material to be measured;

[0094] In the embodiments of the present invention, the metal part to be measured is placed on a high-precision industrial inspection platform to ensure that its surface is flat and unobstructed, so that the subsequent scanning operation can fully cover the surface of the part; a broadband spectrometer is used to perform reflection spectrum scanning on the part. The scanning range of the spectrometer should cover a broadband from ultraviolet to infrared, that is, the wavelength range is from 200 nanometers to 2500 nanometers. During the scanning process, the spectrometer scans the surface of the part point by point with a resolution of 1 nanometer, and records the reflection light intensity of the part surface at different wavelengths. By analyzing the reflection spectrum data, combined with the pre-established metal material spectrum database, using the spectrum matching algorithm, the material of the metal part to be measured is determined; after determining the material of the part, its reflection characteristics are further analyzed. Using the sine reflection judgment technology, the reflection light intensity data on the part surface is fitted with a sine function model. Specifically, multiple representative regions on the part surface are selected, and 100 reflection light intensity data points are collected for each region. These data points are used as inputs, and the sine function model is fitted by the least squares method to calculate the fitting parameters of the reflection light intensity and the sine function for each region, including amplitude, frequency, and phase. By comparing the fitting parameters of different regions, the reflection data characteristics of the metal material to be measured are obtained.

[0095] Step S2: According to the reflection data of the metal material to be measured, use a variable light source scanning device to perform multi-wavelength light source modulation on the metal part, and perform multi-angle image acquisition on the metal part to obtain multi-angle images of the metal part;

[0096] In the embodiments of the present invention, start the metallurgical microscope and the variable light source scanning device, perform preheating and calibration. According to the material reflection data of the metal part to be measured, adjust the illumination system of the metallurgical microscope to ensure that the light source is a white light LED with a wavelength range covering 400 - 700 nanometers to adapt to metal surfaces with different reflection characteristics; set the light source angle range of the variable light source scanning device to be from 0° to 90°, and adjust the angle at a step interval of 5°; at the same time, adjust the light source intensity to a preset value to ensure it remains constant during the acquisition process. Place the metal part to be measured on the stage of the metallurgical microscope and fix it with a special fixture to ensure that the part remains stable and has no displacement during the scanning process. Adjust the objective lens of the microscope, select a magnification of 100 times, and make the microscopic structure of the metal surface clearly visible by coarsely and finely adjusting the focus. Observe the metal surface through the eyepiece or display screen of the microscope to ensure that the imaging area covers the key parts to be detected; set the image acquisition parameters in the control software of the variable light source scanning device, set the image resolution to 12 million pixels to ensure image clarity and detail integrity; start the light source angle scanning program, start from 0°, and collect one image every 5° until 90°. At each angle, the imaging system of the microscope automatically collects the image of the surface of the metal part and transmits the image data to the computer for storage in real time. After the acquisition is completed, number the images in the order of the light source angle, with the numbering format from "Angle_0°" to "Angle_90°", and store them as an image data set; perform a preliminary verification on the collected image data to check whether there are problems such as overexposure, underexposure, or defocusing in the images. If problems are found, readjust the light source intensity or the microscope focus and re-collect the images of the relevant angles; after the verification is completed, store all the image data in a dedicated data storage unit to ensure the integrity and traceability of the data;

[0097] Step S3: Perform image multi-point pixel enhancement on the multi-angle images of the metal part to generate a multi-angle enhanced image of the part; perform component structure relationship phase detection on the multi-angle enhanced image of the part and measure the parameters of the component structure to obtain component structure data; perform surface texture level identification on the multi-angle enhanced image of the part to obtain surface texture feature data; construct a three-dimensional model of the metal part to be measured based on the component structure data and the surface texture feature data;

[0098] In the embodiments of the present invention, the multi-angle images of the metal parts collected are imported into the image processing software, and each image is grayscale processed to convert the RGB color image into a grayscale image, so as to reduce the data volume and highlight the structural features. Subsequently, the histogram equalization technology is applied to adjust the contrast and brightness of the image, making the details in the image clearer. By adjusting the distribution range of the histogram, the dynamic range of the image is enhanced, ensuring that the microscopic structure and texture features of the metal surface are more obvious. After the image enhancement is completed, the enhanced images are saved as a multi-angle enhanced image dataset. The image analysis software equipped with the metallographic microscope is used to perform structural detection on the enhanced multi-angle images. Through the edge detection function of the software, the contour and internal structure features of the metal parts are identified. The software automatically calculates the parameters of the component structure, including the contour length, the size, angle, perimeter, and area of the internal structure, etc. These parameters are recorded as component structure data and stored in tabular form for subsequent analysis and processing. The surface texture features of the multi-angle enhanced images are extracted. Through the texture analysis module of the image analysis software, the gray-level co-occurrence matrix (GLCM) of each image is calculated, and the texture feature parameters, including contrast, correlation, energy, and homogeneity, are extracted. These parameters reflect the microscopic texture characteristics of the metal surface and can provide an important basis for subsequent analysis. After the extraction is completed, the texture feature data is recorded and saved in numerical form. The component structure data and the surface texture feature data are imported into the 3D modeling software. According to the structural parameters and texture features in the multi-angle images, through point cloud fitting or meshing processing, a 3D model of the metal part to be tested is constructed. During the modeling process, the geometric shape and size of the model are determined using the component structure data, and at the same time, combined with the surface texture feature data, the corresponding texture information is given to the surface of the model. The finally generated 3D model can intuitively display the shape, size, and surface features of the metal part.

[0099] Step S4: Identify the bending degree of the component structure of the 3D model of the metal part to be tested, and measure the bending degree co-occurrence matrix of the component structure bending degree to obtain the bending degree co-occurrence matrix; detect the component structure bending degree defect according to the bending degree co-occurrence matrix to obtain the component structure defect data; identify the surface texture defect of the 3D model of the metal part to be tested to obtain the surface texture defect data; output the component structure defect data and the surface texture defect data as a metal part defect report.

[0100] In the embodiments of the present invention, a three-dimensional scanning device is used to obtain the three-dimensional model data of the metal part to be measured, ensuring that the scanning accuracy reaches 0.01 mm to fully cover the geometric features of the part; preprocess the three-dimensional model, including operations such as removing noise points and filling holes, to ensure the integrity and accuracy of the model; use an algorithm based on geometric analysis to identify the curvature of the structure of the part. The specific method is to calculate the curvature value of each point on the model surface, and distinguish the normal structure from the potential curved structure by setting a threshold (such as the curvature threshold is 0.1). In the identified curved structure area, select multiple representative points as the analysis objects; calculate the curvature difference between each point and its surrounding points, and construct a curvature co-occurrence matrix. The size of the matrix is 10×10, indicating that the curvature differences are calculated in 10 directions respectively; by statistically analyzing the data distribution in the co-occurrence matrix, obtain the eigenvalues of the curvature co-occurrence matrix, including energy, contrast, and correlation; according to the eigenvalues of the curvature co-occurrence matrix, compare with the preset normal range, if the eigenvalue exceeds the normal range (such as the energy value exceeds 0.5 and the contrast exceeds 0.3), it is determined that there is a curvature defect in this area; record the coordinates, dimensions, etc. of the detected curvature defect area as the component structure defect data; perform texture analysis on the surface of the three-dimensional model of the metal part to be measured, use image processing algorithms, such as the gray-level co-occurrence matrix (GLCM) analysis method, to calculate the characteristic parameters of the surface texture of the model, including the uniformity and roughness of the texture; set the threshold range of the texture characteristics (such as the roughness threshold is 0.2), and determine the area exceeding the threshold range as the surface texture defect, record the position, area, etc. of the surface texture defect area to form the surface texture defect data; integrate the component structure defect data and the surface texture defect data, and output the metal part defect report in text format. The report details information such as the defect type, position, size, and severity. At the same time, generate a three-dimensional model visualization image with defect markings to intuitively display the defect position.

[0101] Preferably, step S1 includes the following steps:

[0102] Step S11: Obtain the metal part to be measured;

[0103] Step S12: Use a metallurgical microscope to detect the material of the metal part to be measured, and set the measurement time to 120 - 150 seconds and the measurement accuracy to ±0.1% to obtain the material of the metal part to be measured;

[0104] Step S13: Use the metallurgical microscope again to measure the reflection spectrum of the material of the metal part to be measured, set the measurement wavelength range of the spectral analyzer to 400 - 700 nm, the integration time to 50 - 60 ms, and the sampling interval to 1 nm;

[0105] Step S14: Perform three repeated measurements on the measured reflection spectrum, with an interval of 2 seconds for each measurement. Take the arithmetic mean of the three measurement results as the final reflection spectrum data to generate material reflection spectrum data.

[0106] Step S15: Calculate the average reflectivity of the metal component to be measured based on the material reflection spectrum data to obtain the reflection data of the metal material to be measured.

[0107] In the embodiment of the present invention, a metal component sample is selected from the sample library to be measured and placed on the stage of a metallurgical microscope, and the sample is fixed using a special fixture; the metallurgical microscope is turned on, the light source intensity is adjusted to a preset value, and a 100-fold objective lens is selected for observation. The image analysis software supporting the microscope is started, the material detection mode is set, the measurement time is 120 seconds, and the measurement accuracy is set to ±0.1%. The software automatically analyzes the microstructure of the sample, records the material information and saves it as a material detection report file. The spectral analyzer is connected to the reflection light output port of the metallurgical microscope, the measurement wavelength range of the spectral analyzer is set to 400 - 700 nanometers, the integration time is 55 milliseconds, and the sampling interval is 1 nanometer. The illumination mode of the microscope is adjusted to the reflection light mode so that the light source evenly irradiates the sample surface; the spectral analyzer is started, the reflection spectrum of the sample surface is measured, and the measurement data is transmitted to the computer for storage in real time; the reflection spectrum of the sample surface is measured three times, with an interval of 2 seconds set for each measurement. The spectral analyzer automatically records the spectral data of each measurement and imports the three measurement results into the data processing software. The software calculates the arithmetic mean of the three measurement data to obtain the final reflection spectrum data, and saves it as a material reflection spectrum data file in the CSV format, which contains two columns of data: wavelength and reflectivity; the reflectivity data is extracted from the material reflection spectrum data file, and the average reflectivity in the wavelength range of 400 - 700 nanometers is calculated. The reflection spectrum curve is integrated through the data processing software to obtain the average reflectivity value, and this value is recorded as the reflection data of the metal material to be measured and stored in the material reflection data file in the TXT format, which contains the value of the average reflectivity and the corresponding wavelength range information.

[0108] As an example of the present invention, referring to Figure 2 as shown, in this example, step S2 includes:

[0109] Step S21: According to the reflection data of the metal material to be measured, select a variable light source scanning device, and set the light source of the variable light source scanning device to three different wavelengths, namely 450 - 500 nanometers, 550 - 600 nanometers, and 650 - 700 nanometers respectively.

[0110] Step S22: Scan the device with a variable light source and set the light source intensity to 50 - 60%, 70 - 80%, and 90 - 100%, corresponding to light sources of three different wavelengths respectively;

[0111] Step S23: Collect multi - angle images of the metal component. The collection angles include 0°, 45°, and 90°, and each angle is irradiated with light sources of three different wavelengths respectively;

[0112] Step S24: At each angle, use a metallurgical microscope to collect images, set the resolution to 1080×1080 to 2048×2048 pixels, and set the exposure time to 10 - 15 milliseconds;

[0113] Step S25: Collect nine images under different conditions and mark them with different conditions to obtain multi - angle images of the metal component.

[0114] In an embodiment of the present invention, start the variable light source scanning device and enter the light source setting interface of the device control software. According to the reflection data of the metal material to be measured, sequentially set the wavelength ranges of the light source: the first group of wavelength ranges is 450 - 500 nanometers, the second group of wavelength ranges is 550 - 600 nanometers, and the third group of wavelength ranges is 650 - 700 nanometers. Through the wavelength adjustment function of the software, calibrate the central wavelength of each group of light sources respectively to ensure that they are located at 475 nanometers, 575 nanometers, and 675 nanometers respectively; in the control software of the variable light source scanning device, enter the light source intensity adjustment interface. For the light source with a wavelength of 450 - 500 nanometers, set the intensity to 55%; for the light source with a wavelength of 550 - 600 nanometers, set the intensity to 75%; for the light source with a wavelength of 650 - 700 nanometers, set the intensity to 95%. Through the light intensity calibration function of the software, calibrate the intensity of each group of light sources to ensure that their output is stable at the set value; place the metal part to be measured on the stage of the metallurgical microscope and fix it with a fixture. Through the stage control software of the microscope, adjust the stage angle to 0°, start the variable light source scanning device, and irradiate it sequentially with light sources with wavelengths of 450 - 500 nanometers, 550 - 600 nanometers, and 650 - 700 nanometers. After completing the image acquisition at an angle of 0°, adjust the stage angle to 45° and repeat the above light source irradiation process; finally, adjust the stage angle to 90° and perform the same operation again. In the image acquisition system of the metallurgical microscope, set the image acquisition parameters. Set the acquisition resolution to 1080×1080 pixels and 2048×2048 pixels respectively, and select the appropriate resolution according to the surface characteristics of the part. At the same time, set the exposure time to 12 milliseconds. Under each light source condition and angle, start the image acquisition system to acquire the images of the surface of the metal part. After the acquisition is completed, use the marking function of the image acquisition software to conditionally mark each image. The marking content includes the acquisition angle (0°, 45°, 90°), the light source wavelength (450 - 500 nanometers, 550 - 600 nanometers, 650 - 700 nanometers), and the light source intensity (55%, 75%, 95%). Store the marked images in a preset folder according to the naming rule of "angle_wavelength_intensity" to complete the acquisition and marking of multi-angle images of the metal part.

[0115] As an example of the present invention, refer to Figure 3 shown. In this example, step S3 includes:

[0116] Step S31: Traverse the pixel points of the multi-angle images of the metal part and extract the values of each pixel point to obtain the pixel values of the metal part;

[0117] Step S32: Grayscale the pixel values of the metal component, where the weight of the red channel is set to 0.299, the weight of the green channel is set to 0.587, and the weight of the blue channel is set to 0.114 to obtain a multi-angle grayscale image;

[0118] Step S33: Extract all pixel grayscale values of the multi-angle grayscale image, and perform a difference calculation on the pixel grayscale values to obtain a pixel grayscale difference;

[0119] Step S34: Set the pixel grayscale difference threshold to 20. If the pixel grayscale difference is greater than or equal to 20, retain the pixel point; if the pixel grayscale difference is less than 20, remove the pixel point;

[0120] Step S35: Enhance the contrast of the remaining pixel points to generate a multi-angle enhanced image of the component;

[0121] Step S36: Detect the component structure of the multi-angle enhanced image of the component and measure the parameters of the component structure to obtain component structure data; extract the surface texture feature of the multi-angle enhanced image of the component to obtain surface texture feature data;

[0122] Step S37: Construct a three-dimensional model of the metal component to be tested based on the component structure data and the surface texture feature data.

[0123] In an embodiment of the present invention, an image processing software is started to load multi-angle images of metal components. The software automatically identifies the pixel format of the images and confirms it as the RGB format. Through the pixel traversal function of the software, the RGB values in the images are read pixel by pixel, and the RGB values of each pixel are stored in a pixel value data table. The data table uses the pixel coordinates (x, y) as an index to record the corresponding R, G, and B component values; according to a preset grayscale formula, each pixel in the pixel value data table is processed. The specific formula is: grayscale value = 0.299×R + 0.587×G + 0.114×B; the software performs weighted calculation on the RGB values of each pixel to obtain the corresponding grayscale value and replaces the original RGB value with the grayscale value; the grayscale values of each pixel are extracted from the generated multi-angle grayscale images and stored grouped by image angle. The difference calculation is performed on the grayscale values of the same pixel position at different angles, that is, the grayscale differences of the corresponding pixels in the images at angles 0° and 45°, 45° and 90° are calculated, and the calculated differences are stored in a pixel grayscale difference table, which records the pixel coordinates (x, y) and the corresponding grayscale differences; in the pixel grayscale difference table, the grayscale difference threshold is set to 20, and the software traverses the difference table to judge the grayscale difference of each pixel: if the grayscale difference is greater than or equal to 20, the grayscale value of the pixel point is retained; if it is less than 20, the grayscale value of the pixel point is set to 0, and the filtered pixel point data is stored in a new data table; the filtered pixel point data is subjected to contrast enhancement processing using the histogram equalization method. The software automatically calculates the distribution histogram of the grayscale values and normalizes it. By adjusting the distribution range of the grayscale values, the contrast of the image is improved. After the processing is completed, a multi-angle enhanced image of the component is generated and saved as a new image file. The multi-angle enhanced image of the component is processed using image analysis software. First, the contour and structural features of the component are identified through an edge detection algorithm (such as the Canny operator), and the geometric parameters of the component, including length, angle, area, etc., are extracted and stored as component structure data. Secondly, the surface texture features are extracted using the gray-level co-occurrence matrix (GLCM) method, and parameters such as energy, contrast, and correlation are calculated and stored as surface texture feature data; the component structure data and surface texture feature data are imported into 3D modeling software. The software performs point cloud fitting or meshing processing according to the structure data to generate the geometric shape of the component. At the same time, according to the texture feature data, the corresponding texture information is assigned to the model surface to complete the construction of the 3D model of the metal component to be measured, and the model is saved in the STL format.

[0124] Particularly importantly, step S35 includes the following steps:

[0125] Step S351: linearly stretch the grayscale value of each pixel point, map the minimum grayscale value to 0, the maximum grayscale value to 255, and adjust the intermediate grayscale values proportionally;

[0126] Step S352: For each pixel, calculate its enhanced grayscale value using the formula: New grayscale value = (Original grayscale value - Minimum grayscale value) × (255 / (Maximum grayscale value - Minimum grayscale value));

[0127] Step S353: Replace the grayscale values in the original image with the calculated new grayscale values to complete contrast enhancement;

[0128] Step S354: Extract multiple views at different angles from the enhanced image. The angle interval for each view is 45°, and a total of 4 views are extracted; Crop each view to remove the image background;

[0129] Step S355: Arrange the cropped views in angular order and merge them into a multi-angle enhanced image in JPEG format to generate a multi-angle enhanced image of the component.

[0130] In an embodiment of the present invention, start the image processing software and load the grayscale image of the metal part to be measured. Enter the "Image Processing" module and select the "Linear Stretch" function. The software automatically scans all pixel points in the image, extracts the minimum grayscale value (denoted as MinGray) and the maximum grayscale value (denoted as MaxGray). According to the linear stretch formula, map MinGray to 0 and MaxGray to 255, and adjust the intermediate grayscale values proportionally; the adjusted grayscale value range is from 0 to 255. The software stores the grayscale value of each pixel and its corresponding mapped value in memory for the next calculation. For each pixel point in the image, calculate its enhanced grayscale value according to the following formula: New grayscale value = (Original grayscale value - MinGray) × (255 / (MaxGray - MinGray)); the software traverses the image pixel by pixel, reads the original grayscale value of each pixel (denoted as OriginalGray), and calculates the new grayscale value of each pixel (denoted as NewGray) according to the above formula. After the calculation is completed, the software stores NewGray as the enhanced grayscale value data and saves these data as a temporary file in binary format; the software reads the enhanced grayscale value data (NewGray) in the temporary file and replaces the grayscale value in the original image pixel by pixel; after the replacement is completed, a contrast-enhanced image is generated; the software saves the enhanced image as an intermediate processing result file in BMP format, and the storage path is the working directory; extract multiple views at different angles from the enhanced image, set the angle interval to 45°, and extract a total of 4 views. The software automatically identifies and extracts the image area corresponding to each angle according to the set angle interval; 0° view: extract the horizontal view of the image; 45° view: extract the diagonal view of the image; 90° view: extract the vertical view of the image; 135° view: extract the other diagonal view of the image; perform a cropping operation on each extracted view to remove the background part of the image and only retain the image area of the target part. The cropped views are saved in the form of independent image files named "View_0°.jpg", "View_45°.jpg", "View_90°.jpg", and "View_135°.jpg" in JPEG format; arrange the 4 cropped views in the order of angles, which are 0°, 45°, 90°, and 135° in sequence; the software combines these views into a multi-angle enhanced image. The specific operation is as follows: create a new image file with a size of 2 times the width and 2 times the height of the cropped single view, and the background color is white. Place the cropped views in the four quadrants of the new image in sequence: place the 0° view in the upper left corner; place the 45° view in the upper right corner; place the 90° view in the lower left corner; place the 135° view in the lower right corner; adjust the size of each view to ensure that they are evenly distributed in the new image, and finally save the generated multi-angle enhanced image in JPEG format.

[0131] Preferably, step S36 includes the following steps:

[0132] Step S361: Perform edge detection on the multi-angle enhanced image of the component, and mark the component edge information of the multi-angle enhanced image of the component to obtain a component edge marked image;

[0133] Step S362: Extract the inner and outer contours of the component from the component edge marked image, divide the inner and outer contours of the component into component structures, and calculate the length, width, and area of the component structure to obtain component structure data;

[0134] Step S363: Divide the multi-angle enhanced image of the component, and set the division pixels to 4×4 to 8×8 to obtain a component block image;

[0135] Step S364: Traverse the pixel gray values of the component block image, and calculate the standard deviation and variance of its pixel gray values to obtain block pixel gray feature values;

[0136] Step S365: Determine the pixel gray gradient of the block pixel gray feature values, and map the pixel gray gradient to surface texture feature data.

[0137] In an embodiment of the present invention, start the image analysis software supporting the metallurgical microscope, and load the multi-angle enhanced image of the component. Select the "edge detection" function module and adopt the Canny edge detection algorithm. Set the low threshold of the algorithm to 0.1 and the high threshold to 0.3. The software calculates the gradient amplitude and direction of the pixels in the image, identifies the edge features in the image, and marks these edges in a highlighted form on the original image to generate the component edge marked image, and saves the marked image; load the component edge marked image and enter the "contour extraction" function module. The software extracts the inner and outer contours in the image through morphological operations (such as dilation and erosion). For each contour area, perform structural division to identify independent component structures; calculate the geometric parameters of each component structure, length: obtained by calculating the perimeter of the contour, that is, the number of pixels along the contour edge multiplied by the physical size of a single pixel; width: obtained by calculating the short side length of the minimum bounding rectangle of the contour; area: obtained by counting the number of pixels within the area enclosed by the contour and multiplying by the area of a single pixel; store the calculated length, width, and area data as component structure data in a table format, with each row corresponding to the parameters of a component structure; load the multi-angle enhanced image of the component and enter the "image division" function module. Set the pixel sizes for image division to three modes: 4×4, 6×6, and 8×8. The software divides the image into multiple small blocks according to the set pixel sizes. For example, for the 4×4 mode, the image is divided into small blocks each containing 16 pixels; for the 6×6 mode, each block contains 36 pixels; for the 8×8 mode, each block contains 64 pixels; store the divided image blocks as component sub-block images respectively, and the file name of each sub-block image contains its corresponding division mode information; load the component sub-block images and enter the "gray feature calculation" function module. The software traverses each image block pixel by pixel to extract the gray value of the pixel. Perform statistical analysis on the gray values within each image block; average gray value: add up the gray values of all pixels within the image block and then divide by the total number of pixels in the block. Variance: calculate the square of the difference between each pixel gray value and the average gray value, and then add up all the squared values and divide by the total number of pixels. Standard deviation: take the square root of the variance to obtain the standard deviation value. Store the calculated average gray value, variance, and standard deviation as the sub-block pixel gray feature values, with each image block corresponding to a set of feature values; load the sub-block pixel gray feature value data and enter the "gray gradient analysis" function module. The software uses the Sobel operator to calculate the gradient of the pixel gray values within each image block; gradient amplitude: obtain the gradient amplitude of each pixel by calculating the gray change rate of the pixel in the horizontal and vertical directions. Gradient direction: obtain the direction angle of the gradient by calculating the arctangent value of the gradient amplitude. Map the calculated gradient amplitude and direction information into surface texture feature data and store it in a structured format, with each record containing the position information of the image block, gradient amplitude, and gradient direction.

[0138] Preferably, step S37 includes the following steps:

[0139] Step S371: Determine the three-dimensional dimensions of the metal component according to the extracted component structure data, where the length is L millimeters, the width is W millimeters, and the height is H millimeters;

[0140] Step S372: Use 3D modeling software to create a blank 3D model framework, and set the length, width, and height of the model to L, W, and H respectively to obtain the metal component size model;

[0141] Step S373: Determine the texture roughness, direction, and uniformity of the metal component surface according to the surface texture feature data;

[0142] Step S374: Adjust the texture roughness of the metal component size model, and set the area with a roughness value greater than 0.5 to a high texture depth, and the area less than 0.5 to a low texture depth;

[0143] Step S375: Adjust the texture direction of the metal component size model, and set the area with a directionality value greater than 0.7 to a strongly directional texture, and the area less than 0.3 to a non-directional texture;

[0144] Step S376: Adjust the texture uniformity of the metal component size model, and set the area with a uniformity value greater than 0.8 to a uniform texture, and the area less than 0.2 to a non-uniform texture;

[0145] Step S377: Smooth the model surface, and set the number of smoothing iterations to 5 times to obtain the 3D model of the metal component to be tested.

[0146] In the embodiments of the present invention, the dimensional information of metal components is extracted from the component structure data, including length (L millimeters), width (W millimeters), and height (H millimeters). These dimensional data are calculated by image analysis software. Specifically, the length L is the length of the longest contour line of the component structure, the width W is the distance at the widest part of the component structure, and the height H is the vertical distance between the highest point and the lowest point of the component structure. Start the 3D modeling software and enter the model creation interface; select the "New Model" function and input the length, width, and height dimensions of the model, which are set as L, W, and H respectively. The software generates a blank 3D model framework according to the input dimensional parameters. The coordinate origin of the model is located at the geometric center, the X-axis corresponds to the length direction, the Y-axis corresponds to the width direction, and the Z-axis corresponds to the height direction. The texture roughness, directionality, and uniformity parameters of the surface of the metal component are extracted from the surface texture feature data. The texture roughness is calculated by the standard deviation of the gray gradient, the directionality is calculated by the distribution concentration of the gradient direction, and the uniformity is calculated by the homogeneity parameter of the gray level co-occurrence matrix. The specific numerical ranges are as follows: the roughness value ranges from 0 to 1, the directionality value ranges from 0 to 1, and the uniformity value ranges from 0 to 1. In the 3D model framework, load the surface texture feature data and adjust the texture depth of the model surface according to the roughness value. For areas where the roughness value is greater than 0.5, set the texture depth to a high texture depth (for example, the depth value is 0.2 millimeters). For areas where the roughness value is less than 0.5, set the texture depth to a low texture depth (for example, the depth value is 0.05 millimeters). The software associates the roughness value with the texture depth through the texture mapping function and updates the texture details of the model surface. Adjust the texture direction of the model surface according to the directionality value. For areas where the directionality value is greater than 0.7, set it to a strongly directional texture (for example, the texture direction is consistent with the local gradient direction). For areas where the directionality value is less than 0.3, set it to a non-directional texture (for example, the texture direction is randomly distributed). The software maps the directionality value to the texture direction through the texture direction adjustment tool and updates the texture direction information of the model surface. Adjust the texture uniformity of the model surface according to the uniformity value. For areas where the uniformity value is greater than 0.8, set it to a uniform texture (for example, the texture spacing is consistent). For areas where the uniformity value is less than 0.2, set it to a non-uniform texture (for example, the texture spacing is randomly distributed); the software maps the uniformity value to the texture spacing through the texture uniformity adjustment tool and updates the texture uniformity information of the model surface; smooth the adjusted model surface. Select the "Surface Smoothing" function in the software and set the number of smoothing iterations to 5 times; the software moderately smooths the high texture depth areas of the model surface through multiple iterations of the smoothing algorithm while retaining the texture details, and finally generates a 3D model of the metal component to be tested.

[0147] Preferably, step S4 includes the following steps:

[0148] Step S41: Identify the bending degree of the component structure of the three-dimensional model of the metal component to be tested, and measure the bending degree co-occurrence matrix of the component structure bending degree to obtain the bending degree co-occurrence matrix;

[0149] Step S42: Detect the bending degree defects of the component structure based on the bending degree co-occurrence matrix to obtain the component structure defect data;

[0150] Step S43: Identify the surface texture defects of the three-dimensional model of the metal component to be tested to obtain the surface texture defect data;

[0151] Step S44: Classify the component structure defect data and the surface texture defect data by defect type and label the defect type to obtain the defect type labeled data;

[0152] Step S45: Perform data visualization based on the defect type labeled data to obtain the metal component defect report.

[0153] In the embodiments of the present invention, a high-precision three-dimensional scanning device is used to obtain the three-dimensional model of the metal part to be measured, ensuring that the scanning accuracy reaches 0.01 mm. The three-dimensional model is preprocessed, including operations such as removing noise points and filling holes. A method based on geometric analysis is adopted to identify the curvature of the structure of the part. Specifically, the curvature value of each point on the model surface is calculated, and by setting a curvature threshold (such as 0.1), the normal structure and potential curved structure are distinguished. In the identified curved structure area, multiple representative points are selected, the curvature difference between them and the surrounding points is calculated, and a 10×10 curvature co-occurrence matrix is constructed. Each element in the matrix represents the curvature difference in a specific direction; by statistically analyzing the data distribution in the curvature co-occurrence matrix, its eigenvalues are obtained, including energy, contrast, correlation, etc. These eigenvalues are compared with the preset normal range. If the eigenvalues exceed the normal range (such as the energy value exceeds 0.5 and the contrast exceeds 0.3), it is determined that there is a curvature defect in this area. The coordinates, dimensions, and other information of the detected curvature defect area are recorded as component structure defect data; the surface of the three-dimensional model is subjected to texture analysis, and the gray-level co-occurrence matrix (GLCM) analysis method is used to calculate the characteristic parameters of the surface texture of the model, including texture uniformity, roughness, etc. A threshold range for texture features is set (such as the roughness threshold is 0.2), and the area exceeding the threshold range is determined as a surface texture defect. The position, area, and other information of the surface texture defect area are recorded to form surface texture defect data; the component structure defect data and the surface texture defect data are integrated. According to the defect characteristic parameters, a pre-trained classification model (such as a support vector machine or a convolutional neural network) is used to classify the defect types. The classified defect types are labeled, and the labeling content includes information such as the defect type name, position, and dimensions to obtain defect type labeling data; according to the defect type labeling data, a data visualization tool (such as Matplotlib or OpenGL) is used to label and visualize the defect information on the three-dimensional model. A three-dimensional model visualization image containing defect labels is generated, and a metal part defect report is output in text format, which details information such as the defect type, position, dimensions, and severity.

[0154] Preferably, step S41 includes the following steps:

[0155] Step S411: Perform component structure mesh division on the three-dimensional model of the metal part to be measured, and set the side length of the structure mesh unit to 1.0 - 1.5 mm;

[0156] Step S412: For each structure mesh unit, calculate the change rate of its normal vector as the local curvature of the unit; normalize the local curvature value to the range of 0 to 1, where 0 represents no curvature and 1 represents the maximum curvature;

[0157] Step S413: Perform threshold segmentation on the normalized curvature data, and set the curvature threshold to 0.5;

[0158] Step S414: Mark the regions with curvature greater than 0.5 as potential bending regions, and extract the coordinates and curvature values of these regions;

[0159] Step S415: Initialize the curvature value variable to accumulate the curvature values of all grid cells within this region; traverse all grid cells within this region, and accumulate the curvature value of each grid cell into the above variable; calculate the total number of grid cells within this region, divide the accumulated value by the total number of grid cells to obtain the average curvature; initialize the standard deviation variable to accumulate the square of the difference between the curvature of each grid cell and the average curvature;

[0160] Step S416: Traverse all grid cells within this region, calculate the square of the difference between the curvature of each grid cell and the average curvature, and accumulate it into the above variable; divide the accumulated value by the total number of grid cells, calculate the square root of the above result to obtain the standard deviation; if the average curvature of a certain region is greater than 0.8 and the standard deviation is less than 0.1, then it is determined that there is a bending defect in this region;

[0161] Step S417: Record the coordinates, average curvature, and standard deviation of the regions with bending defects to obtain the component structure defect data.

[0162] In the embodiments of the present invention, a three-dimensional model of a metal part to be measured is subjected to structural mesh division, and the model is segmented into multiple structural mesh units. The side length of each structural mesh unit is set to 1.0 - 1.5 millimeters to ensure that the mesh units can finely cover the surface and internal structure of the part; for each structural mesh unit, the change rate of its normal vector is calculated as the local curvature of the unit. The change rate of the normal vector of each unit is calculated through a mathematical formula, and the local curvature value is normalized to the range of 0 to 1. Among them, 0 represents no curvature, and 1 represents the maximum curvature; threshold segmentation is performed on the normalized curvature data, and the curvature threshold is set to 0.5. The areas with a curvature greater than 0.5 are marked as potential curvature areas; the coordinates and curvature values of the areas with a curvature greater than 0.5 are extracted. The specific positions and curvature information of these areas are recorded for subsequent analysis; a curvature value variable is initialized to accumulate the curvature values of all mesh units within the area. All mesh units within the area are traversed, and the curvature value of each mesh unit is accumulated into the above variable. The total number of mesh units within the area is calculated, and the accumulated value is divided by the total number of mesh units to obtain the average curvature. At the same time, a standard deviation variable is initialized to accumulate the squares of the differences between the curvature of each mesh unit and the average curvature; all mesh units within the area are traversed, the square of the difference between the curvature of each mesh unit and the average curvature is calculated, and the result is accumulated into the above variable. The accumulated value is divided by the total number of mesh units, and the square root of the above result is calculated to obtain the standard deviation; if the average curvature of a certain area is greater than 0.8 and the standard deviation is less than 0.1, it is determined that there is a curvature defect in this area. The coordinates, average curvature, and standard deviation of the area with a curvature defect are recorded to obtain the part structure defect data. In the three-dimensional modeling software, first, two variables are defined for each potential curvature area: the total curvature and the total sum of squared differences, with their initial values both set to 0, and at the same time, a variable for the total number of mesh units is defined, with its initial value being 0. Then, all mesh units within each potential curvature area are accessed one by one. After reading the normalized curvature value of each mesh unit, it is accumulated into the total curvature variable, and the total number of mesh units is incremented by 1. After traversing all mesh units within the area, the average curvature of the area is calculated by dividing the total curvature by the total number of mesh units, and the result is stored as the average curvature variable. When traversing all mesh units within the area again, the square of the difference between the curvature of each mesh unit and the average curvature is calculated, and the squared difference is accumulated into the total sum of squared differences variable. After the traversal is completed, the average of the squared differences is obtained by dividing the total sum of squared differences by the total number of mesh units, and then the square root operation is performed on this average value to obtain the curvature standard deviation of the area, and the result is stored as the standard deviation variable. Finally, for each potential curvature area, if the average curvature is greater than 0.8 and the standard deviation is less than 0.1, it is determined that there is a curvature defect in this area, and the number, average curvature, and standard deviation of this area are recorded as the content of the part structure defect data.

[0163] Preferably, step S42 includes the following steps:

[0164] Step S421: Perform component surface meshing on the three-dimensional model of the metal component to be measured, and set the side length of the surface mesh elements to 0.5 - 1.0 mm;

[0165] Step S422: For each surface mesh element, extract the gray value of its surface texture;

[0166] Step S423: Calculate the gray-level co-occurrence matrix of each mesh element, set the offset distance of the gray-level co-occurrence matrix to 1 pixel, and set the directions to 0°, 45°, 90°, and 135°;

[0167] Step S424: For each direction, count the frequency of occurrence of the gray values of adjacent pixel pairs to obtain the gray-level co-occurrence matrix;

[0168] Step S425: Traverse each element in the gray-level co-occurrence matrix to obtain the element value of the gray-level co-occurrence matrix; calculate the square of the difference between the element value of the gray-level co-occurrence matrix and its row index and column index; multiply each element value of the gray-level co-occurrence matrix by the square of the difference between its row index and column index, and add all the calculation results to generate the surface texture measurement parameter;

[0169] Step S426: Determine the texture defect area of the three-dimensional model of the metal component to be measured according to the surface texture measurement parameter, and record the area coordinates and contrast of the texture defect to obtain the surface texture defect data.

[0170] In an embodiment of the present invention, a 3D modeling software is started, and a 3D model of the metal part to be tested is loaded. Enter the "Mesh Generation" function module, and set the side length of the surface mesh elements to be 0.5 - 1.0 mm; the software divides the model surface into meshes according to the set side length parameter, generating regular mesh elements. The geometric information (including vertex coordinates and side lengths) of each mesh element is stored as a mesh data file in CSV format, including columns: element number, vertex coordinates (X, Y, Z), and side length; load the surface mesh data file and enter the "Gray Scale Extraction" function module of the image processing software. The software traverses the pixels within each surface mesh element to extract the gray scale value of each pixel. The range of the gray scale value is from 0 to 255, representing the brightness of the image. The extracted gray scale values are stored as a gray scale data table, which includes columns: element number, pixel coordinates (X, Y), and gray scale value. The gray scale data table is saved in CSV format; enter the "Texture Analysis" function module of the image processing software and select the "Gray Level Co-occurrence Matrix Calculation" function. For each surface mesh element, calculate its gray level co-occurrence matrix (GLCM). Set the offset distance of the gray level co-occurrence matrix to 1 pixel, and the directions are 0°, 45°, 90°, and 135° respectively. The software analyzes the pixels within each mesh element according to the set offset distance and directions, and counts the frequency of occurrence of the gray scale values of adjacent pixel pairs; for each direction, the software counts the frequency of occurrence of the gray scale values of adjacent pixel pairs. The specific method is: in each direction, calculate the combined frequency of the gray scale value of the current pixel and the gray scale value of the adjacent pixel, and fill the statistical result into the gray level co-occurrence matrix. For example, in the 0° direction, count the number of occurrences of pixel pairs with gray scale values (i, j), and record this frequency in the i-th row and j-th column of the matrix. After the statistics are completed, generate gray level co-occurrence matrices in four directions, and store the matrix data as a GLCM data file in CSV format, including columns: direction, gray scale value i, gray scale value j, frequency; enter the "Texture Parameter Calculation" function module to calculate the contrast of the calculated gray level co-occurrence matrix. Contrast is used to measure the roughness of the image texture. The software calculates the contrast for the gray level co-occurrence matrix in each direction respectively, and the calculated contrast values are stored as surface texture measurement parameters in CSV format, including columns: element number, direction, contrast value; enter the "Defect Detection" function module to determine the texture defect area of the 3D model of the metal part to be tested according to the surface texture measurement parameters. The software sets a contrast threshold to judge the contrast value of each mesh element. If the contrast value exceeds the set threshold, then determine that this area is a texture defect area, and record its area coordinates and contrast value. Finally, store the coordinates and contrast values of the texture defect area as surface texture defect data in CSV format, including columns: defect area number, area coordinates (X, Y, Z), and contrast value.Retrieve the generated Gray Level Co-occurrence Matrix (GLCM). This matrix is obtained based on the statistical distribution of the gray values of the image, and the matrix size is 256×256 (assuming 256 gray levels); the row index and column index of the matrix respectively represent the gray values of two adjacent pixels, and the element value in the matrix represents the occurrence frequency of the corresponding gray value combination; initialize a variable to store the intermediate result of contrast calculation, named "contrast accumulation value", and set the initial value to 0. Subsequently, access each element in the GLCM one by one: for the element at position (i, j) in the matrix, read its value GLCM(i, j), calculate the difference between the row index i and the column index j, and find the square of the difference. Multiply the element value GLCM(i, j) by the square of the difference to obtain a product result, and accumulate this product into the "contrast accumulation value". Repeat the above operation until the entire GLCM matrix is traversed. After completing the traversal of the matrix, the "contrast accumulation value" is the matrix contrast we want.

[0171] In this specification, a metal component defect recognition system based on image processing technology is also provided, which is used to execute the above-mentioned metal component defect recognition method based on image processing technology. The metal component defect recognition system based on image processing technology includes:

[0172] A metal component material detection module, which is used to obtain the metal component to be tested; perform broadband reflection spectrum scanning on the metal component to be tested to obtain the material of the metal component to be tested; perform sine reflection judgment on the material of the metal component to be tested to obtain the reflection data of the metal material to be tested;

[0173] A multi-angle image acquisition module, which is used to perform multi-wavelength light source modulation on the metal component through a variable light source scanning device according to the reflection data of the metal material to be tested, and perform multi-angle image acquisition on the metal component to obtain multi-angle images of the metal component;

[0174] A metal component three-dimensional model module, which is used to perform image multi-point pixel enhancement on the multi-angle images of the metal component to generate multi-angle enhanced images of the component; perform component structure relationship phase detection on the multi-angle enhanced images of the component, and measure the parameters of the component structure to obtain component structure data; perform surface texture level recognition on the multi-angle enhanced images of the component to obtain surface texture feature data; construct a three-dimensional model of the metal component to be tested based on the component structure data and the surface texture feature data;

[0175] The metal component defect identification module is used to identify the bending degree of the component structure of the three-dimensional model of the metal component to be tested, measure the bending degree co-occurrence matrix of the component structure bending degree, and obtain the bending degree co-occurrence matrix; detect the component structure bending degree defect according to the bending degree co-occurrence matrix to obtain the component structure defect data; identify the surface texture defect of the three-dimensional model of the metal component to be tested to obtain the surface texture defect data; and output the component structure defect data and the surface texture defect data as a metal component defect report.

[0176] Through the metal component material detection module, the metal component to be tested is obtained and its material is determined. At the same time, material reflection judgment is carried out to obtain the material reflection data of the metal component to be tested, which can provide an accurate material information basis for subsequent image acquisition. Based on the accurate material reflection data, the reasonable setting of light source parameters in the subsequent image acquisition process can be ensured, thereby effectively improving the quality and accuracy of image acquisition, laying a reliable data foundation for the subsequent defect identification link, avoiding image acquisition errors caused by material property differences, and ensuring the efficiency and reliability of the entire defect identification process. Through the multi-angle image acquisition module, according to the material reflection data of the metal component to be tested, the variable light source scanning device is used to perform multi-angle image acquisition on the metal component, and comprehensive and high-quality multi-angle images of the metal component can be obtained. This multi-angle image acquisition method can fully capture the appearance characteristics of the metal component from different perspectives, including structural details and surface textures, etc., providing a rich and accurate image data source for subsequent image processing and defect identification, ensuring that the subsequent analysis process can be based on comprehensive image information, and thus effectively improving the accuracy and integrity of defect identification. Through the metal component three-dimensional model module, the multi-angle images of the metal component are enhanced to generate multi-angle enhanced images of the component, which can effectively improve the clarity and contrast of the images, making the structural details and surface texture features of the component more obvious and easy to identify. Furthermore, the component structure is detected from the multi-angle enhanced images of the component and the parameters of the component structure are measured to obtain the component structure data, and the surface texture feature extraction is carried out to obtain the surface texture feature data. These operations can accurately obtain the structural and texture feature information of the metal component. Based on the component structure data and the surface texture feature data, a three-dimensional model of the metal component to be tested is constructed, which can realize the all-round and three-dimensional modeling of the metal component, completely presenting the internal and external structures and surface features of the component, providing a highly restored and accurate three-dimensional model basis for subsequent defect identification, making the defect identification more accurate and comprehensive, and being able to cover all parts and details of the component. Through the metal component defect identification module, the component structure curvature is identified for the three-dimensional model of the metal component to be tested, and the component structure curvature defect is detected to obtain the component structure defect data, and the surface texture defect is identified to obtain the surface texture defect data, which can accurately locate and quantify the structural and surface defect conditions of the metal component. The component structure defect data and the surface texture defect data are output as a metal component defect report, which can provide detailed, accurate and clearly directional defect information for subsequent quality assessment, repair decision-making and process improvement, facilitating relevant personnel to quickly understand the defect status of the component and take corresponding measures, effectively improving the quality detection efficiency and reliability of the metal component, and ensuring the performance and safety of the metal component in practical applications.Therefore, through data processing technology, image processing technology, and three-dimensional modeling technology, the present invention realizes variable light source image scanning of metal parts, enhances the images of metal parts, and constructs three-dimensional models of metal parts, thereby improving the accuracy of defect detection of metal parts.

[0177] Therefore, in any aspect, the embodiments should be regarded as exemplary and non-restrictive. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the application documents are intended to be encompassed within the present invention.

[0178] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.

Claims

1. A metal parts defect recognition method based on image processing technology, characterized in that: The following steps are involved: Step S1: Obtain a metal component to be tested; Perform a wide-band reflection spectrum scan on the metal parts to be tested to obtain the material of the metal parts to be tested; Perform sinusoidal reflection judgment on the material of the metal parts to be tested to obtain the reflection data of the metal material to be tested; Step S2: According to the reflection data of the metal material to be tested, a variable light source scanning device is used to modulate the multi-wavelength light source of the metal parts, and multi-angle images of the metal parts are collected to obtain multi-angle images of the metal parts; Step S3: performing multi-site pixel enhancement on the multi-angle images of metal parts to generate multi-angle enhanced images of the parts; Performing component structural relationship phase detection on the component multi-angle enhanced image and measuring the parameters of the component structure to obtain component structural data; Perform surface texture level recognition on multi-angle enhanced images of components to obtain surface texture feature data; Construct a three-dimensional model of the metal component to be tested based on the component structure data and surface texture feature data; Step S4: identifying the curvature of the component structure on the three-dimensional model of the metal component to be tested, and measuring the curvature co-occurrence matrix of the component structure curvature to obtain the curvature co-occurrence matrix; Detect component structure curvature defects according to the curvature co-occurrence matrix and obtain component structure defect data; Perform surface texture defect recognition on the three-dimensional model of the metal parts to be tested to obtain surface texture defect data; Output component structure defect data and surface texture defect data as metal component defect reports.

2. The metal parts defect recognition method based on image processing technology according to claim 1 is characterized in that: Step S1 includes the following steps: Step S11: obtaining a metal component to be tested; Step S12: Use a metallographic microscope to perform material testing on the metal parts to be tested, and set the measuring time to 120-150 seconds and the measuring accuracy to ±0.1% to obtain the material of the metal parts to be tested; Step S13: Use the metallographic microscope again to measure the reflectance spectrum of the material of the metal component to be measured, set the measurement wavelength range of the spectrum analyzer to 400-700 nanometers, the integration time to 50-60 milliseconds, and the sampling interval to 1 nanometer; Step S14: Repeat the measurement of the measured reflection spectrum three times, with an interval of 2 seconds between each measurement, and take the arithmetic mean of the three measurement results as the final reflection spectrum data to generate material reflection spectrum data; Step S15: Calculate the average sinusoidal reflectivity of the metal component to be tested according to the material reflection spectrum data to obtain the reflection data of the metal material to be tested.

3. The metal parts defect recognition method based on image processing technology according to claim 2 is characterized in that: Step S2 includes the following steps: Step S21: According to the reflection data of the metal material to be tested, a variable light source scanning device is selected, and the light source of the variable light source scanning device is set to three different wavelengths, namely 450-500 nanometers, 550-600 nanometers and 650-700 nanometers; Step S22: Scan the device with a variable light source and set the light source intensity to 50-60%, 70-80% and 90-100%, corresponding to three light sources with different wavelengths respectively; Step S23: performing multi-angle image acquisition on the metal parts, where the acquisition angles include 0°, 45° and 90°, and using three light sources with different wavelengths for illumination at each angle; Step S24: At each angle, an image is collected using a metallographic microscope, and the resolution is set to 1080×1080 to 2048×2048 pixels, and the exposure time is set to 10-15 milliseconds; Step S25: nine images under different conditions are collected and marked under different conditions to obtain multi-angle images of metal parts.

4. The metal parts defect recognition method based on image processing technology according to claim 1 is characterized in that: Step S3 includes the following steps: Step S31: traverse the pixel points of the multi-angle image of the metal component and extract the value of each pixel point to obtain the pixel value of the metal component; Step S32: grayscale the pixel values ​​of the metal parts, wherein the red channel weight is set to 0.299, the green channel weight is set to 0.587, and the blue channel weight is set to 0.114, so as to obtain a multi-angle grayscale image; Step S33: extracting all pixel grayscale values ​​of the multi-angle grayscale image, and performing difference calculation on the pixel grayscale values ​​to obtain pixel grayscale difference; Step S34: setting the pixel grayscale difference threshold to 20, if the pixel grayscale difference is greater than or equal to 20, retain the pixel; if the pixel grayscale difference is less than 20, remove the pixel; Step S35: performing contrast enhancement on the removed pixels to generate a multi-angle enhanced image of the component; Step S36: performing component structural relationship phase detection on the component multi-angle enhanced image, and measuring the parameters of the component structure to obtain component structural data; performing surface texture level recognition on the component multi-angle enhanced image to obtain surface texture feature data; Step S37: constructing a three-dimensional model of the metal component to be tested based on the component structure data and the surface texture feature data.

5. The metal parts defect recognition method based on image processing technology according to claim 4 is characterized in that: Step S36 includes the following steps: Step S361: performing edge detection on the component multi-angle enhanced image, and marking the component edge information of the component multi-angle enhanced image to obtain a component edge marked image; Step S362: extracting the inner and outer contours of the component from the component edge mark image, dividing the inner and outer contours of the component into component structures, and calculating the length, width and area of ​​the component structure to obtain component structure data; Step S363: dividing the component multi-angle enhanced image, setting the division pixels to 4×4 to 8×8, to obtain the component block image; Step S364: traverse the pixel grayscale values ​​of the component block image, and calculate the standard deviation and variance of the pixel grayscale values ​​to obtain the block pixel grayscale feature value; Step S365: Determine the pixel grayscale gradient of the block pixel grayscale feature value, and map the pixel grayscale gradient into surface texture feature data.

6. The metal parts defect recognition method based on image processing technology according to claim 4 is characterized in that: Step S37 includes the following steps: Step S371: Determine the three-dimensional size of the metal component according to the extracted component structure data, where the length is L mm, the width is W mm, and the height is H mm; Step S372: using 3D modeling software to create a blank 3D model frame, setting the length, width and height of the model to L, W and H respectively, to obtain a metal component size model; Step S373: determining the texture roughness, direction and uniformity of the surface of the metal component according to the surface texture feature data; Step S374: adjusting the texture roughness of the metal component size model, setting the area with a roughness value greater than 0.5 as a high texture depth, and setting the area with a roughness value less than 0.5 as a low texture depth; Step S375: adjusting the texture direction of the metal component size model, setting the area with a directionality value greater than 0.7 as a strong directional texture, and setting the area with a directionality value less than 0.3 as a non-directional texture; Step S376: adjusting the texture uniformity of the metal component size model, setting the area with a uniformity value greater than 0.8 as a uniform texture, and setting the area with a uniformity value less than 0.2 as a non-uniform texture; Step S377: Smoothing the model surface, with the number of smoothing iterations set to 5, to obtain a three-dimensional model of the metal component to be tested.

7. The metal parts defect recognition method based on image processing technology according to claim 1 is characterized in that: Step S4 includes the following steps: Step S41: identifying the curvature of the component structure on the three-dimensional model of the metal component to be tested, and measuring the curvature co-occurrence matrix of the component structure curvature to obtain the curvature co-occurrence matrix; Step S42: Detect component structure curvature defects according to the curvature co-occurrence matrix to obtain component structure defect data; Step S43: performing surface texture defect recognition on the three-dimensional model of the metal component to be tested to obtain surface texture defect data; Step S44: classifying the component structure defect data and the surface texture defect data into defect types, and marking the defect types to obtain defect type marking data; Step S45: Annotate the data according to the defect type and perform data visualization to obtain a metal component defect report.

8. The metal parts defect recognition method based on image processing technology according to claim 7 is characterized in that: Step S41 includes the following steps: Step S411: dividing the three-dimensional model of the metal component to be tested into component structure grids, and setting the side length of the structure grid unit to 1.0-1.5 mm; Step S412: for each structural grid unit, calculate the rate of change of its normal vector as the local curvature of the unit; normalize the local curvature value to a range of 0 to 1, where 0 represents no curvature and 1 represents maximum curvature; Step S413: performing threshold segmentation on the normalized curvature data, and setting the curvature threshold to 0.5; Step S414: marking the area with a curvature greater than 0.5 as a potential curvature area, and extracting the coordinates and curvature value of the potential curvature area; Step S415: Initialize a curvature variable for accumulating curvature values ​​of all grid cells in the potential curvature region; traverse all grid cells in the potential curvature region and add the curvature value of each grid cell to the curvature variable; calculate the total number of grid cells in the potential curvature region, and divide the accumulated value by the total number of grid cells to obtain an average curvature; Step S416: Initialize a standard deviation variable to accumulate the square of the difference between the curvature of each grid cell and the average curvature; traverse all grid cells in the potential curvature area, calculate the square of the difference between the curvature of each grid cell and the average curvature, and accumulate it in the standard deviation variable; divide the accumulated value by the total number of grid cells, calculate the square root of the standard deviation variable, and obtain the standard deviation; Step S417: If the average curvature of a region is greater than 0.8 and the standard deviation is less than 0.1, it is determined that the region has a curvature defect; the coordinates of the region with the curvature defect, the average curvature and the standard deviation are recorded to obtain component structure defect data.

9. The metal parts defect recognition method based on image processing technology according to claim 7 is characterized in that: Step S42 includes the following steps: Step S421: dividing the surface mesh of the three-dimensional model of the metal component to be tested, and setting the side length of the surface mesh unit to 0.5-1.0 mm; Step S422: for each surface grid unit, extract the gray value of its surface texture; Step S423: Calculate the gray level co-occurrence matrix of each grid unit, set the offset distance of the gray level co-occurrence matrix to 1 pixel, and set the directions to 0°, 45°, 90°, and 135°; Step S424: for each direction, counting the frequency of occurrence of gray values ​​of adjacent pixel pairs to obtain a gray level co-occurrence matrix; Step S425: traverse each element in the gray-level co-occurrence matrix to obtain the element value of the gray-level co-occurrence matrix; determine the row and column indexes of the element value of the gray-level co-occurrence matrix to obtain the element value row and column index data; perform row index and column index difference calculation on the element value row and column index data to obtain the row and column index difference; perform square calculation on the row and column index difference to generate the column index difference square; Step S426: multiply each gray level co-occurrence matrix element value by the square of its row and column index difference, and add all calculation results to generate a surface texture measurement parameter; Step S427: Determine the texture defect area of ​​the three-dimensional model of the metal component to be measured according to the surface texture measurement parameters, and record the regional coordinates and contrast of the texture defect to obtain surface texture defect data.

10. A metal parts defect recognition system based on image processing technology, characterized in that: Used to execute the metal parts defect recognition method based on image processing technology as claimed in claim 1, the metal parts defect recognition system based on image processing technology comprises: The metal parts material detection module is used to obtain the metal parts to be tested; perform a wide-band reflection spectrum scan on the metal parts to be tested to obtain the material of the metal parts to be tested; perform a sinusoidal reflection judgment on the material of the metal parts to be tested to obtain the reflection data of the metal material to be tested; The multi-angle image acquisition module is used to modulate the multi-wavelength light source of the metal parts through the variable light source scanning device according to the reflection data of the metal material to be tested, and to acquire multi-angle images of the metal parts; The metal parts 3D model module is used to perform multi-site pixel enhancement on multi-angle images of metal parts to generate multi-angle enhanced images of parts; perform component structure relationship phase detection on multi-angle enhanced images of parts, and measure the parameters of component structure to obtain component structure data; perform surface texture level recognition on multi-angle enhanced images of parts to obtain surface texture feature data; and construct a 3D model of the metal parts to be tested based on the component structure data and surface texture feature data; The metal component defect recognition module is used to identify the component structure curvature of the three-dimensional model of the metal component to be tested, and to measure the curvature co-occurrence matrix of the component structure curvature to obtain the curvature co-occurrence matrix; detect the component structure curvature defects according to the curvature co-occurrence matrix to obtain the component structure defect data; identify the surface texture defects of the three-dimensional model of the metal component to be tested to obtain the surface texture defect data; output the component structure defect data and the surface texture defect data as a metal component defect report.

Citation Information

Cited By

  • Pump machine metal shell size detection method based on image analysis

    CN120279080A

  • Fault monitoring intelligent positioning system for liquid crystal display screen

    CN120847105A

  • Automobile part production quality detection method and system

    CN121582225A

  • Automobile part production quality detection method and system

    CN121582225B