Socket surface defect detection method and system based on image processing
By using adjustable polarization light source and frequency domain decomposition processing in socket surface defect detection, combined with adaptive density clustering, a two-dimensional characteristic space of scattered light spot is constructed, which solves the problem of low defect detection accuracy caused by the dynamic reflection characteristics of high-reflective materials, and achieves high-precision and high-adaptive defect detection.
Patent Information
- Application Number
- CN202510483923.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-04-17
AI Technical Summary
In the detection of defect surface of sockets, it is difficult to effectively deal with the dynamic reflection characteristics of highly reflective materials, resulting in high coupling of defect characteristics and background noise, resulting in significant increase in the leakage detection rate and error detection rate of small defects.
Using an image-based processing method, the socket surface image is acquired through an adjustable polarization light source, dynamic light compensation and optimized light source configuration, combined with frequency domain decomposition processing and adaptive density clustering, a two-dimensional feature space of scattered light spot is constructed to distinguish defect types.
It significantly improves the accuracy and adaptability of socket surface defect detection, can adapt to the reflection characteristics of metal contacts and plating in real time, reduce specular reflection noise, enhance the contrast of scattered signal in defect areas, and achieve clear and complete details of defect edges in complex curved surface areas.
Smart Images

Figure CN120064298A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial surface defect detection. More specifically, the present invention relates to a method and system for detecting surface defects of sockets based on image processing. Background Art
[0002] In the field of industrial surface defect detection, as a core component for power transmission, sockets have the problem of specular reflection interference caused by the high reflectivity of metal contacts and plating surfaces. Existing technologies generally use fixed light sources (such as diffused light) and basic image processing algorithms (such as threshold segmentation) to suppress reflection noise, but there are significant limitations. For example, the oxidation spots on the metal contacts of sockets, due to the dynamic change of surface reflectivity (such as differences in oxide layer thickness or ambient light fluctuations), make it difficult for traditional algorithms to stably distinguish defects from background noise. At the same time, due to the complex curvature and high reflectivity of the arc transition area of the socket panel, local overexposure or reflection occlusion is likely to occur, and existing light source layouts and image enhancement methods are difficult to adapt to multi-angle reflection characteristics, resulting in blurred defect edges or misjudgments.
[0003] In the detection of socket surface defects by existing technologies, the dynamic reflection characteristics of high-reflectivity materials will cause the defect features and background noise to be highly coupled in the spatial and frequency domains. Specifically, it is manifested as the non-linear reflection fluctuation of the oxide layer of metal contacts with environmental changes, and the pseudo-defect features formed by specular reflection on complex surfaces (such as the arc surface of the panel). It cannot dynamically adapt to the change of reflectivity, resulting in a significant increase in the miss rate and false alarm rate of tiny defects (such as micro-cracks and oxidation spots), affecting the detection accuracy and reducing the reliability of industrial applications. Summary of the Invention
[0004] In order to overcome the above-mentioned defects of the prior art, embodiments of the present invention provide a method and system for detecting surface defects of sockets based on image processing to solve the problems proposed in the above background art.
[0005] To achieve the above object, the present invention provides the following technical solutions: A method for detecting surface defects of sockets based on image processing, comprising the following steps: S1. Collect an original image sequence of the metal contacts and plating surfaces of the socket through an adjustable polarization light source and perform dynamic light compensation to generate a preprocessed image; S2. Dynamically adjust the incident angle and light intensity control parameters of the adjustable polarization light source according to the local gray distribution characteristics of the preprocessed image to generate an optimized light source configuration; S3. Perform secondary image collection on the socket surface based on the optimized light source configuration and perform frequency domain decomposition processing. Reconstruct the surface geometric contour features through the low-frequency components, and extract the defect candidate regions through the high-frequency components; S4. Dynamically adjust the incident angle of the adjustable polarization light source according to the surface geometric profile characteristics, so that the incident light direction is orthogonal to the scattering direction of the defect candidate area; S5. Analyze the morphological distribution of the diffuse scattering spot of the defect candidate area in the direction of orthogonal incident light, and construct a two-dimensional feature space of the radial curvature of the scattering spot and the light intensity modulation depth; S6. In the two-dimensional feature space, according to the difference in the scattering spot characteristics of metal oxidation and mechanical damage, distinguish the defect types by adaptive density clustering and output the position information.
[0006] In a preferred embodiment, collect the original image sequence of the socket metal contact and the coating surface through the adjustable polarization light source and perform dynamic light compensation to generate a preprocessed image, including: Collect the original image sequence of the socket metal contact and the coating surface through the adjustable polarization light source with a preset polarization angle and initial light intensity control parameters; According to the gray distribution difference at different polarization angles in the original image sequence, adjust the polarization angle and light intensity control parameters of the adjustable polarization light source; Perform gray histogram equalization processing on the original image sequence based on the adjusted polarization angle and light intensity control parameters to generate a preprocessed image.
[0007] In a preferred embodiment, dynamically adjust the incident angle and light intensity control parameters of the adjustable polarization light source according to the local gray distribution characteristics of the preprocessed image to generate an optimized light source configuration, including: Adjust the polarization angle switching sequence and light intensity control parameters of the adjustable polarization light source so that the incident angle of the adjustable polarization light source is orthogonal to the polarization angle direction corresponding to the area where the gray variance in the preprocessed image exceeds the preset threshold; Adjust the light intensity control of the adjustable polarization light source so that the light intensity control parameters of the adjustable polarization light source are inversely proportional to the light intensity control parameters corresponding to the area where the gray mean value in the preprocessed image is lower than the preset threshold; Generate an optimized light source configuration according to the adjusted polarization angle switching sequence and light intensity control parameters.
[0008] In a preferred embodiment, perform secondary image acquisition on the socket surface based on the optimized light source configuration and perform frequency domain decomposition processing, reconstruct the surface geometric profile characteristics through the low-frequency component, and extract the defect candidate area through the high-frequency component, including: Perform secondary image acquisition on the socket surface based on the optimized light source configuration, and perform frequency domain decomposition processing on the acquired image through fast Fourier transform; Reconstruct the surface geometric profile characteristics by inverse Fourier transform of the low-frequency component after frequency domain decomposition; Perform threshold filtering on the high-frequency components after frequency-domain decomposition, and extract the regions in the high-frequency components where the energy amplitude exceeds the preset energy threshold as defect candidate regions; Spatially align the surface geometric contour features with the defect candidate regions to generate a fused image containing the surface geometric contour features and the defect candidate regions.
[0009] In a preferred embodiment, dynamically adjust the incident angle of the adjustable polarization light source according to the surface geometric contour features to make the incident light direction orthogonal to the scattering direction of the defect candidate regions, including: Calculate the scattering direction of the defect candidate regions based on the normal vector of the surface geometric contour features. The scattering direction is the composite vector of the normal vector and the surface reflection direction of the defect candidate regions; Adjust the incident angle of the adjustable polarization light source so that the incident light direction of the adjustable polarization light source is orthogonal to the scattering direction. The incident angle adjustment is achieved by driving the polarizer to rotate to the target angle by a stepper motor; Verify the orthogonality of the adjusted incident light direction and the scattering direction. If the deviation exceeds the preset tolerance threshold, iteratively correct the incident angle until the orthogonality meets the requirements.
[0010] In a preferred embodiment, analyze the morphological distribution of the diffuse scattering spots of the defect candidate regions in the direction of orthogonal incident light, and construct a two-dimensional feature space of the radial curvature and the light modulation depth of the scattering spots, including: Based on the anisotropic distribution characteristics of the diffuse scattering spots of the defect candidate regions in the direction of orthogonal incident light, extract the radial curvature of the scattering spots through a multi-scale edge detection algorithm; Calculate the light modulation depth according to the consistency of the gray-scale gradient direction from the center to the edge of the scattering spot. The light modulation depth is the product of the normalized gradient direction consistency coefficient and the maximum gray-scale attenuation gradient; Map the radial curvature and the light modulation depth to an orthogonal coordinate system to construct a two-dimensional feature space based on the physical scattering characteristics of the defects, where the radial curvature is the first feature axis and the light modulation depth is the second feature axis.
[0011] In a preferred embodiment, the radial curvature is the reciprocal of the curvature radius of the spot edge, and the radial curvature calculation is corrected based on the cosine value of the angle between the orthogonal incident light direction and the defect surface normal.
[0012] In a preferred embodiment, in the two-dimensional feature space, distinguish the defect types and output the position information by adaptive density clustering according to the differences in the scattering spot characteristics of metal oxidation and mechanical damage, including: Dynamically adjust the neighborhood radius parameter of the adaptive density clustering according to the density distribution of the data points in the two-dimensional feature space. The neighborhood radius parameter is adaptively set based on the density distribution of the data points; Based on the difference in the characteristic distribution of radial curvature and light intensity modulation depth, the clustering boundary between the metal oxidation region and the mechanical damage region is divided in the two-dimensional feature space; Map the clustered defect types to the original image coordinate system, and output the defect position information through the affine transformation matrix. The defect position information includes the defect type label and the pixel coordinate range.
[0013] In a preferred embodiment, the metal oxidation region corresponds to a set of data points with higher radial curvature and higher light intensity modulation depth, and the mechanical damage region corresponds to a set of data points with lower radial curvature and lower light intensity modulation depth.
[0014] On the other hand, the present invention provides a socket surface defect detection system based on image processing, including the following modules: Polarized light source acquisition module: used to collect the original image sequence of the socket metal contact and the plating surface through an adjustable polarized light source and perform dynamic light compensation to generate a preprocessed image; Light source dynamic optimization module: used to dynamically adjust the incident angle and light intensity control parameters of the adjustable polarized light source according to the local gray distribution characteristics of the preprocessed image to generate an optimized light source configuration; Frequency domain decomposition and reconstruction module: used to perform secondary image acquisition on the socket surface based on the optimized light source configuration and perform frequency domain decomposition processing, reconstruct the surface geometric contour features through the low-frequency components, and extract the defect candidate regions through the high-frequency components; Optical path orthogonal calibration module: used to dynamically adjust the incident angle of the adjustable polarized light source according to the surface geometric contour features to make the incident light direction orthogonal to the scattering direction of the defect candidate region; Feature space modeling module: used to analyze the diffuse scattering spot morphology distribution of the defect candidate region in the direction of orthogonal incident light, and construct a two-dimensional feature space of the radial curvature and light intensity modulation depth of the scattering spot; Density clustering recognition module: used to distinguish the defect types and output the position information through adaptive density clustering according to the difference in the scattering spot characteristics of metal oxidation and mechanical damage in the two-dimensional feature space.
[0015] Compared with the prior art, the present invention has the following beneficial effects: 1. By means of collaborative analysis of a dynamically adjustable polarized light source and multi-dimensional features, the defect detection accuracy and adaptability on the surface of highly reflective sockets are significantly improved. Based on the dynamic polarization angle adjustment and light intensity control feedback mechanism, it can adapt to the changes in the reflection characteristics of metal contacts and coatings in real time. By suppressing specular reflection noise through the orthogonal incident light direction, the contrast of the scattering signal in the defect area is enhanced at the same time. Combining frequency domain decomposition processing, separating the surface geometric contour reconstruction from the extraction of defect high-frequency features, effectively solving the interference problem caused by the coupling of spatial and frequency domain features, making the defect edges clear and the details complete in complex curved surface areas, and avoiding overexposure, underexposure and pseudo-defect problems caused by traditional methods with fixed light sources or single frequency domain analysis.
[0016] 2. Through the construction of a two-dimensional feature space driven by physical scattering characteristics and adaptive density clustering, accurate distinction between metal oxidation and mechanical damage defects is achieved; based on the physical correlation between radial curvature and light intensity modulation depth, the differences in defect morphology and surface roughness are quantified, avoiding the limitations of traditional threshold segmentation or single-dimensional feature classification; combined with the clustering boundary division with adaptive data density, dynamically adapting to different defect distribution scenarios, ensuring high separability of oxidation spots and mechanical damage in the feature space; finally, precise positioning of the defect location is achieved through affine transformation mapping, meeting the high-precision and high-robustness requirements of industrial inspection for complex curved surface defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flowchart of the socket surface defect detection method based on image processing of the present invention; Figure 2 is a schematic structural diagram of the socket surface defect detection system based on image processing of the present invention; Figure 3 is a flowchart of constructing a two-dimensional feature space of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0019] Embodiment 1: Figure 1 A socket surface defect detection method based on image processing of the present invention is given, including the following steps: S1. Collect the original image sequence of the socket metal contact and coating surface through an adjustable polarized light source and perform dynamic light compensation to generate a preprocessed image; S2. Dynamically adjust the incident angle and light intensity modulation parameters of the adjustable polarization light source according to the local gray distribution characteristics of the preprocessed image to generate an optimized light source configuration; S3. Based on the optimized light source configuration, perform secondary image acquisition on the socket surface and carry out frequency-domain decomposition processing. Reconstruct the surface geometric contour features through the low-frequency components, and extract the defect candidate regions through the high-frequency components; S4. Dynamically adjust the incident angle of the adjustable polarization light source according to the surface geometric contour features to make the incident light direction orthogonal to the scattering direction of the defect candidate region; S5. Analyze the morphological distribution of the diffuse scattering light spots in the defect candidate region under the orthogonal incident light direction, and construct a two-dimensional feature space of the radial curvature of the scattering light spots and the light intensity modulation depth; S6. In the two-dimensional feature space, according to the differences in the scattering light spot characteristics of metal oxidation and mechanical damage, distinguish the defect types through adaptive density clustering and output the position information.
[0020] S1. Collect the original image sequence of the socket metal contacts and the coating surface through the adjustable polarization light source and perform dynamic light compensation to generate a preprocessed image, including: Collect the original image sequence of the socket metal contacts and the coating surface through the adjustable polarization light source with a preset polarization angle and initial light intensity modulation parameters; According to the gray distribution differences at different polarization angles in the original image sequence, adjust the polarization angle and light intensity modulation parameters of the adjustable polarization light source; Based on the adjusted polarization angle and light intensity modulation parameters, perform gray histogram equalization processing on the original image sequence to generate a preprocessed image.
[0021] The preset polarization angle is preset according to the reflection characteristics of the socket surface material. For example, the preset polarization angles of the metal contacts are set to three directions of 0 degrees, 45 degrees, and 90 degrees to cover the maximum reflectivity differences of the metal material in different polarization directions. The selection basis of the preset polarization angle is the Fresnel reflection law. The reflectivity of the metal material is significantly reduced at a specific polarization angle, thereby suppressing the specular reflection noise. For example, the 0-degree polarization direction is parallel to the surface texture direction of the metal contact, and the specular reflection is the strongest at this time; the 90-degree direction is perpendicular to the texture direction, and the scattering signal accounts for the largest proportion at this time. By setting the orthogonal polarization angle combination (0 degrees, 45 degrees, 90 degrees), the reflectivity difference between the defect and the background can be maximized.
[0022] The initial light intensity control parameter is dynamically set according to the ambient light intensity measured in real time by the ambient light sensor. For example, when the ambient light intensity exceeds 2000 Lux, the initial light intensity control parameter is set to 80% of the maximum output power. The ambient light intensity is measured by an industrial-grade light sensor installed at the top of the detection station, which monitors the ambient light intensity in real time and feeds it back to the light source controller. The adjustable polarization light source drives the polarization plate to rotate to a preset angle through a stepper motor. Light intensity control is achieved by the digital signal controller adjusting the drive current of the LED array. The LED drive circuit uses PWM modulation technology, and the duty cycle of 0% - 100% corresponds to the light intensity control parameter of 0% - 100%. The industrial camera and the adjustable polarization light source are synchronized through a hardware trigger signal. The hardware trigger interface is a GPIO pin, and the trigger signal is a rising-edge pulse with a trigger delay of less than 1 ms to ensure consistent image acquisition timing at each preset polarization angle.
[0023] When adjusting the polarization angle and light intensity control parameter of the adjustable polarization light source, the light source parameters are dynamically optimized according to the gray-scale distribution differences at different polarization angles in the original image sequence. Specifically, perform sub-region gray-scale analysis on the original images at each preset polarization angle. Divide the image into sub-regions of 10×10 pixels, and calculate the gray-scale mean and variance of the metal contact area and the plating area respectively. For example, if the gray-scale variance of the metal contact area at a polarization angle of 45 degrees exceeds the preset threshold (the preset threshold of the gray-scale variance is 50), it indicates that the specular reflection noise interference at this angle is severe, then the light intensity control parameter at this polarization angle is reduced to 70% of the current value. The gray-scale variance threshold is determined by analyzing the gray-scale distribution statistics of 1000 normal socket surface images. The specific method is as follows: collect normal sample images, calculate the gray-scale variance of each sub-region, and statistically analyze its distribution range (for example, the variance is concentrated between 10 - 40), and set the threshold to 50 to cover 99% of the normal samples. If the gray-scale mean of the plating area at a polarization angle of 90 degrees is lower than the preset threshold (the preset threshold of the gray-scale mean is 80), it indicates insufficient contrast of defect features, then the light intensity control parameter at this angle is increased to 120% of the current value. The gray-scale mean threshold is determined based on the same historical data statistics. The gray-scale mean of the normal plating area is distributed between 90 - 150, and the threshold is set to 80 to cover the lowest contrast scenario. Through the feedback mechanism of the gray-scale distribution difference, adjust the polarization angle switching sequence and light intensity control parameter of the adjustable polarization light source frame by frame. After adjusting each frame of the image, re-collect and verify the parameter effect until the gray-scale variance and mean reach the target range, and generate an optimized light source configuration adapted to the current detection scenario.
[0024] When performing dynamic light compensation, histogram equalization processing is performed on the original image sequence based on the adjusted polarization angle and light intensity control parameters. Specifically, the original image corresponding to the adjusted polarization angle is input into the histogram equalization algorithm, and the gray value of each pixel is normalized and mapped. For example, for the original image at a certain polarization angle, by calculating the cumulative distribution function of its gray histogram, the original gray value range from 100 to 200 is mapped to the full range from 0 to 255. The calculation method of the cumulative distribution function is: count the number of pixels at each gray level in the image, calculate the cumulative probability distribution, and linearly map the cumulative probability to the gray range of 0 - 255.
[0025] The histogram equalization algorithm processes the images at each polarization angle independently to avoid the interference of light differences between multi-angle images. After processing, the multi-angle polarized images are fused into a single preprocessed image according to weights, and the weights are dynamically assigned according to the defect contrast of each angle. For example, the defect contrast in the 0-degree polarized image is relatively high, and the weight is set to 0.4; the contrasts of the 45-degree and 90-degree images are relatively low, and the weights are both set to 0.3. The finally generated preprocessed image has uniform illumination and obvious defect features, providing high-quality input data for the subsequent steps.
[0026] S2. Dynamically adjust the incident angle and light intensity control parameters of the adjustable polarized light source according to the local gray distribution characteristics of the preprocessed image to generate an optimized light source configuration, including: Adjust the polarization angle switching sequence and light intensity control parameters of the adjustable polarized light source so that the incident angle of the adjustable polarized light source is orthogonal to the polarization angle direction corresponding to the area where the gray variance in the preprocessed image exceeds the preset threshold; Adjust the light intensity control of the adjustable polarized light source so that the light intensity control parameters of the adjustable polarized light source are inversely proportional to the light intensity control parameters corresponding to the area where the gray mean in the preprocessed image is lower than the preset threshold; Generate an optimized light source configuration according to the adjusted polarization angle switching sequence and light intensity control parameters, so that the polarization angle switching sequence and light intensity control parameters of the optimized light source configuration adapt to the local gray distribution characteristics of the preprocessed image.
[0027] When adjusting the polarization angle switching sequence and light intensity control parameters of the adjustable polarization light source, the light source parameters are dynamically optimized according to the gray variance and gray mean of different regions in the preprocessed image. For regions in the preprocessed image where the gray variance exceeds the preset threshold, the incident angle of the adjustable polarization light source is adjusted to be orthogonal to the polarization angle direction corresponding to this region. For example, the preset threshold for gray variance is 50, which is determined by statistically analyzing the gray variance distribution of 1000 normal socket surface images. The specific method is as follows: collect normal socket surface images, calculate the gray variance of each sub-region (10×10 pixels), and statistically analyze its distribution range from 10 to 40. The threshold is set to 50 to cover 99% of the normal samples. When the gray variance of a certain region exceeds 50, it is determined that there is strong specular reflection noise in this region, and the incident angle of the adjustable polarization light source is adjusted to be orthogonal to the original polarization angle direction of this region. For example, when the original acquisition angle is 45 degrees, the adjusted angle is 135 degrees, which is achieved by driving the polarization plate to rotate with a stepper motor.
[0028] When adjusting the light intensity control parameters of the adjustable polarization light source, according to the regions in the preprocessed image where the gray mean is lower than the preset threshold, the light intensity control parameters are adjusted in an inverse proportion relationship. For example, the preset threshold for gray mean is 80, which is determined by statistically analyzing the gray mean distribution of the normal plating region. The gray mean of the normal plating region is distributed between 90 and 150, and the threshold is set to 80 to cover the lowest contrast scene. When the gray mean of a certain region is lower than 80, it is determined that the defect contrast in this region is insufficient, and the light intensity control parameter is increased to 120% of the current value. For example, when the original light intensity control parameter is 50%, the adjusted parameter is 60%. The light intensity control parameter is achieved by adjusting the driving current of the LED array. The driving current and the light intensity control parameter are in a linear relationship. For every 10 mA increase in the driving current, the light intensity control parameter is increased by 10%. During the adjustment process, the gray mean of the image corresponding to the adjusted light intensity control parameter is monitored in real time until the gray mean reaches the target range.
[0029] When generating the optimized light source configuration, the adjusted polarization angle switching sequence and light intensity control parameters are integrated to form a light source configuration adapted to the current detection scene. The optimized light source configuration includes a polarization angle switching sequence of 0 degrees, 135 degrees, 90 degrees, and the light intensity control parameters are 80%, 60%, 100% respectively. The configuration parameters are stored in the non-volatile memory of the programmable logic controller in JSON format. After the controller parses the configuration, it is sent to the light source drive module through the RS-485 serial communication protocol. The light source drive module controls the stepper motor to rotate to the target angle and adjusts the LED drive current according to the received configuration parameters to ensure that the light source output is consistent with the optimized configuration. The generation logic of the optimized light source configuration is as follows: first, suppress the specular reflection noise in the high variance region, second, enhance the defect contrast in the low mean region, and finally achieve global illumination balance through parameter combination.
[0030] S3. Perform secondary image acquisition on the socket surface based on the optimized light source configuration and conduct frequency-domain decomposition processing. Reconstruct the surface geometric contour features through the low-frequency components and extract the defect candidate regions through the high-frequency components, including: Perform secondary image acquisition on the socket surface based on the optimized light source configuration and conduct frequency-domain decomposition processing on the acquired image through fast Fourier transform; Reconstruct the surface geometric contour features through inverse Fourier transform of the low-frequency components after frequency-domain decomposition; Conduct threshold filtering processing on the high-frequency components after frequency-domain decomposition, and extract the regions where the energy amplitude in the high-frequency components exceeds the preset energy threshold as the defect candidate regions; Align the surface geometric contour features and the defect candidate regions spatially to generate a fused image containing the surface geometric contour features and the defect candidate regions.
[0031] When performing secondary image acquisition on the socket surface based on the optimized light source configuration, the adjustable polarization light source outputs light according to the polarization angle switching sequence and the light intensity control parameters in the optimized light source configuration, and the industrial camera synchronously acquires multi-angle polarization images. The parameters of the optimized light source configuration, for example, include the polarization angle switching sequence of 0 degrees, 135 degrees, and 90 degrees, and the light intensity control parameters are, for example, 80%, 60%, and 100% respectively. The parameters are stored in JSON format and sent to the light source drive module through the RS-485 serial communication protocol. The industrial camera and the light source are synchronized through a hardware trigger signal, and the trigger delay is, for example, less than 1 ms to ensure the lighting consistency of the acquired images. After the acquisition is completed, the multi-angle polarization images are fused into a single secondary acquisition image according to the weights, and the weights are dynamically allocated according to the defect contrast of each angle. For example, the weight of the 0-degree polarization image is 0.4, and the weights of the 135-degree and 90-degree images are each 0.3.
[0032] When conducting frequency-domain decomposition processing on the secondary acquisition image, the image is converted from the spatial domain to the frequency domain through fast Fourier transform to generate a frequency-domain amplitude spectrum and a phase spectrum. The specific implementation method of the fast Fourier transform is, for example: divide the image into 8×8 pixel sub-blocks, perform two-dimensional Fourier transform on each sub-block, and calculate the amplitude and phase of each frequency component. After frequency-domain decomposition, separate the low-frequency components and the high-frequency components in the amplitude spectrum. For example, the low-frequency components correspond to the frequency range of 0 to 10 Hz, and the high-frequency components correspond to the frequency range of 10 Hz to the Nyquist frequency. The low-frequency components reconstruct the surface geometric contour features through inverse Fourier transform. The specific method is, for example: extract the low-frequency amplitude spectrum and the original phase spectrum, perform inverse Fourier transform to generate a low-frequency spatial domain image, and the low-frequency spatial domain image reflects the macroscopic geometric deformation features of the socket surface, such as the curvature of the panel arc surface and the flatness of the contacts.
[0033] When performing threshold filtering on high-frequency components, a preset energy threshold for the high-frequency energy amplitude is set to 200, for example. This threshold is determined by analyzing the statistical distribution of the high-frequency energy of the normal socket surface image. The specific method is, for example: collect 100 normal images, calculate the energy amplitude (sum of squared amplitudes) of the high-frequency components of each sub-block, and statistically analyze its distribution range, which is 50 to 180, for example. Set the threshold to 200, for example, to cover 99% of the normal samples. Perform threshold filtering on the high-frequency amplitude spectrum, retain the regions where the energy amplitude exceeds 200, and generate a binary mask image. Combine the binary mask image with the high-frequency phase spectrum, and reconstruct the high-frequency spatial domain image through inverse Fourier transform. Extract the connected regions in the high-frequency spatial domain image as defect candidate regions, such as the pixel aggregation regions of microcracks and oxidation spots.
[0034] When spatially aligning the surface geometric contour features with the defect candidate regions, a coordinate mapping relationship between the geometric contour and the defect candidate regions is established based on the pixel coordinate system of the secondarily acquired image. The specific method is, for example: perform feature point matching between the geometric contour features (such as curvature change points) of the low-frequency spatial domain image and the center coordinates of the defect candidate regions in the high-frequency spatial domain image, and correct the position deviation through an affine transformation matrix. When the translation deviation is less than 2 pixels and the rotation angle is less than 0.5 degrees, it is considered that the alignment is completed. After the alignment is completed, superimpose the geometric contour features and the defect candidate regions onto the same coordinate system to generate a fused image. The generation logic of the fused image is, for example: the geometric contour features are presented in the form of gray gradients, and the defect candidate regions are highlighted in red for easy defect classification and localization in subsequent steps.
[0035] Step S3 solves the problem of coupling between spatial and frequency domain features in the detection of high-reflective surface defects through secondary image acquisition and frequency domain decomposition processing with optimized light source configuration. Specifically, the fast Fourier transform decomposes the image into low-frequency and high-frequency components: the low-frequency components correspond to the frequency range of 0 to 10 Hz, reconstruct the surface geometric contour features, and retain macroscopic deformation features such as the curvature of the panel arc surface to avoid specular reflection interference; the high-frequency components correspond to the frequency range of 10 Hz to the Nyquist frequency, and extract defect candidate regions such as oxidation spots where the energy amplitude exceeds the preset threshold through threshold filtering to suppress background noise. Compared with single frequency domain analysis or fixed light source acquisition in the prior art, this step realizes the precise decoupling of geometric contours and defects through the collaborative design of frequency band separation and spatial alignment, breaking through the limitation of high false detection rate caused by feature overlap in traditional methods. Combine optical optimization and frequency domain processing, and solve the detection defects of high-reflective materials through the dual means of physically suppressing specular reflection and algorithmically separating frequency band features.
[0036] S4. Dynamically adjust the incident angle of the adjustable polarization light source according to the surface geometric contour features, so that the incident light direction is orthogonal to the scattering direction of the defect candidate region, including: Calculate the scattering direction of the defect candidate region based on the normal vector of the surface geometric profile features. The scattering direction is the combined vector of the normal vector and the surface reflection direction of the defect candidate region. Adjust the incident angle of the adjustable polarization light source so that the incident light direction of the adjustable polarization light source is orthogonal to the scattering direction. The incident angle adjustment is achieved by driving the polarizer to rotate to the target angle through a stepper motor. Verify the orthogonality between the adjusted incident light direction and the scattering direction. If the deviation exceeds the preset tolerance threshold, iteratively correct the incident angle until the orthogonality meets the requirements.
[0037] When calculating the scattering direction of the defect candidate region based on the normal vector of the surface geometric profile features, the surface geometric profile features are reconstructed from the low-frequency components of step S3 and contain the three-dimensional geometric deformation information of the socket surface. The normal vector is determined by calculating the curvature change gradient of each pixel point in the surface geometric profile features. The specific method is as follows: Select the gray gradient of the 3×3 neighborhood around each pixel point, calculate its gradient components in the X-axis and Y-axis directions, and obtain the normal vector direction through the cross product of the gradient components. The scattering direction of the defect candidate region is the combined vector of the normal vector and the surface reflection direction. The surface reflection direction is set according to the material properties of the defect candidate region. For example, the surface reflection direction of the metal contact region is the specular reflection direction, and the surface reflection direction of the plating region is the diffuse reflection direction. The calculation method of the combined vector is: After vectorially superimposing the normal vector and the surface reflection direction vector, perform normalization processing. For example, if the normal vector is in the vertical direction (0, 0, 1) and the surface reflection direction is the light reflection direction (calculated from the incident angle), the combined scattering direction is the direction of the vector sum of the two.
[0038] When adjusting the incident angle of the adjustable polarization light source, based on the calculated scattering direction, adjust the incident light direction to be orthogonal to the scattering direction. The incident angle adjustment is achieved by driving the polarizer to rotate to the target angle through a stepper motor, and corresponding step pulses need to be sent each time it rotates to the target angle. For example, if the current incident angle is 45 degrees and the target angle is 135 degrees, 200 step pulses need to be sent to drive the polarizer to rotate 90 degrees. During the adjustment process, the angle of the polarizer is monitored in real time, and the angle deviation is fed back through a rotary encoder to ensure that the adjustment accuracy is less than 0.5 degrees. After the adjustment is completed, output the adjusted incident light direction through the adjustable polarization light source for the illumination verification of the defect region.
[0039] When verifying the orthogonality of the adjusted incident light direction and the scattering direction, the orthogonality is judged by calculating the dot product value of the incident light direction vector and the scattering direction vector. When the absolute value of the dot product value exceeds a preset tolerance threshold, such as 0.1, it is determined that the deviation exceeds the limit, and the incident angle needs to be iteratively corrected. The preset tolerance threshold of 0.1 is set based on the statistical analysis of experimental data. When the absolute value of the dot product is less than 0.1, the physical orthogonality error between the incident light direction and the scattering direction is less than 2 degrees, meeting the detection accuracy requirements. The correction method is to finely adjust the number of step pulses of the stepper motor. For example, 5 pulses are sent each time (corresponding to an angle adjustment of approximately 0.45 degrees) until the absolute value of the dot product value is less than 0.1. During the iterative correction process, the orthogonality is recalculated after each adjustment, and the maximum number of corrections is, for example, no more than 3 times. Through experimental verification, 3 corrections can cover 99% of the deviation scenarios, avoiding infinite loops. After the verification is passed, the current incident angle is locked as the final parameter for optimizing the light source configuration to ensure that the incident direction of the light source in the subsequent detection steps is strictly orthogonal to the defect scattering direction.
[0040] Step S4 solves the problem that the specular reflection noise masks the defect features in the detection of high-reflectivity surface defects by dynamically adjusting the incident angle of the tunable polarization light source to make the incident light direction orthogonal to the scattering direction of the defect candidate area. Specifically, based on the normal vector of the surface geometric contour features, the scattering direction of the defect area is calculated, and the incident angle is precisely adjusted by driving the polarization plate to rotate with a stepper motor. Compared with the limitations of fixed light sources or single-angle acquisition in the prior art, this step physically suppresses specular reflection and enhances the defect scattering signal through geometric contour-driven dynamic orthogonal adjustment. By combining geometric deformation analysis (surface contour) with optical parameter optimization (incident angle), and through a real-time feedback and iterative correction mechanism, the dynamic matching of the light source and the defect scattering characteristics is achieved, improving the detection stability of micro-defects on complex curved surfaces.
[0041] Figure 3 The flowchart for constructing the two-dimensional feature space of the present invention is given. The morphological distribution of the diffuse scattering spots in the defect candidate area under the orthogonal incident light direction is analyzed, and a two-dimensional feature space of the radial curvature and light intensity modulation depth of the scattering spots is constructed, including: Based on the anisotropic distribution characteristics of the diffuse scattering spots in the defect candidate area under the orthogonal incident light direction, the radial curvature of the scattering spots is extracted by a multi-scale edge detection algorithm. The radial curvature is the reciprocal of the curvature radius of the spot edge, and the radial curvature calculation is corrected based on the cosine value of the angle between the orthogonal incident light direction and the defect surface normal; According to the consistency of the gray gradient direction from the center to the edge of the scattering spot, the light intensity modulation depth is calculated. The light intensity modulation depth is the product of the normalized gradient direction consistency coefficient and the maximum gray attenuation gradient; Map the radial curvature and the light intensity modulation depth to an orthogonal coordinate system to construct a two-dimensional feature space based on the physical scattering characteristics of defects, where the radial curvature is the first feature axis and the light intensity modulation depth is the second feature axis.
[0042] When analyzing the anisotropic distribution characteristics of the diffuse scattering spots in the defect candidate region, based on the scattering spot image of the defect candidate region under the direction of orthogonally incident light, the radial curvature of the scattering spots is extracted by a multi-scale edge detection algorithm. The multi-scale edge detection algorithm performs convolution using Gaussian kernels of different scales. For example, Gaussian kernels with standard deviations of 1 pixel, 3 pixels, and 5 pixels are used to smooth the spot image respectively to extract edge contours of different scales. The radial curvature is the reciprocal of the curvature radius of the spot edge, and the curvature calculation is corrected by combining the cosine value of the angle between the direction of orthogonally incident light and the normal of the defect surface. For example, when the angle between the direction of orthogonally incident light and the normal is 30 degrees, the cosine value is 0.866, and the curvature calculation result is multiplied by this cosine value to eliminate the influence of the angle deviation on the curvature sensitivity. The corrected radial curvature reflects the actual geometric deformation of the spot edge. For example, the curvature value in the crack region is significantly higher than that in the oxidation spot.
[0043] When calculating the light intensity modulation depth, quantitative analysis is performed according to the consistency of the gray gradient direction from the center to the edge of the scattering spot. First, calculate the gray gradient direction of each pixel point in the spot image, and statistically calculate the consistency coefficient of the gradient direction. The consistency coefficient is the normalized value of the reciprocal of the variance of all pixel gradient directions. For example, if the variance of the gradient direction of a certain spot is 0.1, the consistency coefficient is 1 / (0.1 + ε), where ε is a small constant to prevent division by zero, such as 0.01, and the range of the normalized consistency coefficient is from 0 to 1.
[0044] The light intensity modulation depth is the product of the normalized gradient direction consistency coefficient and the maximum gray attenuation gradient. The maximum gray attenuation gradient is determined by calculating the maximum value of the gray descent slope from the center to the edge of the spot. For example, if the normalized consistency coefficient of a certain spot is 0.8 and the maximum gray attenuation gradient is 50, then the light intensity modulation depth is 0.8×50 = 40. The light intensity modulation depth characterizes the surface roughness difference. For example, in the mechanically damaged area, the gradient direction is disordered due to the surface irregularity, and the light intensity modulation depth is relatively low, while in the oxidation spot area, due to the higher surface uniformity, the light intensity modulation depth is relatively high.
[0045] When constructing a two-dimensional feature space, the radial curvature and the light intensity modulation depth are mapped to an orthogonal coordinate system. The radial curvature serves as the first feature axis, and the light intensity modulation depth serves as the second feature axis. Each data point in the coordinate system corresponds to a defect candidate region. For example, the data points of metal oxidation spots are distributed in the region of high radial curvature (e.g., 0.05 - 0.1) and high light intensity modulation depth (e.g., 30 - 50), while the data points of mechanical damage are distributed in the region of low radial curvature (e.g., 0.01 - 0.03) and low light intensity modulation depth (e.g., 10 - 20). The construction logic of the feature space is: different defect types are separated through physical scattering characteristics (curvature reflects geometric deformation, and modulation depth reflects roughness), solving the problem of fuzzy classification of traditional single-dimensional features.
[0046] In step S5, by analyzing the morphological distribution of the diffuse scattering spots in the defect candidate region under the direction of orthogonally incident light, a two-dimensional feature space of radial curvature and light intensity modulation depth is constructed to solve the problems of single feature dimension and poor separability in the defect classification of highly reflective surfaces. Specifically, based on the physical correlation between the direction of orthogonally incident light and the normal of the defect surface, the radial curvature of the spot (reflecting the degree of geometric deformation) is extracted through multi-scale edge detection, and the light intensity modulation depth (quantifying surface roughness) is calculated by combining the gradient direction consistency. Compared with the prior art, in this step, through the construction of multi-dimensional features driven by physical scattering characteristics, the optical response (orthogonal light direction) and image processing (multi-scale analysis) are deeply combined to achieve the accurate separation of metal oxidation spots (high curvature, high modulation depth) and mechanical damage (low curvature, low modulation depth).
[0047] S6. In the two-dimensional feature space, according to the differences in the scattering spot characteristics of metal oxidation and mechanical damage, the defect types are distinguished by adaptive density clustering and the position information is output, including: Dynamically adjust the neighborhood radius parameter of the adaptive density clustering according to the density distribution of the data points in the two-dimensional feature space. The neighborhood radius parameter is adaptively set based on the density distribution of the data points; Based on the feature distribution differences between the radial curvature and the light intensity modulation depth, divide the clustering boundary between the metal oxidation region and the mechanical damage region in the two-dimensional feature space. The metal oxidation region corresponds to the set of data points with higher radial curvature and higher light intensity modulation depth, and the mechanical damage region corresponds to the set of data points with lower radial curvature and lower light intensity modulation depth; Map the clustered defect types to the original image coordinate system, and output the defect position information through the affine transformation matrix. The defect position information includes the defect type label and the pixel coordinate range.
[0048] When dynamically adjusting the neighborhood radius parameter of adaptive density clustering, the neighborhood radius parameter is adaptively set based on the density distribution of data points in the two-dimensional feature space. The specific method is as follows: calculate the average neighborhood distance between all data points, and set the neighborhood radius parameter as a multiple of the average neighborhood distance. For example, in the area where data points are dense, the average neighborhood distance is small, and the neighborhood radius parameter is correspondingly reduced to avoid overfitting; in the area where data points are sparse, the average neighborhood distance is large, and the neighborhood radius parameter is increased to cover a wider range. The dynamic adjustment of the neighborhood radius parameter is achieved by traversing the distribution density of data points. For example, a sliding window is used to statistically calculate the local density, and the neighborhood radius is scaled in real time according to the density level to ensure balanced clustering effects in different density regions.
[0049] When dividing the clustering boundary between the metal oxidation area and the mechanical damage area, based on the difference in the feature distribution of radial curvature and light intensity modulation depth, the data points in the two-dimensional feature space are divided into two categories. The metal oxidation area corresponds to the set of data points with relatively high radial curvature and relatively high light intensity modulation depth. For example, oxidation spots have a high surface uniformity and smooth edges of scattered light spots, with a radial curvature value greater than the preset curvature threshold and a light intensity modulation depth value greater than the preset modulation depth threshold. The mechanical damage area corresponds to the set of data points with relatively low radial curvature and relatively low light intensity modulation depth. For example, mechanical damage has a rough surface and irregular edges of scattered light spots, with a radial curvature value less than the curvature threshold and a light intensity modulation depth value less than the modulation depth threshold. The division of the clustering boundary is achieved through an adaptive density clustering algorithm, which automatically identifies the high-density core area and the low-density boundary area according to the data point distribution, and generates the clustering clusters of metal oxidation and mechanical damage.
[0050] When mapping the clustered defect types to the original image coordinate system, the transformation from the feature space to the image coordinates is realized through an affine transformation matrix. The affine transformation matrix is calculated by matching the center points of the clustering in the two-dimensional feature space with the center points of the defect candidate areas in the original image. For example, select the center point coordinates of the metal oxidation clustering cluster and the center point coordinates of the corresponding defect candidate area in the original image, and solve the affine transformation parameters by the least squares method to ensure that the coordinate mapping error is less than the preset tolerance. After the mapping is completed, the defect position information is output, and the defect position information includes the defect type label and the pixel coordinate range. For example, metal oxidation defects are marked with red rectangular frames, and mechanical damage is marked with blue rectangular frames. The coordinate range of the rectangular frames is determined by the maximum and minimum coordinate values of all data points inside.
[0051] Step S6 differentiates metal oxidation and mechanical damage defects in two dimensions through adaptive density clustering, solving the problems of fuzzy defect classification and low positioning accuracy in industrial inspection. Based on the physical feature differences of radial curvature and light modulation depth, the neighborhood radius parameter is dynamically adjusted to adapt to the data point density distribution. For example, in the high-density oxidation spot area, the neighborhood radius is reduced to avoid overfitting, and in the low-density mechanical damage area, the radius is enlarged to cover the scattered data. The accurate separation of oxidation spots (high curvature, high modulation depth) and mechanical damage (low curvature, low modulation depth) is achieved through density-adaptive physical feature clustering. The optical scattering characteristics (curvature, modulation depth) and data distribution characteristics (density) are analyzed collaboratively, and the problems of interpretable classification and precise positioning of complex defects are solved through dynamic clustering and affine mapping.
[0052] Among them, the adjustable polarization light source includes a polarizer, a stepper motor, and a light intensity control circuit. The polarizer is rotated to a preset angle (such as 0 degrees, 45 degrees, 90 degrees) by the stepper motor, and the light intensity control circuit adjusts the LED array through PWM. For example, a drive current of 10 - 100 mA corresponds to a light intensity of 10% - 100%. The light source and the industrial camera are synchronized through hardware triggering to ensure consistent acquisition timing.
[0053] Embodiment 2: Figure 2 The structural schematic diagram of the socket surface defect detection system based on image processing according to the present invention is given. The socket surface defect detection system based on image processing includes the following modules: Polarized light source acquisition module: used to collect the original image sequence of the socket metal contacts and the coating surface through the adjustable polarization light source and perform dynamic light compensation to generate a preprocessed image; Light source dynamic optimization module: used to dynamically adjust the incident angle and light intensity control parameters of the adjustable polarization light source according to the local gray distribution characteristics of the preprocessed image to generate an optimized light source configuration; Frequency domain decomposition and reconstruction module: used to perform secondary image acquisition on the socket surface based on the optimized light source configuration and perform frequency domain decomposition processing, reconstruct the surface geometric contour features through the low-frequency components, and extract the defect candidate regions through the high-frequency components; Optical path orthogonal calibration module: used to dynamically adjust the incident angle of the adjustable polarization light source according to the surface geometric contour features to make the incident light direction orthogonal to the scattering direction of the defect candidate region; Feature space modeling module: used to analyze the diffuse scattering spot morphology distribution of the defect candidate region in the direction of orthogonal incident light and construct a two-dimensional feature space of the radial curvature and light modulation depth of the scattering spot; Density clustering recognition module: used to distinguish the defect types and output the position information through adaptive density clustering according to the scattering spot characteristic differences between metal oxidation and mechanical damage in the two-dimensional feature space.
[0054] The above formulas are all dimensionless and only take their numerical values for calculation. The formulas are obtained by collecting a large amount of data and performing software simulation to get a formula that is closest to the actual situation. The preset parameters and threshold selection in the formulas are set by those skilled in the art according to the actual situation.
[0055] It should be noted that the present invention can be deployed on the device itself to achieve embedded applications, or can also run on a PC or other terminal with a user interface, so as to meet various hardware environments and usage requirements.
[0056] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access, or a data storage device such as a server or data center that contains one or more collections of available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
[0057] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the foregoing method embodiments, and will not be described herein again.
[0058] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there can be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or modules can be in electrical, mechanical, or other forms.
[0059] The module described as a separation component may or may not be physically separated. The component shown as a module may or may not be a physical module, and it may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0060] In addition, in each embodiment of this application, each functional module can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.
[0061] If the above functions are implemented in the form of software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0062] As described above, this is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
[0063] Finally: The above is only the preferred embodiment of the present invention and is not used to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A socket surface defect detection method based on image processing, characterized in that: The steps include: S1, collecting the original image sequence of the metal contact and the coating surface of the socket through an adjustable polarized light source and performing dynamic illumination compensation to generate a pre-processed image; S2, dynamically adjusting the incident angle and light intensity control parameters of the adjustable polarized light source according to the local grayscale distribution characteristics of the preprocessed image to generate an optimized light source configuration; S3, based on the optimized light source configuration, secondary image acquisition is performed on the socket surface and frequency domain decomposition is performed, the surface geometric contour features are reconstructed through low-frequency components, and defect candidate areas are extracted through high-frequency components; S4, dynamically adjusting the incident angle of the adjustable polarized light source according to the surface geometric profile characteristics, so that the incident light direction is orthogonal to the scattering direction of the defect candidate area; S5. Analyze the distribution of diffuse scattering spots in the defect candidate area under the orthogonal incident light direction, and construct a two-dimensional feature space of radial curvature of the scattering spots and light intensity modulation depth; S6. In the two-dimensional feature space, according to the difference in the scattered light spot characteristics of metal oxidation and mechanical damage, the defect types are distinguished through adaptive density clustering and the position information is output.
2. The socket surface defect detection method based on image processing according to claim 1 is characterized in that: The original image sequence of the metal contacts and the coating surface of the socket is collected through an adjustable polarized light source and dynamic illumination compensation is performed to generate pre-processed images, including: The original image sequence of the metal contact and the coating surface of the socket is collected by using an adjustable polarized light source with preset polarization angle and initial light intensity control parameters; According to the grayscale distribution difference at different polarization angles in the original image sequence, the polarization angle and light intensity control parameters of the adjustable polarization light source are adjusted; The grayscale histogram equalization processing is performed on the original image sequence based on the adjusted polarization angle and light intensity control parameters to generate a preprocessed image.
3. The socket surface defect detection method based on image processing according to claim 1 is characterized in that: The incident angle and light intensity control parameters of the adjustable polarized light source are dynamically adjusted according to the local grayscale distribution characteristics of the preprocessed image to generate an optimized light source configuration, including: Adjusting the polarization angle switching sequence and light intensity control parameters of the adjustable polarized light source so that the incident angle of the adjustable polarized light source is orthogonal to the polarization angle direction corresponding to the area in the preprocessed image where the grayscale variance exceeds a preset threshold; Adjusting the light intensity control of the adjustable polarized light source so that the light intensity control parameter of the adjustable polarized light source is in inverse proportion to the light intensity control parameter corresponding to the area in the preprocessed image where the grayscale mean is lower than a preset threshold; An optimized light source configuration is generated according to the adjusted polarization angle switching sequence and light intensity control parameters.
4. The socket surface defect detection method based on image processing according to claim 1 is characterized in that: Based on the optimized light source configuration, the socket surface is imaged twice and decomposed in the frequency domain. The surface geometric features are reconstructed through low-frequency components, and defect candidate areas are extracted through high-frequency components, including: Based on the optimized light source configuration, secondary image acquisition is performed on the socket surface, and the acquired image is decomposed in the frequency domain by fast Fourier transform; The low-frequency components after frequency domain decomposition are used to reconstruct the surface geometric contour features through inverse Fourier transform; Perform threshold filtering on the high-frequency components after frequency domain decomposition, and extract the areas in the high-frequency components where the energy amplitude exceeds the preset energy threshold as defect candidate areas; The surface geometric contour features and the defect candidate areas are spatially aligned to generate a fused image containing the surface geometric contour features and the defect candidate areas.
5. The socket surface defect detection method based on image processing according to claim 1 is characterized in that: Dynamically adjust the incident angle of the adjustable polarized light source according to the surface geometric profile characteristics so that the incident light direction is orthogonal to the scattering direction of the defect candidate area, including: The scattering direction of the defect candidate area is calculated based on the normal vector of the surface geometric contour feature, and the scattering direction is the composite vector of the normal vector and the surface reflection direction of the defect candidate area; Adjusting the incident angle of the adjustable polarized light source so that the incident light direction of the adjustable polarized light source is orthogonal to the scattering direction, and the incident angle adjustment is achieved by driving the polarizer to rotate to the target angle through a stepper motor; Verify the orthogonality of the adjusted incident light direction and the scattering direction. If the deviation exceeds the preset tolerance threshold, iteratively correct the incident angle until the orthogonality meets the requirements.
6. The socket surface defect detection method based on image processing according to claim 1 is characterized in that: Analyze the distribution of diffuse scattering spots in the defect candidate area under the orthogonal incident light direction, and construct a two-dimensional feature space of the radial curvature of the scattering spot and the light intensity modulation depth, including: Based on the anisotropic distribution characteristics of the diffuse scattering spot of the defect candidate area under the orthogonal incident light direction, the radial curvature of the scattered light spot is extracted by a multi-scale edge detection algorithm. According to the directional consistency of the grayscale gradient from the center to the edge of the scattered light spot, the light intensity modulation depth is calculated. The light intensity modulation depth is the product of the normalized gradient directional consistency coefficient and the maximum grayscale attenuation gradient. The radial curvature and the light intensity modulation depth are mapped to an orthogonal coordinate system to construct a two-dimensional feature space based on the physical scattering characteristics of the defect, in which the radial curvature is the first characteristic axis and the light intensity modulation depth is the second characteristic axis.
7. The socket surface defect detection method based on image processing according to claim 6 is characterized in that: The radial curvature is the inverse of the radius of curvature of the edge of the light spot, and the calculation of the radial curvature is based on the cosine value correction of the angle between the orthogonal incident light direction and the normal of the defect surface.
8. The socket surface defect detection method based on image processing according to claim 1 is characterized in that: In the two-dimensional feature space, according to the difference in the scattered light spot characteristics of metal oxidation and mechanical damage, the defect types are distinguished through adaptive density clustering and the position information is output, including: Dynamically adjust the neighborhood radius parameter of adaptive density clustering according to the density distribution of data points in the two-dimensional feature space, and the neighborhood radius parameter is adaptively set based on the density distribution of data points; Based on the difference in the characteristic distribution of radial curvature and light intensity modulation depth, the clustering boundaries of metal oxidation areas and mechanical damage areas are divided in the two-dimensional feature space; The clustered defect types are mapped to the original image coordinate system, and the defect location information is output through the affine transformation matrix. The defect location information includes the defect type label and the pixel coordinate range.
9. The socket surface defect detection method based on image processing according to claim 8, characterized in that: The metal oxidation region corresponds to a data point set with a higher radial curvature and a higher light intensity modulation depth, and the mechanical damage region corresponds to a data point set with a lower radial curvature and a lower light intensity modulation depth.
10. A socket surface defect detection system based on image processing, used to implement the socket surface defect detection method based on image processing according to any one of claims 1 to 9, characterized in that: Includes the following modules: Polarized light source acquisition module: used to acquire the original image sequence of the metal contacts and the coating surface of the socket through an adjustable polarized light source and perform dynamic light compensation to generate a pre-processed image; Light source dynamic tuning module: used to dynamically adjust the incident angle and light intensity control parameters of the adjustable polarized light source according to the local grayscale distribution characteristics of the preprocessed image, and generate an optimized light source configuration; Frequency domain decomposition and reconstruction module: used to collect secondary images of the socket surface based on the optimized light source configuration and perform frequency domain decomposition processing, reconstruct the surface geometric contour features through low-frequency components, and extract defect candidate areas through high-frequency components; Optical path orthogonal adjustment module: used to dynamically adjust the incident angle of the adjustable polarized light source according to the surface geometric profile characteristics, so that the incident light direction is orthogonal to the scattering direction of the defect candidate area; Feature space modeling module: used to analyze the distribution of diffuse scattering spots in the defect candidate area under the orthogonal incident light direction, and construct a two-dimensional feature space of the radial curvature of the scattering spot and the light intensity modulation depth; Density clustering recognition module: It is used to distinguish defect types and output location information through adaptive density clustering in two-dimensional feature space according to the differences in scattered light spot characteristics of metal oxidation and mechanical damage.
Citation Information
Patent Citations
Defect inspection device and defect inspection method
CN110546487A
Bulk scattering optical material surface microdefect detection device and detection method thereof
CN114136979A
Five-jack socket panel defect intelligent detection method and system based on machine vision
CN114324350A
Surface defect detection method and surface defect detection system
CN115575399A
Workpiece surface defect detection method and system based on optical technology
CN119413802A
Cited By
Defect detection method for solid thick-wall section bar processing die
CN120259289A
A defect detection method for solid thick-walled section profile processing mold
CN120259289B
Dual complementary dynamic convolution optimization method and system for underwater robot image processing
CN120298234A
Magnetic material defect detection system based on image recognition
CN120558971A
A magnetic material defect detection system based on image recognition
CN120558971B