Socket surface defect detection method and system based on image processing
Through dynamic illumination compensation and frequency domain decomposition processing based on an adjustable polarized light source, combined with two-dimensional feature space analysis, the detection accuracy problem caused by the dynamic change of reflection characteristics in socket surface defect detection is solved, and high-precision and high-reliability defect detection is achieved.
Patent Information
- Application Number
- CN202510483923.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-04-17
AI Technical Summary
In the existing technology of socket surface defect detection, the dynamic reflection characteristics of highly reflective materials cause the defect characteristics to be highly coupled with background noise, making them difficult to distinguish, resulting in high missed detection and false detection rates, affecting detection accuracy and reliability of industrial applications.
An adjustable polarized light source is used for dynamic illumination compensation and light intensity control. Combined with frequency domain decomposition processing, the surface geometric contour features are reconstructed through low-frequency components and the defect candidate areas are extracted through high-frequency components. The incident angle is dynamically adjusted to be orthogonal to the scattering direction, and a two-dimensional feature space of the radial curvature of the scattered light spot and the light intensity modulation depth is constructed. Adaptive density clustering is used to distinguish defect types.
It significantly improves the defect detection accuracy and adaptability of highly reflective socket surfaces, solves the problem of coupling between spatial and frequency domain features, and achieves detection of defects with clear edges and complete details in complex curved surface areas, avoiding overexposure, underexposure and false defects of traditional methods, and meeting the high-precision and high-robustness requirements of industrial detection.
Smart Images

Figure CN120064298B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial surface defect detection, more particularly, the present application relates to a socket surface defect detection method and system based on image processing. BACKGROUND
[0002] In the field of industrial surface defect detection, as the core component of power transmission, the socket has the problem of mirror reflection interference due to the high reflectivity of the metal contact and the plating surface. The existing technology generally uses fixed light sources (such as diffuse light) and basic image processing algorithms (such as threshold segmentation) to suppress reflection noise, but there are significant limitations. For example, the oxidation spots of the socket metal contact are difficult to distinguish from background noise by traditional algorithms due to the dynamic changes in surface reflectivity (such as differences in oxidation layer thickness or environmental light fluctuations). At the same time, the arc transition area of the socket panel is prone to local overexposure or reflection shielding due to its complex curvature and high reflectivity. The existing light source layout and image enhancement methods cannot adapt to the multi-angle reflection characteristics, resulting in blurred defect edges or misjudgments.
[0003] In the existing technology for socket surface defect detection, the dynamic reflection characteristics of high-reflectivity materials cause the defect features and background noise to be highly coupled in the spatial and frequency domains. Specifically, the oxidation layer of the metal contact exhibits nonlinear reflection fluctuations with environmental changes, and the complex curved surface (such as the panel arc surface) forms pseudo-defect features due to mirror reflection, which cannot dynamically adapt to changes in reflectivity. This leads to a significant increase in the miss rate and false detection rate of small defects (such as micro-cracks and oxidation spots), affecting detection accuracy and reducing the reliability of industrial applications. SUMMARY
[0004] To overcome the above-mentioned defects of the prior art, embodiments of the present application provide a socket surface defect detection method and system based on image processing to solve the problems raised in the background art.
[0005] To achieve the above-mentioned purpose, the present application provides the following technical solutions:
[0006] The socket surface defect detection method based on image processing comprises the following steps:
[0007] S1, acquiring the original image sequence of the socket metal contact and the plating surface through an adjustable polarized light source and performing dynamic light compensation to generate a preprocessed image;
[0008] S2, dynamically adjusting the incident angle and light intensity control parameters of the adjustable polarized light source according to the local gray scale distribution characteristics of the preprocessed image to generate an optimized light source configuration;
[0009] S3, performing secondary image acquisition of the socket surface based on the optimized light source configuration and performing frequency domain decomposition processing, reconstructing the surface geometric profile features through low-frequency components, and extracting defect candidate regions through high-frequency components;
[0010] S4, dynamically adjusting the incident angle of the adjustable polarized light source according to the surface geometric profile feature, so that the incident light direction is orthogonal to the scattering direction of the defect candidate region;
[0011] S5, analyzing the diffuse scattering spot shape distribution of the defect candidate region under the orthogonal incident light direction, and constructing a two-dimensional feature space of the scattering spot radial curvature and the light intensity modulation depth;
[0012] S6, in the two-dimensional feature space, according to the scattering spot characteristic difference between metal oxidation and mechanical damage, the defect type is distinguished and the position information is output by adaptive density clustering.
[0013] In a preferred embodiment, the original image sequence of the socket metal contact and the plating surface is collected by the adjustable polarized light source and dynamic light compensation is performed to generate a preprocessed image, including:
[0014] The original image sequence of the socket metal contact and the plating surface is collected by the adjustable polarized light source at a preset polarization angle and initial light intensity control parameter;
[0015] According to the gray scale distribution difference of the original image sequence under different polarization angles, the polarization angle and the light intensity control parameter of the adjustable polarized light source are adjusted;
[0016] Based on the adjusted polarization angle and light intensity control parameter, the original image sequence is processed by gray scale histogram equalization to generate a preprocessed image.
[0017] In a preferred embodiment, the incident angle and light intensity control parameter of the adjustable polarized light source are dynamically adjusted according to the local gray scale distribution feature of the preprocessed image to generate an optimized light source configuration, including:
[0018] The polarization angle switching sequence and the light intensity control parameter of the adjustable polarized light source are adjusted so that the incident angle of the adjustable polarized light source is orthogonal to the polarization angle direction corresponding to the region in the preprocessed image whose gray scale variance exceeds a preset threshold;
[0019] The light intensity control of the adjustable polarized light source is adjusted so that the light intensity control parameter of the adjustable polarized light source is inversely proportional to the light intensity control parameter corresponding to the region in the preprocessed image whose gray scale mean value is lower than a preset threshold;
[0020] According to the adjusted polarization angle switching sequence and the light intensity control parameter, an optimized light source configuration is generated.
[0021] In a preferred embodiment, based on the optimized light source configuration, the surface of the socket is collected for secondary image acquisition and processed by frequency domain decomposition, and the surface geometric profile feature is reconstructed by the low frequency component, and the defect candidate region is extracted by the high frequency component, including:
[0022] Based on the optimized light source configuration, the secondary image acquisition is performed on the socket surface, and the collected image is processed by fast Fourier transform for frequency domain decomposition;
[0023] The low-frequency component after frequency domain decomposition is reconstructed by inverse Fourier transform to obtain the surface geometric profile feature;
[0024] The high-frequency component after frequency domain decomposition is processed by threshold filtering, and the region with energy amplitude exceeding the preset energy threshold in the high-frequency component is extracted as the defect candidate region;
[0025] The surface geometric profile feature and the defect candidate region are spatially aligned to generate a fusion image containing the surface geometric profile feature and the defect candidate region.
[0026] In a preferred embodiment, the incident angle of the adjustable polarized light source is dynamically adjusted according to the surface geometric profile feature, so that the incident light direction is orthogonal to the scattering direction of the defect candidate region, comprising:
[0027] Based on the normal vector of the surface geometric profile feature, the scattering direction of the defect candidate region is calculated, and the scattering direction is the resultant vector of the normal vector and the surface reflection direction of the defect candidate region;
[0028] The incident angle of the adjustable polarized light source is adjusted so that the incident light direction of the adjustable polarized light source is orthogonal to the scattering direction, and the incident angle adjustment is realized by rotating the polarizer to the target angle through the stepping motor;
[0029] The orthogonality of the adjusted incident light direction and the scattering direction is verified, and if the deviation exceeds the preset tolerance threshold, the incident angle is iteratively corrected until the orthogonality meets the requirements.
[0030] In a preferred embodiment, the distribution of the diffuse scattering spot morphology of the defect candidate region under the orthogonal incident light direction is analyzed, and a two-dimensional feature space of the radial curvature and the light intensity modulation depth of the scattering spot is constructed, comprising:
[0031] Based on the anisotropic distribution characteristics of the diffuse scattering spot of the defect candidate region under the orthogonal incident light direction, the radial curvature of the scattering spot is extracted by a multi-scale edge detection algorithm;
[0032] According to the consistency of the gray scale gradient direction from the center to the edge of the scattering spot, the light intensity modulation depth is calculated, and the light intensity modulation depth is the product of the normalized gradient direction consistency coefficient and the maximum gray scale attenuation gradient;
[0033] The radial curvature and the light intensity modulation depth are mapped to the orthogonal coordinate system to construct a two-dimensional feature space based on the physical scattering characteristics of the defect, wherein the radial curvature is the first feature axis and the light intensity modulation depth is the second feature axis.
[0034] In a preferred embodiment, 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.
[0035] In a preferred embodiment, based on the difference in scattered light spot characteristics between metal oxidation and mechanical damage in a two-dimensional feature space, defect types are distinguished by adaptive density clustering and position information is output, including:
[0036] Dynamically adjust the neighborhood radius parameter of adaptive density clustering according to the density distribution of data points in the two-dimensional feature space. The neighborhood radius parameter is adaptively set based on the density distribution of data points.
[0037] Based on the characteristic distribution differences of radial curvature and light intensity modulation depth, the cluster boundaries of metal oxidation areas and mechanical damage areas are divided in the two-dimensional feature space;
[0038] 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 pixel coordinate range.
[0039] In a preferred embodiment, 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.
[0040] On the other hand, the present invention provides a socket surface defect detection system based on image processing, comprising the following modules:
[0041] Polarized light source acquisition module: used to collect original image sequences of the socket metal contacts and coating surfaces through an adjustable polarized light source and perform dynamic illumination compensation to generate pre-processed images;
[0042] Light source dynamic tuning module: used to dynamically adjust the incident angle and light intensity control parameters of the adjustable polarization light source according to the local grayscale distribution characteristics of the pre-processed image, and generate an optimized light source configuration;
[0043] 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;
[0044] Optical path orthogonality 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;
[0045] Feature space modeling module: used to analyze the morphological distribution of diffuse scattering spots in defect candidate areas under the orthogonal incident light direction, and construct a two-dimensional feature space of the radial curvature of the scattered light spots and the light intensity modulation depth;
[0046] Density clustering identification module: used for distinguishing defect types and outputting position information by adaptive density clustering according to the scattering spot characteristic difference of metal oxidation and mechanical damage in a two-dimensional feature space.
[0047] Compared with the prior art, the present application has the following beneficial effects:
[0048] 1. By dynamic adjustable polarized light source and multi-dimensional feature collaborative analysis, the defect detection precision and adaptability of the high-reflective socket surface are significantly improved. Based on dynamic polarization angle adjustment and light intensity control feedback mechanism, the reflection characteristic changes of the metal contact and plating layer are adapted in real time. The specular reflection noise is suppressed by orthogonal incident light direction, and the scattering signal contrast of the defect area is enhanced. Combined with frequency domain decomposition processing, the surface geometric profile reconstruction and defect high-frequency feature extraction are separated, effectively solving the interference problem caused by the coupling of spatial and frequency domain features. The defect edges of complex curved surface regions are clear and the details are complete, avoiding the overexposure, underexposure and pseudo-defect problems caused by fixed light source or single frequency domain analysis in traditional methods.
[0049] 2. By two-dimensional feature space construction and adaptive density clustering driven by physical scattering characteristics, the precise differentiation of metal oxidation and mechanical damage defects is realized. Based on the physical correlation of 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 data density adaptive clustering boundary division, different defect distribution scenarios are dynamically adapted to ensure the high separability of oxidation spots and mechanical damage in the feature space. Finally, the precise positioning of the defect position is realized through affine transformation mapping, meeting the high precision and high robustness requirements of industrial detection for complex curved surface defects. BRIEF DESCRIPTION OF DRAWINGS
[0050] Figure 1 The flowchart of the socket surface defect detection method based on image processing of the present application;
[0051] Figure 2 The structural schematic diagram of the socket surface defect detection system based on image processing of the present application;
[0052] Figure 3 The flowchart of constructing a two-dimensional feature space of the present application. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0054] Embodiment 1: Figure 1 The image processing-based socket surface defect detection method of the present application is given, comprising the following steps:
[0055] S1, acquiring the original image sequence of the socket metal contact and plating surface through an adjustable polarized light source and performing dynamic light compensation to generate a preprocessed image;
[0056] S2, dynamically adjusting the incident angle and light intensity control parameters of the adjustable polarized light source according to the local gray scale distribution characteristics of the preprocessed image to generate an optimized light source configuration;
[0057] S3, performing secondary image acquisition on the socket surface based on the optimized light source configuration and performing frequency domain decomposition processing, reconstructing the surface geometric profile characteristics through the low-frequency components, and extracting the defect candidate regions through the high-frequency components;
[0058] 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 region;
[0059] S5, analyzing the diffuse scattering spot morphological distribution of the defect candidate region under the orthogonal incident light direction, and constructing a two-dimensional feature space of the radial curvature of the scattering spot and the light intensity modulation depth;
[0060] S6, according to the differences in scattering spot characteristics between metal oxidation and mechanical damage in the two-dimensional feature space, distinguishing the defect types and outputting the position information through adaptive density clustering.
[0061] S1, acquiring the original image sequence of the socket metal contact and plating surface through an adjustable polarized light source and performing dynamic light compensation to generate a preprocessed image, comprising:
[0062] acquiring the original image sequence of the socket metal contact and plating surface through an adjustable polarized light source at a preset polarization angle and initial light intensity control parameters;
[0063] adjusting the polarization angle and light intensity control parameters of the adjustable polarized light source according to the gray scale distribution differences under different polarization angles in the original image sequence;
[0064] performing gray scale histogram equalization processing on the original image sequence based on the adjusted polarization angle and light intensity control parameters to generate a preprocessed image.
[0065] The preset polarization angle is preset according to the reflection characteristics of the surface material of the socket, for example, the preset polarization angle of the metal contact is set to 0 degrees, 45 degrees and 90 degrees in three directions to cover the maximum reflectivity difference of the metal material under different polarization directions. The selection of the preset polarization angle is based on the Fresnel reflection law, and the reflectivity of the metal material under a specific polarization angle is significantly reduced, thereby suppressing the specular reflection noise. For example, the 0-degree polarization direction is parallel to the surface texture direction of the metal contact, at which time the specular reflection is the strongest; the 90-degree direction is perpendicular to the texture direction, at which time the scattering signal occupies the maximum proportion. By setting the orthogonal polarization angle combination (0 degrees, 45 degrees, 90 degrees), the reflectivity difference between the defects and the background can be maximized.
[0066] The initial light intensity control parameter is dynamically set according to the environmental light intensity measured by the environmental light sensor in real time, for example, when the environmental light intensity exceeds 2000 Lux, the initial light intensity control parameter is set to 80% of the maximum output power. The environmental light intensity is measured by an industrial-grade light sensor, the sensor is installed on the top of the detection station, and the environmental light intensity is monitored in real time and fed back to the light source controller. The adjustable polarized light source drives the polarizer to rotate to the preset angle through the stepping motor. The light intensity control is realized by adjusting the driving current of the LED array through the digital signal controller, the LED driving circuit adopts the PWM modulation technology, and the duty cycle 0%-100% corresponds to the light intensity control parameter 0%-100%. The industrial camera and the adjustable polarized light source are synchronized through the hardware trigger signal, the hardware trigger interface is the GPIO pin, the trigger signal is the rising edge pulse, the trigger delay is less than 1ms, and the image acquisition timing under each preset polarization angle is consistent.
[0067] When the polarization angle and light intensity control parameter of the adjustable polarized light source are adjusted, the gray scale distribution difference of the original image sequence under different polarization angles is dynamically optimized. Specifically, the original image under each preset polarization angle is analyzed by region gray scale, the image is divided into 10x10 pixel sub-regions, and the gray scale mean and variance of the metal contact area and the plating layer area are calculated respectively. For example, if the gray scale variance of the metal contact area under the 45 degree polarization angle exceeds the preset threshold value, the gray scale variance preset threshold value is 50, indicating that the specular reflection noise interference under this angle is serious, then the light intensity control parameter of 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, and the specific method is: collecting normal sample images, calculating the gray scale variance of each sub-region, and statistically analyzing the distribution range (such as the variance being concentrated between 10-40), and setting the threshold value to 50 to cover 99% of the normal samples. If the gray scale mean of the plating layer area under the 90 degree polarization angle is lower than the preset threshold value, the gray scale mean preset threshold value is 80, indicating that the defect feature contrast is insufficient, then the light intensity control parameter of this angle is increased to 120% of the current value. The gray scale mean threshold is determined based on the same historical data statistics, and the gray scale mean of the normal plating layer area is distributed between 90-150, and the threshold value is set to 80 to cover the lowest contrast scene. Through the feedback mechanism of gray scale distribution difference, the polarization angle switching order and light intensity control parameter of the adjustable polarized light source are adjusted frame by frame, and the parameter effect is verified after each frame image is adjusted, until the gray scale variance and mean reach the target range, and the optimized light source configuration adapted to the current detection scene is generated.
[0068] When dynamic light compensation is performed, the original image sequence is processed by gray scale histogram equalization based on the adjusted polarization angle and light intensity control parameter. Specifically, the original image corresponding to the adjusted polarization angle is input into the histogram equalization algorithm, and the gray scale value of each pixel is normalized and mapped. For example, for the original image under a certain polarization angle, the original gray scale value interval 100-200 is mapped to the full range interval 0-255 by calculating the cumulative distribution function of its gray scale histogram. The cumulative distribution function calculation method is: counting the number of pixels of each gray scale level in the image, calculating the cumulative probability distribution, and linearly mapping the cumulative probability to the gray scale range of 0-255.
[0069] The histogram equalization algorithm processes each polarization angle image independently, avoiding the interference of light difference between multi-angle images. After processing, the multi-angle polarization images are fused into a single preprocessed image according to the weight, and the weight is dynamically allocated according to the defect contrast of each angle. For example, the defect contrast in the 0 degree polarization image is higher, and the weight is set to 0.4; the contrast of 45 degree and 90 degree images is lower, and the weight is set to 0.3. The final generated preprocessed image has uniform light and prominent defect features, providing high-quality input data for subsequent steps.
[0070] S2, dynamically adjusting the incident angle and light intensity control parameter of the adjustable polarized light source according to the local gray distribution characteristics of the preprocessed image, generating an optimized light source configuration, comprising:
[0071] Adjusting the polarization angle switching sequence and light intensity control parameter 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 region in the preprocessed image whose gray variance exceeds the preset threshold;
[0072] 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 inversely proportional to the light intensity control parameter corresponding to the region in the preprocessed image whose gray mean value is lower than the preset threshold;
[0073] Generating an optimized light source configuration according to the adjusted polarization angle switching sequence and light intensity control parameter, so that the polarization angle switching sequence and light intensity control parameter of the optimized light source configuration adapt to the local gray distribution characteristics of the preprocessed image.
[0074] When adjusting the polarization angle switching sequence and light intensity control parameter of the adjustable polarized light source, dynamically optimizing the light source parameters according to the gray variance and gray mean value of different regions in the preprocessed image. For the region in the preprocessed image whose gray variance exceeds the preset threshold, adjust the incident angle of the adjustable polarized light source so that it is orthogonal to the polarization angle direction corresponding to the region. For example, the gray variance preset threshold is 50, which is determined by analyzing the gray variance distribution of 1000 normal socket surface images. The specific method is: collect normal socket surface images, calculate the gray variance of each sub-region (10x10 pixels), and count the distribution range as 10 to 40, set the threshold as 50 to cover 99% of normal samples. When the gray variance of a region exceeds 50, it is determined that the region has strong specular reflection noise, and the incident angle of the adjustable polarized light source is adjusted to be orthogonal to the original polarization angle direction of the region. For example, the original collection angle is 45 degrees, and the adjusted angle is 135 degrees, which is realized by rotating the polarization plate driven by a stepping motor.
[0075] When adjusting the light intensity control parameters of the adjustable polarized light source, the light intensity control parameters are adjusted inversely proportionally based on the areas in the preprocessed image where the grayscale mean falls below a preset threshold. For example, the preset grayscale mean threshold is 80, determined by analyzing the grayscale mean distribution statistics of normal coating areas, which range from 90 to 150. Setting the threshold to 80 covers the lowest contrast scenario. When the grayscale mean of a region falls below 80, the defect contrast in that region is determined to be insufficient, and the light intensity control parameter is increased to 120% of the current value. For example, if the original light intensity control parameter is 50%, the adjusted parameter is 60%. The light intensity control parameter is achieved by adjusting the drive current of the LED array. The drive current and the light intensity control parameter are linearly related, with each 10mA increase in the drive current corresponding to a 10% increase in the light intensity control parameter. During the adjustment process, the image grayscale mean corresponding to the adjusted light intensity control parameter is monitored in real time until the grayscale mean reaches the target range.
[0076] 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 suitable for the current inspection scenario. The optimized light source configuration includes a polarization angle switching sequence of 0 degrees, 135 degrees, and 90 degrees, and light intensity control parameters of 80%, 60%, and 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 sends it to the light source driver module via the RS-485 serial communication protocol. Based on the received configuration parameters, the light source driver module controls the stepper motor to rotate to the target angle and adjusts the LED drive current to ensure that the light source output is consistent with the optimized configuration. The generation logic of the optimized light source configuration is to prioritize suppressing specular reflection noise in high-variance areas, then enhance defect contrast in low-mean areas, and ultimately achieve global illumination balance through parameter combination.
[0077] 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, including:
[0078] 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;
[0079] The low-frequency components after frequency domain decomposition are used to reconstruct the surface geometric contour features through inverse Fourier transform;
[0080] 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;
[0081] 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.
[0082] When performing secondary image acquisition on the socket surface based on the optimized light source configuration, the adjustable polarized light source outputs light according to the polarization angle switching sequence and 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 a polarization angle switching sequence of 0 degrees, 135 degrees, and 90 degrees, and light intensity control parameters of 80%, 60%, and 100%, respectively. The parameters are stored in JSON format and delivered to the light source driving module through the RS-485 serial communication protocol. The industrial camera and the light source are synchronized through a hardware trigger signal, with a trigger delay of, for example, less than 1 ms, to ensure the consistency of the light for image acquisition. After the acquisition is completed, the multi-angle polarization images are fused into a single secondary acquisition image according to the weights, which are dynamically allocated according to the contrast of each angle defect, 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.
[0083] When performing 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 of the fast Fourier transform is, for example, to divide the image into 8x8 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, the low frequency components and the high frequency components in the amplitude spectrum are separated, for example, the low frequency components correspond to a frequency range of 0 to 10 Hz, and the high frequency components correspond to a frequency range of 10 Hz to the Nyquist frequency. The low frequency components reconstruct the surface geometric profile features through inverse Fourier transform, and the specific method is, for example, to 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 macro geometric deformation features of the socket surface, such as the panel camber curvature and the contact flatness.
[0084] When performing thresholding filtering processing on the high frequency components, a preset energy threshold of the high frequency energy amplitude is set to, for example, 200, which is determined by analyzing the high frequency energy distribution statistics of normal socket surface images. The specific method is, for example, to collect 100 normal images, calculate the energy amplitude (sum of amplitude squares) of the high frequency components of each sub-block, and statistically determine the distribution range to be, for example, 50 to 180, and set the threshold to, for example, 200 to cover 99% of normal samples. The high frequency amplitude spectrum is thresholded and filtered to retain regions with energy amplitudes exceeding 200, generating a binary mask image. The binary mask image and the high frequency phase spectrum are combined to reconstruct a high frequency spatial domain image through inverse Fourier transform, and the connected regions in the high frequency spatial domain image are extracted as defect candidate regions, such as pixel aggregation regions of micro-cracks and oxidation spots.
[0085] When the surface geometry profile features are spatially aligned with the defect candidate regions, a coordinate mapping relationship between the geometry profile and the defect candidate regions is established based on the pixel coordinate system of the secondary image. The specific method is, for example, to match the feature points of the geometry profile features (such as the curvature change points) of the low-frequency spatial domain image with the center coordinates of the defect candidate regions of the high-frequency spatial domain image, and correct the position deviation through an affine transformation matrix. For example, 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, the geometry profile features and the defect candidate regions are superimposed into the same coordinate system to generate a fusion image. The generation logic of the fusion image is, for example, that the geometry profile features are presented in the form of gray gradient, and the defect candidate regions are marked in red highlight, which is convenient for subsequent steps of defect classification and positioning.
[0086] Step S3 solves the problem of coupling of spatial and frequency domain features in defect detection of high-reflective surfaces through secondary image acquisition and frequency domain decomposition processing of optimized light source configuration. Specifically, the fast Fourier transform decomposes the image into low-frequency and high-frequency components: the low-frequency component corresponds to a frequency range of 0 to 10 Hz, reconstructs the surface geometry profile features, retains macro deformation features such as panel arc curvature, and avoids mirror reflection interference; the high-frequency component corresponds to a frequency range of 10 Hz to the Nyquist frequency, extracts defect candidate regions such as oxidation spots whose energy amplitude exceeds a preset threshold through thresholding filtering, and suppresses background noise. Compared with the single frequency domain analysis or fixed light source acquisition in the prior art, this step realizes accurate decoupling of geometry profile and defects through the cooperative design of frequency band separation and spatial alignment, and breaks through the limitation of high false detection rate caused by feature overlap in traditional methods. By combining optical optimization and frequency domain processing, the dual means of physically suppressing mirror reflection and algorithmically separating frequency band features solve the detection defects of high-reflective materials.
[0087] S4, dynamically adjusts the incident angle of the adjustable polarized light source based on the surface geometry profile features, so that the incident light direction is orthogonal to the scattering direction of the defect candidate region, comprising:
[0088] The scattering direction of the defect candidate region is calculated based on the normal vector of the surface geometry profile features, and the scattering direction is the resultant vector of the normal vector and the reflection direction of the surface of the defect candidate region;
[0089] The incident angle of the adjustable polarized light source is adjusted so that the incident light direction of the adjustable polarized light source is orthogonal to the scattering direction, and the incident angle adjustment is realized by rotating the polarizer to the target angle through a stepping motor;
[0090] The orthogonality of the adjusted incident light direction and the scattering direction is verified, and if the deviation exceeds a preset tolerance threshold, the incident angle is iteratively corrected until the orthogonality meets the requirements.
[0091] In the calculation of the scattering direction of the defect candidate region based on the normal vector of the surface geometry profile feature, the surface geometry profile feature is obtained by the low-frequency component reconstruction of step S3, containing the three-dimensional geometric deformation information of the socket surface. The normal vector is determined by calculating the curvature variation gradient of each pixel point in the surface geometry profile feature. The specific method is: selecting the gray scale gradient of the 3x3 neighborhood around each pixel point, calculating the gradient components in the X and Y axis directions, and obtaining the normal vector direction through the cross product of the gradient components. The scattering direction of the defect candidate region is the resultant 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 area is the specular reflection direction, and the surface reflection direction of the plating layer area is the diffuse reflection direction. The calculation method of the resultant vector is: after the vector superposition of the normal vector and the surface reflection direction vector, normalization processing is performed, for example, the normal vector is the vertical direction (0, 0, 1), and the surface reflection direction is the light reflection direction (calculated from the incident angle). The scattering direction after synthesis is the direction of the vector sum of the two.
[0092] In the adjustment of the incident angle of the adjustable polarized light source, based on the calculated scattering direction, the incident light direction is adjusted to be orthogonal to the scattering direction. The incident angle adjustment is realized by rotating the polarizer to the target angle through a stepping motor. A corresponding stepping pulse needs to be sent every time the polarizer is rotated to the target angle. For example, if the current incident angle is 45 degrees and the target angle is 135 degrees, 200 stepping pulses need to be sent to drive the polarizer to rotate 90 degrees. During the adjustment process, the polarizer angle is monitored in real time, and the angle deviation is fed back through the rotary encoder to ensure that the adjustment accuracy is less than 0.5 degrees. After the adjustment is completed, the adjusted incident light direction is output through the adjustable polarized light source, and the light irradiation verification of the defect area is performed.
[0093] In the verification of the orthogonality between the adjusted incident light direction and the scattering direction, the dot product value of the incident light direction vector and the scattering direction vector is calculated to judge the orthogonality. When the absolute value of the dot product value exceeds a preset tolerance threshold, for example, 0.1, it is determined that the deviation is out of limit, and the incident angle needs to be iteratively corrected. The basis for setting the preset tolerance threshold 0.1 is experimental data statistics. 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, which meets the detection accuracy requirement. The correction method is to fine-tune the number of stepping pulses of the stepping motor, for example, 5 pulses are sent each time (corresponding to an angle adjustment of about 0.45 degrees), until the absolute value of the dot product 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, not more than 3 times. Through experimental verification, 3 times of correction can cover 99% of the deviation scenarios, avoiding infinite loop. After the verification is passed, the current incident angle is locked as the final parameter of the optimized light source configuration, ensuring that the light source incident direction in the subsequent detection steps is strictly orthogonal to the defect scattering direction.
[0094] Step S4 solves the problem that the defect characteristics are covered by the mirror reflection noise in the high-reflective surface defect detection by dynamically adjusting the incident angle of the adjustable polarized light source to make the incident light direction orthogonal to the scattering direction of the defect candidate region. Specifically, the scattering direction of the defect region is calculated based on the normal vector of the surface geometric profile feature, the incident angle is accurately adjusted by rotating the polarizer driven by the stepper motor, compared with the limitations of the fixed light source or single-angle acquisition in the prior art, the dynamic orthogonal adjustment driven by the geometric profile in this step physically suppresses the mirror reflection and enhances the defect scattering signal, by combining the geometric deformation analysis (surface profile) and the optical parameter optimization (incident angle), through the real-time feedback and iterative correction mechanism, the dynamic matching of the light source and the defect scattering characteristics is realized, and the detection stability of the micro defect on the complex curved surface is improved.
[0095] Figure 3 A flowchart of constructing a two-dimensional feature space of the present application is given, the distribution of the diffuse scattering spot shape of the defect candidate region under the orthogonal incident light direction is analyzed, a two-dimensional feature space of the radial curvature and the light intensity modulation depth of the scattering spot is constructed, including:
[0096] Based on the anisotropic distribution characteristics of the diffuse scattering spot of the defect candidate region under the orthogonal incident light direction, the radial curvature of the scattering spot 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 based on the cosine value correction of the angle between the orthogonal incident light direction and the normal of the defect surface;
[0097] 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, and the light intensity modulation depth is the product of the normalized gradient direction consistency coefficient and the maximum gray attenuation gradient;
[0098] The radial curvature and the light intensity modulation depth are mapped to the orthogonal coordinate system to construct a two-dimensional feature space based on the physical scattering characteristics of the defect, wherein the radial curvature is the first characteristic axis, and the light intensity modulation depth is the second characteristic axis.
[0099] In analyzing the anisotropic distribution characteristics of the diffuse scattering spot of the defect candidate area, based on the scattering spot image of the defect candidate area under the orthogonal incident light direction, the radial curvature of the scattering spot is extracted by a multi-scale edge detection algorithm. The multi-scale edge detection algorithm uses different scales of Gaussian kernel for convolution, for example, using Gaussian kernels with standard deviations of 1 pixel, 3 pixels and 5 pixels to smooth the spot image respectively, and different scale edge profiles are extracted. The radial curvature is the reciprocal of the curvature radius of the spot edge, and the cosine value of the angle between the orthogonal incident light direction and the normal of the defect surface is combined for correction when calculating the curvature. For example, when the angle between the orthogonal incident light direction and the normal is 30 degrees, the cosine value is 0.866, and the curvature calculation result is multiplied by the 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 of the crack area is significantly higher than that of the oxidation spot.
[0100] In calculating the light intensity modulation depth, the consistency of the gray scale gradient direction from the center to the edge of the scattering spot is quantitatively analyzed. First, the gray scale gradient direction of each pixel point in the spot image is calculated, and the consistency coefficient of the gradient direction is counted, which is the normalized value of the reciprocal of the variance of all pixel gradient directions. For example, if the gradient direction variance of a certain spot is 0.1, the consistency coefficient is 1 / (0.1+ε), and ε is a small constant to prevent division by zero, for example, 0.01. The normalized consistency coefficient ranges from 0 to 1.
[0101] The light intensity modulation depth is the product of the normalized gradient direction consistency coefficient and the maximum gray scale attenuation gradient, which is determined by calculating the maximum value of the gray scale decline 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 scale attenuation gradient is 50, then the light intensity modulation depth is 0.8x50=40. The light intensity modulation depth represents the difference in surface roughness, for example, the gradient direction of the mechanical damage area is disordered due to the irregular surface, and the light intensity modulation depth is low, while the oxidation spot has a higher light intensity modulation depth due to the higher surface uniformity.
[0102] In constructing the two-dimensional feature space, the radial curvature and the light intensity modulation depth are mapped to the orthogonal coordinate system. The radial curvature is the first feature axis, and the light intensity modulation depth is the second feature axis. Each data point in the coordinate system corresponds to a defect candidate area. For example, the data points of metal oxidation spots are distributed in the high radial curvature (e.g. 0.05-0.1) and high light intensity modulation depth (e.g. 30-50) area, and the mechanical damage data points are distributed in the low radial curvature (e.g. 0.01-0.03) and low light intensity modulation depth (e.g. 10-20) area. The construction logic of the feature space is: different defect types are separated by physical scattering characteristics (curvature reflects geometric deformation, modulation depth reflects roughness), solving the problem of traditional single-dimensional feature classification ambiguity.
[0103] Step S5 solves the problem of single feature dimension and poor separability in defect classification of high-reflective surface by analyzing the distribution of diffuse light spot shape of the defect candidate region under the direction of orthogonal incident light, and constructing a two-dimensional feature space of radial curvature and light intensity modulation depth. Specifically, based on the physical correlation between the direction of orthogonal incident light and the normal of the defect surface, the radial curvature (reflecting the degree of geometric deformation) is extracted by multi-scale edge detection, and the light intensity modulation depth (quantifying the surface roughness) is calculated by gradient direction consistency. Compared with the prior art, this step realizes the precise separation of metal oxidation spots (high curvature and high modulation depth) and mechanical damage (low curvature and low modulation depth) by multi-dimensional feature construction driven by physical scattering characteristics, combining optical response (orthogonal light direction) and image processing (multi-scale analysis) depth.
[0104] S6, according to the difference in scattering light spot characteristics of metal oxidation and mechanical damage in the two-dimensional feature space, the adaptive density clustering is used to distinguish the defect type and output the position information, including:
[0105] The neighborhood radius parameter of adaptive density clustering is dynamically adjusted 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.
[0106] Based on the difference in feature distribution of radial curvature and light intensity modulation depth, the clustering boundary of metal oxidation region and mechanical damage region is divided in the two-dimensional feature space, 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.
[0107] The clustered defect type is mapped to the original image coordinate system, and the defect position information is output through an affine transformation matrix, the defect position information includes a defect type label and a pixel coordinate range.
[0108] When the neighborhood radius parameter of adaptive density clustering is dynamically adjusted, 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 to 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 data point dense area, the average neighborhood distance is small, and the neighborhood radius parameter is correspondingly reduced to avoid overfitting; in the data point sparse area, 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 realized by traversing the data point distribution density, for example, the local density is calculated by using a sliding window, and the neighborhood radius is scaled in real time according to the density, to ensure the balanced clustering effect in different density areas.
[0109] In the clustering boundary of the metal oxidation area and the mechanical damage area, the data points in the two-dimensional feature space are divided into two categories based on the difference in the feature distribution of the radial curvature and the light intensity modulation depth. The metal oxidation area corresponds to a set of data points with high radial curvature and high light intensity modulation depth, such as oxidation spots with high surface uniformity and smooth scattering spot edges, the radial curvature value is greater than the preset curvature threshold, and the light intensity modulation depth value is greater than the preset modulation depth threshold. The mechanical damage area corresponds to a set of data points with low radial curvature and low light intensity modulation depth, such as mechanical damage with rough surface and irregular scattering spot edges, the radial curvature value is less than the curvature threshold, and the light intensity modulation depth value is less than the modulation depth threshold. The clustering boundary is divided by 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 metal oxidation and mechanical damage clustering cluster.
[0110] In the mapping of the clustered defect type to the original image coordinate system, the conversion from the feature space to the image coordinates is realized by an affine transformation matrix. The affine transformation matrix is calculated by matching the cluster center point in the two-dimensional feature space and the defect candidate region center point in the original image. For example, the center point coordinates of the metal oxidation clustering cluster and the corresponding defect candidate region center point coordinates in the original image are selected, and the affine transformation parameters are solved 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, which includes the defect type label and the pixel coordinate range. For example, the metal oxidation defect is marked with a red rectangular frame, and the mechanical damage is marked with a blue rectangular frame. The coordinate range of the rectangular frame is determined by the maximum and minimum coordinate values of all data points.
[0111] Step S6 separates metal oxidation and mechanical damage defects in two dimensions by adaptive density clustering, solving the problems of defect classification ambiguity and low positioning accuracy in industrial detection. Based on the physical feature difference of radial curvature and light intensity modulation depth, the neighborhood radius parameter is dynamically adjusted to adapt to the data point density distribution, such as reducing the neighborhood radius to avoid overfitting in high-density oxidation spot area, and expanding the radius to cover scattered data in low-density mechanical damage area; through the density-adaptive physical feature clustering, the oxidation spot (high curvature, high modulation depth) and the mechanical damage (low curvature, low modulation depth) are accurately separated, the optical scattering characteristics (curvature, modulation depth) and the data distribution characteristics (density) are analyzed cooperatively, and the problems of explainable classification and accurate positioning of complex defects are solved through dynamic clustering and affine mapping.
[0112] Among them, the adjustable polarized 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 by PWM, for example, a driving current of 10-100mA corresponds to a light intensity of 10%-100%. The light source and the industrial camera are synchronized by hardware triggering to ensure consistent timing of acquisition.
[0113] Embodiment 2: Figure 2 The structure diagram of the socket surface defect detection system based on image processing is given, and the socket surface defect detection system based on image processing comprises the following modules:
[0114] The polarized light source acquisition module is used for acquiring the original image sequence of the socket metal contact and the plating layer surface by the adjustable polarized light source and performing dynamic light compensation to generate a pretreatment image;
[0115] The light source dynamic optimization module is used for dynamically adjusting the incident angle and the light intensity control parameter of the adjustable polarized light source according to the local gray scale distribution characteristics of the pretreatment image to generate an optimized light source configuration;
[0116] The frequency domain decomposition and reconstruction module is used for performing secondary image acquisition on the socket surface based on the optimized light source configuration and performing frequency domain decomposition processing, reconstructing the surface geometric contour features through low-frequency components, and extracting defect candidate regions through high-frequency components;
[0117] The light path orthogonal adjustment module is used for dynamically adjusting the incident angle of the adjustable polarized 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;
[0118] The feature space modeling module is used for analyzing the diffuse scattering spot morphological distribution of the defect candidate region under the orthogonal incident light direction, and constructing a two-dimensional feature space of the radial curvature of the scattering spot and the light intensity modulation depth;
[0119] The density clustering identification module is used for distinguishing the defect types and outputting the position information by adaptive density clustering according to the scattering spot characteristic differences of metal oxidation and mechanical damage in the two-dimensional feature space.
[0120] The above formulas are all de-dimensioned to calculate their numerical values, the formula is obtained by software simulation of a large amount of data to obtain a formula closest to the actual situation, and the preset parameters and threshold values in the formula are set by a person skilled in the art according to the actual situation.
[0121] It should be noted that the present application can be deployed in the device itself to realize embedded application, or run on PC terminal or other terminal with user interface, so as to meet various hardware environments and use requirements.
[0122] The above embodiments can be implemented in whole or in part via 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 comprises one or more computer instructions or computer programs. When loaded or executed on a computer, the processes or functions described in the embodiments of this application are fully or partially performed. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server or data center that contains a collection of one or more available media. The available medium can be magnetic media (e.g., floppy disks, hard disks, tapes), optical media (e.g., DVDs), or semiconductor media. The semiconductor media can be a solid-state drive.
[0123] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0124] In the several embodiments provided in this 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 schematic. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0125] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, and may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected to achieve the purpose of this embodiment according to actual needs.
[0126] In addition, each functional module in the various embodiments of the present application can be integrated in one processing module, or each module can exist physically independently, or two or more modules can be integrated in one module.
[0127] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0128] The above is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0129] Finally: the above is only the preferred embodiments of the present application, and is not used to limit the present application, any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A socket surface defect detection method based on image processing, characterized in that: The steps include: S1. Collect original image sequences of the metal contacts and coating surface of the socket using an adjustable polarized light source and perform dynamic illumination compensation to generate pre-processed images. S2. 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 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 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; S5. Analyze the morphological distribution of the diffuse scattering light spot in the defect candidate area under the orthogonal incident light direction, and construct a two-dimensional feature space of the radial curvature of the scattered light spot and the light intensity modulation depth; S6. Based on the differences in the scattered light spot characteristics of metal oxidation and mechanical damage in the two-dimensional feature space, the defect types are distinguished through adaptive density clustering and the location information is output.
2. The socket surface defect detection method based on image processing according to claim 1, characterized in that: The original image sequence of the socket metal contacts and coating surface is collected using 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 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 differences 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; Based on the adjusted polarization angle and light intensity control parameters, the grayscale histogram equalization processing is performed on the original image sequence to generate a preprocessed image.
3. The socket surface defect detection method based on image processing according to claim 1, characterized in that: Dynamically adjust the incident angle and light intensity control parameters of the adjustable polarization light source based on the local grayscale distribution characteristics of the pre-processed 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 inversely proportional 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 based on 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, characterized in that: 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, including: Based on the optimized light source configuration, secondary image acquisition is performed on the socket surface, and the acquired image is subjected to frequency domain decomposition processing through 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, 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. The scattering direction is the composite vector of the normal vector and the surface reflection direction of the defect candidate area. Adjust 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. The incident angle adjustment is achieved by driving the polarizer to rotate to the target angle via 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, 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 scattered light spot and the light intensity modulation depth, including: Based on the anisotropic distribution characteristics of the diffuse scattering light spots in the defect candidate area under the orthogonal incident light direction, the radial curvature of the scattered light spots is extracted through a multi-scale edge detection algorithm. The light intensity modulation depth is calculated based on the directional consistency of the grayscale gradient from the center to the edge of the scattered light spot. 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 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, where 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, characterized in that: The radial curvature is the inverse of the curvature radius 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, characterized in that: In the two-dimensional feature space, based on the differences in the scattered light spot characteristics of metal oxidation and mechanical damage, adaptive density clustering is used to distinguish defect types and output location information, 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. The neighborhood radius parameter is adaptively set based on the density distribution of data points. Based on the characteristic distribution differences of radial curvature and light intensity modulation depth, the cluster 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 pixel coordinate range.
9. The socket surface defect detection method based on image processing according to claim 8, characterized in that: The metal oxidation area corresponds to a data point set with higher radial curvature and higher light intensity modulation depth, while the mechanical damage area corresponds to a data point set with lower radial curvature and 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 collect original image sequences of the socket metal contacts and coating surfaces through an adjustable polarized light source and perform dynamic illumination compensation to generate pre-processed images; Light source dynamic tuning module: used to dynamically adjust the incident angle and light intensity control parameters of the adjustable polarization light source according to the local grayscale distribution characteristics of the pre-processed 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 orthogonality 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 morphological distribution of diffuse scattering spots in defect candidate areas under the orthogonal incident light direction, and construct a two-dimensional feature space of the radial curvature of the scattered light spots 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 based on the differences in scattered light spot characteristics between metal oxidation and mechanical damage in a two-dimensional feature space.
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