Three-dimensional measurement method for non-Lambert metal profile
By using polarization-coded structured light and multimodal data processing, combined with a dual-branch network model, the complex reflection characteristics problem in the three-dimensional topography measurement of non-Lambertian metal surfaces is solved, and high-precision three-dimensional topography reconstruction and detection are achieved, which is suitable for complex industrial detection.
Patent Information
- Application Number
- CN202511287235.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2045-09-10
AI Technical Summary
Existing technologies find it difficult to effectively handle the complex reflection characteristics of non-Lambertian metal surfaces, resulting in limited accuracy and reliability in three-dimensional topography measurement. Traditional methods are unable to adapt to the anisotropic reflection characteristics of metal surfaces, resulting in jump errors in phase solution. The hardware system is complex and difficult to adapt to dynamic scenes, has weak ambient light suppression capabilities, and has a high data loss rate, making it difficult to directly connect to CAD systems or support process optimization feedback.
By projecting polarization-encoded structured light onto non-Lambertian metal surfaces, polarized reflection images and ambient light noise data are simultaneously collected to generate a multimodal dataset. The weighted averaging method is used to remove ambient light noise, distinguish between specular reflection and diffuse reflection areas, and calculate the multi-channel phase. A dual-branch network model is constructed to fuse phase and polarization information, and the NURBS surface is output for defect detection and 3D reconstruction.
It achieves high-precision three-dimensional topography measurement of non-Lambertian metal surfaces, improves measurement accuracy and reliability, can effectively meet the needs of complex industrial inspections, ensures the stability and flexibility of the system, and is suitable for complex industrial inspections.
Smart Images

Figure CN120778034A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional shape measurement, and more particularly to a three-dimensional measurement method for non-Lambertian metal surfaces. Background Art
[0002] Non-Lambertian metal surfaces (such as polished aluminum and chrome-plated parts) present significant challenges in 3D topography measurement due to their complex reflective properties, including mixed specular and diffuse reflections and anisotropic textures. Traditional methods, such as structured light projection and laser scanning, are often based on the Lambertian solid assumption and struggle to effectively address the overexposure, phase jumps, and data loss associated with highly reflective surfaces. These methods perform poorly on real metal surfaces because they fail to fully account for the effects of anisotropic reflection, limiting the accuracy and reliability of the measurement results.
[0003] Existing non-Lambertian metal 3D measurement technology has significant limitations: traditional methods mainly rely on Lambertian bodies or simple specular reflection models based on single modal data (such as grayscale stripes or single polarization information), which cannot adapt to the anisotropic reflection characteristics of metal surfaces (such as the directionality of grinding textures), resulting in jump errors in phase solution; the hardware system is complex. For example, phase measurement deflectometry (PMD) requires multiple projection units and sub-millimeter calibration, which is difficult to deploy and difficult to adapt to dynamic scenes (moving workpieces cause motion blur); the ability to suppress ambient light is weak, and traditional methods (such as narrow-band filters, multi-exposure HDR imaging) are inflexible and inefficient, and the data loss rate in the specular reflection area is too high; in addition, the output form is limited to redundant 3D point clouds, which are difficult to directly connect to CAD systems or support process optimization feedback, seriously restricting industrial online detection applications. Summary of the Invention
[0004] In order to overcome the above-mentioned defects of the prior art and to achieve the above-mentioned objectives, the present invention provides the following technical solution: a three-dimensional measurement method for non-Lambertian metal surfaces, comprising: Polarization-encoded structured light is projected onto a non-Lambertian metal surface, and polarization reflection images and ambient light noise data are simultaneously collected to generate a multimodal dataset. Based on a multimodal dataset, a fused background image is generated for each reflection image using a weighted average method, and ambient light noise is removed using pixel-by-pixel subtraction. For each reflection image under each polarization state, the light intensity values of each pixel in different polarization states are extracted, and the total light intensity value, the first light intensity component, the second light intensity component, and the third light intensity component are calculated. Based on these light intensity components, the light deflection value and light deflection angle of each pixel are calculated, and a grayscale image is constructed using the light deflection values. A light deflection threshold is set to distinguish high- and low-deflection points, and connected domain analysis is used to mark high- and low-deflection areas. For each high-deflection area, the standard deviation of the light deflection angle is compared to determine whether it is a specular reflection area or a diffuse reflection area. Based on the specular reflection area and diffuse reflection area in the reflected image, a reflected image after specular reflection is eliminated is obtained; based on the reflected image after specular reflection is eliminated, a multi-channel phase is solved to obtain a preliminary absolute phase field; based on the preliminary absolute phase field, the phase jump caused by anisotropic reflection is corrected to generate a corrected continuous phase field and polarization reflectivity matrix; A dual-branch network model combining phase and polarization branches was constructed. The continuous phase field and polarization reflectivity features were input into the dual-branch network model, the phase and polarization information were fused, and the dual-branch network model was optimized by combining physical constraint loss and GAN loss. The control point coordinate matrix and weight matrix of the NURBS surface were output, and the NURBS surface was then constructed. Perform defect detection on NURBS surfaces, extract surface roughness and curvature radius, and then reconstruct the high-precision 3D surface shape of the non-Lambertian metal object being tested.
[0005] Furthermore, the multimodal dataset is generated by: Using a high-resolution projector with built-in polarization function, structured light patterns with different polarization states are projected onto the non-Lambertian metal surface in a preset time sequence. The polarization states include horizontal linear polarization, vertical linear polarization, left-angle linear polarization, right-angle linear polarization, left-hand circular polarization, and right-hand circular polarization. The structured light pattern consists of Gray code and phase-shifted stripes. Whenever a structured light pattern is projected, a camera is synchronously triggered to capture the polarized reflection image of the non-Lambertian metal surface at that moment. Polarization channel separation technology is used to obtain reflection images of different polarization states in each polarization channel, including circular polarization and linear polarization. Based on the captured polarized reflection image, phase encoding information is obtained through phase shifting and Gray code decoding algorithms. At the same time, before and after each projection of structured light, the non-Lambertian metal surface image of the rg frame without projection is taken as the background image under the same lighting conditions; All the obtained reflection images and background images are subjected to denoising and contrast enhancement processing, and the processed reflection images, background images, and phase encoding information are integrated into a multimodal dataset.
[0006] Furthermore, the mirror reflection area and the diffuse reflection area are obtained in the following manner: According to the multimodal dataset, for each reflection image, the weighted average method is applied to each pixel position in all corresponding background images to obtain the weighted average value of each pixel position, and the weighted average values of each pixel position are integrated into a fused background image; Use pixel-by-pixel subtraction to subtract the corresponding pixel value of the fused background image from each pixel value of the reflected image to obtain the reflected image after removing the ambient light noise; According to the reflection images of each polarization channel after removing the ambient light noise, all the reflection images in each polarization state are taken as a group of reflection images; For each set of reflected images, for each pixel at each pixel position, extract the light intensity values of the corresponding pixel in the horizontal linear polarization state, vertical linear polarization state, left-oblique linear polarization state, and right-oblique linear polarization state from the reflected images with different deflection states, as well as the light intensity values of each pixel in the right-hand circular polarization state and left-hand circular polarization state; In the same set of reflection images, for each pixel at each position, the average of the light intensity values under all polarization states is taken as the total light intensity value, the difference between the light intensity values of the horizontal linear polarization state and the vertical linear polarization state is taken as the first light intensity component, the difference between the light intensity values of the left-oblique linear polarization state and the right-oblique linear polarization state is taken as the second light intensity component, and the difference between the light intensity values of the right-hand circular polarization state and the left-hand circular polarization state is taken as the third light intensity component; Calculate the sum of the squares of the first light intensity component, the second light intensity component, and the third light intensity component, take the square root of the square sum, and calculate the ratio of the result to the total light intensity value to obtain the light deviation value of each pixel; Calculate the ratio of the first light intensity component to the second light intensity component, and calculate the arc tangent of the ratio, and take half of the arc tangent as the light deflection angle of each pixel; Based on the light deviation value of each pixel, a grayscale image is constructed using the light deviation value as the grayscale value; Based on the grayscale image, a light deviation threshold is set according to the light deviation value of each pixel. Pixels with a value greater than the light deviation threshold are recorded as high deviation points, and pixels with a value less than the light deviation threshold are recorded as low deviation points. Based on the high-bias points and low-bias points, the connected domain analysis method is used to identify and mark the connected high-bias points, forming different connected domains, which are marked as high-bias areas, and the remaining non-high-bias areas are marked as low-bias areas; For each high-bias area, take the standard deviation of the light deflection angles of all pixels in the high-bias area and set the light deflection angle threshold; If the standard deviation of the light deflection angle in the high-deflection area is less than the light deflection angle threshold, the high-deflection area is determined to be a specular reflection area; If the standard deviation of the light deflection angle in the high-deflection area is greater than or equal to the light deflection angle threshold, it is determined to be a diffuse reflection area.
[0007] Furthermore, the method for obtaining the reflected image after the mirror reflection is eliminated includes: Based on the mirror reflection area of the grayscale image, the open operation algorithm is used to remove noise and isolated points, and the closed operation algorithm is used to fill the holes in the mirror reflection area after the open operation. Performing dilation and erosion operations on the mirror reflection area after the closing operation, and subtracting the mirror reflection area after the erosion from the dilated mirror reflection area to obtain the mirror reflection area after edge contour enhancement; Based on the mirror reflection area after edge enhancement, the skeleton extraction technology is used to refine and segment the boundary of the mirror reflection area, and the morphological reconstruction technology is used to fill and repair the mirror reflection area to obtain a complete mirror reflection area; Create a binary mask based on the complete specular reflection area in the grayscale image, mark the specular reflection area as 0 on the binary mask, and mark other areas as 1; For each set of reflection images, the marked binary mask is multiplied with all reflection images respectively, the diffuse reflection area is retained and the specular reflection area is removed, and a set of reflection images after specular reflection elimination is obtained.
[0008] Furthermore, the method of obtaining the preliminary absolute phase field includes: Based on the set of reflected images after specular reflection elimination, the reflected images of the horizontal linear polarization state, vertical linear polarization state, +45 degree linear polarization state and -45 degree linear polarization state, as well as the right circular polarization state and left circular polarization state are Fourier transformed to extract the fundamental frequency component and perform filtering. Then, the initial phase estimate of each polarization state is obtained by inverse Fourier transform. Based on the initial phase estimate for each polarization state, arranging the initial phase estimates for all polarization states into an initial phase estimate sequence; According to the initial phase estimate of any polarization state in the initial phase estimation sequence, calculating the sum of initial phase estimation differences between all adjacent polarization states of the initial phase estimate of the polarization state; Setting a weight for each initial phase estimate based on the sum of initial phase estimate differences between adjacent polarization states; Based on the initial phase estimate of each polarization state and the corresponding weight, the preliminary absolute phase field is calculated using the weighted average method.
[0009] Furthermore, the generation method of the continuous phase field and polarization reflectivity matrix includes: A lightweight residual network is used as the basic network structure. The absolute phase field and the light deviation value and light deviation angle of each pixel are taken as input. The loss function of the residual network is defined as the sum of the gradient smoothing term and the true phase supervision term. The residual network is trained using the defined loss function and the output is the phase jump correction value, which represents the phase change that needs to be adjusted at each pixel. Among them, the gradient smoothing term is defined as the L2 norm of the gradient difference between the predicted phase field and the input absolute phase field; the true phase supervision term is defined as the L1 norm error between the predicted phase field and the true label corresponding to the training sample; According to the output phase jump residual, the sum of the phase jump residual and the absolute phase field is taken to obtain the corrected continuous phase field; Normalizing the light deflection value of each pixel according to the light deflection value and light deflection angle of each pixel obtained from the reflection images under different polarization states; The normalized light deflection value is multiplied by the cosine value of the light deflection angle to obtain the polarization reflectivity of each pixel. The polarization reflectivity matrix is constructed by integrating the polarization reflectivities of all pixels.
[0010] Furthermore, the construction method of the dual-branch network model of the phase branch combined with the polarization branch includes: Construct a two-branch network architecture, including input layer and feature extraction, trans-membrane state attention mechanism, and feature fusion and decoding; The input layer is defined as a dual-branch independent input, where the dual branches are set to be a phase branch and a polarization branch. The phase branch input is a continuous phase field. Multi-scale convolution is used to extract relevant features of the continuous phase field, and the feature map of the continuous phase field is output. The polarization branch inputs the polarization reflectivity matrix, uses lightweight convolution to extract the features of the polarization reflectivity, and outputs a feature map of the polarization reflectivity; Based on the feature map of the continuous phase field and the feature map of the polarization reflectance, the cross-attention mechanism is used to fuse the feature maps of the two branches. The feature map of the phase branch is used as the query, and the feature map of the polarization branch is used as the key and value. The attention weight is calculated using the attention weight formula of the cross-attention mechanism to obtain the attention-enhanced feature map. Among them, Query, Key and Value represent the core part of calculating attention weight in the transmembrane state attention mechanism; The attention enhancement feature map and the feature map of the phase branch are spliced along the channel dimension of the multi-scale convolution to obtain a fused feature map, which is then decoded using a decoder to output the control point coordinate matrix and weight matrix of the NURBS surface. Among them, the decoder is constructed by upsampling combined with convolution method. The upsampling operation is first used to increase the size of the fused feature map, and then the convolution layer is applied to refine the details of the fused feature map.
[0011] Furthermore, the training method of the dual-branch network model includes: Collect training datasets, including continuous phase fields and polarization reflectivity matrices, as well as corresponding true labels; Divide the training dataset into training set and validation set in proportion; The loss function of the two-branch network is defined as a joint loss function, which is composed of physical constraint loss and GAN loss. Physical constraint losses include phase smoothness loss, control point coordinate loss, and weight loss; Phase smoothness loss is defined as: for each pixel, calculate the gradient of the pixel in the horizontal and vertical directions, take the absolute value of all gradients and add them up, and then take the sum of the addition results of all pixels to get the total phase smoothness loss; The control point loss is defined as: calculating the difference between the predicted control point coordinate matrix and the actual control point coordinate matrix, and using the L2 norm to calculate the sum of these differences to obtain the value of the control point coordinate loss; The weight loss is defined as: calculating the difference between the predicted control point weight matrix and the actual control point weight matrix, and using the L2 norm to calculate the sum of these differences to obtain the value of the weight loss; The parameters of the two-branch network are initialized using a random initialization method. The training set is input into the two-branch network for forward propagation to obtain the control point coordinate matrix and weight matrix of the NURBS surface. After each forward propagation of the model, the phase smoothness loss, control point coordinate loss, and weight loss are calculated based on the predicted control point coordinate matrix and weight matrix of the NURBS surface to obtain the values of the three losses. The discriminator in the GAN loss is used to score the values of the three losses and the true labels, and then the GAN loss value is calculated using the GAN loss; The joint loss function is obtained by weighted summing the values of phase smoothness loss, control point loss, weight loss and GAN loss; According to the joint loss function, the gradient of each network parameter is calculated by the back propagation algorithm, and the Adam optimization algorithm is used to update the network parameters to minimize the loss function; For each iteration, AUC is used as the evaluation metric and the AUC value is calculated on the validation set; According to the AUC value on the validation set, the difference between the AUC value after the current iteration and the AUC value of the previous iteration is calculated and recorded as the iteration difference; Set the iteration difference threshold. If the iteration difference is greater than the iteration difference threshold, it is determined that the performance of the model has improved. If the iteration difference is less than or equal to the iteration difference threshold, it is determined that the performance of the model has not improved; If the performance of the model on the validation set does not improve in consecutive DC iterations, the training is stopped and a trained two-branch network model is obtained.
[0012] Furthermore, the NURBS surface is constructed in the following manner: According to the control point coordinate matrix and weight matrix output by the dual-branch network model, the orders of the two directions on the NURBS surface are set, and the number of control points and the corresponding uniformly distributed node vectors of the NURBS surface are set. The control point coordinate matrix and the weight matrix are merged into a four-dimensional vector, and then a parameterized NURBS surface is constructed through the NURBS tool.
[0013] Furthermore, the method for reconstructing the high-precision three-dimensional surface shape of the non-Lambertian metal object under test includes: Based on the generated NURBS surface, the maximum and minimum principal curvatures of each point on the NURBS surface are calculated using differential geometry, and a high curvature threshold is set. If the maximum curvature of any point on the NURBS surface is greater than the high curvature, the point is determined to have a defect and marked as an abnormal area on the NURBS surface. The average height of all points on the NURBS surface is taken as the average plane, and the root mean square value of the height deviation of all points on the NURBS surface relative to the average plane is calculated as the surface roughness; According to the maximum and minimum principal curvatures of each point on the NURBS surface, the curvature radius of each point in two directions of the NURBS surface is calculated using the curvature radius conversion formula; According to the curvature radius of each point on the NURBS surface, as well as the abnormal area and surface roughness, a smoothing algorithm is applied to improve the NURBS surface and reconstruct the three-dimensional surface shape, thereby obtaining a high-precision three-dimensional surface shape of the non-Lambertian metal object being measured.
[0014] The technical effects and advantages of the three-dimensional measurement method of non-Lambertian metal surfaces of the present invention are as follows: The present invention projects structured light patterns of different polarization states onto non-Lambertian metal surfaces and simultaneously collects reflected images and ambient light noise data. This allows the invention to comprehensively capture complex reflection characteristics (including specular reflection and diffuse reflection) and the influence of ambient light noise, providing accurate basic data for subsequent processing. Secondly, the weighted average method is used to generate a fused background image and remove ambient light noise to improve the quality of the reflected image. Subsequently, based on the light intensity value of each pixel under different polarization states, the light deflection value and light deflection angle are calculated to distinguish between specular reflection areas and diffuse reflection areas, thereby reducing the phase jump problem and improving measurement accuracy. Then, the specular reflection area is processed to ensure the authenticity and reliability of the reflected image, and the multi-channel phase is solved to obtain a continuous phase field, which solves the phase jump problem and ensures the continuity of the phase field. and accuracy, providing reliable data support for 3D shape reconstruction; then, a dual-branch network model is constructed by combining phase information and polarization reflectivity characteristics, and the physical constraint loss and GAN loss are applied to jointly optimize the model to output the control point coordinate matrix and weight matrix of the NURBS surface, which improves the robustness and generalization ability of the model and the accuracy of 3D shape reconstruction; finally, a NURBS surface is constructed according to the control point coordinate matrix and weight matrix, defect detection is performed, and surface roughness and curvature radius are extracted, and then a high-precision 3D surface is constructed, which realizes efficient and accurate measurement of the 3D shape of non-Lambertian metal surfaces. This method not only improves the measurement accuracy and reliability, but also has wide applicability and flexibility, can effectively meet the needs of complex industrial detection, and ensure the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 Schematic diagram of a three-dimensional measurement method for non-Lambertian metal surfaces according to the present invention; Figure 2 A schematic diagram of a three-dimensional measurement system for a non-Lambertian metal surface of the present invention; Figure 3 This is a model structure diagram of a three-dimensional measurement method for non-Lambertian metal surfaces according to the present invention. DETAILED DESCRIPTION
[0016] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0017] Example 1 See also Figure 1 and Figure 3 As shown, the three-dimensional measurement method of a non-Lambertian metal surface described in this embodiment includes: A polarized structured light is projected to a non-Lambertian metal surface by a polarization encoding structure, and a polarized reflection image and ambient light noise data are synchronously collected to generate a multi-modal data set; Based on the multi-modal data set, a fusion background image is generated for each reflection image by a weighted average method, and ambient light noise is removed by pixel-by-pixel subtraction; for the reflection image in each polarization state, the light intensity values of each pixel point in different polarization states are extracted, and the total light intensity value, the first, second and third light intensity components are calculated; the light polarization value and the light polarization angle of each pixel point are calculated according to the light intensity components, and a gray-scale image is constructed using the light polarization value; a light polarization threshold is set to distinguish high-polarization points and low-polarization points, and the high-polarization region and the low-polarization region are labeled using connected component analysis; for each high-polarization region, the specular reflection region and the diffuse reflection region are determined by comparing the standard deviation of the light polarization angle; Based on the specular reflection region and the diffuse reflection region in the reflection image, a reflection image after specular reflection elimination is obtained; based on the reflection image after specular reflection elimination, a multi-channel phase is solved to obtain a preliminary absolute phase field, and the phase jump caused by anisotropic reflection is corrected according to the preliminary absolute phase field to generate a corrected continuous phase field and a polarized reflectivity matrix; A double-branch network model combining a phase branch and a polarization branch is constructed, the continuous phase field and the polarized reflectivity feature are input into the double-branch network model, the phase and polarization information are fused, and the double-branch network model is optimized by combining a physical constraint loss and a GAN loss, and the control point coordinate matrix and the weight matrix of the NURBS surface are output to construct the NURBS surface; The NURBS surface is subjected to defect detection, the surface roughness and the curvature radius are extracted, and the high-precision three-dimensional surface of the measured non-Lambertian metal object is reconstructed; The generation method of the multi-modal data set comprises: A high-resolution projector with a built-in polarization function is used to project structured light patterns in different polarization states to the non-Lambertian metal surface according to a preset time sequence (such as dividing the time into different time points according to a preset time interval, and projecting structured light once at each time point), wherein the polarization states include horizontal (0 degrees), vertical (90 degrees), left oblique (such as +45 degrees), right oblique (such as -45 degrees) linear polarization, and left and right circular polarization, and the structured light pattern is composed of Gray code and phase shift stripes; Whenever a structured light pattern is projected, a camera is synchronously triggered to capture the polarized reflection image of the non-Lambertian metal surface at that moment. Polarization channel separation technology is used to obtain reflection images of different polarization states under each polarization channel. Polarization channels include circular polarization and linear polarization. (When using linear polarization, when light strikes a surface at a certain angle, the specular reflection component generally maintains its original polarization direction, while the diffuse reflection component causes a change in polarization direction. The use of circularly polarized light can further help distinguish different reflection types, as specular reflection generally maintains circular polarization, while diffuse reflection may result in a transition from circular polarization to linear polarization or complete depolarization.) Based on the captured polarized reflection images, phase encoding information is obtained through phase shifting and Gray code decoding algorithms. (Specifically, the actual phase value of each pixel is calculated by analyzing the deformation of the structured light pattern on the surface, thereby obtaining the three-dimensional topography of the object surface. These polarized reflection images contain important information about the surface geometry and material properties, namely the so-called phase encoding information, which comes from the deformation of the structured light pattern on the surface.) At the same time, before and after each projection of structured light, RG frame images of non-Lambertian metal surfaces in a non-projection state are captured using the same lighting conditions as background images (i.e., background images, which are captured without interference from active light sources and can reflect various light sources in the environment (such as workshop lights and natural light) and are used as references for subsequent removal of ambient light noise. These background images can help establish a dynamic background noise model for real-time reduction of ambient light interference. Specifically, for each frame of actually measured reflection image, the light intensity value in the corresponding background image is subtracted from the image, thereby eliminating or reducing the interference of ambient light on the measurement results); All the obtained reflection images and background images are subjected to denoising and contrast enhancement, and the processed reflection images, background images, and phase encoding information are integrated into a multimodal dataset; An exemplary method for integrating into a multimodal dataset is to define a unified data structure or framework for storing information from different modalities. For example, a three-dimensional array or tensor can be used, where each dimension represents a different type of information (such as spatial position, polarization state, time series, etc.); The processed reflection images are stored in the data frame according to their corresponding polarization states (circular polarization and linear polarization), ensuring that each image has a clear location representation for subsequent access and processing; The phase encoding information obtained by analysis is also integrated into the data framework. Usually, the phase information corresponds to the spatial coordinates of the reflection image, so it can be directly mapped to the same spatial position; Add necessary metadata to the entire dataset, including but not limited to shooting time, camera and projector parameter settings, experimental conditions, etc. These metadata will help better understand and interpret the results in subsequent data analysis; The specular reflection area and diffuse reflection area are obtained in the following ways: Based on the multimodal dataset, for each reflected image, a weighted average method is applied to each pixel position in all corresponding background images to obtain a weighted average value of each pixel position (that is, for all corresponding background images before and after, a one-to-one correspondence is made between the pixel points at each pixel position in all background images, and the pixel values of each pixel position in different background images are taken and calculated using the weighted average method to obtain the weighted average value of each pixel position). The weighted average values of each pixel position are then integrated into a fused background image. Use pixel-by-pixel subtraction to subtract the corresponding pixel value of the fused background image from each pixel value of the reflected image to obtain the reflected image after removing the ambient light noise; According to the reflection images of each polarization channel after removing the ambient light noise, all the reflection images in each polarization state are taken as a group of reflection images; For each set of reflected images, for each pixel at each pixel position, extract the light intensity values of the corresponding pixel in horizontal, vertical, left-tilted, and right-tilted linear polarization states from the reflected images with different deflection states, as well as the light intensity values of each pixel in right-handed circular polarization and left-handed circular polarization states; In the same set of reflection images, for each pixel at each position, the average of the light intensity values under all polarization states is taken as the total light intensity value, the difference between the light intensity values of the horizontal linear polarization state and the vertical linear polarization state is taken as the first light intensity component, the difference between the light intensity values of the left-oblique linear polarization state and the right-oblique linear polarization state is taken as the second light intensity component, and the difference between the light intensity values of the right-hand circular polarization state and the left-hand circular polarization state is taken as the third light intensity component; Calculate the sum of the squares of the first, second, and third light intensity components, take the square root of the sum, and calculate the ratio of the result to the total light intensity value to obtain the light deviation value of each pixel, that is, ,in, Indicates the total light intensity value, represents the first light intensity component, represents the second light intensity component, represents the third light intensity component; Calculate the ratio of the first light intensity component to the second light intensity component, and calculate the arc tangent of the ratio. Take half of the arc tangent as the light deflection angle of each pixel, that is, ; Based on the light deviation value of each pixel, a grayscale image is constructed using the light deviation value as the grayscale value; Based on the grayscale image, a light deviation threshold (e.g., 0.5, the specific value is determined by industry experts based on experience) is set according to the light deviation value of each pixel. Pixels with a value greater than the light deviation threshold are marked as high deviation points, and pixels with a value less than the light deviation threshold are marked as low deviation points. Based on the high-bias points and low-bias points, the connected domain analysis method is used to identify and mark the connected high-bias points, forming different connected domains, which are marked as high-bias areas, and the remaining non-high-bias areas are marked as low-bias areas; For each high-deflection area, the standard deviation of the light deflection angles of all pixels in the high-deflection area is taken, and a light deflection angle threshold is set (for example, 10 degrees, with the specific value set by relevant industry personnel or experts based on experience). If the standard deviation of the light deflection angles in the high-deflection area is less than the light deflection angle threshold, the high-deflection area is determined to be a specular reflection area (because specular reflection often maintains the polarization state of the incident light, the light deflection value in the specular reflection area is higher. Moreover, when the light source and observation angle are fixed, the polarization directions of the specular reflection parts tend to be consistent because they directly reflect the polarization characteristics of the incident light. This indicates that the light deflection angle will be more regular, that is, the standard deviation of the light deflection angle will be smaller). If the standard deviation of the light deflection angles in the high-deflection area is greater than or equal to the light deflection angle threshold, it is determined to be a diffuse reflection area (because diffuse reflection causes the polarization direction to become irregular, which manifests as a more dispersed light deflection angle, that is, a larger deviation in the light deflection angle). The reflected image after the mirror reflection is eliminated is obtained by: Based on the specular reflection area of the grayscale image, the open-loop algorithm is used to remove noise and isolated points (the purpose is to remove small isolated points or noise points to prevent them from being misjudged as specular reflection areas), and the closed-loop algorithm is used to fill the holes in the specular reflection area after the open-loop operation (the purpose is to fill the holes in the open-loop operation and ensure the coherence of the target area). Performing dilation and erosion operations on the mirror reflection area after the closing operation, and subtracting the mirror reflection area after the erosion from the dilated mirror reflection area to obtain the mirror reflection area after edge contour enhancement; Based on the mirror reflection area after edge enhancement, the skeleton extraction technology is used to refine and segment the boundary of the mirror reflection area, and the morphological reconstruction technology is used to fill and repair the mirror reflection area to obtain a complete mirror reflection area; Create a binary mask based on the complete specular reflection area in the grayscale image, mark the specular reflection area as 0 on the binary mask, and mark other areas as 1; For each set of reflection images, use the marked binary mask to perform product processing with all reflection images respectively, retain the diffuse reflection area and remove the specular reflection area, and obtain a set of reflection images after the specular reflection is eliminated (directly multiplying the mask with the original area, the specular reflection area will become black, and the diffuse reflection area will remain as it is. The resulting image retains the diffuse reflection area and removes the specular reflection area); The methods for obtaining the preliminary absolute phase field include: Based on the set of reflected images after specular reflection elimination, the reflected images of horizontal, vertical, +45 degrees and -45 degrees linear polarization states, as well as right-hand circular polarization and left-hand circular polarization states, are Fourier transformed to extract the fundamental frequency component and filter it. The initial phase estimate of each polarization state is then obtained through inverse Fourier transform. Based on the initial phase estimate for each polarization state, set the weight of each initial phase estimate ; in, Indicates the The initial phase estimation weights of the polarization states, Represents the sum of the initial phase estimation differences between adjacent polarization states. This part represents the summation part, which calculates the difference with the first The sum of the phase differences between pairs of adjacent polarization states directly related to the first polarization state is , only considering , for the last polarization state , only considering , for the intermediate polarization states ,consider and , using the result of the summation as the denominator, calculate the The weight of each polarization state. A larger phase difference means more inconsistency and noise, so these areas are given a smaller weight. On the contrary, a smaller phase difference indicates more stable phase information and should be given a larger weight. u represents the index variable used to traverse the polarization states. polarization state pairs related to polarization states, Indicates the end index of the summation. For the last polarization state, there is no next state, so End, for other states, then Finish, Indicates the starting index for summation. For the first polarization state , it has no previous polarization state, so from For other states, start from start, represents the number of polarization states, (i.e. four linear polarization and two circular polarization states), Indicates the Hedi The initial phase estimate difference between the polarization states is defined as , Indicates the The initial phase estimate of the polarization state, represents a non-zero constant, such as , used to prevent errors when the denominator of the formula is zero; By basing the phase difference between each polarization channel and its directly adjacent channel, a more reasonable weight distribution can be achieved, thereby effectively distinguishing between specular and diffuse reflection areas and improving the quality of phase solution. Based on the initial phase estimate and corresponding weights for each polarization state, a weighted average method is used to calculate a preliminary absolute phase field. By taking advantage of the differences in reflection characteristics of different polarization channels, the phase information of each channel is weightedly fused to compensate for the lack of data from a single channel. Furthermore, by weighted averaging the phase fields of each polarization state, noise can be suppressed in the specular reflection area. The continuous phase field and polarization reflectivity matrix are generated by: After joint phase calculation using multiple polarization states (i.e., multiple channels), a preliminary absolute phase field is obtained. However, due to various factors in actual application scenarios (such as surface texture and noise), this phase field may be discontinuous or jumpy. Therefore, further phase correction is required to obtain a smoother and more accurate result. A lightweight residual network is used as the basic network structure, with the absolute phase field and the light deviation value and angle of each pixel as input. The loss function of the residual network is defined as the sum of the gradient smoothing term and the true phase supervision term (the loss function is designed to ensure that the predicted phase field conforms to physical constraints and is close to the true value). The residual network is trained using the defined loss function, and the output is the phase jump correction value, which represents the phase change that needs to be adjusted at each pixel. Among them, the gradient smoothing term is defined as the L2 norm of the gradient difference between the predicted phase field and the input absolute phase field; the true phase supervision term is defined as the L1 norm error between the predicted phase field and the true label corresponding to the training sample; That is, the loss function is defined as: ,in, represents the predicted phase field, represents the absolute phase field, represents the true phase field referred to by the true label in the training sample, and Represents the factors that balance the smoothness and absolute accuracy of different loss terms (e.g. , , the specific value is set by relevant personnel and experts in the industry based on experience). represents the gradient smoothing term, which measures the similarity between the predicted phase field and the input fused phase field by comparing the gradient difference between the two. The role of this part is to ensure that the predicted phase field is as consistent as possible with the original fused phase field in its gradient direction, thereby maintaining the overall trend of the phase field and suppressing local noise and discontinuity; Represents the true phase supervision term, which directly measures the difference between the predicted phase field and the true phase in the calibration sample. The purpose of this part is to make the prediction result as close as possible to the actual measured or known true phase value to improve the accuracy of the prediction; The entire loss function combines a gradient smoothing term with a true phase supervision term to ensure the physical rationality of the predicted phase field (such as smoothness and consistency) while making it as close to the actual situation as possible. The choice of weight coefficient determines the relative importance of these two factors in the optimization process. This design helps the model learn more accurate and physically reasonable phase information. Based on the output phase jump residual, the phase jump residual and the absolute phase field are summed to obtain the corrected continuous phase field (the continuous phase field is a 2D matrix representing the absolute phase value of each pixel. The corrected continuous phase field is obtained by directly correcting the phase jump area, such as the phase mutation caused by metal brushed texture). Normalizing the light deflection value of each pixel according to the light deflection value and light deflection angle of each pixel obtained from the reflection images under different polarization states; The normalized light deflection value is multiplied by the cosine value of the light deflection angle to obtain the polarization reflectivity of each pixel. The polarization reflectivity of all pixels is integrated to construct a polarization reflectivity matrix (a 2D matrix containing light deflection value and light deflection angle information). By fusing the linearly polarized and circularly polarized phase fields, multi-channel phase complementation effectively suppresses the residual error of specular reflection. The residual network combined with the defined physically constrained loss function solves the phase jump problem caused by processing texture. By suppressing the specular reflection residual and anisotropic interference, high-precision phase solution is achieved. Combined with polarization reflectivity, physical-data collaborative optimization is achieved. The construction methods of the dual-branch network model of phase branching combined with polarization branching include: Construct a two-branch network architecture, including input layer and feature extraction, trans-membrane state attention mechanism, and feature fusion and decoding; Define the input layer as a dual-branch independent input, set the dual branches to be phase branch and polarization branch, the phase branch input is a continuous phase field, use multi-scale convolution (such as ResNet module) to extract the relevant features of the continuous phase field (including local gradient features and global continuity features), and output the feature map of the continuous phase field; The polarization branch takes as input the polarization reflectance matrix and uses lightweight convolution (such as the MobileNet module) to extract polarization reflectance features (including anisotropic features such as texture directionality) and outputs a polarization reflectance feature map. Based on the feature map of the continuous phase field and the feature map of the polarization reflectivity, the cross-attention mechanism is used to fuse the feature maps of the two branches. The feature map of the phase branch is used as the query, and the feature map of the polarization branch is used as the key and value. The attention weight is calculated using the attention weight formula of the cross-attention mechanism to obtain an attention-enhanced feature map, which enhances the sensitivity to anisotropic regions in the phase field. Among them, the query, key, and value represent the core part of calculating the attention weight in the cross-membrane state attention mechanism. Query: Here, Query is the feature vector or feature map extracted from a branch (such as the phase branch), which serves as a "query" to find other related information; Key: Key is a feature vector or feature map extracted from another branch (such as the polarization branch). They are used to respond to the "query" from the Query, that is, they help determine which parts of the information are most relevant to the Query; Value: The value is also extracted from another branch (usually the branch that provides the key, i.e. the polarization branch). The value contains the actual information content. Once the correlation is determined by the query and the key, the value will be used to generate the final output feature map; The attention enhancement feature map and the feature map of the phase branch are spliced along the channel dimension of the multi-scale convolution to obtain a fused feature map, which is then decoded using a decoder to output the control point coordinate matrix and weight matrix of the NURBS surface. The decoder is constructed by combining upsampling with convolution. The upsampling operation is first used to increase the size of the fused feature map, and then the convolution layer is applied to refine the details of the fused feature map. The training methods of the dual-branch network model include: Collect training samples, including continuous phase field and polarization reflectivity matrix, as well as the corresponding true labels; Divide the training samples into training set and validation set in proportion; The loss function of the two-branch network is defined as a joint loss function, which is defined as the weighted sum of the phase smoothness loss value, the control point coordinate loss value, the weight loss value and the GAN loss value; Phase smoothness loss is defined as: for each pixel, calculate the gradient of the pixel in the horizontal and vertical directions, take the absolute value of all gradients and add them up, and then take the sum of the addition results of all pixels to get the total phase smoothness loss; Right now ,in, represents the phase smoothness loss value, Indicates the position of the pixel, Represents the phase field in the horizontal direction In position The absolute value of the gradient at , Represents the phase field in the vertical direction In position The absolute value of the gradient at , calculated by the finite difference method and ; The control point loss is defined as: calculating the difference between the predicted control point coordinate matrix and the true control point coordinate matrix, and using The norm calculates the sum of these differences to obtain the value of the control point coordinate loss; Right now ,in, represents the predicted control point coordinates, Indicates the real control point coordinates corresponding to the real label, express norm; The weight loss is defined as: calculating the difference between the predicted control point weight matrix and the actual control point weight matrix, and using The norm calculates the sum of these differences to get the value of the weight loss; Right now ,in, represents the predicted control point weight, Represents the actual control point weight corresponding to the actual label, express norm; The parameters of the two-branch network are initialized using a random initialization method. The training set is input into the two-branch network for forward propagation to obtain the control point coordinate matrix and weight matrix of the NURBS surface. After each forward propagation of the model, the phase smoothness loss, control point coordinate loss, and weight loss are calculated based on the predicted control point coordinate matrix and weight matrix of the NURBS surface to obtain the values of the three losses. The discriminator in the GAN loss is used to score the values of the three losses and the true labels, and then the GAN loss is used to calculate the GAN adversarial loss, and then the joint loss function is obtained through weighted summation. According to the joint loss function, the gradient of each network parameter is calculated by the back propagation algorithm, and the Adam optimization algorithm is used to update the network parameters to minimize the loss function; For each iteration, AUC is used as the evaluation metric and the AUC value is calculated on the validation set; According to the AUC value on the validation set, the difference between the AUC value after the current iteration and the AUC value of the previous iteration is calculated and recorded as the iteration difference; Set the iteration difference threshold. If the iteration difference is greater than the iteration difference threshold, it is determined that the performance of the model has improved. If the iteration difference is less than or equal to the iteration difference threshold, it is determined that the performance of the model has not improved; If the performance of the model on the validation set does not improve in consecutive DC iterations, the training is stopped and the trained two-branch network model is obtained; NURBS surfaces can be constructed in the following ways: According to the control point coordinate matrix and weight matrix output by the dual-branch network model, the parameters of the NURBS surface are set, and then the NURBS surface is generated through the control point coordinate matrix and weight matrix; The methods for reconstructing the high-precision three-dimensional surface shape of the non-Lambertian metal object being measured include: Based on the generated NURBS surface, the maximum and minimum principal curvatures of each point on the NURBS surface are calculated using differential geometry, and a high curvature threshold is set. If the maximum curvature of any point on the NURBS surface is greater than the high curvature, the point is determined to have a defect and marked as an abnormal area on the NURBS surface. The average height of all points on the NURBS surface is taken as the average plane, and the root mean square value of the height deviation of all points on the NURBS surface relative to the average plane is calculated as the surface roughness; According to the maximum and minimum principal curvatures of each point on the NURBS surface, the curvature radius of each point in two directions of the NURBS surface is calculated using the curvature radius conversion formula; According to the curvature radius of each point on the NURBS surface, as well as the abnormal area and surface roughness, a smoothing algorithm is applied to improve the NURBS surface and reconstruct the three-dimensional surface shape to obtain the reconstructed three-dimensional surface shape of the non-Lambertian metal object being tested.
[0018] This embodiment projects structured light patterns of different polarization states onto non-Lambertian metal surfaces and simultaneously collects reflected images and ambient light noise data, thereby comprehensively capturing complex reflection characteristics (including specular reflection and diffuse reflection) and the influence of ambient light noise, and providing accurate basic data for subsequent processing. Secondly, a weighted average method is used to generate a fused background image and remove ambient light noise, thereby improving the quality of the reflected image. Subsequently, based on the light intensity value of each pixel point under different polarization states, the light deflection value and light deflection angle are calculated to distinguish between specular reflection areas and diffuse reflection areas, thereby reducing the phase jump problem and improving measurement accuracy. Then, the specular reflection area is processed to ensure the authenticity and reliability of the reflected image, and the multi-channel phase is solved to obtain a continuous phase field, thereby solving the phase jump problem and ensuring the continuity of the phase field. The robustness and generalization ability of the model are improved, and the accuracy of 3D shape reconstruction is improved. It provides reliable data support for 3D shape reconstruction. Then, a dual-branch network model is constructed by combining phase information and polarization reflectivity characteristics, and the physical constraint loss and GAN loss are applied to jointly optimize the model to output the control point coordinate matrix and weight matrix of the NURBS surface. Finally, the NURBS surface is constructed according to the control point coordinate matrix and weight matrix to perform defect detection and extract surface roughness and curvature radius, and then a high-precision 3D surface is constructed, realizing efficient and accurate measurement of the 3D shape of non-Lambertian metal surfaces. This method not only improves the measurement accuracy and reliability, but also has wide applicability and flexibility. It can effectively meet the needs of complex industrial detection and ensure the stability and reliability of the system.
[0019] Example 2 See also Figure 2 As shown, the parts not described in detail in this embodiment are described in Example 1, which provides a three-dimensional measurement system for non-Lambertian metal surfaces, including: a spectral data processing area, a polarization feature analysis area, a phase correction and feature extraction area, a dual-branch network optimization area, and a surface reconstruction and detection area; The spectral data processing area includes a polarization projection unit, a dataset generation unit, and a noise cleaning unit. The polarization projection unit is responsible for projecting structured light patterns of different polarization states onto non-Lambertian metal surfaces and synchronously triggering the camera to capture images. The dataset generation unit collects and processes data from the polarization projection workshop to generate a multimodal dataset containing polarized reflection images and ambient light noise. The noise cleaning unit uses a weighted averaging method to generate a fused background image and removes ambient light noise through pixel-by-pixel subtraction, preparing a clean reflection image for subsequent analysis. The polarization feature analysis section includes a light intensity calculation unit, a light polarization analysis unit, and a reflection differentiation unit. The light intensity calculation unit calculates the light intensity value of each pixel in each polarization state, its total light intensity value, and the first, second, and third light intensity components for the reflected image under each polarization state. The light polarization analysis unit calculates the light polarization value and light polarization angle of each pixel based on the light intensity components and uses the light polarization values to construct a grayscale image. The reflection differentiation unit uses the light polarization threshold to distinguish high and low polarization points and mark the specular reflection area and diffuse reflection area. The phase correction and feature extraction area includes a mirror removal unit and a phase resolution unit. The mirror removal unit processes the mirror reflection area in the grayscale image to remove the mirror reflection, ensuring the accuracy of the reflected image. The phase resolution unit resolves the multi-channel phase to obtain a preliminary absolute phase field, and further corrects the phase jump caused by anisotropic reflection to generate a continuous phase field and polarization reflectivity matrix. The dual-branch network optimization area includes a dual-branch unit and a loss optimization unit. The dual-branch unit constructs a dual-branch network model that combines phase information and polarization reflectivity characteristics to fuse the two types of information. The loss optimization unit defines and applies physical constraint loss and GAN loss to optimize the dual-branch network model and output the control point coordinate matrix and weight matrix of the NURBS surface. The surface reconstruction and detection area includes a surface generation unit, a defect and special effect exploration unit, and a three-dimensional morphology reconstruction unit; the surface generation unit constructs a NURBS surface based on the optimized control point coordinate matrix and weight matrix; the defect and special effect exploration unit performs defect detection on the constructed NURBS surface and extracts characteristics such as surface roughness and curvature radius; the three-dimensional morphology reconstruction unit applies an algorithm to improve the NURBS surface based on the extracted surface features, and reconstructs the high-precision three-dimensional morphology of the non-Lambertian metal object being tested.
[0020] Example 3 This embodiment discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the operation mode of the three-dimensional measurement method of a non-Lambertian metal surface provided above is implemented.
[0021] Since the electronic device described in this embodiment is an electronic device used to implement a three-dimensional measurement method for a non-Lambertian metal surface in the embodiment of this application, based on the three-dimensional measurement method for a non-Lambertian metal surface described in the embodiment of this application, those skilled in the art will be able to understand the specific implementation of the electronic device of this embodiment and its various variations, so how the electronic device implements the method in the embodiment of this application will not be described in detail here. As long as the electronic device used by those skilled in the art to implement the three-dimensional measurement method for a non-Lambertian metal surface in the embodiment of this application falls within the scope of protection to be provided by this application.
[0022] The above formulas are all dimensionless and numerical calculations. The formulas are obtained by collecting a large amount of data and performing software simulation to obtain the most recent real situation. The preset parameters and thresholds in the formulas are set by technicians in this field according to actual conditions.
[0023] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiment. All technical solutions based on the principles of the present invention are within the scope of protection of the present invention. It should be noted that for users of ordinary skill in the art, various improvements and modifications that do not depart from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A three-dimensional measurement method for non-Lambertian metal surfaces, characterized in that: include: S1: Polarization-encoded structured light is projected onto a non-Lambertian metal surface, and polarization reflection images and ambient light noise data are simultaneously collected to generate a multimodal dataset. S2: Based on the multimodal dataset, a fused background image is generated for each reflected image using the weighted averaging method, and ambient light noise is removed using pixel-by-pixel subtraction. For each reflected image in each polarization state, the light intensity value of each pixel in different polarization states is extracted and the total light intensity value, the first light intensity component, the second light intensity component, and the third light intensity component are calculated. Based on these light intensity components, the light deflection value and light deflection angle of each pixel are calculated, and a grayscale image is constructed using the light deflection values. A light deflection threshold is set to distinguish high- and low-deflection points, and connected domain analysis is used to mark high- and low-deflection areas. For each high-deflection area, the standard deviation of the light deflection angle is compared to determine whether it is a specular reflection area or a diffuse reflection area. S3: Based on the specular reflection area and diffuse reflection area in the reflected image, a reflected image after specular reflection is eliminated is obtained; based on the reflected image after specular reflection is eliminated, a multi-channel phase is solved to obtain a preliminary absolute phase field; based on the preliminary absolute phase field, the phase jump caused by anisotropic reflection is corrected to generate a corrected continuous phase field and a polarization reflectivity matrix; S4: Construct a dual-branch network model that combines a phase branch with a polarization branch. Input the continuous phase field and polarization reflectivity features into the dual-branch network model, fuse the phase and polarization information, and optimize the dual-branch network model using a combination of physical constraint loss and GAN loss. Output the control point coordinate matrix and weight matrix of the NURBS surface, and then construct the NURBS surface. S5: Perform defect detection on NURBS surfaces, extract surface roughness and curvature radius, and then reconstruct the high-precision 3D surface shape of the non-Lambertian metal object being tested.
2. A three-dimensional measurement method for non-Lambertian metal surfaces according to claim 1, characterized in that: The multimodal dataset is generated by: Using a high-resolution projector with built-in polarization function, a structured light pattern with different polarization states is projected onto a non-Lambertian metal surface in a preset time sequence. The polarization states include horizontal linear polarization, vertical linear polarization, left-leaning linear polarization, right-leaning linear polarization, left-hand circular polarization, and right-hand circular polarization. The structured light pattern consists of Gray code and phase-shifted fringes. Whenever a structured light pattern is projected, a camera is synchronously triggered to capture the polarized reflection image of the non-Lambertian metal surface at that moment. Polarization channel separation technology is used to obtain reflection images of different polarization states in each polarization channel, including circular polarization and linear polarization. Based on the captured polarized reflection image, phase encoding information is obtained through phase shifting and Gray code decoding algorithms. At the same time, before and after each projection of structured light, the non-Lambertian metal surface image of the rg frame without projection is taken as the background image under the same lighting conditions; All the obtained reflection images and background images are subjected to denoising and contrast enhancement processing, and the processed reflection images, background images, and phase encoding information are integrated into a multimodal dataset.
3. The three-dimensional measurement method of a non-Lambertian metal surface according to claim 2, characterized in that: The method for obtaining the specular reflection area and the diffuse reflection area includes: According to the multimodal dataset, for each reflection image, the weighted average method is applied to each pixel position in all corresponding background images to obtain the weighted average value of each pixel position, and the weighted average values of each pixel position are integrated into a fused background image; Use pixel-by-pixel subtraction to subtract the corresponding pixel value of the fused background image from each pixel value of the reflected image to obtain the reflected image after removing the ambient light noise; According to the reflection images of each polarization channel after removing the ambient light noise, all the reflection images in each polarization state are taken as a group of reflection images; For each set of reflected images, for each pixel at each pixel position, extract the light intensity values of the corresponding pixel in the horizontal linear polarization state, vertical linear polarization state, left-oblique linear polarization state, and right-oblique linear polarization state from the reflected images with different deflection states, as well as the light intensity values of each pixel in the right-hand circular polarization state and left-hand circular polarization state; In the same set of reflection images, for each pixel at each position, the average of the light intensity values under all polarization states is taken as the total light intensity value, the difference between the light intensity values of the horizontal linear polarization state and the vertical linear polarization state is taken as the first light intensity component, the difference between the light intensity values of the left-oblique linear polarization state and the right-oblique linear polarization state is taken as the second light intensity component, and the difference between the light intensity values of the right-hand circular polarization state and the left-hand circular polarization state is taken as the third light intensity component; Calculate the sum of the squares of the first light intensity component, the second light intensity component, and the third light intensity component, take the square root of the sum of the squares, and calculate the ratio of the result to the total light intensity value to obtain the light deviation value of each pixel; Calculate the ratio of the first light intensity component to the second light intensity component, and calculate the arc tangent of the ratio, and take half of the arc tangent as the light deflection angle of each pixel; Based on the light deviation value of each pixel, a grayscale image is constructed using the light deviation value as the grayscale value; Based on the grayscale image, a light deviation threshold is set according to the light deviation value of each pixel. Pixels with a value greater than the light deviation threshold are recorded as high deviation points, and pixels with a value less than the light deviation threshold are recorded as low deviation points. Based on the high-bias points and low-bias points, the connected domain analysis method is used to identify and mark the connected high-bias points, forming different connected domains, which are marked as high-bias areas, and the remaining non-high-bias areas are marked as low-bias areas; For each high-bias area, take the standard deviation of the light deflection angles of all pixels in the high-bias area and set the light deflection angle threshold; If the standard deviation of the light deflection angle in the high-deflection area is less than the light deflection angle threshold, the high-deflection area is determined to be a specular reflection area; If the standard deviation of the light deflection angle in the high-deflection area is greater than or equal to the light deflection angle threshold, it is determined to be a diffuse reflection area.
4. The three-dimensional measurement method of a non-Lambertian metal surface according to claim 3, characterized in that: The method of obtaining the reflected image after the mirror reflection is eliminated includes: Based on the mirror reflection area of the grayscale image, the open operation algorithm is used to remove noise and isolated points, and the closed operation algorithm is used to fill the holes in the mirror reflection area after the open operation. Performing dilation and erosion operations on the mirror reflection area after the closing operation, and subtracting the mirror reflection area after the erosion from the dilated mirror reflection area to obtain the mirror reflection area after edge contour enhancement; Based on the mirror reflection area after edge enhancement, the skeleton extraction technology is used to refine and segment the boundary of the mirror reflection area, and the morphological reconstruction technology is used to fill and repair the mirror reflection area to obtain a complete mirror reflection area; Create a binary mask based on the complete specular reflection area in the grayscale image, mark the specular reflection area as 0 on the binary mask, and mark other areas as 1; For each set of reflection images, the marked binary mask is multiplied with all reflection images respectively, the diffuse reflection area is retained and the specular reflection area is removed, and a set of reflection images after specular reflection elimination is obtained.
5. The three-dimensional measurement method of a non-Lambertian metal surface according to claim 4, characterized in that: The method of obtaining the preliminary absolute phase field includes: Based on the set of reflected images after specular reflection elimination, according to the reflected images of the horizontal linear polarization state, vertical linear polarization state, +45 degree linear polarization state and -45 degree linear polarization state, as well as the right circular polarization state and left circular polarization state, the reflected image of each polarization state is Fourier transformed to extract the fundamental frequency component and perform filtering processing, and then the initial phase estimate of each polarization state is obtained by inverse Fourier transform; Based on the initial phase estimate for each polarization state, arranging the initial phase estimates for all polarization states into an initial phase estimate sequence; Calculating, based on an initial phase estimate of any polarization state in the initial phase estimation sequence, a sum of initial phase estimate differences between all adjacent polarization states of the initial phase estimate of the polarization state; Setting a weight for each initial phase estimate based on the sum of initial phase estimate differences between adjacent polarization states; Based on the initial phase estimate of each polarization state and the corresponding weight, the preliminary absolute phase field is calculated using the weighted average method.
6. The three-dimensional measurement method of a non-Lambertian metal surface according to claim 5, characterized in that: The generation method of the continuous phase field and polarization reflectivity matrix includes: A lightweight residual network is used as the basic network structure. The absolute phase field and the light deviation value and light deviation angle of each pixel are taken as input. The loss function of the residual network is defined as the sum of the gradient smoothing term and the true phase supervision term. The residual network is trained using the defined loss function and the output is the phase jump correction value, which represents the phase change that needs to be adjusted at each pixel. Among them, the gradient smoothing term is defined as the L2 norm of the gradient difference between the predicted phase field and the input absolute phase field; the true phase supervision term is defined as the L1 norm error between the predicted phase field and the true label corresponding to the training sample; According to the output phase jump residual, the sum of the phase jump residual and the absolute phase field is taken to obtain the corrected continuous phase field; Normalizing the light deflection value of each pixel according to the light deflection value and light deflection angle of each pixel obtained from the reflection images under different polarization states; The normalized light deflection value is multiplied by the cosine value of the light deflection angle to obtain the polarization reflectivity of each pixel. The polarization reflectivity matrix is constructed by integrating the polarization reflectivities of all pixels.
7. A three-dimensional measurement method for non-Lambertian metal surfaces according to claim 6, characterized in that: The construction method of the dual-branch network model of the phase branch combined with the polarization branch includes: Construct a two-branch network architecture, including input layer and feature extraction, trans-membrane state attention mechanism, and feature fusion and decoding; The input layer is defined as a dual-branch independent input, where the dual branches are set to be a phase branch and a polarization branch. The phase branch input is a continuous phase field. Multi-scale convolution is used to extract relevant features of the continuous phase field, and the feature map of the continuous phase field is output. The polarization branch inputs the polarization reflectivity matrix, uses lightweight convolution to extract the features of the polarization reflectivity, and outputs a feature map of the polarization reflectivity; Based on the feature map of the continuous phase field and the feature map of the polarization reflectance, the cross-attention mechanism is used to fuse the feature maps of the two branches. The feature map of the phase branch is used as the query, and the feature map of the polarization branch is used as the key and value. The attention weight is calculated using the attention weight formula of the cross-attention mechanism to obtain the attention-enhanced feature map. Among them, Query, Key and Value represent the core part of calculating attention weight in the transmembrane state attention mechanism; The attention enhancement feature map and the feature map of the phase branch are spliced along the channel dimension of the multi-scale convolution to obtain a fused feature map, which is then decoded using a decoder to output the control point coordinate matrix and weight matrix of the NURBS surface. Among them, the decoder is constructed by upsampling combined with convolution method. The upsampling operation is first used to increase the size of the fused feature map, and then the convolution layer is applied to refine the details of the fused feature map.
8. The three-dimensional measurement method of a non-Lambertian metal surface according to claim 7, characterized in that: The training method of the dual-branch network model includes: Collect training datasets, including continuous phase fields and polarization reflectivity matrices, as well as corresponding true labels; Divide the training dataset into training set and validation set in proportion; The loss function of the two-branch network is defined as a joint loss function, which is composed of physical constraint loss and GAN loss. Physical constraint losses include phase smoothness loss, control point coordinate loss, and weight loss; Phase smoothness loss is defined as: for each pixel, calculate the gradient of the pixel in the horizontal and vertical directions, take the absolute value of all gradients and add them up, and then take the sum of the addition results of all pixels to get the total phase smoothness loss; The control point loss is defined as: calculating the difference between the predicted control point coordinate matrix and the actual control point coordinate matrix, and using the L2 norm to calculate the sum of these differences to obtain the value of the control point coordinate loss; The weight loss is defined as: calculating the difference between the predicted control point weight matrix and the actual control point weight matrix, and using the L2 norm to calculate the sum of these differences to obtain the value of the weight loss; The parameters of the two-branch network are initialized using a random initialization method. The training set is input into the two-branch network for forward propagation to obtain the control point coordinate matrix and weight matrix of the NURBS surface. After each forward propagation of the model, the phase smoothness loss, control point coordinate loss, and weight loss are calculated based on the predicted control point coordinate matrix and weight matrix of the NURBS surface to obtain the values of the three losses. The discriminator in the GAN loss is used to score the values of the three losses and the true labels, and then the GAN loss value is calculated using the GAN loss; The joint loss function is obtained by weighted summing the values of phase smoothness loss, control point loss, weight loss and GAN loss; According to the joint loss function, the gradient of each network parameter is calculated by the back propagation algorithm, and the Adam optimization algorithm is used to update the network parameters to minimize the loss function; For each iteration, AUC is used as the evaluation metric and the AUC value is calculated on the validation set; According to the AUC value on the validation set, the difference between the AUC value after the current iteration and the AUC value of the previous iteration is calculated and recorded as the iteration difference; Set the iteration difference threshold. If the iteration difference is greater than the iteration difference threshold, it is determined that the performance of the model has improved. If the iteration difference is less than or equal to the iteration difference threshold, it is determined that the performance of the model has not improved; If the performance of the model on the validation set does not improve in consecutive DC iterations, the training is stopped and a trained two-branch network model is obtained.
9. The three-dimensional measurement method of non-Lambertian metal surfaces according to claim 8, characterized in that: The NURBS surface is constructed in the following ways: According to the control point coordinate matrix and weight matrix output by the dual-branch network model, the orders of the two directions on the NURBS surface are set, and the number of control points and the corresponding uniformly distributed node vectors of the NURBS surface are set. The control point coordinate matrix and the weight matrix are merged into a four-dimensional vector, and then a parameterized NURBS surface is constructed through the NURBS tool.
10. The three-dimensional measurement method of non-Lambertian metal surface according to claim 9, characterized in that: The method for reconstructing the high-precision three-dimensional surface shape of the non-Lambertian metal object under test includes: Based on the generated NURBS surface, the maximum and minimum principal curvatures of each point on the NURBS surface are calculated using differential geometry, and a high curvature threshold is set. If the maximum curvature of any point on the NURBS surface is greater than the high curvature, the point is determined to have a defect and marked as an abnormal area on the NURBS surface. The average height of all points on the NURBS surface is taken as the average plane, and the root mean square value of the height deviation of all points on the NURBS surface relative to the average plane is calculated as the surface roughness; According to the maximum and minimum principal curvatures of each point on the NURBS surface, the curvature radius of each point in two directions of the NURBS surface is calculated using the curvature radius conversion formula; According to the curvature radius of each point on the NURBS surface, as well as the abnormal area and surface roughness, a smoothing algorithm is applied to improve the NURBS surface and reconstruct the three-dimensional surface shape, thereby obtaining a high-precision three-dimensional surface shape of the non-Lambertian metal object being measured.
Citation Information
Patent Citations
Image processing method, image processor, and image processing program
CN101044507A
Image processing device, method, and computer program for generating normal (line) information, and viewpoint-converted image generation device
CN102047651A
Curvature measurement apparatus and method
CN104949631A
Surface three-dimensional reconstruction method and system based on reflected light field polarization and space-time coding
CN108692677A
Strong reflection workpiece vision measurement method based on polarization imaging
CN111127384A
Cited By
Non-ferrous metal rolling quality management system and method
CN121504258A
Non-ferrous metal calendering quality management system and method
CN121504258B