Surface quality inspection method of connector production based on image processing
By performing affine transformation and wavelet transformation on the connector surface image, combined with filter cores of different directional scales to remove the inherent texture, the problem of low quality detection accuracy of connector surface is solved, and accurate extraction and quality judgment of abnormal areas are achieved .
Patent Information
- Application Number
- CN202211542460.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-12-02
AI Technical Summary
In the prior art, the accuracy of the connector surface quality detection is low, which affects the accurate detection of the connector surface quality, especially the inherent texture interferes with the detection of abnormal areas.
By performing affine transformation and wavelet transformation on the connector surface image, filtering is performed with multiple filter cores of different directional scales, the inherent texture is removed, and the quality index of the final abnormal area is obtained to judge the surface quality.
Accurate extraction and quality judgment of abnormal areas on the connector surface are achieved, reducing the impact of inherent texture on detection and improving detection accuracy.
Smart Images

Figure CN115861233B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a connector production surface quality detection method based on image processing. Background Art
[0002] With the continuous development of the connector industry, the precision requirements for connector mold parts are getting higher and higher, especially for the surface quality of precision connector parts, which has a great impact on the life of the connector. The surface quality of the connector determines the wear resistance and lubrication conditions of the connector. When the surface quality of the connector is oxidized, damaged, rough and uneven during the production process of the connector, the surface metal of the part will undergo structural changes, affecting the welding quality, and the wear will increase during subsequent use, and even peeling will occur. Therefore, the surface quality of the connector must be controlled within a certain range during the production process, and the detection of surface quality is crucial.
[0003] Currently, the appearance quality of connectors is mostly judged by manual visual inspection. This method is inefficient, has insufficient detection accuracy, and consumes manpower. Therefore, with the advent of the artificial intelligence era, the detection of connector surface anomalies is mostly done by directly performing threshold segmentation or directly detecting and identifying abnormal pixels on the image.
[0004] However, during the connector production process, its surface has a certain inherent texture. Therefore, when using threshold segmentation detection, the inherent texture will affect the detection and extraction of abnormal areas of surface defects, thereby affecting the detection accuracy of abnormal areas, and further affecting the accurate detection of connector surface quality. Summary of the invention
[0005] The present invention provides a connector production surface quality detection method based on image processing to solve the problem that the existing detection accuracy of abnormal areas is low, thereby affecting the accurate detection of connector surface quality.
[0006] A connector production surface quality detection method based on image processing of the present invention adopts the following technical solution:
[0007] Acquire a surface image of the connector;
[0008] Performing affine transformation on the surface image to obtain a transformed image, obtaining a detail layer image of the transformed image, performing filtering processing on the detail layer image according to preset filter kernels of multiple different directional scales to obtain a filtered image, and obtaining a first suspected abnormal area according to the filtered image and the detail layer image;
[0009] Performing wavelet transform on the transformed image to obtain the target image, using the horizontal detail component in the target image to obtain the final target image, performing inverse transform on the final target image to obtain the reconstructed image, and taking the closed area in the reconstructed image as the second suspected abnormal area;
[0010] Acquire a final abnormal region according to the first suspected abnormal region and the second suspected abnormal region;
[0011] Obtain a Gaussian model according to the pixel points corresponding to the non-final abnormal area in the surface image, and obtain a Gaussian value of each abnormal pixel point according to the pixel value of the abnormal pixel point in the final abnormal area and the Gaussian model;
[0012] The quality index of the connector is obtained according to the Gaussian values of all abnormal pixels in the final abnormal area, and whether the surface quality of the connector is qualified is judged according to the quality index and the preset quality index threshold.
[0013] Preferably, obtaining the quality index of the connector includes:
[0014] Get the sum of the Gaussian values of all abnormal pixels in the final abnormal area;
[0015] Perform inverse proportional calculation on the total number of abnormal pixels in the final abnormal area;
[0016] The quality index of the connector is obtained by adding the inverse proportional calculation result of the total number of abnormal pixels and the sum of the Gaussian values of all abnormal pixels.
[0017] Preferably, obtaining the first suspected abnormal area includes:
[0018] Obtain target pixel points whose positions in the filter image and detail layer image correspond and whose pixel values are all 0;
[0019] The area formed by all target pixels in the detail layer image is recorded as the first suspected abnormal area.
[0020] Preferably, the first suspected abnormal region and the second suspected abnormal region are intersected to obtain the final abnormal region.
[0021] Preferably, obtaining the filtered image includes:
[0022] The detail layer image is filtered according to a plurality of filter kernels of different directional scales to obtain a convolution image corresponding to the filter kernel of each directional scale;
[0023] According to the convolution image corresponding to the filter kernel of each directional scale and the preset weight of each convolution image, all convolution images are fused to obtain the filtered image.
[0024] Preferably, a two-layer wavelet transform is performed on the transformed image to obtain the target image.
[0025] Preferably, the wavelet coefficients of the horizontal detail components in the target image are set to 0 to obtain the final target image.
[0026] Preferably, when the quality index is greater than the quality index threshold, the surface quality of the connector is qualified, and when the quality index is less than or equal to the quality index threshold, the surface quality of the connector is unqualified.
[0027] The beneficial effects of the connector production surface quality detection method based on image processing of the present invention are:
[0028] Since the surface structural texture of the connector is relatively uniform during the production process, in order to facilitate analysis and filter out the influence of the inherent structural texture of the connector surface on quality inspection, the surface image is affine transformed to obtain a transformed image. The affine transformation is used to ensure that the direction of the connector inherent structural texture in the surface image of the connector to be inspected is horizontal, so as to facilitate the subsequent filtering of the connector inherent structural texture. Then, the detail layer image of the transformed image is filtered using multiple filter kernels of different directional scales, that is, the connector inherent structural texture in the detail layer image is filtered out through filtering to obtain the first suspected defect area in the detail layer image, thereby realizing the first filtering of the connector inherent structural texture. Affine transformation is performed to ensure that the direction of the connector's inherent structural texture in the surface image of the connector to be inspected is horizontal, so the transformed image is subjected to wavelet transform filtering processing, and the horizontal detail component after wavelet transform is filtered out to obtain the second suspected abnormal area, thereby achieving accurate removal of the connector's inherent structural texture in the surface image of the connector, that is, by filtering the inherent texture twice, accurate extraction of the abnormal area is achieved, that is, the final abnormal area is obtained based on the second suspected abnormal area and the first suspected abnormal area, and finally, the surface quality of the connector is judged according to the quality index of the final abnormal area, that is, the final abnormal area is quantified as a quality index, thereby achieving accurate judgment of the surface quality of the connector. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0030] Figure 1 The present invention is a flowchart of an embodiment of a connector production surface quality detection method based on image processing. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.
[0032] An embodiment of a connector production surface quality detection method based on image processing of the present invention is as follows: Figure 1 As shown, this implementation includes:
[0033] S1, obtaining a surface image of the connector;
[0034] Specifically, an image acquisition device is set up to capture images of the connector surface. The image acquisition device is a camera, wherein the specific deployment and viewing angle of the camera can be set by the implementer according to actual conditions. Then, a light source is set above the conveyor belt that conveys the connector. The light source is a ring light with uniform light emission. The implementer can also select and set the position and angle of the light source according to actual conditions to ensure uniform illumination on the surface of the connector to be inspected and avoid affecting the surface quality inspection of the connector, thereby realizing image acquisition of the produced connector to obtain the surface image of the connector.
[0035] S2, obtaining a first suspected abnormal area;
[0036] Specifically, an affine transformation is performed on the surface image to obtain a transformed image, a detail layer image of the transformed image is obtained, the detail layer image is filtered according to preset filter kernels of multiple different directional scales to obtain a filtered image, and the first suspected abnormal area is obtained according to the filtered image and the detail layer image.
[0037] Among them, taking into account that the surface structural texture of the connector is relatively uniform during the production process, in order to facilitate analysis and filter out the inherent structural texture on its surface, the present invention will perform an affine transformation on the collected surface image of the connector to obtain a transformed image, so that the direction of the inherent structural texture on the surface of the connector is uniformly maintained in the horizontal direction. The affine transformation process and the solution process of the affine transformation matrix are both existing well-known technologies, and the present invention will not make relevant elaborations. Then, through the affine transformation rotation process, it can be ensured that the direction of the inherent structural texture of the connector in the surface image of the connector to be inspected is in the horizontal direction, and the image after the affine transformation is recorded as the transformed image for subsequent system detection.
[0038] Among them, after obtaining the transformed image, in order to improve the detection and extraction of abnormal areas, this embodiment will further analyze the transformed image, filter out the inherent texture in the production process of the connector surface, and realize the extraction of abnormal areas, that is, obtain the detail layer image of the transformed image, that is, this embodiment separates the transformed image to obtain the corresponding base layer image and detail layer image. There are many image separation methods. The present invention adopts homomorphic filtering to realize the separation of the base layer image and the detail layer image of the transformed image, wherein the detail layer image mainly includes the edge detail texture information in the image.
[0039] Wherein, obtaining the filtered image includes: filtering the detail layer image according to multiple filter kernels of different directional scales to obtain the convolution image corresponding to the filter kernel of each directional scale; fusing all the convolution images according to the convolution image corresponding to the filter kernel of each directional scale and the preset weight of each convolution image to obtain the filtered image, that is, the steps of setting the filter kernels of multiple different directional scales are specifically as follows: considering that the surface inherent texture direction of the connector in the transformed image is horizontal, in order to ensure the accurate extraction of the inherent texture of the connector surface, therefore, in this embodiment, filter kernels of three directional scales of 0°, 30°, and 160° are set, and the settings of other parameters of the filter kernel are the prior art, that is, in this embodiment, the specific settings are: phase offset 0, aspect ratio 0.5, bandwidth 1, wavelength 5, and the implementer can set the values of other parameters of the filter kernel by himself. So far, a corresponding filter kernel can be obtained in each direction, and there are three filter kernels in total. Then, the corresponding detail layer image is filtered according to the filter kernel to obtain the convolution image corresponding to the filter kernel of each directional scale. Specifically, the detail layer image is convolution filtered by three filter kernels to obtain the corresponding three convolution images C. 0° , C 30° , C 160° , the convolution image C obtained by the filter kernel corresponding to the three directions of 0°, 30°, and 160° 0° , C 30° , C 160° The weights of are set to 0.5, 0.25, 0.25 respectively. Finally, according to the weights of the convolution image corresponding to the filter kernel of each direction scale and the preset convolution image, all the convolution images are fused to obtain the filtered image of the detail layer image. That is, the three convolution images C 0° , C 30° , C 160° The fusion process is performed to obtain the filtered image of the detail layer image (weighted summation of the corresponding positions to increase the influence of the filtered image obtained by the corresponding filter kernel in the horizontal direction), that is, the filtered image is C = 0.5C 0° +0.25C 30° +0.25C 160°, where C0° represents the convolution image obtained by the filter kernel with a scale in the 0° direction, C 30 ° represents the convolution image obtained by the filter kernel with a 30° direction scale, C 160 ° represents the convolution image obtained by the filter kernel with a 160° direction scale.
[0040] Among them, after obtaining the filtered image, this embodiment uses the pixel points with pixel values of 1 in the filtered image as the inherent texture information of the connector surface, and the pixel points with pixel values of 0 are suspected abnormal pixels. In order to facilitate subsequent analysis and the size and pixel position information of the detail layer image of the transformed image and the filtered image of the detail layer image are one-to-one corresponding. Therefore, this embodiment uses the pixel points in the detail layer image that have pixel values of 0 and corresponding positions in the filtered image of the detail layer image as target pixels, and uses the area formed by all target pixels as the first suspected abnormal area.
[0041] In order to facilitate the subsequent rapid extraction of the final abnormal area, this embodiment marks the pixel value of each pixel corresponding to the first suspected abnormal area in the detail layer image as 1, and sets the pixel value of the pixel points in other areas of the detail layer image to 0, so as to obtain the target binary image of the detail layer image.
[0042] At this point, the first suspected abnormal area was obtained.
[0043] S3, obtaining a second suspected abnormal area;
[0044] Specifically, wavelet transform is performed on the transformed image to obtain a target image, horizontal detail components in the target image are used to obtain a final target image, the final target image is inversely transformed to obtain a reconstructed image, and a region in the reconstructed image is used as the second suspected abnormal region.
[0045] In order to improve the detection and extraction accuracy of abnormal areas, the present embodiment will further accurately filter out the inherent texture of the connector surface in the transformed image to ensure accurate identification of the abnormal area on the connector surface, that is, the transformed image is subjected to wavelet transform to obtain a target image. In the present embodiment, a two-layer wavelet transform is adopted, and a total of 7 component images, namely 7 target images, are obtained by the two-layer wavelet transform. Since the direction of the inherent structural texture of the connector in the surface image of the connector to be detected is horizontal by using the affine transformation rotation process in step S2, that is, the inherent structural texture of the connector is mainly reflected as a horizontal detail component, so when filtering out the inherent structural texture of the connector, it is necessary to filter out the horizontal component information in the target image, and the vertical detail component and the diagonal detail component in the decomposed image obtained after the wavelet transform do not contain the inherent texture information of the connector surface, so the vertical detail component and the diagonal detail component do not need to be filtered. Based on this, the present embodiment sets the wavelet coefficient of the horizontal detail component in the target image (7 component images) to 0 to obtain the final target image, and then inversely transforms the final target image to obtain a reconstructed image, and the closed area in the reconstructed image is the second suspected abnormal area.
[0046] To facilitate the subsequent rapid extraction of the final abnormal area, this embodiment sets the pixel values of the pixels in the second suspected abnormal area in the reconstructed image to 1, and sets the pixel values of other inherent texture pixels to 0 to obtain the target binary image of the reconstructed image.
[0047] At this point, we have arrived at the second suspected abnormal area.
[0048] S4, obtaining the final abnormal area;
[0049] Specifically, the final abnormal area is obtained according to the first suspected abnormal area and the second suspected abnormal area, that is, the final abnormal area is obtained by finding the intersection of the first suspected abnormal area and the second suspected abnormal area. In order to facilitate the acquisition of the final abnormal area, this embodiment can also find the intersection of the target binary image of the detail layer image and the target binary image of the reconstructed image to obtain the final binary image, and use the closed area in the final binary image as the final abnormal area.
[0050] S5, obtaining the quality index of the connector and determining whether the quality of the connector is qualified;
[0051] Specifically, a Gaussian model is obtained based on the pixel points of the non-final abnormal area in the surface image, and the Gaussian value of each abnormal pixel is obtained based on the pixel value of the abnormal pixel points in the final abnormal area and the Gaussian model; the quality index of the connector is obtained based on the Gaussian values of all abnormal pixels in the final abnormal area, and whether the surface quality of the connector is qualified is judged based on the quality index and a preset quality index threshold.
[0052] Based on the analysis of the surface image of the connector in steps S1-S4 of this embodiment, the final abnormal area of the connector surface is accurately extracted. Considering that there is a certain tolerance for slight defects on the connector surface in actual situations, for the abnormal pixels in the final abnormal area, this embodiment will determine the quality index of the abnormal pixels based on the surface image of the connector, thereby accurately detecting the surface quality of the connector. That is, for the non-abnormal pixels in the surface image of the connector to be detected, that is, normal pixels, the present invention will construct a Gaussian model through a set of normal pixels. The process of fitting the Gaussian model based on the pixel values of normal pixels is an existing well-known technology and is not elaborated in detail in the present invention. For each abnormal pixel in the surface image of the connector to be detected, the present invention substitutes it into the Gaussian model to obtain the corresponding Gaussian value. The larger the Gaussian value, the higher the similarity between the abnormal pixel and the normal pixel. Otherwise, the larger the quality index of the abnormal pixel, the more it deviates from the characteristic information of the normal pixel, and the Gaussian value P of each abnormal pixel is obtained. u , where u = 1, 2, ..., M, M is the total number of abnormal pixels corresponding to the final abnormal area in the connector surface image to be detected, P u is the Gaussian value corresponding to the abnormal pixel u, so the quality index of the connector is obtained according to the Gaussian values of all abnormal pixels in the final abnormal area, that is, the sum of the Gaussian values of all abnormal pixels in the final abnormal area is obtained; the total number of abnormal pixels in the final abnormal area is inversely calculated; the inverse proportional calculation result of the total number of abnormal pixels is added to the sum of the Gaussian values of all abnormal pixels to obtain the quality index of the connector, where the calculation formula of the quality index of the connector is:
[0053]
[0054] In the formula, Q represents the quality index of the connector;
[0055] M is the total number of abnormal pixels corresponding to the final abnormal area in the surface image of the connector to be detected;
[0056] P u is the Gaussian value corresponding to the abnormal pixel u in the final abnormal area of the surface image of the connector to be detected;
[0057] It should be noted that the greater the total number of abnormal pixels, the worse the quality of the connector, that is, the smaller the quality index of the connector to be detected. When the Gaussian value of the abnormal pixel is greater, the smaller the abnormal degree of the connector to be detected, that is, the greater the quality index. The greater the sum of the Gaussian values of all abnormal pixels in the final abnormal area, the smaller the abnormal degree of the connector to be detected, that is, the greater the quality index of the connector to be detected, the higher the quality. Therefore, the Gaussian value of the abnormal pixel is proportional to the quality index of this embodiment, and the number of abnormal pixels is inversely proportional to the quality index. Secondly, The denominator is added with 1 to prevent the denominator from being 0.
[0058] In order to facilitate the setting of the quality index threshold, the quality index is normalized. In this embodiment, the quality index threshold is set to 0.5. When the normalized quality index is higher than the quality index threshold, it is considered that the surface quality of the connector is poor and needs to be reprocessed and repaired. Otherwise, the surface quality of the connector is considered to be qualified, and the surface abnormality is not obvious, which does not affect the later use and is within the allowable quality range. At this point, the surface quality of the connector is detected.
[0059] The present invention discloses a method for detecting the surface quality of connector production based on image processing. Since the surface structure texture of the connector is relatively uniform during the production process, in order to facilitate analysis and filter out the influence of the inherent structure texture of the connector surface on quality detection, an affine transformation is performed on the surface image to obtain a transformed image. The affine transformation is used to ensure that the direction of the inherent structure texture of the connector in the surface image of the connector to be detected is horizontal, so as to facilitate subsequent filtering of the inherent structure texture of the connector. Then, a filtering process is performed on the detail layer image of the transformed image using a plurality of filter kernels of different directional scales, that is, the inherent structure texture of the connector in the detail layer image is filtered out by filtering to obtain the first suspected defect area in the detail layer image, thereby realizing the detection of the inherent structure of the connector. The inherent structural texture is filtered out for the first time. Since the affine transformation is used to ensure that the direction of the connector's inherent structural texture in the surface image of the connector to be detected is horizontal, the transformed image is subjected to wavelet transform filtering processing, and the horizontal detail component after the wavelet transform is filtered out to obtain the second suspected abnormal area, thereby achieving accurate removal of the connector's inherent structural texture in the surface image of the connector. By removing the inherent texture twice, accurate extraction of the abnormal area is achieved, that is, the final abnormal area is obtained based on the second suspected abnormal area and the first suspected abnormal area. Finally, the surface quality of the connector is judged according to the quality index of the final abnormal area, that is, the final abnormal area is quantified as a quality index, thereby achieving accurate judgment of the surface quality of the connector.
[0060] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A connector production surface quality detection method based on image processing, It is characterized in that include: Acquire a surface image of the connector; Performing affine transformation on the surface image to obtain a transformed image, obtaining a detail layer image of the transformed image, performing filtering processing on the detail layer image according to preset filter kernels of multiple different directional scales to obtain a filtered image, and obtaining a first suspected abnormal area according to the filtered image and the detail layer image; Performing wavelet transform on the transformed image to obtain the target image, using the horizontal detail component in the target image to obtain the final target image, performing inverse transform on the final target image to obtain the reconstructed image, and taking the closed area in the reconstructed image as the second suspected abnormal area; The method of obtaining the final target image by using the horizontal detail components in the target image specifically includes: setting the wavelet coefficients of the horizontal detail components in the target image to 0 to obtain the final target image; Acquire a final abnormal region according to the first suspected abnormal region and the second suspected abnormal region; Obtain a Gaussian model according to the pixel points corresponding to the non-final abnormal area in the surface image, and obtain a Gaussian value of each abnormal pixel point according to the pixel value of the abnormal pixel point in the final abnormal area and the Gaussian model; The quality index of the connector is obtained according to the Gaussian values of all abnormal pixels in the final abnormal area, and whether the surface quality of the connector is qualified is judged according to the quality index and the preset quality index threshold.
2. According to claim 1, a connector production surface quality detection method based on image processing, It is characterized in that The quality indicators of the connector include: Get the sum of the Gaussian values of all abnormal pixels in the final abnormal area; Perform inverse proportional calculation on the total number of abnormal pixels in the final abnormal area; The quality index of the connector is obtained by adding the inverse proportional calculation result of the total number of abnormal pixels and the sum of the Gaussian values of all abnormal pixels.
3. According to claim 1, a connector production surface quality detection method based on image processing, It is characterized in that Obtaining the first suspected abnormal area includes: Obtain target pixel points whose positions in the filter image and detail layer image correspond and whose pixel values are all 0; The area formed by all target pixels in the detail layer image is recorded as the first suspected abnormal area.
4. According to claim 1, a connector production surface quality detection method based on image processing, It is characterized in that The final abnormal area is obtained by finding the intersection of the first suspected abnormal area and the second suspected abnormal area.
5. According to claim 1, a connector production surface quality detection method based on image processing, It is characterized in that Obtaining the filtered image includes: The detail layer image is filtered according to a plurality of filter kernels of different directional scales to obtain a convolution image corresponding to the filter kernel of each directional scale; According to the convolution image corresponding to the filter kernel of each directional scale and the preset weight of each convolution image, all convolution images are fused to obtain the filtered image.
6. The connector production surface quality detection method based on image processing according to claim 1, It is characterized in that The target image is obtained by performing a two-layer wavelet transform on the transformed image.
7. The connector production surface quality detection method based on image processing according to claim 1, It is characterized in that When the quality index is greater than the quality index threshold, the surface quality of the connector is qualified, and when the quality index is less than or equal to the quality index threshold, the surface quality of the connector is unqualified.
