High-reflective surface deformation feature image generation method, deformation detection method and device
Patent Information
- Application Number
- CN202611263975.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-20
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2046-08-20
AI Technical Summary
[0007]本发明针对现有三维重建方案的不足:(1)基于相位偏折术的三维重建方案需完整相位展开与三维标定,计算链长,(2)对相位梯度直接做普通形态学平滑的方案未保留梯度方向符号,无法区分凸起与凹陷,(3)现有多尺度融合方案各尺度权重缺乏系统设计,宏观形变与局部细节的检测灵敏度难以兼顾,提出一种高反光表面形变特征图像生成方法、高反光表面形变检测方法及检测装置,通过包裹相位直接求梯度(无需展开)、方向保留型非线性幅值融合和五级指数加权多尺度体系,将微小形变信息转化为瑕疵清晰可见、具备凸凹方向区分能力的散度特征图像,兼顾方向信息保留和多尺度系统融合,且无需三维标定,可直接用于人工判读或作为深度学习模型的输入
[0030]本发明将结构光投影模块、图像采集模块与配置有前述检测方法的形变检测模块集成为高反光表面形变检测装置。结构光投影模块与图像采集模块协同完成多幅相移条纹图像的快速采集,形变检测模块在无需三维标定的前提下直接基于采集图像输出散度特征图并进行凸凹判定,整个装置的计算链短、硬件要求低,能够在工业在线检测场景中实现对高反光零件表面微小形变的高效、精准检测,具有良好的工程实用性和部署便捷性。
Smart Images

Figure CN122793035B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial manufacturing technology. Specifically, it relates to a method for generating images of deformation features of highly reflective surfaces, a method for detecting deformation of highly reflective surfaces, and a detection device. Background Technology
[0002] In the industrial manufacturing sector, scratches, pits, bumps, embossing, and other minute deformation defects are commonly found on the surfaces of highly reflective parts (such as polished metal parts, glass panels, and automotive paint). These defects are typically in the millimeter or sub-millimeter range, but they have a significant impact on product functionality and appearance quality.
[0003] Existing image detection technologies struggle to obtain clear images of minute deformations on the surface of highly reflective parts, primarily due to the following limitations:
[0004] (1) Highly reflective surfaces produce strong specular reflections at different angles, resulting in large areas of bright and dark areas in the acquired images. Minor deformations are almost invisible in such images.
[0005] (2) Although deep learning-based detection methods have powerful feature learning capabilities, their detection accuracy is highly dependent on the quality of the input image. When the input is a regular grayscale image, the features of small deformations are overwhelmed by specular reflection and background noise, and the model cannot effectively learn and recognize these defects.
[0006] (3) Existing 3D reconstruction schemes based on phase deflection can recover surface normal vectors, but require complete phase unwrapping and 3D calibration, have long computation chains, and require high equipment accuracy, making it difficult to meet the online detection cycle. Schemes that directly perform ordinary morphological smoothing on the phase gradient cannot distinguish between surface protrusions and depressions because they do not retain the gradient direction information; moreover, the weights of each scale lack a systematic design when multi-scale fusion, making it difficult to balance the detection sensitivity of macroscopic deformation and local details. Summary of the Invention
[0007] This invention addresses the shortcomings of existing 3D reconstruction schemes: (1) 3D reconstruction schemes based on phase deflection require complete phase unrolling and 3D calibration, and chain length calculation; (2) schemes that directly perform ordinary morphological smoothing on phase gradients do not retain the gradient direction sign and cannot distinguish between convex and concave surfaces; (3) existing multi-scale fusion schemes lack systematic design of the weights of each scale, and it is difficult to balance the detection sensitivity of macroscopic deformation and local details. This invention proposes a method for generating high-reflectivity surface deformation feature images, a method for detecting high-reflectivity surface deformation, and a detection device. By directly calculating the gradient by wrapping the phase (without unrolling), direction-preserving nonlinear amplitude fusion, and a five-level exponential weighted multi-scale system, the micro-deformation information is transformed into a divergence feature image with clearly visible defects and the ability to distinguish between convex and concave directions. It balances the preservation of direction information and multi-scale system fusion, and does not require 3D calibration. It can be directly used for manual interpretation or as input for deep learning models.
[0008] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A method for generating images of deformation features of highly reflective surfaces is proposed, including: A sinusoidal stripe pattern is projected onto a highly reflective surface, and multiple stripe images are acquired sequentially through equally spaced phase shifts. The wrapping phase map is obtained by calculating the wrapping phase value at each pixel of multiple striped images using the phase-shifting method. Calculate the horizontal and vertical gradients for the wrapper phase map; Pre-set gradient information with preset weights and write it into a buffer to establish a multi-scale cumulative baseline; Using the gradient matrices in the horizontal and vertical directions as inputs for morphological operations and the corresponding accumulation buffers as accumulation targets, morphological dilation and erosion operations are performed at multiple scales. Combined with direction-preserving nonlinear amplitude fusion and Gaussian smoothing, a multi-scale enhanced gradient field is obtained. A vector field is constructed based on a multi-scale enhanced gradient field. The divergence of the vector field is calculated to obtain the divergence matrix. A divergence feature map is generated based on the divergence matrix.
[0009] Compared with the prior art, the advantages and positive effects of the present invention are: (1) The present invention uses the phase shift method to extract the package phase, and directly calculates the gradient based on the package phase, omitting the phase unfolding links such as multi-frequency heterodyne and quality map guidance and the three-dimensional calibration process, significantly shortening the calculation chain, which can meet the requirements of online detection cycle.
[0010] (2) This invention uses a multi-level exponential weighting system and multi-scale morphological structural elements to simultaneously detect sub-millimeter-level local defects and millimeter-level macroscopic deformations, thus avoiding the problem of missing large-scale defects or smoothing out small defects under a single scale.
[0011] (3) The direction-preserving amplitude fusion formula always preserves the gradient direction sign during the multi-scale smoothing process, avoiding the problem of deformation features being suppressed due to the mutual cancellation of positive and negative gradients in the dilation-erosion operation; the signed square operation produces nonlinear amplification of large-amplitude deformation edges and nonlinear compression of small-amplitude background noise, which has a higher defect / background signal-to-noise ratio compared with ordinary morphological smoothing.
[0012] (4) The divergence feature map has the ability to distinguish the signs of surface protrusions and depressions, while the ordinary gradient amplitude map can only reflect the existence of deformation and cannot distinguish the direction of deformation. This method can provide richer feature information for subsequent classification and rejection.
[0013] In some embodiments of the present invention, before calculating the horizontal and vertical gradients of the wrapper phase map, the method further includes the steps of phase correction and range scaling of the wrapper phase map, specifically including: Invert the sign of the package phase so that the direction of increase or decrease of the phase value is aligned with the direction of deflection of the surface normal. Perform on the inverted phase of the package Translation; Scaling the range of the package phase after inversion and translation: First, scale the range beyond the specified value. The range of values is wrapped around and then linearly scaled.
[0014] In this embodiment, before calculating the gradient of the package phase map, the sign of the package phase is inverted so that its increase / decrease direction is aligned with the surface normal deflection direction, and then... The translation is performed with a unified coordinate system and a zero reference, and finally the phase range is linearly scaled. The sign-inversion operation ensures that the subsequent gradient direction is consistent with the physical direction of the surface deformation, enabling the divergence calculation results to correctly distinguish between convexities and depressions; Translation only introduces a constant offset, whose gradient is always zero and does not affect subsequent gradient calculations; it only serves to align the coordinate reference. Range scaling makes the threshold and correction amount of subsequent gradient jump corrections simple values, which simplifies the calculation parameters and reduces the difficulty of threshold debugging in algorithm implementation.
[0015] In some embodiments of the present invention, after performing phase correction and range scaling on the packaged phase map, the method further includes a step of truncating and correcting the pseudo-gradient generated by the packaged phase transition, including: Set the cutoff threshold to half the gradient of a single pixel at the transition position; For gradients exceeding the cutoff threshold, perform cutoff correction: if the gradient is greater than the cutoff threshold, update the original gradient value by subtracting twice the cutoff threshold; if the gradient is less than the negative cutoff threshold, update the original gradient value by adding twice the cutoff threshold.
[0016] Since the wrapped phase is a fixed value after linear scaling, its inherent jump within the original range is also a fixed value after scaling, and the gradient calculated using the central difference is also a fixed value. Therefore, in this embodiment, for the pseudo gradient anomalies caused by phase jumps at the boundary of the wrapped phase, the truncation threshold is set to half of the single-pixel gradient at the jump position in combination with the scaling ratio, and a correction operation of twice the truncation threshold is performed on the gradients exceeding the threshold to eliminate pseudo gradients.
[0017] In some embodiments of the present invention, gradient information is preset with preset weights and written into a buffer to establish a multi-scale cumulative baseline, specifically: The gradient information and its Gaussian-smoothed gradient are weighted according to preset coefficients. , Perform weighted combination and write to the cumulative buffer: ; in, Let this be the gradient accumulation buffer. Let it be denoted as gradient. and The exponential weighting coefficients are used; GaussianBlur is a Gaussian smoothing operation with constant zero padding at the boundaries; the initial Gaussian kernel standard deviation is used. ; For multi-scale magnification parameters; These are denoted as pixel coordinates.
[0018] In this embodiment, the original gradient and the gradient after Gaussian smoothing are respectively... and The exponential weights are weighted and combined, then written into the cumulative buffer, along with the weights of the subsequent three scales. , , Together constitute from arrive A continuous five-level exponential weighted system. Original gradient (weights) It retains the finest-grained phase detail information and lightly smooths the gradient (weights). It provides microstructural information after omitting extremely high frequency noise. The two constitute the finest two levels in the multi-scale system, enabling subsequent three-scale morphological accumulation to use the prior fine-grained information as a baseline, avoiding the complete neglect of the original detail signal due to the buffer starting from zero, and ensuring complete multi-scale coverage from sub-millimeter level details to millimeter level macroscopic deformation.
[0019] In some embodiments of the present invention, morphological expansion and erosion operations are performed at multiple scales, specifically including: For the gradient matrix in each direction, morphological dilation and erosion operations are performed sequentially at three scales, corresponding to 3×3, 5×5, and 7×7 elliptical structuring elements, respectively; the Gaussian smoothing standard deviation at each scale is... , .
[0020] In this embodiment, morphological dilation and erosion operations are performed using elliptical structuring elements of 3×3, 5×5, and 7×7 at three scales, respectively, with Gaussian smoothing standard deviations at each scale. ( The size of the structural elements increases synchronously with the scale. Elliptical structural elements are isotropic and respond identically to deformations in any direction (such as oblique scratches and arc-shaped imprints), avoiding the response attenuation of rectangular structural elements in the 45° direction and the limitation of cross-shaped structural elements that are only sensitive to the horizontal and vertical directions. The size of the structural elements at the three scales increases in synergy with the Gaussian smoothing standard deviation, enabling small-scale structural elements to finely capture sub-millimeter-level local defects with a small standard deviation Gaussian kernel, and large-scale structural elements to fully perceive millimeter-level macroscopic deformations with a large standard deviation Gaussian kernel, achieving systematic and comprehensive detection of defects at different physical scales.
[0021] In some embodiments of the present invention, the direction-preserving nonlinear amplitude fusion is achieved by fusing the expansion results and corrosion results using a direction-preserving nonlinear amplitude fusion formula: ; in, As a result of morphological dilatation, For morphological corrosion results, For symbolic functions, This is the result of the fusion.
[0022] This embodiment uses a direction-preserving nonlinear amplitude fusion formula to analyze the morphological dilation results. and corrosion results The core of this formula lies in the signed square operation: [The formula is then used to] merge [squared squares]. and Calculate separately While preserving the positive and negative signs (i.e., gradient direction), it nonlinearly amplifies large-amplitude deformation edges and nonlinearly compresses small-amplitude background noise; the square root of the sum of signed squares converges the numerical range to an order of magnitude close to the original gradient, ensuring the numerical stability of subsequent Gaussian smoothing and accumulation; finally, it uses... The output sign is determined so that when dilation and erosion have the same sign, their directions are clear; when they have opposite signs, the direction of the larger absolute value is taken, avoiding noise dominating the sign determination. The entire fusion process achieves multi-scale smoothing while forcibly preserving gradient direction information, enabling subsequent scatter plots to clearly distinguish between bulges and depressions.
[0023] In some embodiments of the present invention, after Gaussian smoothing of the fusion result, the method accumulates it into an accumulation buffer with scale-increasing weights to obtain a multi-scale enhanced gradient field: ; Among them, the weights of each scale , , It increases with the scale exponent.
[0024] In this embodiment, the results of the fusion with preservation of each scale direction are Gaussian smoothed and then weighted exponentially with increasing scale. , , Accumulate to the cumulative buffer. Gaussian smoothing is used. Spatial diffusion of the fusion results transforms the deformation response at the current scale into a smooth and continuous feature region, causing defect edges to form stable peaks rather than isolated spikes in the cumulative map; and The synchronous scaling ensures that the wide response of large-scale structural elements is fully smoothed before accumulation, avoiding the erroneous accumulation of boundary noise as deformation features. The exponential weighted accumulation makes macroscopic deformation (large scale) dominate the final detection result with high weight, while local details (small scale) are supplemented with low weight. This not only ensures the detection sensitivity of macroscopic defects, but also avoids the technical problem of increased background clutter caused by competition between small-scale noise and macroscopic signals during equal-weighted fusion.
[0025] In some embodiments of the present invention, the step of constructing a vector field based on a multi-scale enhanced gradient field and calculating the divergence of the vector field to obtain a divergence matrix includes: Transform the horizontal and vertical components of the multi-scale enhanced gradient field to polar coordinates to obtain the amplitude. and phase : ; ; Phase coordinate correction: ; Phase values that are out of range are wrapped around, and then transformed back to Cartesian coordinates to obtain the vector field components. , : ; ; Calculate the vector field divergence: The partial derivatives are calculated using the central difference method. in, Let these be pixel coordinates; Let it be denoted as the horizontal gradient. Let it be denoted as the vertical gradient; and For vector field components; Let be the vector field divergence.
[0026] This embodiment transforms the multi-scale enhanced gradient field to polar coordinates and separates the amplitude. and phase Then perform phase After coordinate system correction and transformation back to Cartesian coordinates, the vector field components are obtained. , Finally, calculate the divergence. Directly enhance the gradient field at multiple scales. , When calculating divergence, if there is a systematic deviation in magnitude or direction between the two components, it will cause the divergence plot to have inconsistent deformation sensitivity in the horizontal and vertical directions (anisotropic deviation). By separating the amplitude and phase using polar coordinates and making a unified correction to the phase before converting back to Cartesian coordinates, it is ensured that the direction of the vector field is consistent with the actual surface normal deflection direction, so that the divergence calculation has uniform sensitivity to deformation in all directions. The positive and negative divergence values accurately correspond to surface convexity and depression, and the divergence in flat areas approaches zero.
[0027] The present invention also proposes a method for detecting deformation of highly reflective surfaces, which generates a divergence feature image of the target highly reflective surface using the high-reflective surface deformation feature image generation method described above; the divergence feature image is used for deformation detection of the highly reflective surface, wherein regions with divergence greater than zero correspond to surface convexity, and regions with divergence less than zero correspond to surface depression.
[0028] This invention directly uses the divergence feature image generated by the aforementioned method for the detection of deformation on highly reflective surfaces, utilizing the divergence matrix... , and The regions correspond to the physical meanings of surface protrusions, depressions, and flat areas, respectively, enabling the detection results to not only determine the presence or absence of deformation but also clearly distinguish the direction and type of deformation. Compared to ordinary gradient amplitude maps, which only reflect the presence of deformation but cannot distinguish between protrusions and depressions, the divergence feature map output by this method provides richer discriminative information for subsequent defect determination (such as distinguishing between acceptable protrusion defects and depression defects that need repair), thus improving the precision of deformation detection on highly reflective surfaces.
[0029] The present invention also provides a device for detecting deformation of highly reflective surfaces, comprising: Structured light projection module, used to project sinusoidal fringe images onto a highly reflective target surface; The image acquisition module is used to sequentially acquire multiple stripe images based on equally spaced phase shifts; The deformation detection module is equipped with the high reflectivity surface deformation detection method described above, and detects the deformation of the target high reflectivity surface based on the high reflectivity surface deformation detection method.
[0030] This invention integrates a structured light projection module, an image acquisition module, and a deformation detection module equipped with the aforementioned detection method into a high-reflectivity surface deformation detection device. The structured light projection module and the image acquisition module work together to rapidly acquire multiple phase-shifting fringe images. The deformation detection module directly outputs a divergence feature map based on the acquired images and performs convexity / concavity determination without the need for three-dimensional calibration. The entire device has a short computational chain and low hardware requirements, enabling efficient and accurate detection of minute deformations on the surface of highly reflective parts in industrial online inspection scenarios. It has good engineering practicality and ease of deployment. Attached Figure Description
[0031] Figure 1 This is a flowchart of the method for generating images of highly reflective surface deformation features proposed in this invention; Figure 2 This is a schematic diagram of the loop structure for multi-scale morphological smoothing processing in the method of the present invention; Figure 3 This is a schematic diagram illustrating the principle of direction-preserving nonlinear amplitude fusion in the method of this invention; Figure 4 This is a schematic diagram of shadowless light source imaging in an embodiment of the high reflectivity surface deformation detection of the present invention; Figure 5 This is the original stripe image in the embodiment of the high reflectivity surface deformation detection of the present invention; Figure 6 This is a schematic diagram of the divergence image result obtained by the feature image generation method in the embodiment of the high reflectivity surface deformation detection of the present invention. Detailed Implementation
[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0033] This invention aims to propose a method for generating feature images of deformation on highly reflective surfaces. It transforms the minute deformation information of highly reflective surfaces into divergence feature images that clearly show defects and have the ability to distinguish between concave and convex directions. This feature image is then applied to the deformation detection of highly reflective surfaces to improve the detection accuracy of deformation on highly reflective surfaces.
[0034] Specifically, the method for generating images of highly reflective surface deformation features proposed in this invention, such as... Figure 1As shown, it includes the following steps:
[0035] S1: Project a sinusoidal stripe pattern onto a highly reflective surface and acquire multiple stripe images sequentially through equally spaced phase shifts.
[0036] Taking highly reflective parts as an example, a structured light projection device is used to project a sinusoidal stripe pattern onto the surface of the highly reflective parts, and five stripe images are acquired sequentially through equally spaced phase shifts. , , , , The phase offset between adjacent images is .
[0037] This invention employs a five-step equally spaced phase shift (72° step), which, compared to the commonly used four-step phase shift (90° step) in industry, offers two advantages:
[0038] (1) Stronger noise suppression. The five-step method uses five observations to solve for three unknowns (background light A, modulation B, and phase) using least squares. All frames simultaneously constrain all unknowns, and the phase noise variance is proportional to 1 / N; although the four-step closed solution also has redundant original equations, it achieves this through... and Eliminating A degenerates into a deterministic system with two equations and two unknowns, thus eliminating the original redundant statistical averaging capabilities. Furthermore, each frame in the five-step solution participates simultaneously. and The estimation of two components disperses the noise in a single frame in two directions, avoiding the concentrated propagation of errors.
[0039] (2) Wider nonlinear harmonic suppression: N-step equally spaced phase shifts can suppress the first N−1 nonlinear harmonics; the four-step method covers the third order, and the five-step method additionally suppresses the fourth order. Strong specular reflection from highly reflective surfaces can easily lead to camera saturation and gamma distortion, and its nonlinear components may include higher-order harmonics. The five-step scheme has an additional layer of frequency suppression.
[0040] S2: The phase-shifting method is used to calculate the wrapping phase value at each pixel of multiple striped images to obtain the wrapping phase map.
[0041] In this embodiment of the invention, based on the five-step phase shift principle, the wrapping phase value at each pixel is calculated using five striped images.
[0042] The physical model for the five-step phase shift is: for each pixel on the measured surface... The light intensities of the five fringe images satisfy the following set of equations (A is the background light intensity, B is the fringe modulation amplitude, ...). (The phase to be determined):
[0043] ;
[0044] ;
[0045] ;
[0046] ;
[0047] ;
[0048] Among the three unknowns A, B, ... There are a total of 5 constraint equations (overdetermined system of equations). Solving this system of equations simultaneously eliminates the background light term. The analytical solutions for the numerator and denominator matrices are then obtained as follows:
[0049] Molecular matrix:
[0050] ;
[0051] Denominator matrix:
[0052] ;
[0053] The encapsulated phase is obtained through polar coordinate transformation:
[0054] .
[0055] S3: Calculate the horizontal and vertical gradients for the wrapping phase map.
[0056] First, perform phase correction and range scaling on the package phase map:
[0057] (1) Invert the sign of the wrapped phase obtained by S2 so that the direction of increase or decrease of the phase value is aligned with the direction of deflection of the surface normal.
[0058] (2) Perform on the inverted phase of the package Translation introduces only a constant offset, and its gradient is always zero. It does not affect subsequent gradient calculations and only serves to align the coordinate system to the zero reference datum.
[0059] The corrected package phase is denoted as above. The corrected formula is as follows:
[0060] .
[0061] (3) Scaling the range of the package phase after inversion and translation.
[0062] First, for those exceeding Wrap the values within the range:
[0063] like ,but ;
[0064] Then The range from linear scaling to This simplifies the threshold and correction amount for gradient jump correction in the subsequent step four. and :
[0065] .
[0066] Next, the central difference method is used to calculate the phase gradients in the horizontal and vertical directions of the wrapped phase map. Compared with forward / backward difference, central difference has second-order accuracy, and the gradient value falls symmetrically at the current pixel position, maintaining spatial alignment with the original phase map and avoiding the introduction of systematic spatial offset errors.
[0067] Let the phase gradient in the horizontal direction (X direction) be denoted as... The phase gradient in the vertical direction (Y direction) is denoted as... :
[0068] ;
[0069] ;
[0070] In this embodiment of the invention, the boundaries of the horizontal and vertical gradients are filled with mirror reflections to maintain the continuity of the gradient at the boundaries and avoid false high-amplitude gradient responses introduced by zero filling.
[0071] Finally, regarding the phase of the wrapping The pseudo-gradient generated by the transition is truncated and corrected. In step S2, the wrapped phase has been removed from... Linear scaling to The scaling factor is The wrapping phase in the original Inherent within the range After being scaled proportionally, the jump becomes Therefore, in this step, the gradient is calculated using center difference (interval of 2 pixels), and the single-pixel gradient at the jump position is calculated. Therefore, the truncation threshold is set to half of this value. The correction amount is Gradient calculation will produce an amplitude of approximately [value missing] at the transition position. Abnormally large values, exceeding the threshold The gradient is truncated and corrected as follows to eliminate spurious gradients:
[0072] like ,but ;
[0073] like ,but ;
[0074] The above corrections are applied to both the horizontal and vertical directions, and the corrected gradient values are limited to... Within the range.
[0075] S4: Preset gradient information with preset weights and write it into the cumulative buffer to establish a multi-scale cumulative baseline.
[0076] In this embodiment of the invention, the gradient information obtained in S3 and the gradient after Gaussian smoothing are weighted according to a preset weighting coefficient. , Perform a weighted combination, and then combine it with the weights of the three scales from step S5. , , Together they form a continuous and complete five-level index-weighted system. , , , , This ensures the integrity of multi-scale coverage, from fine-grained to macroscopic.
[0077] Specifically, the horizontal gradient The cumulative buffer is denoted as Vertical gradient The cumulative buffer is denoted as Perform the same initialization operation on the gradient matrices in both the horizontal and vertical directions. The following example uses the horizontal direction:
[0078] ;
[0079] in and The exponential weighting coefficients are used; GaussianBlur is a Gaussian smoothing operation with constant zero padding at the boundaries. Multi-scale scaling parameters are set. Initial Gaussian kernel standard deviation .
[0080] vertical direction The calculation method is exactly the same as that for the horizontal direction.
[0081] The reason for establishing this step is: the three-scale cycle of the subsequent step S5 of this invention ( , , This step only accumulates gradients after morphological processing. If the buffer starts from zero, the final result will completely ignore the original detailed signal without morphological operations. In this step, the original gradients (weights) are pre-accumulated. ) and lightly smoothed gradients (weights) The data was written to the buffer, completing the two finest-grained levels of the five-level exponential weighting system. , This ensures complete multi-scale coverage from original details to macroscopic deformations, and guarantees consistency between the initial baseline and the cumulative weights of subsequent scales.
[0082] S5: Using the gradient matrices in the horizontal and vertical directions as inputs for morphological operations and the corresponding cumulative buffers as accumulation targets, morphological dilation and erosion operations are performed at multiple scales. Combined with direction-preserving nonlinear amplitude fusion and Gaussian smoothing, a multi-scale enhanced gradient field is obtained.
[0083] In this embodiment of the invention, combined with Figure 2 As shown, the original gradient matrices in the horizontal and vertical directions are respectively... (i.e., the gradient after jump correction output in step S3) serves as the input for morphological operations, with an accumulation buffer in the corresponding direction. (i.e., the cumulative baseline initialized in step S4) is the cumulative target. Morphological dilation-erosion operations are performed on three scales, combined with direction-preserving nonlinear amplitude fusion and Gaussian smoothing to achieve nonlinear multi-scale smoothing.
[0084] Specifically, including:
[0085] (1) For the gradient matrix in each direction, at three scales ( Morphological expansion and erosion operations are performed sequentially on the 3×3, 5×5, and 7×7 elliptical structural elements.
[0086] In this embodiment of the invention, the selection of three scales constitutes a self-consistent multi-scale perception system: Scale 0 (3×3 structuring element, Gaussian) 11×11 cores, weights This corresponds to sub-millimeter level local defects (such as fine scratches and dot-like indentations), with a small sensing range and narrow smoothing range, preserving local deformation details with low weight; Scale 1 (5×5 structuring element, Gaussian) 31×31 cores, weights For millimeter-scale medium-sized defects (such as paint pits and particles), the perception and smoothing range is moderate, and the weight is appropriately increased; Scale 2 (7×7 structuring element, Gaussian) Approximately 87×87, weight It corresponds to macroscopic deformations at the millimeter level (such as drips and imprinted contours), with the largest sensing range and the most complete smoothing, and dominates the detection sensitivity of macroscopic deformations with the highest weight.
[0087] The size of the structural element, the Gaussian kernel size, and the exponential weight increase synchronously across the three scales to ensure that defects at different physical scales can be effectively responded to, while avoiding the problem of large defects being missed or small defects being over-smoothed at a single scale. Ellipses are chosen as structural elements instead of rectangles or crosses because ellipses are isotropic and respond the same to deformation in any direction; rectangular structural elements exhibit response attenuation at the 45° direction, and cross-shaped structural elements are only sensitive to the horizontal and vertical directions, making them unsuitable for uniform detection of deformation in any direction (such as oblique scratches or arc-shaped imprint contours) on highly reflective surfaces.
[0088] Morphological dilation and erosion operations are used to extract local maxima and minima, respectively.
[0089] , ∈ Elliptical structural element;
[0090] , ∈ Elliptical structural element.
[0091] (2) The expansion and corrosion results are fused using a direction-preserving nonlinear amplitude fusion formula:
[0092] ;
[0093] The fusion formula and appendix Figure 3 The calculation steps correspond one-to-one, let's assume (Local maximum of expansion) (Local corrosion minimum):
[0094] (21) Signed square: squared , Calculate separately , While preserving the positive and negative signs (gradient direction), a nonlinear gain is introduced, which amplifies large values by square and compresses small values by square.
[0095] (22) Summation of signed squares: This superimposes the results of enhancing the direction of expansion and corrosion.
[0096] (23) Take the square root of the absolute value: Amplitude = This narrows the numerical range to an order of magnitude similar to the original gradient, ensuring the numerical stability of subsequent Gaussian smoothing and exponential weighted accumulation.
[0097] (24) Determine the output symbol: symbol The dominant gradient direction is determined by the sign of the sum of the expansion and erosion values. When they are the same sign, the direction is clear; when they are opposite signs, the direction of the larger absolute value is taken to avoid noise dominating the output sign.
[0098] (25) Final result:
[0099] .
[0100] The above fusion formula preserves the phase gradient direction for highly reflective surfaces.
[0101] (3) After Gaussian smoothing of the fusion result, it is accumulated into the accumulation buffer with increasing weights as the scale increases, to obtain the multi-scale enhanced gradient field.
[0102] Gaussian smoothing and exponential weighted accumulation:
[0103] ;
[0104] in, .
[0105] Weights of each scale , , As the scale exponent increases, its effect is twofold:
[0106] (1) The effect of Gaussian smoothing: the result obtained after direction-preserving fusion It still contains edge burrs and discrete noise introduced by morphological operations. right Gaussian smoothing serves two purposes: firstly, it spatially diffuses the deformation response at the current scale into smooth, continuous feature regions, causing defect edges to form stable peaks rather than isolated spikes in the cumulative map; secondly, it... Increase synchronously with scale ( hour , hour , hour This ensures that the wide response generated by large-scale structural elements is fully smoothed before accumulation, avoiding the misaccumulation of large-scale boundary noise as deformation features.
[0107] (2) The effect of exponential weighted accumulation: the smoothing results of the three scales are weighted. , , The data are accumulated into the same buffer C. The exponential increase in weight with scale means that macroscopic deformation (large scale) dominates the final accumulated result, while local details (small scale) are superimposed with low weight, serving a supplementary rather than dominant role. The physical basis for this design is that small deformations on highly reflective surfaces are more easily detected by divergence calculations on a macroscopic scale (relative to background noise). If fusion is performed with equal weights, small-scale noise will compete with the macroscopic deformation signal, leading to increased background clutter. Exponential weighting ensures the signal-to-noise ratio advantage of the macroscopic deformation signal while not completely discarding local detail information.
[0108] After the three scale cycles are completed, the accumulated buffer will be... , Assign values back respectively , This serves as the input for constructing the vector field in step S6. At this point... , The stored data is a multi-scale enhanced gradient field that has been weighted by five-level exponentials and fused by three-scale morphology.
[0109] S6: Construct a vector field based on a multi-scale enhanced gradient field, calculate the divergence of the vector field to obtain the divergence matrix, and generate a divergence feature map based on the divergence matrix.
[0110] (1) Perform directional normalization correction on the multiscale enhanced gradient field after weighted and multiscale morphological fusion.
[0111] The multi-scale enhanced gradient field obtained from S5, after weighted and multi-scale morphological fusion, is input to polar coordinates for transformation:
[0112] ;
[0113] ;
[0114] The gradient vector field after multi-scale enhancement is normalized and corrected by employing a transformation path of polar coordinates → phase correction → Cartesian coordinates: directly to... , When calculating divergence, if there is a systematic deviation in magnitude or direction between the two components, it will cause the divergence plot to have inconsistent deformation sensitivity in the horizontal and vertical directions (anisotropic deviation). By separating the amplitude and phase using polar coordinates, correcting the phase using coordinate systems, and then converting back to Cartesian coordinates, we can ensure that the direction of the vector field is consistent with the actual surface normal deflection direction, and the divergence calculation has uniform sensitivity to deformation in all directions.
[0115] (2) Correct the phase using the coordinate system:
[0116] ;
[0117] If corrected Then subtract ;like Then add .
[0118] (3) Transform back to Cartesian coordinates to obtain vector field components. , .
[0119] The calculation formula is:
[0120] ;
[0121] ;
[0122] (4) Calculate the vector field divergence based on the vector field components:
[0123] ;
[0124] The partial derivatives are calculated using the same central difference method as in step S4.
[0125] The physical meaning of divergence is: Corresponding surface protrusions, Corresponding to the surface depression, Corresponding to flat areas.
[0126] Linearly normalize the scatter matrix and map it to... The grayscale range is used to generate a divergence feature image. To ensure that convexities (positive divergence) and concaveities (negative divergence) are symmetrically distributed around 128 in the grayscale image and to preserve directional distinguishability, a symmetrical normalization centered on the maximum absolute value of the divergence is adopted.
[0127] .
[0128] In the generated divergence feature image, tiny deformation defects that are not visible in ordinary grayscale images are presented with high-contrast grayscale exceptional clarity. They can be directly used for manual interpretation or as input to deep learning object detection models for automatic defect detection and classification.
[0129] The following is a specific embodiment of using a feature image generated by the above-described high reflectivity surface deformation feature image generation method to perform high reflectivity surface deformation detection.
[0130] like Figure 4 The embodiment shown is a shadowless light source imaging of a slice of automotive paint. Under conventional shadowless light sources, defects such as paint runs and minor scratches have low contrast and blurred details, making them difficult to identify effectively. Figure 5 This is the original striped image obtained from the acquisition. Figure 6 The divergence image obtained by fusing stripe images is enhanced by the algorithm of this invention. The features of paint runs and minor scratches are significantly amplified, the defect edges are clearly highlighted, and the recognition is greatly improved. It can accurately detect minor paint defects that cannot be clearly distinguished under shadowless light.
[0131] It should be noted that the above description is not intended to limit the present invention, and the present invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of the present invention should also fall within the protection scope of the present invention.
Claims
1. A method for generating images of deformation features of highly reflective surfaces, characterized in that, include: A sinusoidal stripe pattern is projected onto a highly reflective surface, and multiple stripe images are acquired sequentially through equally spaced phase shifts. The wrapping phase map is obtained by calculating the wrapping phase value at each pixel of multiple striped images using the phase-shifting method. Calculate the horizontal and vertical gradients for the wrapper phase map; Pre-set gradient information with preset weights and write it into the cumulative buffer to establish a multi-scale cumulative baseline; Using the gradient matrices in the horizontal and vertical directions as inputs for morphological operations and the corresponding accumulation buffers as accumulation targets, morphological dilation and erosion operations are performed at multiple scales. Combined with direction-preserving nonlinear amplitude fusion and Gaussian smoothing, a multi-scale enhanced gradient field is obtained. A vector field is constructed based on a multi-scale enhanced gradient field. The divergence of the vector field is calculated to obtain the divergence matrix. A divergence feature map is generated based on the divergence matrix.
2. The method for generating images of highly reflective surface deformation features according to claim 1, characterized in that, Before calculating the horizontal and vertical gradients of the wrapped phase map, the method further includes steps of phase correction and range scaling of the wrapped phase map, specifically including: Invert the sign of the package phase so that the direction of increase or decrease of the phase value is aligned with the direction of deflection of the surface normal. Perform on the inverted phase of the package Translation; Scaling the range of the package phase after inversion and translation: First, scale the range beyond the specified value. The range of values is wrapped around and then linearly scaled.
3. The method for generating images of highly reflective surface deformation features according to claim 1 or 2, characterized in that, After performing phase correction and range scaling on the package phase map, the method further includes a step of truncating and correcting the pseudo-gradients generated by the package phase transition, including: Set the cutoff threshold to half the gradient of a single pixel at the transition position; For gradients exceeding the cutoff threshold, perform cutoff correction: if the gradient is greater than the cutoff threshold, update the original gradient value by subtracting twice the cutoff threshold; if the gradient is less than the negative cutoff threshold, update the original gradient value by adding twice the cutoff threshold.
4. The method for generating images of highly reflective surface deformation features according to claim 1, characterized in that, Gradient information is pre-set with preset weights and written into a buffer to establish a multi-scale cumulative baseline, specifically: The gradient information and its Gaussian-smoothed gradient are weighted according to preset coefficients. , Perform weighted combination and write to the cumulative buffer: ; in, Let this be the gradient accumulation buffer. Let it be denoted as gradient. and The exponential weighting coefficients are used; GaussianBlur is a Gaussian smoothing operation with constant zero padding at the boundaries; the initial Gaussian kernel standard deviation is used. ; For multi-scale magnification parameters; These are denoted as pixel coordinates.
5. The method for generating images of highly reflective surface deformation features according to claim 4, characterized in that, Morphological expansion and erosion operations are performed at multiple scales, specifically including: For the gradient matrix in each direction, morphological dilation and erosion operations are performed sequentially at three scales, corresponding to 3×3, 5×5, and 7×7 elliptical structuring elements, respectively; the Gaussian smoothing standard deviation at each scale is... , .
6. The method for generating images of highly reflective surface deformation features according to claim 4, characterized in that, The direction-preserving nonlinear amplitude fusion method fuses the expansion and corrosion results using a direction-preserving nonlinear amplitude fusion formula. ; in, As a result of morphological dilatation, For morphological corrosion results, For symbolic functions, This is the result of the fusion.
7. The method for generating a high-reflectivity surface deformation feature image according to claim 6, characterized in that, After Gaussian smoothing the fusion result, the method accumulates it into an accumulation buffer with scale-increasing weights to obtain a multi-scale enhanced gradient field: ; Among them, the weights of each scale , , It increases with the scale exponent.
8. The method for generating images of highly reflective surface deformation features according to claim 1, characterized in that, The process of constructing a vector field based on a multi-scale enhanced gradient field and calculating the divergence matrix of the vector field includes: Transform the horizontal and vertical components of the multi-scale enhanced gradient field to polar coordinates to obtain the amplitude. and phase : ; ; Phase coordinate correction: ; Phase values that are out of range are wrapped around, and then transformed back to Cartesian coordinates to obtain the vector field components. , : ; ; Calculate the vector field divergence: The partial derivatives are calculated using the central difference method. in, Let these be pixel coordinates; Let it be denoted as the horizontal gradient. Let it be denoted as the vertical gradient; and For vector field components; Let be the vector field divergence.
9. A method for detecting deformation of highly reflective surfaces, characterized in that, A divergence feature image of a target highly reflective surface is generated using the high reflective surface deformation feature image generation method as described in any one of claims 1-8; the divergence feature image is used for deformation detection of the highly reflective surface, wherein regions with divergence greater than zero correspond to surface convexity, and regions with divergence less than zero correspond to surface depression.
10. A device for detecting deformation of highly reflective surfaces, characterized in that, include: Structured light projection module, used to project sinusoidal fringe images onto a highly reflective target surface; The image acquisition module is used to sequentially acquire multiple stripe images based on equally spaced phase shifts; The deformation detection module is equipped with the high reflectivity surface deformation detection method as described in claim 9, and detects the deformation of the target high reflectivity surface based on the high reflectivity surface deformation detection method.
Citation Information
Patent Citations
Mirror-like defect positioning method and device, electronic equipment and storage medium
CN117522849A
Object surface defect detection method and device, computer equipment and storage medium
CN117740801A