Abnormal defect detection method for terminal welding
By using multi-source image acquisition and photometric stereo processing algorithms, combined with reflectivity and color space conversion, the error problems caused by light and dust in terminal welding defect detection are solved, achieving high-precision defect identification.
Patent Information
- Application Number
- CN202511546126.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-10-28
AI Technical Summary
Traditional methods for detecting terminal welding defects are easily affected by light and dust, resulting in insufficient detection accuracy.
By employing a multi-source image acquisition module combined with photometric stereo algorithm and enhanced kernel function filtering technology, and through reflectivity image processing and color space conversion, multi-angle image fusion and threshold segmentation are performed to identify welding defects.
It effectively reduces interference from light and dust, improves the accuracy of welding defect detection, and accurately identifies minute abnormal defects.
Smart Images

Figure CN121033022A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing technology, and in particular to a method for detecting abnormal defects in terminal welding. Background Technology
[0002] Terminals, also known as wiring terminals, are important connecting components widely used in electronic and electrical equipment. The main function of a terminal is to provide a connection endpoint for a circuit, allowing wires or cables to be connected or disconnected. They also provide additional protection for circuit connections, preventing wires from becoming loose or disconnected, thereby improving the stability and durability of equipment and ensuring the normal operation of various electronic and electrical devices. Terminals not only increase the stability of electrical signals and current transmission but also make connecting and securing circuits between different devices more convenient and faster, reducing the workload required for the installation and maintenance of electronic equipment. In recent years, with the rapid development of China's electronics and electrical industry, the popularization of electronic products and the increasing complexity of electrical equipment, the market demand for terminals has been continuously increasing, resulting in a large number of diverse terminal types with varying functions, and increasingly higher requirements for terminal performance and quality.
[0003] Currently, Chinese invention patent application number CN202310993735.8 discloses a method for detecting manufacturing defects in electrical terminals. The method includes: acquiring a surface image of the electrical terminal to be inspected and determining whether the acquired surface image contains suspicious connected components; if the acquired surface image contains suspicious connected components, calculating a first confidence factor based on the grayscale distribution characteristics of the pixels in the suspicious connected components; calculating a second confidence factor based on the texture characteristics of the pixels in the suspicious connected components; determining the confidence level of the suspicious connected components based on the first and second confidence factors; and determining whether the electrical terminal to be inspected has defects based on the confidence level of the suspicious connected components. This application's method performs in-depth analysis and calculation of the grayscale distribution and texture characteristics within the region, achieving defect detection and identification. However, due to the numerous types and shapes of terminals, this application mainly targets terminal dents, thus limiting its applicability. Furthermore, in specific applications, defects in the terminal welding area are the most common problem affecting terminal quality. Abnormal defects in terminal welding include arc craters, weld beads, undercut, deformation, and cracks. Since most terminals are within a few centimeters in size and specifications, their welding defects are usually very small. Therefore, when using traditional methods to acquire and inspect terminals, errors can easily occur due to adverse effects such as light and dust, resulting in insufficient accuracy in defect detection. Summary of the Invention
[0004] The technical problem solved by this invention is that when using traditional methods to acquire and inspect terminals, errors are easily caused by adverse effects such as light and dust, resulting in insufficient accuracy in defect detection.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: A method for detecting abnormal defects in terminal welding, specifically including the following steps: Step 1: The welding area of the terminal to be tested is acquired using a multi-light source image acquisition module to obtain single-light source images and uniform light source images; Step 2: The reflectance image is calculated from the single-source image using a photometric stereo algorithm. A reflectance grayscale image is obtained through bilateral filtering and nonlinear transformation using an enhanced kernel function. The logarithmic amplitude-frequency characteristic is obtained by performing a Fourier transform on the reflectance grayscale image. A frequency domain interest map is obtained through mean filtering and difference calculation. A logical image is obtained by binary matrix sampling of the reflectance grayscale image. A two-dimensional interest map is obtained through feature extraction using a conditional probability model. Feature pixels are selected by performing two pixel filtering and maximum suppression operations on the reflectance grayscale image to obtain the texture interest map. Step 3: Perform HSV color space conversion on the uniform light source image, filter the chroma channels, and calculate the color interest map using the paradigm distance model; Step 4: Interest Image Fusion. Threshold segmentation is performed on the fused image and defects are marked to complete the identification of surface defects in the texture image.
[0006] In a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, the welding area of the terminal to be inspected is captured by a multi-light source image acquisition module, wherein the multi-light source image acquisition module specifically includes: Four identical, highly uniform strip-shaped LED lights, a CCD camera fixed vertically above the inspection stage, and the inspection stage itself. The four highly uniform strip-shaped LED lights are equidistantly fixed on a plane centered on the camera, and each forms a horizontal alignment with the camera. The angle between the four uniform LED strips is such that their horizontal height, illuminance, and vertical incident angle are all the same, and the vertical incident angle is [missing information]. .
[0007] When acquiring images using the multi-light source image acquisition module, four strip-shaped highly uniform LED lights are first simultaneously activated to acquire one uniform light source image. Then, one strip-shaped highly uniform LED light is activated sequentially to acquire four single-light source images. That is, five images are acquired for the welded portion of each terminal to be inspected, including one uniform light source image and four single-light source images. Furthermore, fixing the CCD camera 10 to 15 centimeters from the center of the inspection stage allows for close-range illumination and imaging, effectively reducing total internal reflection and improving the accuracy of the Lambertian reflection model in subsequent image processing. Moreover, the terminals are typically small in size, and close-range imaging does not affect image acquisition.
[0008] In a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, a system of linear equations is established using the Lambertian reflection model, and the reflectance value of each pixel is calculated using the least squares method to obtain a reflectance image. The calculation expression is as follows: , ;
[0009] in, This represents the brightness of a pixel in the i-th single-light source image. Indicates reflectivity, Let represent the unit direction vector of the i-th light source. Surface unit normal vector This represents the brightness matrix of pixels in four single-light source images. This represents a matrix consisting of the unit direction vectors of the four light sources, and T represents the matrix transpose. This indicates taking the Euclidean norm.
[0010] In a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, the reflectance image is denoised by bilateral filtering with enhanced spatial kernel function, and a reflectance grayscale image is obtained by nonlinear transformation of the denoised reflectance image, the calculation expression of which is:
[0011]
[0012] Where D represents the enhanced spatial domain kernel, Indicates the center pixel, Represents neighboring pixels, Indicates the standard deviation of the normal distribution. Indicates coordinates as The pixel grayscale value, denoted by reflectivity, and c represents the compensation coefficient. The index represents the grayscale mapping exponent, and e represents the natural constant. This represents the normative distance.
[0013] In a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, the image amplitude is obtained by performing a Fourier transform on the reflection grayscale image, and then median filtering is performed after taking the natural logarithm of the image amplitude. The frequency domain interest map is then obtained by calculating the difference, and its calculation expression is as follows:
[0014] in, Represents a grayscale image of reflection. Represents a frequency domain interest map. Indicates Fourier transform, This indicates mean filtering. It represents the natural logarithm.
[0015] In a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, a logical image is obtained by performing a binary matrix sampling operation on the reflective grayscale image, and a two-dimensional feature map is obtained by feature extraction using a conditional probability model. The calculation expression is as follows:
[0016] in, Represents a two-dimensional interest graph. Represents a logical image. Indicates feature prominence. This represents the probability distribution of the logical image given an input reflective grayscale image. d represents integration, and d represents the differential symbol.
[0017] As a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, the method includes: obtaining candidate feature points by initial screening of pixels in a reflection grayscale image, obtaining selected feature points by secondary screening, and obtaining a texture interest map by performing non-maximum suppression on the selected feature points. The specific steps include: For the initial screening of pixels to be detected, a circle is drawn with the pixel to be detected as the center and a radius of one pixel. Eight pixels on the circumference are selected, and their differences from the pixel to be detected are calculated to obtain eight grayscale difference values. The absolute values of these eight grayscale difference values are then compared with a threshold value. When comparing, if the absolute value of three or more grayscale differences is greater than or equal to the threshold... When the pixel to be detected is determined to be a candidate feature point; A secondary screening is performed on the pixels to be detected. A circle is drawn with the candidate feature point as the center and the length of three pixels as the radius. Sixteen pixels on the circumference are selected and their differences from the candidate feature point are calculated to obtain sixteen grayscale difference values. If there are eight or more consecutive grayscale difference values with an absolute value greater than or equal to a threshold, the detection is successful. When the candidate feature point is selected, it is determined to be the winning feature point. Non-maximum suppression is applied to the selected feature points. The absolute values of the sixteen gray-level differences obtained from the corresponding secondary screening of the selected feature points are calculated and accumulated to obtain the influence coefficient. A circle is drawn with the selected feature point as the center and the length of three pixels as the radius. Other selected feature points on the circumference are selected and their influence coefficients are compared with those of the selected feature point at the center. When the influence coefficient of the selected feature point at the center is the largest, it is retained. All the retained selected feature points are combined to obtain the texture interest map.
[0018] In a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, the uniform light source image is converted to HSV color space, the chroma channel is Gaussian filtered, and a color interest map is obtained through a normative distance model, the calculation expression of which is:
[0019] in, Indicates chromaticity characteristics, Indicates average chromaticity. Indicates scaling weights. Indicates coordinates as The pixel chromaticity value, Indicates Gaussian filtering. This indicates taking the Euclidean norm.
[0020] In a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, the frequency domain interest map, two-dimensional interest map, texture interest map, and color interest map are subjected to image weighted fusion to obtain a defect feature map, the calculation expression of which is:
[0021] in, Represents a defect feature map. Represents a frequency domain interest map. Represents a two-dimensional interest graph. Represents a texture interest map. Represents a reflectance image. Representing color interest maps, Represents the normalization function. Indicates the weight parameter, This represents the matrix element-wise multiplication operation. This represents the addition operation of matrix elements.
[0022] As a preferred embodiment of the abnormal defect detection method for terminal welding described in this invention, the following steps are performed: a threshold segmentation is performed on the defect feature map to obtain a binarized image; defect pixels are marked using a connected component marking method to obtain an output defect image; an empty stack is created for connected component marking, and a counter is set for marking connected components. Starting from the top left corner of the image, each pixel is scanned in a left-to-right, top-to-bottom order. When an unmarked pixel is scanned, its coordinates are pushed onto the stack, and a unique label is assigned to the connected component in the data structure. Connected component marking is performed by taking the coordinates of a pixel from the stack and checking the pixels in its 4-neighborhood. If a neighboring pixel has the same value as the current pixel and is not marked, the coordinates of the neighboring pixel are pushed onto the stack, and it is marked as the same connected component as the current pixel in the data structure. Marked pixels are skipped during the scanning process to avoid duplicate marking. The above process is repeated until the stack is empty. The remaining part of the image is scanned, and the above steps are repeated for unmarked pixels until the defect marking is completed and the image is output. The threshold segmentation calculation expression is:
[0023] in, This indicates that the coordinates in the output defect image are... The grayscale value of a pixel. This indicates that the coordinates in the binarized image are... The grayscale value of a pixel. This represents the segmentation threshold.
[0024] The beneficial effects of this invention are as follows: Obtaining multi-angle images of the terminal welding section through a multi-light source image acquisition module helps reduce lighting errors easily generated by traditional image acquisition methods, such as excessive reflection and redundant shadow interference. Simultaneously, considering the non-uniform and irregular three-dimensional structure of the terminal welding point, a reflectance map is obtained by partially selecting a photometric stereo algorithm, avoiding the three-dimensional reconstruction operation in the complete photometric stereo algorithm. This fully utilizes the image information from multiple light sources while effectively reducing computational complexity. Noise reduction of the reflectance image is achieved through bilateral filtering with enhanced spatial kernel functions, which is beneficial for subsequent image analysis and processing. Defect features are extracted from different angles to obtain frequency domain interest maps, two-dimensional interest maps, texture interest maps, and color interest maps. The texture interest map effectively highlights all possible defect parts in the reflectance grayscale image, the two-dimensional interest map effectively identifies minor defects, and the frequency domain interest map effectively distinguishes defects from the interference of dust and dirt. The frequency domain interest map, two-dimensional interest map, and texture interest map are all obtained by processing the reflectance map. The color interest map obtained through uniform light source image processing helps to supplement defect features from the perspective of image colorimetry. The image acquisition and processing method of the present invention helps to overcome errors caused by adverse factors such as light and dust, and effectively improves the detection accuracy of abnormal defects in terminal welding. Attached Figure Description
[0025] Figure 1 A basic framework diagram provided for one embodiment of the present invention; Figure 2 This is a flowchart illustrating an embodiment of the present invention. Detailed Implementation
[0026] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0027] Example 1, referring to Figure 1 and Figure 2 As an embodiment of the present invention, a method for detecting abnormal defects in terminal welding is provided, comprising: Step 1: The welding area of the terminal to be tested is acquired using a multi-light source image acquisition module to obtain single-light source images and uniform light source images; Step 2: The reflectance image is obtained by calculating the single-source image using a photometric stereo algorithm. The reflectance grayscale image is obtained by bilateral filtering and nonlinear transformation using an enhanced kernel function. The logarithmic amplitude-frequency characteristic is obtained by performing a Fourier transform on the reflectance grayscale image. The frequency domain interest map is obtained by mean filtering and difference calculation. The logical image is obtained by binary matrix sampling of the reflectance grayscale image. The two-dimensional interest map is obtained by feature extraction using a conditional probability model. Feature pixels are selected by performing two pixel point screening and maximum suppression operations on the reflectance grayscale image to obtain the texture interest map. Step 3: Perform HSV color space conversion on the uniform light source image, filter the chroma channels, and calculate the color interest map using the paradigm distance model; Step 4: Perform weighted fusion on the obtained interest map to obtain the defect feature map, perform threshold segmentation on the defect feature map and mark the defects to complete the identification of terminal welding defects.
[0028] In this embodiment, an image acquisition module is used to acquire images of the welding area of the terminal to be inspected. The multi-source image acquisition module specifically includes: Four identical strip-shaped, highly uniform LED lights, a CCD camera fixed vertically above the inspection platform, and the inspection platform itself; The four strip-shaped, highly uniform LED lights are fixed on a plane centered on the camera and form a line with the camera. The horizontal angle between the four strip-shaped, highly uniform LED lights is such that their illuminance, horizontal height, and vertical incident angle are all the same, and the vertical incident angle is selected accordingly. The lighting effect is optimal; The multi-light source image acquisition module acquires images of the welding area of each terminal to be inspected. Simultaneously, four highly uniform LED strips are activated to acquire one uniform light source image, and one highly uniform LED strip is activated sequentially to acquire four single-light source images. Furthermore, a CCD camera is fixed 10-15 cm from the center of the inspection stage. Close-range illumination and imaging effectively reduce total internal reflection caused by light, significantly improving the accuracy of the Lambertian reflection model in subsequent image processing. Moreover, the terminals are typically small, and close-range imaging does not affect image acquisition.
[0029] The multi-light source image acquisition module can illuminate the terminal to be inspected from four angles. When illuminated by a single light source, shadows can highlight minute defects that are difficult to detect under uniform lighting, but at the same time, shadows can also increase the probability of false identification. By using multiple light sources to illuminate from multiple angles sequentially, minute abnormal defects can be fully detected and false identification can be reduced.
[0030] In this embodiment, a system of linear equations is established using the Lambert reflection model, and the reflectance value of each pixel is calculated using the least squares method to obtain a reflectance image. The calculation expression is as follows: , ;
[0031] in, This represents the brightness of a pixel in the i-th single-light source image. Indicates reflectivity, Let represent the unit direction vector of the i-th light source. Surface unit normal vector This represents the brightness matrix of pixels in four single-light source images. This represents a matrix consisting of the unit direction vectors of the four light sources, and T represents the matrix transpose. This indicates taking the Euclidean norm.
[0032] The reflectance map is obtained by partially selecting the photometric stereo algorithm, thus avoiding the three-dimensional reconstruction operation in the complete photometric stereo algorithm. This fully utilizes the image information from multiple light sources and effectively reduces the computational complexity.
[0033] In this embodiment, the reflectance image is denoised by bilateral filtering with enhanced spatial kernel function, and the denoised reflectance image is then subjected to nonlinear transformation to obtain a reflectance grayscale image, the calculation expression of which is:
[0034]
[0035] Where D represents the enhanced spatial domain kernel, Indicates the center pixel, Represents neighboring pixels, Indicates the standard deviation of the normal distribution. Indicates coordinates as The pixel grayscale value, denoted by reflectivity, and c represents the compensation coefficient. The index represents the grayscale mapping exponent, and e represents the natural constant. This represents the normal distance.
[0036] In this embodiment, the image amplitude is obtained by performing a Fourier transform on the reflection grayscale image, and then the natural logarithm of the image amplitude is taken followed by median filtering. The frequency domain interest map is obtained by calculating the difference, and its calculation expression is as follows:
[0037] in, Represents a grayscale image of reflection. Represents a frequency domain interest map. Indicates Fourier transform, This indicates mean filtering. It represents the natural logarithm. Frequency domain features are used to effectively distinguish target defects from dust and dirt.
[0038] In this embodiment, a logical image is obtained by performing binary matrix sampling on the reflectance grayscale image, and a two-dimensional feature map is obtained by feature extraction using a conditional probability model. The calculation expression is as follows:
[0039] in, Represents a two-dimensional interest graph. Represents a logical image. Indicates feature prominence. It represents the probability distribution of the logical image under the condition of input reflection grayscale image, which is helpful for the identification of minor defects.
[0040] In this embodiment, the abnormal defect detection method for terminal welding as described in claim 1 is characterized by: obtaining candidate feature points through initial screening of reflection grayscale image pixels, obtaining selected feature points through secondary screening, and obtaining a texture interest map by performing non-maximum suppression on the selected feature points. The specific steps include: For the initial screening of pixels to be detected, a circle is drawn with the pixel to be detected as the center and a radius of one pixel. Eight pixels on the circumference are selected, and their differences from the pixel to be detected are calculated to obtain eight grayscale difference values. The absolute values of these eight grayscale difference values are then compared with a threshold value. When comparing, if the absolute value of three or more grayscale differences is greater than or equal to the threshold... When the pixel to be detected is determined to be a candidate feature point; A secondary screening is performed on the pixels to be detected. A circle is drawn with the candidate feature point as the center and the length of three pixels as the radius. Sixteen pixels on the circumference are selected and their differences from the candidate feature point are calculated to obtain sixteen grayscale difference values. If there are eight or more consecutive grayscale difference values with an absolute value greater than or equal to a threshold, the detection is successful. When the candidate feature point is selected, it is determined to be the winning feature point. Non-maximum suppression is applied to the selected feature points. The absolute values of the sixteen grayscale differences obtained from the corresponding secondary screening of the selected feature points are calculated and accumulated to obtain the influence coefficient. A circle is drawn with the selected feature point as the center and a radius of three pixels. Other selected feature points on the circumference are selected and their influence coefficients are compared with those of the selected feature point at the center. The selected feature point with the largest influence coefficient is retained. This process is repeated for all pixels to obtain a texture interest map. The image size of the terminal welding section is usually small; secondary screening is beneficial for efficiently detecting all possible defects in the image.
[0041] In this embodiment, the uniform light source image is converted to HSV color space, the chroma channel is Gaussian filtered, and a color interest map is obtained through the normative distance model. The calculation expression is as follows:
[0042] in, Indicates chromaticity characteristics, Indicates average chromaticity. Indicates scaling weights. Indicates coordinates as The pixel chromaticity value, Indicates Gaussian filtering. This indicates the use of the Euclidean norm. The reflectance image is calculated based on the brightness of the reflected light, while the color interest map is helpful in supplementing defect identification from the perspective of image chromaticity.
[0043] In this embodiment, the frequency domain interest map, two-dimensional interest map, texture interest map, and color interest map are subjected to image weighted fusion to obtain a defect feature map, the calculation expression of which is:
[0044] in, Represents a defect feature map. Represents a frequency domain interest map. Represents a two-dimensional interest graph. Represents a texture interest map. Represents a reflectance image. Representing color interest maps, Represents the normalization function. Indicates the weight parameter. This represents the matrix element-wise multiplication operation. This represents the addition operation of matrix elements.
[0045] In this embodiment, a binarized image is obtained by thresholding the defect feature map. The defect pixels are then labeled using a connected component labeling method to obtain the output defect image. An empty stack is created for connected component labeling, and a counter is set for labeling connected components. Starting from the top left corner of the image, each pixel is scanned from left to right and from top to bottom. When an unlabeled pixel is scanned, its coordinates are pushed onto the stack, and a unique label is assigned to the connected component in the data structure. Connected component labeling is performed by retrieving the coordinates of a pixel from the stack and checking its four neighboring pixels. If a neighboring pixel has the same value as the current pixel and is not labeled, its coordinates are pushed onto the stack, and it is labeled as a connected component with the same value as the current pixel in the data structure. Labeled pixels are skipped during the scan to avoid duplicate labeling. This process is repeated until the stack is empty. The remaining portion of the image is scanned, and the above steps are repeated for unlabeled pixels until the defect labeling is completed and the image is output. The thresholding calculation expression is:
[0046] in, This indicates that the coordinates in the output defect image are... The grayscale value of a pixel. This indicates that the coordinates in the binarized image are... The grayscale value of a pixel. This represents the segmentation threshold.
[0047] In this embodiment, multi-angle images of the terminal welding section are obtained through a multi-light source image acquisition module, which helps to reduce lighting errors easily generated by traditional image acquisition methods, such as excessive reflection and redundant shadow interference. Considering the non-uniform and irregular three-dimensional structure of the terminal welding point, a reflectance map is obtained by partially selecting a photometric stereo algorithm, avoiding the three-dimensional reconstruction operation in the complete photometric stereo algorithm. This fully utilizes the image information from multiple light sources while effectively reducing computational complexity. Noise reduction of the reflectance image is achieved through bilateral filtering with an enhanced spatial kernel function, which is beneficial for subsequent image analysis and processing. Defect features are extracted from different angles to obtain frequency domain interest maps, two-dimensional interest maps, texture interest maps, and color interest maps. The texture interest map effectively highlights all possible defect parts in the reflectance grayscale image, the two-dimensional interest map effectively identifies minor defects, and the frequency domain interest map effectively distinguishes defects from the interference of dust and dirt. The frequency domain interest map, two-dimensional interest map, and texture interest map are all obtained by processing the reflectance map. The color interest map obtained through uniform light source image processing helps to supplement defect features from the perspective of image colorimetry. The image acquisition and processing method of the present invention helps to overcome errors caused by adverse factors such as light and dust, and effectively improves the detection accuracy of abnormal defects in terminal welding.
[0048] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0049] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for detecting abnormal defects in terminal welding, characterized in that, include: Step 1: The welding area of the terminal to be tested is acquired using a multi-light source image acquisition module to obtain single-light source images and uniform light source images; Step 2: The reflectance image is obtained by calculating the single-source image using a photometric stereo algorithm. The reflectance grayscale image is obtained by bilateral filtering and nonlinear transformation using an enhanced kernel function. The logarithmic amplitude-frequency characteristic is obtained by performing a Fourier transform on the reflectance grayscale image. The frequency domain interest map is obtained by mean filtering and difference calculation. The logical image is obtained by binary matrix sampling of the reflectance grayscale image. The two-dimensional interest map is obtained by feature extraction using a conditional probability model. Feature pixels are selected by performing two pixel point screening and maximum suppression operations on the reflectance grayscale image to obtain the texture interest map. Step 3: Perform HSV color space conversion on the uniform light source image, filter the chroma channels, and calculate the color interest map using the paradigm distance model; Step 4: The obtained frequency domain interest map, two-dimensional interest map, texture interest map and color interest map are weighted and fused to obtain a defect feature map. Threshold segmentation and defect labeling are performed on the defect feature map to complete the identification of terminal welding defects.
2. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: The multi-light source image acquisition module acquires images of the welding area of the terminal to be inspected. Specifically, the multi-light source image acquisition module includes: Four identical strip-shaped, highly uniform LED lights, a CCD camera fixed vertically above the inspection platform, and the inspection platform itself; The four strip-shaped, highly uniform LED lights are fixed on a plane centered on the CCD camera and form a plane with the CCD camera. The horizontal angle between the four strip-shaped high uniform LED lights is the same, and the light intensity, horizontal height and vertical incident angle are all the same. The multi-light source image acquisition module obtains the welding area image of each terminal to be tested, and simultaneously turns on four strip-shaped high uniformity LED lights to illuminate and acquire a uniform light source image. Then, one strip-shaped high uniformity LED light is turned on in turn to illuminate and four single light source images are acquired.
3. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: A system of linear equations is established using the Lambert reflection model, and the reflectance value of each pixel is calculated using the least squares method to obtain the reflectance image. The calculation expression is as follows: , ; ; in, This represents the brightness of a pixel in the i-th single-light source image. Indicates reflectivity, Let represent the unit direction vector of the i-th light source. Surface unit normal vector This represents the brightness matrix of pixels in a single-source image. Let T represent the matrix consisting of the unit direction vectors of the four light sources, and let T denote the matrix transpose operation. This indicates taking the Euclidean norm.
4. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: The reflectance image is denoised by bilateral filtering with enhanced spatial kernel function. A nonlinear transformation is then performed on the denoised reflectance image to obtain a reflectance grayscale image, the calculation expression of which is: ; ; Where D represents the enhanced spatial domain kernel, Indicates the center pixel, Represents neighboring pixels, Indicates the standard deviation of the normal distribution. Indicates coordinates as The pixel grayscale value, c represents reflectivity, and c represents the compensation coefficient. The index represents the grayscale mapping exponent, and e represents the natural constant. This represents the normal distance.
5. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: The image amplitude is obtained by performing a Fourier transform on the reflection grayscale image. After taking the natural logarithm of the image amplitude, a median filter is applied. The frequency domain interest map is then calculated by subtraction. The calculation expression is as follows: ; in, Represents a grayscale image of reflection. Represents a frequency domain interest map. Indicates Fourier transform, This indicates mean filtering. It represents the natural logarithm.
6. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: A logical image is obtained by performing binary matrix sampling on the reflectance grayscale image. A two-dimensional feature map is then extracted using a conditional probability model. The calculation expression for this feature map is as follows: ; in, Represents a two-dimensional interest graph. Represents a logical image. Indicates feature prominence. This represents the probability distribution of the logical image given an input reflective grayscale image. d represents integration, and d represents the differential symbol.
7. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: Candidate feature points are obtained by initial screening of pixels in the reflection grayscale image, and the winning feature points are obtained by secondary screening. Non-maximum suppression is then applied to the winning feature points to obtain a texture interest map. The specific steps include: For the initial screening of pixels to be detected, a circle is drawn with the pixel to be detected as the center and a radius of one pixel. Eight pixels on the circumference are selected, and their differences from the pixel to be detected are calculated to obtain eight grayscale difference values. The absolute values of these eight grayscale difference values are then compared with a threshold value. When comparing, if the absolute value of three or more grayscale differences is greater than or equal to the threshold... When the pixel to be detected is determined to be a candidate feature point; A secondary screening is performed on the pixels to be detected. A circle is drawn with the candidate feature point as the center and the length of three pixels as the radius. Sixteen pixels on the circumference are selected and their differences from the candidate feature point are calculated to obtain sixteen grayscale difference values. If there are eight or more consecutive grayscale difference values with an absolute value greater than or equal to a threshold, the detection is successful. When the candidate feature point is selected, it is determined to be the winning feature point. Non-maximum suppression is applied to the selected feature points. The absolute values of the sixteen gray-level differences obtained from the corresponding secondary screening of the selected feature points are calculated and accumulated to obtain the influence coefficient. A circle is drawn with the selected feature point as the center and the length of three pixels as the radius. Other selected feature points on the circumference are selected and their influence coefficients are compared with those of the selected feature point at the center. The selected feature point at the center is retained when its influence coefficient is the largest, thus obtaining the texture interest map.
8. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: The uniform light source image is converted to HSV color space, and the chroma channel is Gaussian filtered. A color interest map is obtained through the normative distance model, and its calculation expression is as follows: ; in, Indicates chromaticity characteristics, Indicates average chromaticity. Indicates scaling weights. Indicates coordinates as The pixel chromaticity value, Indicates Gaussian filtering. This indicates taking the Euclidean norm.
9. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: Image weighted fusion is performed on the frequency domain interest map, two-dimensional interest map, texture interest map, and color interest map to obtain the defect feature map, the calculation expression of which is: ; in, Represents a defect feature map. Represents a frequency domain interest map. Represents a two-dimensional interest graph. Represents a texture interest map. Represents a reflectance image. Representing color interest maps, Represents the normalization function. Indicates the weight parameter. This represents the matrix element-wise multiplication operation. This represents the addition operation of matrix elements.
10. The method for detecting abnormal defects in terminal welding as described in claim 1, characterized in that: Thresholding segmentation of the defect feature map yields a binarized image. Connected component labeling is then used to label the pixels in the binarized image to obtain the output defect image. The calculation expression is as follows: ; in, This indicates that the coordinates in the output defect image are... The grayscale value of a pixel. Indicates the coordinates in the binarized image. The grayscale value of a pixel. This represents the segmentation threshold.
Citation Information
Patent Citations
A method for detecting manufacturing defects in electrical terminals
CN116758056B
Marine metal plate welding defect identification method
CN115294118A
Metal surface defect detection method and system based on multi-angle image exposure fusion
CN117115610A
Chip surface defect detection system and method based on photometric stereoscopic vision
CN118483237A
Defect detection and analysis method and system based on photometry
CN118887165A
Cited By
Automatic flat cable detection equipment
CN122252403A