Surface detection method, device, equipment and storage medium of electrical connector structure
By using annular and radial light sources for structured light illumination, decoupling gradient information on the electrical connector surface, and performing multi-scale feature extraction and quantitative analysis, the problems of insufficient detection accuracy and difficulty in decoupling gradient information in the prior art are solved, and high-precision defect detection and quality evaluation are achieved.
Patent Information
- Application Number
- CN202510182590.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-04-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing electrical connector surface detection methods are limited by the direction of a single light source, resulting in insufficient detection accuracy and difficulty in decoupling gradient information for quantitative analysis of subtle defects.
The latitude light source arranged in annular shape and the longitude light source arranged in radial direction are used for illumination of latitude and longitude structure light to generate chromaticity-encoded images. By decoupling surface gradient information, the gradient direction components and size components are extracted, and multi-scale feature extraction and quantitative analysis are performed.
It realizes high-precision defect detection and quality evaluation of the electrical connector surface, and is suitable for electrical connector detection scenarios with complex shapes and high-precision requirements.
Smart Images

Figure CN119757372A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of defect detection, and in particular to a surface detection method, device, equipment and storage medium for an electrical connector structure. Background Art
[0002] Electrical connectors are core components widely used in modern electronic devices, and their performance and reliability directly affect the stable operation of the equipment. The surface quality of electrical connectors is not only related to the contact reliability of electrical performance, but also determines its physical properties such as corrosion resistance and wear resistance. Therefore, high-precision detection of the surface of electrical connectors is a key link to ensure product quality and service life.
[0003] Existing surface inspection methods for electrical connectors are mainly based on visual inspection and optical microscopy. These methods usually rely on a single light source in a fixed direction to identify surface defects by detecting changes in the intensity of reflected or scattered light on the surface. This inspection method is easily affected by the direction of illumination and surface texture when dealing with large areas, complex geometric shapes or multi-angle features, resulting in insufficient inspection accuracy. In addition, traditional methods are difficult to effectively decouple the gradient direction and gradient size of the surface, which limits the ability to perform in-depth quantitative analysis of surface defects, especially in the measurement of geometric parameters and quality assessment of subtle defects. Summary of the invention
[0004] The main purpose of the present invention is to solve the technical problems in the existing electrical connector surface inspection method, which is limited by the single light source direction, resulting in insufficient inspection accuracy, and it is difficult to decouple gradient information for quantitative analysis of subtle defects; A first aspect of the present invention provides a surface detection method for an electrical connector structure, the surface detection method for an electrical connector structure comprising: Using a circularly arranged latitude light source and a radially arranged longitude light source to illuminate the electrical connector structure with longitude and latitude structured light to obtain a color coding image; Decoupling the gradient information of the surface of the electrical connector according to the chroma-coded image to obtain a surface gradient direction component and a gradient magnitude component; Perform multi-scale feature extraction on the surface of the electrical connector according to the surface gradient direction component and the gradient magnitude component to obtain a feature pyramid; The surface defects on the surface of the electrical connector are quantitatively analyzed according to the feature pyramid to obtain geometric parameters and quality evaluation results of the surface defects.
[0005] Optionally, in a first implementation of the first aspect of the present invention, the step of using a circularly arranged latitude light source and a radially arranged longitude light source to illuminate the electrical connector structure with longitude and latitude structured light to obtain a chromaticity coded image includes: Controlling the circularly arranged latitude light sources to emit light of different colors to illuminate the surface of the electrical connector to obtain latitude color distribution; Controlling the radially arranged longitude light sources to emit light of different intensities to illuminate the surface of the electrical connector to obtain longitude brightness distribution; collecting light reflected from the surface of the electrical connector to obtain a composite image including a latitude color distribution and a longitude brightness distribution; The composite image is converted into a color space to obtain a color coding image representing the spatial position of the surface.
[0006] Optionally, in a second implementation of the first aspect of the present invention, the decoupling of the gradient information on the surface of the electrical connector according to the chroma-encoded image to obtain the surface gradient direction component and the gradient magnitude component includes: Performing hue analysis, saturation analysis and brightness analysis on the chroma-coded image, and obtaining surface local direction information and surface tilt degree information based on the analysis results; Acquiring structural material data of the electrical connector structure, and adjusting a preset chromaticity-gradient mapping relationship according to the structural material data; According to the chromaticity-gradient mapping relationship, the gradient information on the surface of the electrical connector is decoupled according to the surface local direction information and the surface inclination degree information to obtain a surface gradient direction component and a gradient magnitude component.
[0007] Optionally, in a third implementation of the first aspect of the present invention, the performing hue analysis and saturation and brightness analysis on the chromaticity-coded image, and obtaining surface local direction information and surface tilt degree information based on the analysis results respectively includes: Performing color space conversion on the chroma-coded image to obtain an HSV format image; Performing gradient calculation on the hue channel of the HSV format image to obtain a hue gradient map; Performing directional statistical analysis on the hue gradient image to obtain local directional information of the surface; Performing weighted combination on the saturation and lightness channels of the HSV format image to obtain an intensity map, and performing gradient calculation on the intensity map to obtain an intensity gradient map; The local gradient amplitude is calculated according to the intensity gradient map to obtain the surface inclination information.
[0008] Optionally, in a fourth implementation manner of the first aspect of the present invention, acquiring structural material data of the electrical connector structure, and adjusting a preset chromaticity-gradient mapping relationship according to the structural material data includes: Performing material composition analysis on the electrical connector structure to obtain material composition ratio data, and querying a preset material optical property database based on the material composition ratio data to obtain structural material data of the material; Substituting the structural material data into a preset bidirectional reflectance distribution function model to obtain a theoretical optical response function of the material, and performing a correction calculation on a preset chromaticity-gradient mapping relationship according to the theoretical optical response function to obtain a preliminarily adjusted chromaticity-gradient mapping function; Discretizing the preliminarily adjusted chromaticity-gradient mapping function to obtain a discrete mapping data point set, and performing polynomial fitting on the discrete mapping data point set to obtain a continuous mapping function expression; Numerically deriving the continuous mapping function expression to obtain a gradient distribution of the mapping function expression, and performing piecewise linear approximation on the mapping function expression according to the gradient distribution to obtain a piecewise linear mapping relationship; The piecewise linear mapping relationship is converted into a lookup table to obtain a mapping lookup table for fast calculation, and the mapping lookup table is checked for boundary conditions and smoothed to obtain a chromaticity-gradient mapping relationship.
[0009] Optionally, in a fifth implementation of the first aspect of the present invention, the decoupling of the gradient information on the surface of the electrical connector according to the surface local direction information and the surface inclination degree information according to the chromaticity-gradient mapping relationship to obtain the surface gradient direction component and the gradient magnitude component includes: Inputting the surface local direction information into an optimized chromaticity-gradient direction mapping function to obtain an initial gradient direction component; Inputting the surface inclination information into an optimized chromaticity-gradient magnitude mapping function to obtain an initial gradient magnitude component; orthogonalizing the initial gradient direction component and the initial gradient magnitude component to obtain an orthogonal gradient component, and performing local consistency constraints on the orthogonal gradient component to obtain a smoothed gradient field; The smoothed gradient field is subjected to a main direction analysis to obtain a surface gradient direction component, and the smoothed gradient field is subjected to amplitude normalization to obtain a surface gradient magnitude component.
[0010] Optionally, in a sixth implementation of the first aspect of the present invention, the quantitative analysis of the surface defects on the surface of the electrical connector according to the feature pyramid to obtain the geometric parameters and quality assessment results of the surface defects includes: Extracting the boundary of the potential defect area in the feature pyramid to obtain the defect contour; Calculating the depth, area and volume of the defect according to the defect contour and the decoupled gradient information to obtain defect geometric parameters; Inputting the defect geometric parameters into a pre-established physical model to obtain an evaluation of the effect of the defect on the performance of the electrical connector; Build a knowledge graph based on product specifications, manufacturing processes, and historical data to obtain a defect assessment benchmark; Comparing the impact assessment of the defect on the performance of the electrical connector with the defect assessment benchmark to obtain defect severity and potential cause analysis results; A quality assessment report is generated based on the defect severity and potential cause analysis results to obtain the final quality assessment results.
[0011] A second aspect of the present invention provides a surface detection device for an electrical connector structure, the surface detection device for an electrical connector structure comprising: An illumination generation module, used to perform latitude and longitude structured light illumination on the electrical connector structure using a circularly arranged latitude light source and a radially arranged longitude light source to obtain a chromaticity coded image; A gradient decoupling module, used to decouple the gradient information of the surface of the electrical connector according to the chroma-encoded image to obtain a surface gradient direction component and a gradient magnitude component; A feature extraction module, used to extract multi-scale features of the surface of the electrical connector according to the surface gradient direction component and the gradient magnitude component to obtain a feature pyramid; The defect analysis module is used to perform quantitative analysis on the surface defects of the electrical connector surface according to the feature pyramid to obtain geometric parameters and quality assessment results of the surface defects.
[0012] A third aspect of the present invention provides a surface detection device for an electrical connector structure, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the surface detection device of the electrical connector structure executes the steps of the above-mentioned surface detection method of the electrical connector structure.
[0013] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the steps of the above-mentioned surface detection method for an electrical connector structure.
[0014] The surface detection method, device, equipment and storage medium of the above-mentioned electrical connector structure use a circularly arranged latitude light source and a radially arranged longitude light source to perform longitude and latitude structured light illumination on the electrical connector to generate a chromaticity-coded image. By decoupling the gradient information of the chromaticity-coded image, the surface gradient direction component and the gradient magnitude component are extracted. Subsequently, multi-scale feature extraction is performed based on the surface gradient component to construct a feature pyramid, thereby comprehensively capturing the surface detail features. Finally, the feature pyramid is used to quantitatively analyze the surface defects to obtain the geometric parameters and quality assessment results of the surface defects. The present invention achieves high-precision defect detection and quality assessment on the surface of electrical connectors by combining multi-dimensional illumination structure, gradient decoupling and multi-scale analysis, and is suitable for electrical connector detection scenarios with complex shapes and high precision requirements.
[0015] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0016] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of a first embodiment of a surface detection method of an electrical connector structure according to an embodiment of the present invention; Figure 2 A schematic diagram of an embodiment of a surface detection device for an electrical connector structure according to an embodiment of the present invention; Figure 3 It is a schematic diagram of an embodiment of a surface detection device for an electrical connector structure in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] The terms "including" and "having" and any variations thereof mentioned in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device end including a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or device ends.
[0020] To facilitate understanding of this embodiment, a surface detection method for an electrical connector structure disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method comprises the following steps: 101. Use a circularly arranged latitude light source and a radially arranged longitude light source to illuminate the electrical connector structure with longitude and latitude structured light to obtain a chromaticity coded image; In one embodiment of the present invention, the use of a circularly arranged latitude light source and a radially arranged longitude light source to perform longitude and latitude structured light illumination on the electrical connector structure to obtain a color-coded image includes: controlling the circularly arranged latitude light source to emit light of different colors to illuminate the surface of the electrical connector to obtain a latitude color distribution; controlling the radially arranged longitude light source to emit light of different intensities to illuminate the surface of the electrical connector to obtain a longitude brightness distribution; collecting light reflected from the surface of the electrical connector to obtain a composite image including a latitude color distribution and a longitude brightness distribution; and performing a color space conversion on the composite image to obtain a color-coded image representing the spatial position of the surface.
[0021] Specifically, the process of controlling the annularly arranged latitude light sources to emit light of different colors and illuminate the surface of the electrical connector to obtain the latitude color distribution requires first arranging a number of annular layered light source modules around the workbench, and setting an independently adjustable light-emitting unit at each annular light source position so that it can emit light of different wavelengths such as red, green, and blue, and then arranging the start-up sequence and channel intensity parameters of each annular light source to ensure that the color corresponding to each annular ring band maintains a clear and discernible distribution state in space. In order to make the reflected light signal on the surface of the electrical connector structure present a stable and distinguishable color effect, it is necessary to arrange the annular light source in multiple concentric rings from the inside to the outside, and each annular band section uses a different color formula so that the color changes layer by layer from the center to the outer edge. In this way, when the light-emitting module is put into use, the light from different annular band areas will cover the curved or flat position of the electrical connector at different angles, forming a layered color area projection. In this process, the emission angle, divergence characteristics and power distribution of the light source itself need to be considered. The designer will make detailed calculations on the angle and power of each ring-shaped light source so that a uniform and stable color illumination field can be obtained everywhere on the surface of the electrical connector. Through such an optical arrangement, it is possible to accurately distinguish which area is illuminated by which color in the surface reflection image, thereby laying a feasible color recognition foundation for distinguishing different directions or different orientation features of the surface. In order to make this color distribution more recognizable, it is also necessary to adjust the time or intensity of each color channel in combination with the light source control system, so as to further enhance the color contrast between different rings, so that the surface of the electrical connector visually presents a clear band-shaped color ring distribution, thereby obtaining initial information that can be used to extract the latitudinal color distribution.
[0022] Specifically, the process of controlling the radially arranged longitude light sources to emit light of different intensities to illuminate the surface of the electrical connector to obtain the longitude brightness distribution requires configuring a radial light source system independent of the annular light source in the same working area, and distributing these light source units around the structure of the electrical connector to be detected in a radially uniformly spaced manner, so that each light source emits a light beam outward from the center or a certain reference point to form a fan-shaped coverage range. In order to achieve different brightness levels, it is necessary to make these radial light sources have adjustable output power or variable illumination intensity, and the light intensity of each unit is divided into grades by the light source controller, so that each light source can emit low, medium, high and other multi-level brightness values, thereby generating different brightness gradients on the surface of the electrical connector. At the same time, based on the preliminary understanding of the overall shape of the electrical connector, the illumination angle or inclination of each radial light source can be accurately designed so that each beam of light can be projected onto the target surface from different directions, thereby forming a light and dark transition zone in the reflected image. If there are depressions, protrusions or other fine unevenness on the surface of the electrical connector, different brightness segments will generate perceptible light intensity differences on the surface, providing clues for subsequent distinction between surface height changes and lateral boundaries. Since the radial light source uses a separate control mode independent of the annular light source, each group of light sources can be individually lit or turned off according to the timing and power curve set by the system, thereby forming a reflection image with partitioned brightness levels when the camera is collecting. In this way, the color distribution generated by the annular light source and the brightness level formed by the radial light source can be used to encode composite information about the orientation and light intensity on the surface of the electrical connector at the same time, thus laying the foundation for the visualization of the longitude brightness distribution.
[0023] Specifically, the process of collecting the light reflected from the surface of the electrical connector to obtain a composite image containing the latitudinal color distribution and the longitudinal brightness distribution requires that the surface of the electrical connector be captured by a photographic device or an industrial camera when the annular light source and the radial light source are working separately, and the different color components and brightness information are integrated into one or more frames of image data. In order to obtain chromaticity and brightness information at the same time during the same shooting process, the annular light source can be activated in accordance with the established color combination, and then the radial light source can be emitted one by one or simultaneously according to the pre-configured intensity formula, so that the surface of the electrical connector produces a layered lighting effect. The optical system of the camera should maintain linear and low-distortion imaging characteristics for reflected light of different wavelengths, and accurately set the imaging exposure time to avoid overexposure or underexposure. After completing the optical irradiation, the surface of the electrical connector will reflect the incident light according to the surface geometry and material reflection characteristics, and these reflected lights will carry mixed information including color coding and brightness coding. The image acquisition module uses high-resolution and high-dynamic-range imaging functions to convert these reflected light signals containing chromaticity and brightness characteristics into digital image data. Through pixel-level reading and storage, the microscopic differences on the surface are expressed as a comprehensive distribution of color and brightness on the image. Subsequently, these original images need to be synthesized or superimposed to retain the color information introduced by the annular light source and the brightness information generated by the radial light source, thereby generating a complete composite image. The image also reflects the color layering characteristics and brightness gradient characteristics of various parts of the electrical connector surface, providing an intuitive and visual basis for the subsequent identification of the surface spatial position and direction.
[0024] Specifically, the implementation process of converting the composite image into a color space to obtain a color coding image representing the surface spatial position first converts the acquired composite image from the original RGB or other imaging mode into a color space that is more convenient for extracting hue and intensity components, such as HSV or Lab. At this time, a linear or nonlinear color conversion equation is required to map the red, green, and blue primary color values in the pixel data to the hue, saturation, and brightness (or brightness) channels. This is done to allow the direction and intensity characteristics formed by different light sources on the surface to be better identified in the hue and brightness space. The converted image will highlight the color rings corresponding to the circularly arranged light sources in the hue channel, so that any surface area in the polar coordinate system can reflect the corresponding "latitude" information in different colors, while the saturation and brightness channels can show the brightness gradient formed by the radial light source, that is, the "longitude" information. In order to accurately represent the subtle geometric differences on the surface, it is necessary to reasonably configure the white balance, gamma correction and standardization processing parameters involved in the conversion process according to the calibration results of the actual light source and the optical properties of the electrical connector material. After the conversion is completed, each channel is filtered or denoised to eliminate irrelevant factors such as ambient light interference. Through this color space transformation, a color encoding image that reflects the spatial position information of the surface can be finally obtained, and it can be observed on the image how the annular color band and the radial brightness band are intertwined in the pixel coordinates, thereby laying a visual data carrier for the subsequent decoupling of the surface gradient direction and gradient magnitude.
[0025] 102. Decoupling the gradient information of the surface of the electrical connector according to the chroma-coded image to obtain a surface gradient direction component and a gradient magnitude component; In one embodiment of the present invention, the decoupling of the gradient information on the surface of the electrical connector according to the chromaticity-encoded image to obtain the surface gradient direction component and the gradient magnitude component includes: performing hue analysis as well as saturation and brightness analysis on the chromaticity-encoded image, and obtaining surface local direction information and surface inclination degree information based on the analysis results; obtaining structural material data of the electrical connector structure, and adjusting a preset chromaticity-gradient mapping relationship according to the structural material data; and decoupling the gradient information on the surface of the electrical connector according to the surface local direction information and the surface inclination degree information according to the chromaticity-gradient mapping relationship to obtain the surface gradient direction component and the gradient magnitude component.
[0026] Specifically, the chromaticity-encoded image is subjected to hue analysis as well as saturation and brightness analysis, and the realization process of obtaining the local surface direction information and the surface tilt degree information based on the analysis results requires that the chromaticity-encoded image obtained in the previous step is first converted into a color model suitable for analyzing multi-dimensional parameters such as hue, saturation, brightness, etc., so as to separate the optical characteristic values related to the surface morphology of the electrical connector at the pixel level. In order to achieve this goal, it is necessary to accurately convert the original color image from the common RGB mode or other modes to a space such as HSV or Lab that can separately reflect the hue and intensity by writing or calling an image processing function. After the conversion is completed, the hue channel should be locked and targeted gradient or edge operations should be performed on it so that the local fluctuations in the hue distribution reflect the area where the surface can be regarded as a "directional" feature. For example, if a strip transitioning from light to dark is detected in the hue channel, it means that the incident light at the corresponding position may be obliquely reflected, thereby suggesting that the surface at that position has obvious concave-convex in a certain direction. In order to further distinguish the local direction, the algorithm will look for the distribution of the direction vector in the hue gradient map, and measure the phase change between adjacent pixels, thereby obtaining the local direction information of the surface within a certain range. At the same time, in the saturation and brightness channels, by calculating the combined intensity map, the difference in overall reflection intensity of local pixels can be evaluated. If there are significant brightness fluctuations in the intensity map, it can be determined that there is a difference in the degree of surface inclination at that location. In order to quantitatively evaluate the inclination amplitude, it is necessary to compare the brightness gradient value with the brightness distribution of the reference light source sampled in advance to estimate the surface height difference. At this time, the noise points need to be filtered to avoid interference caused by sensor noise or dust particles. After completing this series of pixel-level hue and brightness analysis, two sets of results can be output: one group indicates the microscopic direction distribution of the surface, and the other group reflects the distribution of local inclination angles or height gradient amplitudes. In this way, the information obtained from hue analysis, saturation, and brightness analysis can effectively characterize the inclination direction and light intensity variation amplitude of different areas on the surface of the electrical connector, so as to be combined with material properties in subsequent steps to help accurately decouple the surface gradient.
[0027] Specifically, the process of obtaining the structural material data of the electrical connector structure and adjusting the preset chromaticity-gradient mapping relationship according to the structural material data needs to consider the metal or alloy composition used by the electrical connector itself, as well as its reflection and absorption rules of light of different wavelengths when illuminated. In order to ensure that the comparison relationship between chromaticity and gradient has sufficient applicability, it is necessary to sample and analyze the material components contained in the electrical connector, and match the obtained element content ratio with the preset material optical property database, and obtain a data set that can be used to describe its surface optical behavior by searching for parameters such as refractive index, reflectivity and scattering characteristics that match the material. Subsequently, based on such optical behavior data, a bidirectional reflectance distribution function model can be constructed or called at the mathematical level to characterize the reflection response of the electrical connector surface at various incident angles, exit angles and wavelengths. By comparing the difference between the reflection response and the previously established chromaticity-gradient mapping function, the deviation between the two can be found. After observing the deviation, a correction amount should be introduced into the coefficient of the original mapping function, and nonlinear or piecewise linear processing should be added during the mapping process, so that the gradient inference of hue and brightness is closer to the real optical reflection behavior of the material. In order to improve computational efficiency, the corrected mapping function will be discretized and converted into a series of quickly queryable lookup tables or polynomial fitting expressions, and numerical derivatives and continuity checks will be performed at discrete sampling points to ensure consistent conversion effects across the lighting range from low angles to high angles. After completing data matching and function correction, the boundary conditions of the mapping function will be additionally reviewed to exclude results that do not conform to physical laws at extreme angles or extreme light intensities, and the mapping function will be frozen as a globally valid chromaticity-gradient transformation rule on the premise of satisfying the material optical model. Therefore, in the adjusted chromaticity-gradient mapping relationship, any changes in hue and brightness can be associated with more accurate surface gradient calculation values, providing data support for material properties in subsequent steps when decoupling the gradient direction and magnitude components.
[0028] Specifically, according to the chroma-gradient mapping relationship, the gradient information of the surface of the electrical connector is decoupled according to the surface local direction information and the surface inclination information, and the implementation process of obtaining the surface gradient direction component and the gradient magnitude component requires that the direction information and inclination information obtained in the previous step are respectively input into the modified mapping function or lookup table to calculate the real gradient direction vector and magnitude value that may correspond to each pixel coordinate. In order to make the direction and magnitude independent of each other in calculation, the local direction derived from the hue analysis is usually regarded as angle data, and then interpolated or evaluated in the chroma-gradient direction mapping function to finally generate the initial gradient direction component; at the same time, the inclination value extracted from channels such as brightness or saturation is passed to the chroma-gradient magnitude mapping function to obtain the initial gradient amplitude. After completing this initial calculation, there are some adjacent areas where the direction or amplitude jumps discontinuously due to noise or surface texture complexity. In order to alleviate this kind of jump phenomenon, it is necessary to orthogonalize the global gradient field and constrain the local consistency. Orthogonalization means that after the direction and amplitude are calculated, the two orthogonal dimensions are recalibrated to the plane coordinate system, and the direction and magnitude satisfy the geometric orthogonal relationship to eliminate the deviation caused by rounding or interpolation within the algorithm. Subsequently, a smoothing algorithm is used to perform neighborhood screening on the gradient field to keep the direction component approximately consistent within a small range, exclude isolated outliers, and normalize the magnitude component to avoid the situation where the gradient difference in a large range is too large and affects the overall analysis. After completing these processes, the gradient direction component and gradient magnitude component of each pixel or grid unit can be output as a two-dimensional vector field or a three-dimensional data mapping, which directly corresponds to the inclination direction and convexity of the electrical connector surface at various locations in the physical space, thereby providing accurate surface gradient data for defect identification and geometric measurement.
[0029] Furthermore, the hue analysis, saturation and brightness analysis are performed on the chromaticity-coded image, and the surface local direction information and surface inclination degree information are obtained based on the analysis results, respectively, including: performing color space conversion on the chromaticity-coded image to obtain an HSV format image; performing gradient calculation on the hue channel of the HSV format image to obtain a hue gradient map; performing directional statistical analysis on the hue gradient map to obtain surface local direction information; performing weighted combination on the saturation and brightness channels of the HSV format image to obtain an intensity map, and performing gradient calculation on the intensity map to obtain an intensity gradient map; calculating the local gradient amplitude according to the intensity gradient map to obtain surface inclination degree information.
[0030] Specifically, the color space conversion of the chromaticity coded image to obtain the HSV format image will first load the generated chromaticity coded image from the storage medium or memory, and use the image processing module to read its pixel matrix row by row, and then according to the established color conversion formula, the red, green and blue primary color components are nonlinearly or linearly combined to convert them into data of three channels of hue, saturation and brightness. This process requires ensuring that each pixel is fully numerically calculated and eliminating the deviation caused by floating point errors during the conversion process. In order to overcome the color distortion caused by ambient lighting or lens characteristics, it is necessary to adjust the conversion coefficient or gamma correction factor accordingly based on the calibration parameters of the light source and the optical characteristics of the surface material of the electrical connector, so that the obtained HSV image can truly reflect the hue and brightness distribution of the surface at different positions. The conversion step also includes the correction operation of extreme pixel values. If some areas in the original image are overexposed or particularly dark, interpolation or threshold clipping is required to prevent the hue or saturation from jumping in a fault-like manner. After completing these processes, each pixel will carry a hue value H, a saturation value S, and a brightness value V. These three values maintain a certain constraint range in the numerical domain, such as limiting the hue to between 0 and 360 degrees, and limiting the saturation and brightness to between 0 and 1. It is worth noting that when there is a local reflection intensity mutation area on the surface of the electrical connector, the saturation value will change significantly. Therefore, after obtaining the HSV format image, the image needs to be stored with floating point precision and marked with the corrected mapping relationship so that it can be read losslessly during subsequent calls. In order to allow the converted image to be seamlessly connected with the subsequent gradient operation, the metadata of the correspondence between pixel coordinates and physical coordinates should also be retained in the storage structure to help the subsequent algorithm quickly locate the specific area and obtain material properties. Through these steps, an HSV format image that is clearly distinguished in the three dimensions of hue, saturation, and brightness can be obtained, providing basic data support for the further extraction of surface direction and tilt features.
[0031] Specifically, the implementation process of performing gradient calculation on the hue channel of the HSV format image to obtain the hue gradient map includes several steps of local difference of the image. To carry out this operation, it is necessary to select a suitable gradient operator (such as Sobel or Scharr) in the image processing algorithm, and then perform convolution operation on the hue difference values of adjacent pixels in the hue channel to measure the hue change rate around each pixel. Since the hue value is usually distributed in a ring shape, if the standard operator is directly used during the conversion, some hue values close to the two ends will encounter a sudden change problem. In order to eliminate such surrounding discontinuities, a specific phase correction method is required for the hue channel. When the system reads that the pixel value is close to 360 degrees and the adjacent pixel is close to 0 degrees, the two need to be mapped to the same phase interval to avoid introducing erroneous huge differences in the gradient operation. After completing the correction of the surrounding problem, the algorithm will calculate the hue difference in the horizontal direction and the vertical direction respectively, and synthesize the difference vectors in these two directions into the hue gradient amplitude or hue gradient vector. At this time, the area with a larger gradient value indicates that the hue has changed significantly locally, that is, the light source reflection or material properties have a directional mutation at the corresponding position. In order to avoid excessive noise interference, it is necessary to perform low-pass filtering or other smoothing operations on the hue gradient map after calculating the initial gradient, and ensure that isolated pixel-level fluctuations are suppressed while retaining the actual edge information. After the gradient value calculation and post-processing of all pixels are completed, a hue gradient map will be obtained, which can highlight the distribution of the intensity of the hue changes at various locations on the surface of the electrical connector. If there is an obvious sudden increase in the hue gradient in a specific area, it means that the surface directional properties there have changed significantly, suggesting that the corresponding position is different from the surrounding area in surface direction or angle.
[0032] Specifically, the process of performing directional statistical analysis on the hue gradient map to obtain local directional information of the surface mainly relies on summarizing the distribution of gradient vectors in the local neighborhood. When the gradient operation generates a map containing direction and amplitude information, it is necessary to perform directional aggregation analysis on the small area where each pixel is located to determine whether the surface where the pixel is located is tilted or changes in direction along a relatively stable direction. In order to achieve this, it is necessary to pre-set a directional quantization accuracy in the algorithm and discretize the directional components in the hue gradient map into multiple directional intervals. Subsequently, the most dominant directions of several local pixels are counted in the form of a directional histogram or a rose diagram. When a clear peak appears in the directional histogram, it means that the hue change of that area is concentrated in one or a few distribution directions, and this type of information can represent the local directional characteristics of the surface. At the same time, the amplitude mean corresponding to the peak can also be recorded to determine how much hue difference the direction has produced locally. If the directional distribution of a certain area is very scattered, it means that the hue gradient there is irregular multi-directional change, which usually shows a special structure or defect form. After the statistics of these directional data are completed, the results are output as a two-dimensional or three-dimensional mapping of the local directional information of the surface, and each area corresponds to one or more significant directional vectors. In order to make the directional statistics closer to the actual geometric direction of the surface of the electrical connector, the area can be further merged or segmented after the directional analysis is completed to ensure that only one or a few directions are retained in a large smooth interval to avoid excessive subdivision caused by noise. The local directional information of the surface thus formed can not only provide assistance for the calculation of the degree of inclination, but can also be used in the subsequent steps to detect protrusions, depressions or other deformation paths.
[0033] Specifically, the saturation and brightness channels of the HSV format image are weighted and combined to obtain an intensity map, and the intensity map is gradient calculated. The implementation process of obtaining the intensity gradient map is to first separate the two channels S (saturation) and V (brightness or brightness) from the HSV image, and then use a set of predefined weighting schemes to fuse these two parts of data into a separate intensity map I. The weighting scheme can determine the weight ratio of saturation and brightness in the fusion process based on the understanding of the optical reflection law of the electrical connector material. If the surface is sensitive to color reflection differences, the saturation should be given a higher weight, and vice versa, the proportion of the brightness component can be increased so that the final output intensity map can more intuitively show the reflected energy distribution of the electrical connector surface. After obtaining the intensity map, it is necessary to input it into the same or similar gradient operator module to perform convolution or differential operations similar to the hue gradient to calculate the rate of change of each pixel at the intensity level. The larger the intensity gradient value, the more obvious the difference in the intensity of the light reflection between adjacent areas. It can generally be inferred that there is a large difference in the surface tilt or material properties here. In order to improve the calculation accuracy, the intensity map must be denoised or filtered before the gradient operation to eliminate short-term changes caused by high-frequency textures or random noise. After the operation process is completed, an intensity gradient map will be generated, and the pixel value represents the amplitude of the fluctuation in the intensity level of the area. This result can provide a basis for evaluating whether the surface is flat or has protrusions. If an area shows a significant intensity gradient boundary, it means that there is a large difference in brightness level between the area and the surrounding area, which largely implies geometric discontinuities or changes in reflective properties. After completing these steps, the intensity gradient map can be stored.
[0034] Specifically, the implementation process of calculating the local gradient amplitude according to the intensity gradient map and obtaining the surface inclination information usually performs a secondary analysis on the intensity gradient data at the pixel or small area level to derive a relatively quantitative surface inclination index. This step will first read the gradient amplitude of each pixel point of the intensity gradient map, and use this amplitude as a measure of the speed of change of the local reflection intensity. In order to link the amplitude with the actual inclination, it is necessary to combine the incident angle calibration data of the light source or the pre-set geometric reference in the measurement scene, and use the geometric or optical model to map the gradient amplitude into an approximate angle or height difference. In this process, the gradient amplitude can be divided into several gears, or the inversion formula can be applied to correspond to a specific arc or angle value. Detection tasks that are sensitive to the degree of inclination often want to distinguish the size of inclination at several levels, so a linear or piecewise linear mapping method can be used to associate the intensity gradient with the inclination angle. If the gradient amplitude of a certain area is higher than a certain threshold, it means that the inclination of the surface section is obvious, and it is inferred that there may be a height difference or special deformation here. In order to maintain the consistency of the calculation of the whole image, local smoothing needs to be performed to correct the discontinuous extreme gradient points to the nearby average level so that the tilt distribution remains coherent in space. In the end, a data structure or a set of data structures will be obtained, marking the tilt value of each pixel or grid point. These values represent the local slope or height fluctuation of the electrical connector surface at that location. This information is regarded as surface tilt information, which can be fused with the direction information later, and further combined into complete surface gradient data for defect analysis or other geometric measurement scenarios.
[0035] Furthermore, the obtaining of the structural material data of the electrical connector structure and the adjustment of the preset chromaticity-gradient mapping relationship according to the structural material data include: performing a material composition analysis on the electrical connector structure to obtain material composition ratio data, and querying a preset material optical property database according to the material composition ratio data to obtain the structural material data of the material; substituting the structural material data into a preset bidirectional reflection distribution function model to obtain the theoretical optical response function of the material, and performing a correction calculation on the preset chromaticity-gradient mapping relationship according to the theoretical optical response function to obtain a preliminarily adjusted chromaticity-gradient mapping function; discretizing the preliminarily adjusted chromaticity-gradient mapping function to obtain a discrete mapping data point set, and performing polynomial fitting on the discrete mapping data point set to obtain a continuous mapping function expression; numerically deriving the continuous mapping function expression to obtain a gradient distribution of the mapping function expression, and performing piecewise linear approximation on the mapping function expression according to the gradient distribution to obtain a piecewise linear mapping relationship; performing a lookup table conversion on the piecewise linear mapping relationship to obtain a mapping lookup table for fast calculation, and performing boundary condition checking and smoothing on the mapping lookup table to obtain a chromaticity-gradient mapping relationship.
[0036] Specifically, the material composition analysis of the electrical connector structure is performed to obtain the material composition ratio data, and the preset material optical property database is queried according to the material composition ratio data to obtain the material structure material data. The realization process requires chemical detection and separation measurement of the metal or alloy part of the electrical connector to grasp the accurate ratio of its main elements and impurity content. In order to complete this detection, it is necessary to use technical means such as spectral analysis, energy dispersive X-ray analysis or metallographic detection in the laboratory or production line to test the surface or cross-section of the electrical connector sample multiple times, and compare the obtained spectral lines or photoelectron signals with the standard spectrum library to determine the mass and atomic percentage of each element or compound in the sample. After obtaining the material composition ratio data, the technician will search for the entries closest to these element combinations in the local or cloud material optical property database by keyword or index. The database often contains the refractive index, absorption coefficient and scattering coefficient of various common metals and their alloys under different wavelengths of light, as well as the correction parameters of surface roughness for reflection intensity. When querying, the material formula and process conditions (such as surface coating, heat treatment status, etc.) of the electrical connector need to be used as input variables, the closest optical reference record needs to be retrieved in the database, and the appropriate optical property data is screened out based on the similarity or normalized score. In some cases, in order to ensure the accuracy of the information, it is necessary to perform a secondary comparison of the screening results or integrate multiple material property entries by interpolation to form a comprehensive data table that is more in line with the actual properties of the target electrical connector. After confirming the appropriate data, the system will output information such as the material's refractive index-wavelength curve, reflectivity function, or scattering parameter set, and package or store this data in a structural material data file that can be directly called in subsequent links, so that it can provide a real and refined input basis for the optical model calculation of the electrical connector surface.
[0037] Specifically, the structural material data is substituted into the preset bidirectional reflection distribution function model to obtain the theoretical optical response function of the material, and the preset chromaticity-gradient mapping relationship is corrected and calculated according to the theoretical optical response function to obtain the implementation process of the preliminarily adjusted chromaticity-gradient mapping function. It is necessary to first parse the key parameters such as refractive index, absorption coefficient and surface roughness from the material data file, and assign these optical properties to the dimensional variables such as the incident angle, the exit angle and the wavelength of the model one by one according to the modeling framework of the bidirectional reflection distribution function (BRDF). The reason for this is that BRDF can accurately describe the reflection intensity distribution of the surface at different angles and spectral ranges at the mathematical level, thereby helping to understand the relationship between the pixel value in the chromaticity channel and the actual tilt or direction of the surface. When establishing or calling the BRDF model, it is necessary to comprehensively consider different forms such as the Feng model, the Cook-Torrance model or the Oren-Nayar model, select an expression that matches the target electrical connector material, and incorporate details such as diffraction and microfacet distribution function into the parameters, so that the theoretical optical response function has a higher degree of consistency with the real surface behavior. After obtaining the theoretical optical response function, the results should be numerically sampled and interpolated to associate the spectral angle characteristics with the hue, saturation or brightness values in the chromaticity space, and find and quantify the differences between the model output and the previously set chromaticity-gradient mapping function. If it is found that the existing mapping function deviates greatly at certain angles or wavelength ranges, it is necessary to correct the function coefficients, thresholds or nonlinear terms, and converge to a preliminary adjustment function that can balance theory and empirical measurements after multiple cycles of calculation. The preliminary adjusted chromaticity-gradient mapping function retains the original basic framework for fast calculations, and has also been revised accordingly based on the actual reflection characteristics of the material, so that the mapping accuracy can continue to be improved in the subsequent discretization and fitting steps.
[0038] Specifically, the chromaticity-gradient mapping function of the preliminary adjustment is discretized to obtain a discrete mapping data point set, and the discrete mapping data point set is polynomially fitted to obtain a continuous mapping function expression. The implementation process will first sample the preliminary adjusted function in the form of a table or a numerical array at multiple angles, chromaticity or gradient values, thereby forming a series of discrete data points on the mapping surface or mapping curve. Each data point records the correspondence between the chromaticity input (such as hue, saturation or brightness combination) and the output gradient value. These data points cover the possible input intervals, including shallow angles, small gradients, large angles, large gradients and other scenes. When sampling, it is necessary to ensure that the resolution is fine enough to avoid interpolation errors in sections where the curve deformation is more severe. After obtaining the discrete point set, it is necessary to use a polynomial fitting method (such as least squares fitting or a higher-order curve approximation algorithm) to approximate these scattered points as a whole to obtain one or more continuous mapping function expressions. In order to improve the fitting accuracy, it is sometimes necessary to use piecewise polynomial or multidimensional polynomial models, and add nonlinear adjustment items according to the reflective characteristics of the material to ensure that the fitting errors in the high gradient and low gradient intervals can be kept within a controllable range. At this time, residual analysis is required to check the deviation between each scattered point and the fitting curve. When the deviation exceeds the set threshold, you can try to increase the polynomial order or increase the sampling point density so that the fitting curve can fit the original data distribution more closely. After the fitting is completed, a set or a function expression that can directly input chromaticity values and output gradient values will be generated, and the corresponding coefficients and accuracy information will be recorded to provide a smoother and easier-to-operate function basis for the differentiation and piecewise linear approximation required in the subsequent steps.
[0039] Specifically, the continuous mapping function expression is numerically differentiated to obtain the gradient distribution of the mapping function expression, and the mapping function expression is piecewise linearly approximated according to the gradient distribution to obtain the implementation process of the piecewise linear mapping relationship based on the following idea: first, the polynomial or other type of continuous function that has been fitted is numerically differentiated globally or locally, and the function that originally describes the chromaticity to gradient output is converted into a distribution diagram describing the function growth rate or slope as the chromaticity value changes at the derivative level. Numerical differentiation can be implemented using a differential method or a symbolic operation library, and the specific choice depends on the order and complexity of the polynomial. After obtaining the derivative information, it is necessary to find the inflection point or the area with significant slope change on the derivative distribution to determine the interval division scheme that is most suitable for piecewise linear approximation. The derivative is kept relatively stable as much as possible within each interval, so that the linear approximation can achieve a smaller absolute error in this interval. Once the segmentation is completed, the function is linearly regressed in each interval or directly constructed with the endpoint data to generate a piecewise linear mapping expression. This form helps to perform fast interpolation when implementing hardware or software, and can be completed efficiently in a lookup table when reading the function output. When performing piecewise linear approximation, it is necessary to pay attention to both the numerical value of the function itself and the value of its derivative, ensure the continuity or differentiability of each segment at the beginning and end, and minimize the transition mutation. If a drastic change occurs in a certain segment, the number of subdivisions can be increased to make the approximation result more consistent with the curvature of the real function. Through this type of processing, a set of piecewise linear mapping relationships with strong executability, simple calculation and accuracy can be obtained.
[0040] Specifically, the piecewise linear mapping relationship is converted into a lookup table to obtain a mapping lookup table for fast calculation, and the mapping lookup table is checked for boundary conditions and smoothed to obtain the chromaticity-gradient mapping relationship. The implementation process requires that the start and end ranges of the input intervals and the corresponding linear coefficients or constant terms are listed in a table or data array in sequence according to each interval of the piecewise linear mapping, and the entire curve is divided into several rows or columns to form a fast index structure for outputting gradient values after discretizing the input values. When establishing a lookup table, it is necessary to set an appropriate sampling step between the minimum input value and the maximum input value. If there are too many segmented intervals, a multi-level search idea can be used to divide a large range into a coarse step index, and then use a finer step to record the linear slope in the local interval. After obtaining a complete lookup table, it is necessary to check its boundary conditions to prevent overflow or fallback when the input is at the extreme boundary. If it is found that the linear coefficients of some boundary intervals are mismatched between adjacent paragraphs, it is necessary to adjust the connection points or interpolation parameters to make the output value transition smoothly. At the same time, the entire lookup table must be filtered or smoothed to eliminate the subtle jumps caused by numerical discretization, so that the interpolation results remain stable and coherent. After confirming that the errors within each interval are within an acceptable range, a final mapping lookup table formed by piecewise linear expression is obtained, which can directly output the corresponding gradient value according to the chromaticity value in the form of array index in the later calculation, and this search method is also easy to implement in hardware acceleration or embedded environments without consuming too many floating-point computing resources. After this series of processing, a complete chromaticity-gradient mapping relationship is obtained, which can fully reflect the matching degree between the electrical connector material and the optical model, and has high computational efficiency and accuracy.
[0041] Furthermore, the decoupling of the gradient information on the surface of the electrical connector according to the surface local direction information and the surface inclination degree information according to the chromaticity-gradient mapping relationship to obtain the surface gradient direction component and the gradient magnitude component includes: inputting the surface local direction information into the optimized chromaticity-gradient direction mapping function to obtain the initial gradient direction component; inputting the surface inclination degree information into the optimized chromaticity-gradient magnitude mapping function to obtain the initial gradient magnitude component; orthogonalizing the initial gradient direction component and the initial gradient magnitude component to obtain the orthogonal gradient component, and performing local consistency constraints on the orthogonal gradient component to obtain a smoothed gradient field; performing main direction analysis on the smoothed gradient field to obtain the surface gradient direction component, and performing amplitude normalization on the smoothed gradient field to obtain the surface gradient magnitude component.
[0042] Specifically, the implementation process of inputting the surface local direction information into the optimized chromaticity-gradient direction mapping function to obtain the initial gradient direction component requires first establishing a corresponding relationship between the surface local direction information obtained in the previous step and the chromaticity-gradient direction mapping function that has been corrected for material and reflective characteristics. The reason is that the surface local direction information usually exists in the form of hue gradient statistics or local phase distribution, and the mapping function associates the difference in chromaticity channels with possible tilt angles or direction vectors. In order to combine the two, it is necessary to formulate a unified index or interpolation mechanism within the algorithm, that is, to retrieve or interpolate the corresponding direction vector reference for each local direction information unit according to its chromaticity value (such as hue or composite chromaticity index). When this step is completed, the system will find the closest input interval in the optimized mapping function, and then read or calculate the corresponding direction output. If the mapping function is subjected to piecewise linear processing or polynomial fitting, it may be necessary to perform interpolation in the local interval to obtain a more accurate direction vector result. Once these direction results are obtained, the algorithm will assign an initial gradient direction component to each pixel or area, which is numerically expressed as an angle or unit vector in a two-dimensional plane. In some cases, the direction information is stored in spherical coordinates or polar coordinates, so it is also necessary to convert it into the required orthogonal coordinate form through conversion equations. In order to ensure the consistency of the output results, the program needs to do a small amount of filtering after generating the initial direction component to exclude noise pixels or isolated outliers. When the hue analysis and mapping function pointing directions of several pixels in the neighborhood show a drastic jump, the system can also make a very small range of smooth corrections, but will not significantly change the local direction structure, thereby retaining the steep transition features that may exist on the real surface. After completing the direction calculation of all pixels or grid nodes, these discrete direction components will be combined into a two-dimensional vector field or other form of data structure to provide the necessary direction reference for subsequent combination with the tilt amplitude. In this way, the local direction information can be converted into the initial gradient direction component that reflects the tilt trend of the real surface of the electrical connector with the assistance of the mapping function, laying a sufficient data foundation for the subsequent calculation of the size component and orthogonalization processing.
[0043] Specifically, the surface tilt information is input into the optimized chromaticity-gradient magnitude mapping function, and the realization process of obtaining the initial gradient magnitude component requires comparing or interpolating the surface tilt information extracted previously (usually reflected by the intensity gradient or the combined gradient amplitude) with the modified chromaticity-gradient magnitude mapping function. Since this mapping function has also undergone material composition analysis and BRDF correction in the previous step, the differences in material optical properties, surface roughness, and lighting conditions have been integrated in the gradient output corresponding to each input value. When the system reads the surface tilt information, it will first locate the corresponding input range in the mapping function based on the information, and use linear interpolation, piecewise linear indexing or polynomial calculation to obtain the initial gradient magnitude value corresponding to the area. The reason for this is that the tilt information only represents the rate of change of the reflection strength of the pixel point or local area, and has not yet been converted into an absolute gradient amplitude that can describe the fluctuation of the physical shape; and the mapping function integrates multiple factors such as the incident angle of light, the refractive index of the surface material, and the scattering parameters in the process of comparing the chromaticity and the gradient, which can give this change rate a more physically meaningful numerical interpretation. When each pixel or grid node obtains the initial gradient magnitude component, the algorithm stores these magnitude values in a matrix or vector field with the same resolution as the directional component, and performs certain threshold screening locally as needed. The purpose of screening is to exclude extremely high or low values and avoid random spikes in the magnitude components due to noise or shadow effects. When the screening is completed, a reasonably distributed initial gradient amplitude map will be generated on the entire surface. The larger the value, the steeper the slope or more significant concave-convex deformation of the surface. Global smoothing is not performed at this stage in order to preserve the differences between different regions and leave enough information for subsequent orthogonalization and consistency processing. This approach allows each pixel to accurately express its reflection characteristics in optical and physical space in the size dimension, and convert the numerical mapping of the chromaticity channel into a height or tilt intensity estimate of the physical surface.
[0044] Specifically, the initial gradient direction component and the initial gradient magnitude component are orthogonalized to obtain orthogonal gradient components, and the orthogonal gradient components are constrained by local consistency to obtain the smoothed gradient field. The two components of direction and magnitude are first regarded as a combination of vector amplitude and angle, and the plane coordinate system is used to characterize its projection in the x and y directions. When the initial direction component appears in polar coordinates or angle form, it needs to be converted into an orthogonal unit vector in the x and y directions, and then multiplied by the corresponding initial magnitude value to obtain the complete gradient vector of each pixel. If it is found in this process that there is a numerical mismatch between direction and magnitude, or the direction vector and amplitude in some areas exceed the reasonable range after multiplication, a local correction strategy can be used to make appropriate corrections without changing the overall tendency. The gradient vector field obtained in this way may have sudden changes at the boundaries of adjacent pixels, so it is necessary to impose local consistency constraints to keep the direction and amplitude of each pixel physically connected with its neighbors, especially in the surface smoothing area to ensure that the gradient vectors of adjacent pixels will not jump violently for no reason. Local consistency is usually performed using weighted smoothing or a regularization algorithm based on energy minimization. The algorithm sets a neighborhood window around each pixel, calculates the direction differences and size differences between all pixels, and compresses excessively high outliers to the neighborhood's average or median to maintain overall gradient continuity. At the same time, in order to retain true mutations or edge information, the algorithm sets smaller smoothing weights where the gradient changes sharply to avoid erasing important defect features or steep contours. After all pixels have completed this balance, a smoothed gradient field is obtained, which can not only reflect the smooth transition of the electrical connector surface over a large range, but also retain good resolution of defective areas or sharp corners. This smoothed gradient field is the carrier for the subsequent main direction analysis and amplitude normalization, providing a consistent and rich vector distribution for higher-level surface reconstruction or defect determination.
[0045] Specifically, the main direction analysis is performed on the smoothed gradient field to obtain the surface gradient direction component, and the smoothed gradient field is normalized to obtain the surface gradient size component. The smoothed gradient field generated in the previous step is used as input data, and the most representative gradient direction in each local area is determined by means of direction clustering or high-order feature extraction. A common method is to count the direction components of the gradient vector in a small range window. If there is an obvious direction distribution peak, the peak direction can be identified as the main direction, and a small number of outlier direction vectors can be weakened in the window to make the statistical results more concentrated. If there is more than one main direction in a certain area, it is necessary to further distinguish whether the area contains turning points, edges or defects based on thresholds or classification algorithms. After completing these statistics and classifications, the main direction of each pixel or sub-area will be output to form the final surface gradient direction component map. At the same time, amplitude normalization of the smoothed gradient field includes determining the maximum and minimum intervals of an amplitude distribution in a global or regional range, and mapping the gradient amplitude to a relatively uniform numerical range through linear or nonlinear methods, such as limiting all amplitudes to between 0 and 1 or between 0 and 255. The reason for this is that there may be very flat areas and very steep areas on the surface of the electrical connector. If normalization is not performed, the overall data will have a very large discreteness, which will not be convenient for subsequent defect assessment or three-dimensional reconstruction analysis. When performing amplitude normalization, in order not to submerge extremely small or extremely small features, segmented mapping or automatic matching of histograms can be used to make the amplitude distribution more even. After completing these operations, two core data will be obtained: one is the surface gradient direction component map, which expresses the direction of each coordinate; the other is the surface gradient magnitude component map, which depicts the amplitude strength of the corresponding direction.
[0046] 103. Perform multi-scale feature extraction on the surface of the electrical connector according to the surface gradient direction component and the gradient magnitude component to obtain a feature pyramid; In one embodiment of the present invention, when performing multi-scale feature extraction based on the surface gradient direction component and the gradient magnitude component, the obtained gradient vector field needs to be scaled or sampled according to different resolutions to form several image levels with different spatial resolutions and texture details. Each level carries the gradient change distribution of the surface of the electrical connector at the corresponding scale. The higher data level can retain finer local textures, and the lower data level can summarize the overall contour of a larger range. When establishing these multi-scale images, the surface direction and amplitude information need to be stored in the form of vectors or composite features, and combined with interpolation or downsampling strategies to ensure that the key texture can be maintained after reduction or enlargement. Subsequently, a stable multi-scale detection algorithm (such as Laplacian pyramid or Gaussian pyramid deformation) should be used to identify features at each scale, and analyze the local gradient anomaly separately from the overall gradient trend. If a certain place shows a clear and sharp gradient mutation at the high-resolution level, but still shows a significant contrast at the lower resolution level, it means that there is a high degree of deformation or scratches at that place; if only a slight difference is retained at the high-resolution level, it indicates that the place is a slight surface defect. After completing feature aggregation at each scale, the detection results of all scales are combined into a feature pyramid in a stacked form, so that macro and micro information are reflected in different image layers. After that, the system will search for potential anomalies between layers based on the determined direction and amplitude distribution. If the same position shows anomalies in multiple layers, it can be determined that the defect stability at this position is high. Through this multi-scale feature analysis, both deep contour differences and fine texture anomalies can be highlighted, thereby providing a more complete data structure for defect analysis and quality assessment.
[0047] 104. The surface defects of the electrical connector are quantitatively analyzed based on the feature pyramid to obtain the geometric parameters and quality evaluation results of the surface defects.
[0048] In one embodiment of the present invention, the quantitative analysis of the surface defects on the surface of the electrical connector according to the feature pyramid to obtain the geometric parameters and quality assessment results of the surface defects includes: The boundary of the potential defect area in the feature pyramid is extracted to obtain the defect contour; the depth, area and volume of the defect are calculated according to the defect contour and the decoupled gradient information to obtain the defect geometric parameters; the defect geometric parameters are input into a pre-established physical model to obtain an impact assessment of the defect on the performance of the electrical connector; a knowledge graph is constructed according to product specifications, manufacturing processes and historical data to obtain a defect assessment benchmark; the impact assessment of the defect on the performance of the electrical connector is compared with the defect assessment benchmark to obtain defect severity and potential cause analysis results; a quality assessment report is generated according to the defect severity and potential cause analysis results to obtain a final quality assessment result.
[0049] Specifically, the boundary of the potential defect area in the feature pyramid is extracted, and the defect contour is obtained by using adaptive threshold or multi-scale gradient operation, merging the suspicious deformation parts detected at different scales, and then locating the irregular boundary position in the image or three-dimensional data. In this process, the connectivity analysis of the candidate pixel set is first performed, and the contour direction of the suspected defect area is identified by using gradient distribution or texture difference. Then, the regional contraction or expansion operation is performed locally to exclude small or isolated noise points, and keep the more obvious outer edge of the defect shape still with high contrast after processing. The closed edge mark finally extracted is the defect contour data, which can be directly used for the subsequent geometric parameter calculation. In the extraction process, the method of combining morphological gradient or Canny operator with regional growth is also used to make the defect edge more accurately presented on the multi-scale feature map, avoid low contrast or excessive illumination area covering the real contour, and ensure clear boundary alignment in high difference area.
[0050] Specifically, the depth, area and volume of the defect are calculated according to the defect contour and the decoupled gradient information. The process of obtaining the defect geometric parameters requires integrating the gradient direction and gradient amplitude of each pixel or grid unit within the obtained closed contour. During the calculation, the surface inclination angle obtained by decoupling is used to infer the local height difference, and then the overall depth of the depression or protrusion is estimated by regional scanning or surface integral. The area measurement will be based on the number of pixels in the contour or the projection of the grid unit to obtain the plane expansion area, and the volume is achieved by accumulating the local height layer by layer to achieve a three-dimensional volume approximation. If a defect area has multiple independent sub-segments, their respective geometric quantities will be counted separately, and a global defect parameter table will be generated. The depth, area and volume data obtained in this way have a certain degree of accuracy and can provide a direct reference for assessing the severity of the defect. In this process, the degree of fit between the decoupled gradient information and the contour position will directly affect the accuracy of the geometric parameters, so it is necessary to ensure that the coordinate system of contour extraction and gradient matching remains unified.
[0051] Specifically, the process of inputting the defect geometric parameters into a pre-established physical model to obtain the impact of the defect on the performance of the electrical connector requires combining the mechanical, electrical and thermal environment of the electrical connector under actual working conditions, and quantifying the stress concentration and conduction efficiency changes at the defect site when the external force load or temperature changes. The physical model contains basic assumptions about structural strength, current distribution and heat conduction, and calculates the maximum stress concentration factor or contact resistance increment caused by the defect area by substituting key parameters such as depth, area and volume into relevant equations. If the simulation results show that the stress concentration is high or the contact resistance increases significantly, it indicates that the defect has a great impact on the performance of the connector. When outputting the evaluation data, the safety margin reduction value or electrical performance attenuation amplitude caused by the defect will be recorded to provide data support for the subsequent judgment of the severity of the defect.
[0052] Specifically, the process of constructing a knowledge graph based on product specifications, manufacturing processes and historical data to obtain a defect assessment benchmark requires collecting data from previous production and testing from technical archives and manufacturing records, and extracting typical failure forms and corresponding dimensional quantitative indicators. The knowledge graph contains production raw material ratios, connector shape structures, common stress concentration points, and corresponding failure cases and their specific defect parameters. By integrating these contents in the information system, a set of comparative reference tables can be generated, covering the defect morphology and the performance loss caused by it during testing or use. If a certain type of defect has been proven to cause obvious mechanical fatigue or current attenuation under similar conditions, the graph will be marked as high risk; if the defect size is small and no early failure occurs in the corresponding case, it will be classified as a low risk interval. The knowledge graph formed in this way can provide a matching basis for newly detected defects, so as to determine reasonable judgment thresholds and classification criteria in subsequent evaluation links.
[0053] Specifically, the process of comparing the impact assessment of the defect on the performance of the electrical connector with the defect assessment benchmark to obtain the defect severity and potential cause analysis results requires finding the historical records or standard classification entries closest to the current defect geometric parameters in the database, and using performance indicator comparison to determine its level. If the simulated stress concentration factor or contact resistance increase exceeds the high-risk critical value in the spectrum, the system will mark the defect as a severe level and give potential cause prompts, such as material defects or process deviations. If each performance indicator is in the medium or low range, it can be defined as a general level or a negligible level, but it is also necessary to combine the actual use scenario to determine whether there is an extreme load-induced problem. This comparison link will also analyze multiple influencing factors, such as manufacturing batches, surface treatment methods, and operating temperature ranges, so as to determine the main causes of defects and output classification suggestions.
[0054] Specifically, a quality assessment report is generated based on the severity of the defects and the results of the potential cause analysis. The process of obtaining the final quality assessment results will integrate the degree of deviation of the defects in various performance indicators, potential failure modes, and traceable manufacturing link information into a unified assessment document, and identify the hazard level of the defects according to the quality grading standards commonly used by the enterprise or industry. The report usually contains the coordinate position, dimensional data, impact analysis, and treatment suggestions of the defects. If the assessment conclusion shows that the defect is sufficient to cause functional failure or significantly reduce the safety factor of use, the report will list maintenance or rework suggestions; if the assessment result does not exceed the warning line, its location and observation data can be recorded in the report for later tracking. The entire report file will be synchronized to the quality management system and linked with subsequent production parameters or material supply data to jointly promote the prevention and continuous improvement of similar defects.
[0055] In this embodiment, a chromaticity-coded image is generated by illuminating the electrical connector with latitude and longitude structured light using a circularly arranged latitude light source and a radially arranged longitude light source. The surface gradient direction component and the gradient magnitude component are extracted by decoupling the gradient information of the chromaticity-coded image. Subsequently, multi-scale feature extraction is performed based on the surface gradient components to construct a feature pyramid, thereby comprehensively capturing the surface detail features. Finally, the feature pyramid is used to quantitatively analyze the surface defects to obtain the geometric parameters and quality assessment results of the surface defects. The present invention achieves high-precision defect detection and quality assessment on the surface of electrical connectors by combining multi-dimensional illumination structure, gradient decoupling and multi-scale analysis, and is suitable for electrical connector inspection scenarios with complex shapes and high precision requirements.
[0056] The surface detection method of the electrical connector structure in the embodiment of the present invention is described above. The surface detection device of the electrical connector structure in the embodiment of the present invention is described below. Figure 2 , an embodiment of the surface detection device of the electrical connector structure in the embodiment of the present invention includes: The illumination generation module 201 is used to perform longitude and latitude structured light illumination on the electrical connector structure using a circularly arranged latitude light source and a radially arranged longitude light source to obtain a chromaticity coded image; A gradient decoupling module 202, configured to decouple the gradient information on the surface of the electrical connector according to the chroma-encoded image to obtain a surface gradient direction component and a gradient magnitude component; A feature extraction module 203 is used to extract multi-scale features of the surface of the electrical connector according to the surface gradient direction component and the gradient magnitude component to obtain a feature pyramid; The defect analysis module 204 is used to perform quantitative analysis on the surface defects of the electrical connector surface according to the feature pyramid to obtain geometric parameters and quality assessment results of the surface defects.
[0057] In an embodiment of the present invention, the surface detection device of the electrical connector structure runs the surface detection method of the electrical connector structure, and the surface detection device of the electrical connector structure performs longitude and latitude structured light illumination on the electrical connector by using a circularly arranged latitude light source and a radially arranged longitude light source to generate a chromaticity-coded image. By decoupling the gradient information of the chromaticity-coded image, the surface gradient direction component and the gradient magnitude component are extracted. Subsequently, multi-scale feature extraction is performed based on the surface gradient component to construct a feature pyramid, thereby comprehensively capturing the surface detail features. Finally, the feature pyramid is used to quantitatively analyze the surface defects to obtain the geometric parameters and quality assessment results of the surface defects. The present invention realizes high-precision defect detection and quality assessment on the surface of the electrical connector by combining multi-dimensional illumination structure, gradient decoupling and multi-scale analysis, and is suitable for electrical connector detection scenarios with complex shapes and high precision requirements.
[0058] above Figure 2 The surface detection device of the electrical connector structure in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The surface detection device of the electrical connector structure in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0059] Figure 3 3 is a schematic diagram of the structure of a surface detection device of an electrical connector structure provided by an embodiment of the present invention. The surface detection device 300 of the electrical connector structure may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 310 (for example, one or more processors) and a memory 320, and one or more storage media 330 (for example, one or more mass storage device terminals) storing application programs 333 or data 332. Among them, the memory 320 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the surface detection device 300 of the electrical connector structure. Furthermore, the processor 310 may be configured to communicate with the storage medium 330, and execute a series of instruction operations in the storage medium 330 on the surface detection device 300 of the electrical connector structure to implement the steps of the surface detection method of the electrical connector structure.
[0060] The surface detection device 300 of the electrical connector structure may also include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input and output interfaces 360, and / or one or more operating systems 331, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 3 The surface detection device structure of the electrical connector structure shown does not constitute a limitation on the surface detection device of the electrical connector structure provided by the present invention, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0061] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the surface detection method of the electrical connector structure.
[0062] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0063] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0064] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A surface detection method for an electrical connector structure, characterized in that: The surface detection method of the electrical connector structure comprises: Using a circularly arranged latitude light source and a radially arranged longitude light source to illuminate the electrical connector structure with longitude and latitude structured light to obtain a color coding image; Decoupling the gradient information of the surface of the electrical connector according to the chroma-coded image to obtain a surface gradient direction component and a gradient magnitude component; Perform multi-scale feature extraction on the surface of the electrical connector according to the surface gradient direction component and the gradient magnitude component to obtain a feature pyramid; The surface defects on the surface of the electrical connector are quantitatively analyzed according to the feature pyramid to obtain geometric parameters and quality evaluation results of the surface defects.
2. The surface detection method of the electrical connector structure according to claim 1, characterized in that: The method of using the circularly arranged latitude light source and the radially arranged longitude light source to illuminate the electrical connector structure with longitude and latitude structured light to obtain a color coding image includes: Controlling the circularly arranged latitude light sources to emit light of different colors to illuminate the surface of the electrical connector to obtain latitude color distribution; Controlling the radially arranged longitude light sources to emit light of different intensities to illuminate the surface of the electrical connector to obtain longitude brightness distribution; collecting light reflected from the surface of the electrical connector to obtain a composite image including a latitude color distribution and a longitude brightness distribution; The composite image is converted into a color space to obtain a color coding image representing the spatial position of the surface.
3. The surface detection method of the electrical connector structure according to claim 1, characterized in that: Decoupling the gradient information of the surface of the electrical connector according to the chroma-coded image to obtain the surface gradient direction component and the gradient magnitude component includes: Performing hue analysis, saturation analysis and brightness analysis on the chroma-coded image, and obtaining surface local direction information and surface tilt degree information based on the analysis results; Acquiring structural material data of the electrical connector structure, and adjusting a preset chromaticity-gradient mapping relationship according to the structural material data; According to the chromaticity-gradient mapping relationship, the gradient information on the surface of the electrical connector is decoupled according to the surface local direction information and the surface inclination degree information to obtain a surface gradient direction component and a gradient magnitude component.
4. The surface detection method of the electrical connector structure according to claim 3, characterized in that: The performing hue analysis and saturation and brightness analysis on the chromaticity coded image, and obtaining surface local direction information and surface tilt degree information based on the analysis results respectively comprises: Performing color space conversion on the chroma-coded image to obtain an HSV format image; Performing gradient calculation on the hue channel of the HSV format image to obtain a hue gradient map; Performing directional statistical analysis on the hue gradient image to obtain local directional information of the surface; Performing weighted combination on the saturation and lightness channels of the HSV format image to obtain an intensity map, and performing gradient calculation on the intensity map to obtain an intensity gradient map; The local gradient amplitude is calculated according to the intensity gradient map to obtain the surface inclination information.
5. The surface detection method of the electrical connector structure according to claim 3, characterized in that: The obtaining of structural material data of the electrical connector structure and adjusting a preset chromaticity-gradient mapping relationship according to the structural material data comprises: Performing material composition analysis on the electrical connector structure to obtain material composition ratio data, and querying a preset material optical property database based on the material composition ratio data to obtain structural material data of the material; Substituting the structural material data into a preset bidirectional reflectance distribution function model to obtain a theoretical optical response function of the material, and performing a correction calculation on a preset chromaticity-gradient mapping relationship according to the theoretical optical response function to obtain a preliminarily adjusted chromaticity-gradient mapping function; Discretizing the preliminarily adjusted chromaticity-gradient mapping function to obtain a discrete mapping data point set, and performing polynomial fitting on the discrete mapping data point set to obtain a continuous mapping function expression; Numerically deriving the continuous mapping function expression to obtain a gradient distribution of the mapping function expression, and performing piecewise linear approximation on the mapping function expression according to the gradient distribution to obtain a piecewise linear mapping relationship; The piecewise linear mapping relationship is converted into a lookup table to obtain a mapping lookup table for fast calculation, and the mapping lookup table is checked for boundary conditions and smoothed to obtain a chromaticity-gradient mapping relationship.
6. The surface detection method of the electrical connector structure according to claim 3, characterized in that: The step of decoupling the gradient information on the surface of the electrical connector according to the local surface direction information and the surface inclination degree information according to the chromaticity-gradient mapping relationship to obtain the surface gradient direction component and the gradient magnitude component includes: Inputting the surface local direction information into an optimized chromaticity-gradient direction mapping function to obtain an initial gradient direction component; Inputting the surface inclination information into an optimized chromaticity-gradient magnitude mapping function to obtain an initial gradient magnitude component; orthogonalizing the initial gradient direction component and the initial gradient magnitude component to obtain an orthogonal gradient component, and performing local consistency constraints on the orthogonal gradient component to obtain a smoothed gradient field; The smoothed gradient field is subjected to a main direction analysis to obtain a surface gradient direction component, and the smoothed gradient field is subjected to amplitude normalization to obtain a surface gradient magnitude component.
7. The surface detection method of the electrical connector structure according to claim 1, characterized in that: The quantitative analysis of the surface defects on the surface of the electrical connector according to the feature pyramid to obtain the geometric parameters and quality assessment results of the surface defects includes: Extracting the boundary of the potential defect area in the feature pyramid to obtain the defect contour; Calculating the depth, area and volume of the defect according to the defect contour and the decoupled gradient information to obtain defect geometric parameters; Inputting the defect geometric parameters into a pre-established physical model to obtain an evaluation of the effect of the defect on the performance of the electrical connector; Build a knowledge graph based on product specifications, manufacturing processes, and historical data to obtain a defect assessment benchmark; Comparing the impact assessment of the defect on the performance of the electrical connector with the defect assessment benchmark to obtain defect severity and potential cause analysis results; A quality assessment report is generated based on the defect severity and potential cause analysis results to obtain the final quality assessment results.
8. A surface detection device for an electrical connector structure, characterized in that: The surface detection device of the electrical connector structure comprises: An illumination generation module, used to perform latitude and longitude structured light illumination on the electrical connector structure using a circularly arranged latitude light source and a radially arranged longitude light source to obtain a chromaticity coded image; A gradient decoupling module, used to decouple the gradient information of the surface of the electrical connector according to the chroma-encoded image to obtain a surface gradient direction component and a gradient magnitude component; A feature extraction module, used to extract multi-scale features of the surface of the electrical connector according to the surface gradient direction component and the gradient magnitude component to obtain a feature pyramid; The defect analysis module is used to perform quantitative analysis on the surface defects of the electrical connector surface according to the feature pyramid to obtain geometric parameters and quality assessment results of the surface defects.
9. A surface detection device for an electrical connector structure, characterized in that: The surface detection device of the electrical connector structure comprises: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instructions in the memory to enable the surface detection device of the electrical connector structure to perform the steps of the surface detection method of the electrical connector structure as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the steps of the surface detection method of the electrical connector structure as described in any one of claims 1-7 are implemented.
Citation Information
Cited By
Method and system for automatically detecting defects of static arc contact based on image recognition
CN120471921A
An automatic detection method and system for static arc contact defects based on image recognition
CN120471921B
Micro connector production quality detection method and system based on computer vision
CN120495294A
Micro connector production quality inspection method and system based on computer vision
CN120495294B
Radioactive substance multi-point synchronous detection and identification method and system
CN120705611A