Metal button electroplating uniformity evaluation method based on machine vision
By acquiring grayscale and depth maps of metal buttons, and using region growing algorithms and filtering and denoising techniques, the defect types of metal buttons are identified. This solves the problem of inaccurate electroplating uniformity assessment under the influence of local lighting blind spots, and achieves accurate electroplating uniformity assessment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUIZHOU HENGXINGLONG TECHNOLOGY CO LTD
- Filing Date
- 2026-02-02
- Publication Date
- 2026-05-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The uneven structure of metal buttons is affected by the local light blind spots formed by the sidewalls, making it difficult to distinguish between structural shadows, metal reflections and real defects, resulting in inaccurate electroplating uniformity assessment results.
By acquiring grayscale and depth maps of metal buttons, a region growing algorithm is used to obtain the region to be identified. The depth gradient and grayscale gradient are combined for filtering and noise reduction to establish a high-frequency texture feature vector, identify the defect type, calculate the comprehensive impact of the defect, and obtain the electroplating uniformity evaluation result.
It effectively distinguishes between structural shadows and actual defects, improves the accuracy of electroplating uniformity assessment, eliminates interference from local light blind spots, and achieves objective quantitative assessment of the electroplating uniformity of metal buttons.
Smart Images

Figure CN122023352A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of visual inspection technology, specifically to a machine vision-based method for evaluating the uniformity of electroplating on metal buttons. Background Technology
[0002] Metal buttons are key accessories for clothing and bags, and the uniformity of electroplating directly determines their appearance, texture, corrosion resistance, and lifespan. Using machine vision to assess the uniformity of metal button electroplating allows for quantitative evaluation based on objective and consistent standards, eliminating subjective bias and significantly reducing the evaluation time for a single button.
[0003] In the process of evaluating the uniformity of electroplating of metal buttons based on machine vision, the engraved logo characters, grooves, buttonholes and other areas of the metal buttons are affected by the local light blind spots formed by the side walls, which makes the structural shadows, metal reflections and real defects confused and difficult to identify, resulting in inaccurate evaluation results of the uniformity of electroplating of metal buttons. Summary of the Invention
[0004] This application provides a machine vision-based method for evaluating the uniformity of electroplating in metal buttons. This method addresses the problem that the uneven structure of metal buttons is affected by localized illumination blind spots formed by the sidewalls, making it difficult to distinguish between structural shadows, metallic reflections, and actual defects, thus leading to inaccurate evaluation results for the uniformity of metal button electroplating. The specific technical solution adopted is as follows: One embodiment of this application provides a machine vision-based method for evaluating the uniformity of electroplating on metal buttons, the method comprising the following steps: Acquire grayscale and depth maps of metal buttons after spatial alignment processing, and obtain the region to be confirmed in the depth map based on the difference between the depth values of all pixels in the depth map; Based on the grayscale and depth values of the pixels in the region to be confirmed, the base gradient, detail gradient, and depth gradient of the pixels are calculated respectively. Based on the depth gradient and base gradient of the pixels in the region to be confirmed, a guided filter is selected to perform the first denoising of the region to be confirmed, and the region to be confirmed with the first denoising effect quality meets the standard is obtained. The region to be confirmed with the first denoising effect quality meets the standard is then denoised a second time. Based on the difference in edge information of the detail gradient in the region to be confirmed before and after the second denoising, the region to be confirmed with the second denoising effect quality meets the standard, and the denoising base gradient and denoising detail gradient of the pixels are calculated. Based on the depth gradient and denoising base gradient of the pixel, as well as the denoising detail gradient of all pixels within the local window of the pixel and the position of edge pixels, a high-frequency texture feature vector of the pixel is established. Based on the high-frequency texture feature vector of all pixels in the region to be confirmed, the defect type corresponding to the region to be confirmed is determined. Based on the number of pixels in the area to be confirmed for all defect types and the denoising detail gradient, the overall defect impact of the metal button is calculated, and the electroplating uniformity evaluation result of the metal button is obtained based on the overall defect impact.
[0005] Furthermore, the specific method for obtaining the region to be confirmed in the depth map is as follows: Randomly generate the location of seed points for the region growing algorithm, and use the region growing algorithm to divide pixels whose absolute value of the difference between their depth values and those of their neighboring pixels is less than or equal to the preset adjacent depth difference into the same connected region. The gradient value of the depth value of a pixel in the depth map is recorded as the slope value of the pixel. The mean of all depth values in the depth map that are greater than or equal to the 25th percentile and less than or equal to the 75th percentile is recorded as the baseline depth of the depth map. The difference between the depth value of a pixel in the depth map and the baseline depth of the depth map is recorded as the relative depth of the pixel. Based on the slope value and relative depth of the pixels within the connected region, as well as the circularity of the connected region, determine the slope area to be confirmed, the recessed LOGO area to be confirmed, and the inner wall area of the buttonhole to be confirmed. The area to be confirmed (sloping surface), the area to be confirmed (recessed logo), and the area to be confirmed (inner wall of buttonhole) are all recorded as areas to be confirmed.
[0006] Furthermore, the specific calculation methods for the basic gradient, detail gradient, and depth gradient of the pixel are as follows: The gradient value calculated by the Prewitt gradient operator on the gray value of a pixel is denoted as the basic gradient of the pixel. The gradient value calculated by the Sobel operator on the gray value of a pixel is denoted as the basic gradient of the pixel. The gradient value calculated from the depth value of a pixel is denoted as the depth gradient of the pixel.
[0007] Furthermore, the step of selecting a guided filter to perform the first denoising of the region to be confirmed based on the depth gradient and basic gradient of the pixels in the region to be confirmed includes the following specific methods: The ratio of the number 1 to the depth gradient of the pixel is denoted as the adaptive guiding weight of the pixel. The adaptive guiding weight of each pixel is used as the guiding weight of the pixel in the guided filter, and the guided filter is used to perform the first denoising of the region to be identified.
[0008] Furthermore, the method for determining the region to be confirmed where the noise reduction effect meets the quality standard is as follows: The percentage reduction in the variance of the base gradient of the pixels contained in the region to be confirmed after the first denoising is compared with that in the region to be confirmed before denoising is denoised as the first denoising effect of the region to be confirmed. When the noise reduction effect of a single denoising operation in the area to be confirmed is greater than or equal to the preset noise reduction effect threshold, the noise reduction effect quality is deemed to meet the standard. When the denoising effect of the region to be confirmed is less than the preset denoising effect threshold, 85% of the adaptive guiding weight of the pixel is used as the new value of the adaptive guiding weight of the pixel. The region to be confirmed is denoised again, and it is determined whether the quality of the denoising effect meets the standard. If it does not meet the standard, the adaptive guiding weight of the pixel is reduced in a step of 0.05, the region to be confirmed is denoised again, and it is determined whether the quality of the denoising effect meets the standard, until the quality of the denoising effect meets the standard or the adaptive guiding weight of the pixel is less than 0.1. When the adaptive guiding weight of a pixel is less than 0.1, the side length of the filter kernel is increased in steps of 2 to denoise the region to be confirmed, and it is determined whether the quality of the denoising effect meets the standard, until the quality of the denoising effect meets the standard.
[0009] Furthermore, the specific method for obtaining the region to be confirmed that meets the quality standard of the second denoising effect based on the difference in edge information of the detail gradient within the region to be confirmed before and after the second denoising includes: The percentage reduction in the number of edge pixels in the region to be confirmed after the second denoising process compared to the region to be confirmed before denoising is denoised as the second denoising effect of the region to be confirmed. When the secondary denoising effect of the area to be confirmed is greater than or equal to the preset secondary denoising effect threshold, the quality of the secondary denoising effect is deemed to meet the standard. When the secondary denoising effect of the region to be confirmed is less than the preset secondary denoising effect threshold, connected component analysis is performed on all edge pixels in the region to be confirmed after the second denoising to obtain the edge pixel connected components. When the number of pixels contained in all edge pixel connected components is less than the first quantity threshold, 95% of the preset fixed weight is used as the new value of the guiding weight, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. If it is not, the guiding weight is decreased in steps of 0.02, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. This process continues until the quality of the secondary denoising effect is satisfactory. When the number of pixels contained in all edge pixel connected components is greater than or equal to the first quantity threshold, 105% of the preset fixed weight is used as the new value of the guiding weight, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. If it is not, the guiding weight is increased in steps of 0.02, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. This process continues until the quality of the secondary denoising effect is satisfactory.
[0010] Furthermore, the method for obtaining the denoising base gradient and denoising detail gradient of the pixel is as follows: Calculate the base gradient and detail gradient of each pixel in the region to be confirmed where the secondary denoising effect meets the quality standard, and record them as the denoising base gradient and denoising detail gradient of the pixel.
[0011] Furthermore, the specific steps for establishing the high-frequency texture feature vector of the pixel are as follows: The average value of the denoising base gradients of all pixels within the four neighborhoods of a pixel is denoised as the neighboring denoising base gradient of the pixel. The absolute value of the difference between the denoising base gradient of a pixel and its neighboring denoising base gradients is denoised as the denoising base gradient difference of the pixel. The ratio of the denoising base gradient difference of the pixel to the depth gradient is denoised as the depth gradient coefficient of the pixel. The mean of the denoising detail gradients of all pixels within a local window centered on the pixel and with a side length of the first preset length is denoised as the adjacent denoising detail gradient of the centered pixel. The absolute value of the difference between the denoising detail gradient of the pixel and the adjacent denoising detail gradient is denoised as the grayscale anomaly deviation of the pixel. Perform connected component analysis on all edge pixels within a local window centered on a pixel with a side length of the first preset length, obtain the edge connected components, and record the maximum number of edge pixels contained in all edge connected components as the number of neighborhood edges in the same direction of the centered pixel. The minimum value of the denoising detail gradient of all pixels within a local window centered on the pixel and with a side length of the first preset length is denoted as the local grayscale feature value of the pixel at the center. The high-frequency texture feature vector of a pixel is obtained by sequentially arranging the pixel's depth gradient coefficient, gray-level anomaly deviation, number of neighborhood edges in the same direction, and local gray-level feature values.
[0012] Furthermore, the method for determining the defect type corresponding to the area to be confirmed is as follows: The random forest algorithm is used to process the high-frequency texture feature vectors of all pixels in the region to be confirmed, and the defect type corresponding to the region to be confirmed is obtained. The defect types corresponding to the areas to be confirmed include pseudo-defects, yellowing defects, flow marks, and black corner defects.
[0013] Furthermore, the method for calculating the overall impact of defects in the metal button is as follows: The minimum value of the denoising detail gradient of all pixels in the region to be confirmed is recorded as the first minimum value. The normalized value of the mean of the absolute values of the differences between the denoising detail gradient of all pixels in the region to be confirmed of the same type of defect and the first minimum value is recorded as the gray-scale anomaly degree of the same type of defect. The ratio of the number of pixels in the region to be confirmed of the same type of defect to the total number of pixels in all regions to be confirmed is denoted as the defect density of the same type of defect. The ratio of the defect density of the same type of defect to the maximum value of the defect density of all types of defect is denoted as the relative defect density of the same type of defect. The positive correlation between the grayscale anomaly degree and the relative defect density of all defects of the same type is recorded as the comprehensive defect impact degree of the metal button.
[0014] The beneficial effects of this application are: This application first divides the areas in the depth map that may require defect judgment based on the differences in depth values among all pixels, obtaining the areas to be confirmed. It then extracts the natural gradient information of grayscale values with surface morphology, as well as high-frequency information such as edge and texture information of the pixels within these areas, obtaining the base gradient and detail gradient of the pixels. Based on the depth changes at the pixel positions, it determines the severity of interference from localized illumination blind spots formed by sidewalls. For areas with more severe interference, it uses stronger filtering for denoising, obtaining the areas to be confirmed with satisfactory first-stage denoising quality. This weakens the influence of structural shadows on the areas to be confirmed. Then, it performs a second denoising on these areas, filtering high-frequency reflections from the metal surface while preserving detailed features, obtaining the areas to be confirmed with satisfactory second-stage denoising quality. Finally, it calculates the base gradient and detail gradient of the pixels. Step by step, based on the depth gradient and denoising base gradient of the pixels, unfiltered structural shadows and real defects are distinguished. Based on the high-frequency texture feature vectors of all pixels in the area to be confirmed, the defect type corresponding to the area to be confirmed is determined. Finally, based on the number of pixels in the area to be confirmed for all defect types and the denoising detail gradient, the degree to which the electroplating effect of the metal button is affected by defects is evaluated. This avoids the influence of isolated low-density defects caused by accidental errors such as local dust on the evaluation results. The comprehensive defect influence degree of the metal button is calculated to solve the problem that different types of defects cannot be directly compared, which leads to inaccurate evaluation of the electroplating uniformity of the metal button. Based on the comprehensive defect influence degree, the electroplating uniformity evaluation results of the metal button are obtained. This solves the problem that the uneven structure of the metal button is affected by the local light blind area formed by the sidewall, making it difficult to distinguish between structural shadows, metal reflections and real defects, which leads to inaccurate evaluation results of the electroplating uniformity of the metal button. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of a machine vision-based method for evaluating the uniformity of electroplating in metal buttons, provided in one embodiment of this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] Please see Figure 1 The diagram illustrates a flowchart of a machine vision-based method for evaluating the uniformity of electroplating in metal buttons, according to an embodiment of this application. The method includes the following steps: Step S001: Acquire the grayscale image and depth map of the metal button after spatial alignment processing. Based on the difference between the depth values of all pixels in the depth map, obtain the area to be confirmed in the depth map.
[0019] In this embodiment, after the metal buttons are electroplated, they need to be inspected to evaluate the uniformity of the electroplating. The conveyor belt carries the electroplated metal buttons through the inspection area of the quality inspection process, where images are captured and scanned. While identifying electroplating defects such as yellowing, flow marks, and black corners, false defects are eliminated, and the uniformity of electroplating is evaluated based on the inspection results.
[0020] Illumination was provided using a multi-angle ring LED light source, and grayscale and depth maps of the metal buttons were captured using a structured light industrial camera.
[0021] The use of multi-angle ring LED light sources for illumination can suppress reflections on the metal surface by adjusting the light intensity and illumination angle, and ensure stable and uniform illumination. The grayscale image is a two-dimensional image, and the depth image is a three-dimensional image. The grayscale image and depth image of the metal button are spatially aligned, and the pixels in the grayscale image and depth image correspond to each other, that is, each pixel has a corresponding grayscale value and depth value.
[0022] Based on the differences in depth values among all pixels in the depth map, as well as the gradient values of the depth values, the three-dimensional structural features of slope, depth, and shape in the depth map are extracted to obtain the region to be confirmed in the depth map.
[0023] One hundred uniformly plated, flawless metal buttons are selected by those skilled in the art. 95% of the absolute value of the difference in depth values between adjacent pixels within the region corresponding to each flawless metal button is recorded as the preset adjacent depth difference. The depth values of pixels in the depth map are then used for region growing using an eight-neighbor expansion method. The seed point is randomly generated. Pixels whose absolute value of the difference in depth value with their adjacent pixels is less than or equal to the preset adjacent depth difference are grouped into the same connected component, thus obtaining the connected component.
[0024] In this embodiment, the number of seed points is set to 20. The number of seed points can be set by those skilled in the art according to the uniformity evaluation requirements of metal buttons. The region growth algorithm is a well-known technology and will not be described in detail here.
[0025] The gradient value of the depth value of a pixel in the depth map is recorded as the slope value of the pixel; the mean of all depth values in the depth map that are greater than or equal to the 25th quantile and less than or equal to the 75th quantile of the depth value is recorded as the baseline depth of the depth map; the difference between the depth value of a pixel in the depth map and the baseline depth of the depth map is recorded as the relative depth of the pixel; the circularity of the connected components in the depth map is calculated.
[0026] The calculation of gradient value, 25th percentile, 75th percentile and circularity are all well-known techniques and will not be elaborated further.
[0027] Based on the slope value and relative depth of the pixels within the connected region, as well as the circularity of the connected region, the slope area to be confirmed, the recessed logo area to be confirmed, and the inner wall area of the buttonhole to be confirmed are determined.
[0028] Specifically, a connected region where the slope value of all pixels within the connected region is less than or equal to a first preset slope threshold and greater than a second preset slope threshold, the relative depth of all pixels within the connected region is less than or equal to a first preset depth threshold, and the roundness is greater than a first preset roundness threshold is designated as the slope region to be confirmed. A connected region where the slope value of all pixels within the connected region is less than or equal to a third preset slope threshold and the roundness is less than or equal to a first preset roundness threshold is designated as the recessed logo region to be confirmed. A connected region where the slope value of all pixels within the connected region is less than or equal to a fourth preset slope threshold and the relative depth of all pixels within the connected region is greater than or equal to a second preset depth threshold is designated as the inner wall region of the buttonhole to be confirmed. The slope region to be confirmed, the recessed logo region to be confirmed, and the inner wall region of the buttonhole to be confirmed are all designated as regions to be confirmed.
[0029] Among them, the first preset slope threshold, the second preset slope threshold, the first preset depth threshold, the first preset roundness threshold, the third preset slope threshold, the fourth preset slope threshold, and the second preset depth threshold are all preset thresholds, determined by the specific manufacturing specifications of the metal button. In this embodiment, the values of the first preset slope threshold, the second preset slope threshold, the first preset depth threshold, the first preset roundness threshold, the third preset slope threshold, the fourth preset slope threshold, and the second preset depth threshold are 0.1mm, 0.3mm, 0.05mm, 0.6mm, -0.1mm, -0.2mm, and 0.3mm, respectively. The slope area to be confirmed, the recessed LOGO area to be confirmed, and the inner wall area of the buttonhole to be confirmed may correspond to the slope position of the metal button, the recessed LOGO area, and the inner wall of the buttonhole, respectively.
[0030] At this point, the region to be confirmed in the depth map has been obtained.
[0031] Step S002: Based on the grayscale value and depth value of the pixels in the region to be confirmed, calculate the base gradient, detail gradient, and depth gradient of the pixels respectively. Based on the depth gradient and base gradient of the pixels in the region to be confirmed, select guided filtering to perform the first denoising of the region to be confirmed, and obtain the region to be confirmed with satisfactory denoising effect. Perform the second denoising on the region to be confirmed with satisfactory denoising effect. Based on the difference in edge information of detail gradient in the region to be confirmed before and after the second denoising, obtain the region to be confirmed with satisfactory second denoising effect, and calculate the denoising base gradient and denoising detail gradient of the pixels.
[0032] The Prewitt gradient operator is used to calculate the gradient value of each pixel based on the grayscale value of the pixel in the region to be confirmed, and this gradient is recorded as the basic gradient of the pixel. Gaussian blur is applied to the region to be confirmed, and the Sobel operator is used to obtain the gradient value of each pixel in the region to be confirmed based on the grayscale value of the pixel, which is recorded as the detail gradient of the pixel.
[0033] In this embodiment, 3 are selected. 3 represents the kernel size of the Gaussian blur; the Prewitt gradient operator and the Sobel operator are well-known techniques for obtaining the gradient values of pixels, and will not be elaborated further; the basic gradient of a pixel is used to reflect the natural gradation information of the gray value of the pixel in the area to be confirmed as a function of the surface morphology, such as the brightness change of the sloping area due to the angle of illumination; the detail gradient of a pixel is used to capture high-frequency information such as the edge and texture of the pixel, such as the linear texture of flow marks, the boundary features of black corners, and the local gradation of shadows formed by illumination occlusion.
[0034] The shadow change characteristics of the unconfirmed slope area, the unconfirmed concave logo area, and the unconfirmed buttonhole inner wall area in the area to be confirmed are different, and the intensity of the influence of the side wall shadows is also different. If the unconfirmed slope area, the unconfirmed concave logo area, and the unconfirmed buttonhole inner wall area in the area to be confirmed are all processed with uniform filtering parameters, it is difficult to avoid the problem of incomplete filtering of the influence of some side wall shadows, and it may also cause some defects in some areas to be smoothed. Therefore, it is necessary to determine the smoothness of each area to be confirmed.
[0035] Based on the depth value of the pixel in the region to be confirmed, calculate the gradient value of the pixel and record it as the depth gradient of the pixel. The ratio of the number 1 to the depth gradient of the pixel is recorded as the adaptive guiding weight of the pixel.
[0036] In the process of calculating the ratio, in order to avoid the denominator being zero, a preset value needs to be added to the denominator. In this example, the preset value is 1.
[0037] The greater the depth gradient of a pixel, the greater the depth change at the pixel position, and the more severe the interference from the local illumination blind zone formed by the sidewalls at the pixel position, the more powerful the filtering is required for noise reduction.
[0038] The adaptive guiding weight of each pixel is used as the guiding weight of the pixel in the guided filter, and the guided filter is used to perform the first denoising of the region to be identified.
[0039] In this embodiment, a Gaussian kernel function is selected as the filtering kernel, and the kernel size is chosen to be 3. 3. Among them, the guided filtering can dynamically adjust the smoothing intensity according to the gradient of the pixels in the area to be confirmed, smoothing low-frequency structural shadows and retaining high-frequency defect features; selecting the Gaussian kernel function as the filtering kernel can eliminate the interference of shadows and reflections while retaining defects based on the distance-weighted smoothing characteristics of the Gaussian kernel function. It can also split the calculation and quickly process the grayscale images and depth images of batches of metal buttons, improving the detection speed; using the adaptive guided weight of the pixels as the value of the guided weight of the pixels for noise reduction can avoid the problem of incomplete filtering due to the influence of side wall shadows, and can also solve the problem of smoothing defects in some areas.
[0040] The percentage reduction in the variance of the base gradient of the pixels contained in the region to be confirmed after the first denoising step compared to the region to be confirmed before denoising is denoised as the first denoising effect of the region to be confirmed.
[0041] When the denoising effect of the region to be confirmed in one pass is greater than or equal to the preset threshold for the first pass, the denoising effect quality is deemed to be up to standard. When the denoising effect of the region to be confirmed in one pass is less than the preset threshold for the first pass, the denoising effect quality is deemed to be down to standard. 85% of the adaptive guiding weight of the pixel is used as the new value of the adaptive guiding weight of the pixel, and the region to be confirmed is denoised again. The denoising effect quality is then judged to be up to standard. If it is down to standard, the adaptive guiding weight of the pixel is reduced in steps of 0.05, and the region to be confirmed is denoised again. The denoising effect quality is then judged to be up to standard again until the denoising effect quality is up to standard or the adaptive guiding weight of the pixel is less than 0.1. When the adaptive guiding weight of the pixel is less than 0.1, it means that the goal of achieving the denoising effect quality standard cannot be achieved by guiding filtering alone. Therefore, when the adaptive guiding weight of the pixel is less than 0.1, the side length of the filter kernel is increased in steps of 2, and the region to be confirmed is denoised again. The denoising effect quality is then judged to be up to standard again until the denoising effect quality is up to standard.
[0042] In this embodiment, the threshold value for the first denoising effect is set at 30%. The threshold value for the first denoising effect is determined by those skilled in the art through the first denoising effect on 100 groups of structural shadows that have been completely weakened and where the real defects have not been lost.
[0043] The preset fixed weights are used as the guiding weights for the pixels, and the guided filter is selected to perform a second denoising on the region to be identified.
[0044] In this embodiment, the fixed weight is set to 0.8. The fixed weight should be greater than or equal to 0.75 and less than or equal to 0.85. The purpose of the second noise reduction is to filter the high-frequency reflection of the metal surface and retain the detailed features.
[0045] Edge detection is performed on the detail gradients of the region to be confirmed before and after the second denoising. The percentage reduction in the number of edge pixels in the region to be confirmed after the second denoising compared to the region to be confirmed before denoising is denoised as the second denoising effect of the region to be confirmed.
[0046] In this embodiment, the first quantity threshold is set to 3, and the secondary denoising effect threshold is set to 85%. The value of the secondary denoising effect threshold is determined by those skilled in the art through the secondary denoising effect of the area to be confirmed, in which 100 sets of high-frequency reflective noise are filtered out and the textures of defects such as black corner edges and flow marks are completely preserved.
[0047] When the secondary denoising effect of the region to be confirmed is greater than or equal to the preset secondary denoising effect threshold, the secondary denoising effect quality is deemed satisfactory. When the secondary denoising effect of the region to be confirmed is less than the preset secondary denoising effect threshold, the secondary denoising effect quality is deemed unsatisfactory. Connectivity analysis is then performed on all edge pixels within the region to be confirmed after the second denoising to obtain the edge pixel connected components. When the secondary denoising effect quality is unsatisfactory, and the number of pixels contained in all edge pixel connected components is less than a first quantity threshold, 95% of the preset fixed weight is used as the new value of the guiding weight. Secondary denoising is then performed on the region to be confirmed again, and the secondary denoising effect quality is determined to be satisfactory. If it is unsatisfactory... If the quality of the second denoising is not up to standard, the guiding weight is reduced in increments of 0.02, and the region to be denoised is denoised again. The quality of the second denoising is then determined. If the quality of the second denoising is not up to standard, and the number of pixels contained in the connected regions of all edge pixels is greater than or equal to the first threshold, 105% of the preset fixed weight is used as the new value of the guiding weight. The region to be denoised is denoised again, and the quality of the second denoising is then determined. If the quality of the second denoising is not up to standard, the guiding weight is increased in increments of 0.02, and the region to be denoised is denoised again. The quality of the second denoising is then determined. The process continues until the quality of the second denoising is up to standard.
[0048] Calculate the base gradient and detail gradient of each pixel in the region to be confirmed where the secondary denoising effect meets the quality standard, and record them as the denoising base gradient and denoising detail gradient of the pixel.
[0049] At this point, the denoising base gradient and denoising detail gradient of the pixels in the region to be confirmed are obtained.
[0050] Step S003: Based on the depth gradient and denoising base gradient of the pixel, as well as the denoising detail gradient of all pixels within the local window of the pixel and the position of edge pixels, establish the high-frequency texture feature vector of the pixel. Based on the high-frequency texture feature vector of all pixels in the area to be confirmed, determine the defect type corresponding to the area to be confirmed.
[0051] Based on the residual grayscale value changes and edge texture changes in the denoising base gradient and denoising detail gradient of the pixels in the region to be confirmed, it is not possible to directly distinguish between unfiltered structural shadows and real defects, and further defect identification is required.
[0052] The depth variation of the recessed area of the logo on the metal button is irregular. The depth of the inner wall of the buttonhole gradually increases from the opening to the bottom of the inner wall. The depth variation at the bevel of the metal button is relatively gentle and linear. Therefore, the morphological characteristics of different positions on the metal button are different, and it is impossible to distinguish different positions of the metal button based on a single gradient feature. However, the structure of the metal button exhibits gradient changes, while the local lighting shadows formed by the sidewalls do not show gradient changes. Based on the depth gradient of the pixel and the denoising baseline gradient, the depth gradient coefficient of the pixel is calculated.
[0053] Preferably, as an embodiment of this application, the average value of the denoising base gradients of all pixels contained in the four neighborhoods of a pixel is denoised as the adjacent denoising base gradient of the pixel; the absolute value of the difference between the denoising base gradient of a pixel and the adjacent denoising base gradients is denoised as the denoising base gradient difference of the pixel; and the ratio of the denoising base gradient difference of the pixel to the depth gradient is denoised as the depth gradient coefficient of the pixel.
[0054] Because the grayscale value of structural shadows caused by localized lighting changes with depth, the depth gradient coefficient of pixels at these shadow locations is relatively stable. However, the grayscale value of actual defect locations does not exhibit this correlation with depth changes; therefore, the depth gradient coefficient of pixels at actual defect locations is more discrete. The depth gradient coefficient can be used to classify pseudo-defects and real defects corresponding to structural shadows.
[0055] The mean of the denoising detail gradients of all pixels within a local window centered on the pixel and with a side length of the first preset length is denoised as the adjacent denoising detail gradient of the centered pixel. The absolute value of the difference between the denoising detail gradient of a pixel and its adjacent denoising detail gradient is denoised as the grayscale anomaly deviation of the pixel.
[0056] Abnormal grayscale deviation of a pixel can be used to determine whether a pixel is in a region of abnormal grayscale.
[0057] Perform connected component analysis on all edge pixels within a local window centered on a pixel with a side length of a first preset length to obtain edge connected components. The maximum number of edge pixels contained in all edge connected components is recorded as the number of neighboring edges in the same direction of the centered pixel.
[0058] It is important to note that when the edge connectivity cannot be obtained centered on a pixel, the number of neighboring edges in the same direction is assigned to 0. Flow mark defects manifest as continuous linearity and short line noise, such as thin lines 8-15 pixels in length and reflective residues 2-3 pixels in length. Therefore, the number of neighboring edges in the same direction corresponding to a pixel with a flow mark defect is relatively large.
[0059] The minimum value of the denoising detail gradient of all pixels within a local window centered on the pixel and with a side length of the first preset length is denoted as the local grayscale feature value of the pixel at the center.
[0060] The high-frequency texture feature vector of a pixel is obtained by sequentially arranging the pixel's depth gradient coefficient, gray-level anomaly deviation, number of neighborhood edges in the same direction, and local gray-level feature values.
[0061] The random forest algorithm is used to process the high-frequency texture feature vectors of all pixels in the region to be confirmed, and to obtain the defect type corresponding to the region to be confirmed. There are four types of defects in the region to be confirmed: pseudo defects, yellowing defects, flow marks defects, and black corner defects.
[0062] Each defect type has at least 200 samples. The samples from all defect types together form the sample set for the Random Forest algorithm. The sample set is divided into a training set and a validation set in a 7:3 ratio. The training set is used for model learning of the Random Forest algorithm, and the validation set is used to optimize parameters. The number of decision trees should be greater than or equal to 50 and less than or equal to 80 to avoid computational redundancy caused by too many decision trees. The tree depth should be greater than or equal to 8 and less than or equal to 12 layers to avoid overfitting caused by excessive tree depth. The optimal value is determined by the accuracy-tree depth curve of the validation set. The depth corresponding to the peak accuracy of the validation set is the optimal depth. The training and usage process of the Random Forest algorithm are well-known techniques and will not be described in detail here.
[0063] At this point, the defect type corresponding to the area to be confirmed is obtained.
[0064] Step S004: Calculate the overall defect impact of the metal button based on the number of pixels in the area to be confirmed for all defect types and the denoising detail gradient, and obtain the electroplating uniformity evaluation result of the metal button based on the overall defect impact.
[0065] Based on the defect type corresponding to the area to be confirmed and the number of pixels contained in the area to be confirmed, the electroplating uniformity and corresponding quality level of the metal button are quantified.
[0066] The minimum value of the denoising detail gradient of all pixels in all regions to be confirmed is recorded as the first minimum value. The normalized value of the mean of the absolute values of the differences between the denoising detail gradient of all pixels in the regions to be confirmed of the same type of defect and the first minimum value is recorded as the gray-level anomaly degree of the same type of defect. The ratio of the number of pixels in the regions to be confirmed of the same type of defect to the total number of pixels in all regions to be confirmed is recorded as the defect density of the same type of defect. The ratio of the defect density of the same type of defect to the maximum value of the defect density of all types of defect is recorded as the relative defect density of the same type of defect. The positive correlation between the gray-level anomaly degree and the relative defect density of all types of defect is recorded as the comprehensive defect impact degree of the metal button.
[0067] It is understood that a positive correlation is applied to the grayscale anomaly degree and relative defect density of the same type of defect, ensuring that both the grayscale anomaly degree and relative defect density of the same type of defect are positively correlated with the overall defect impact of the metal button. It is understood that the positive correlation in this application refers to the relationship between the independent and dependent variables. The independent variables are the grayscale anomaly degree and relative defect density of the same type of defect, and the dependent variable is the overall defect impact of the metal button. The positive correlation means that the dependent variable increases (decreases) as the independent variable increases (decreases), and can be an additive or multiplicative relationship.
[0068] Preferably, as an embodiment of this application, the first preset defect coefficient and the second preset defect coefficient are used as weights for the gray-scale anomaly degree and relative defect density of the same type of defect, respectively. The weighted summation of the gray-scale anomaly degree and relative defect density of the same type of defect is recorded as the defect influence degree of the same type of defect. The summation of the defect influence degrees of all types of defect is recorded as the comprehensive defect influence degree of the metal button.
[0069] Wherein, the first preset defect coefficient and the second preset defect coefficient are both preset parameters, and the sum of the first preset defect coefficient and the second preset defect coefficient is 0.7. In this embodiment, the values of the first preset defect coefficient and the second preset defect coefficient are 0.3 and 0.7, respectively.
[0070] Isolated low-density defects may be due to random errors such as localized dust. Therefore, relative defect density is used to evaluate the proportion of pixels corresponding to defects per unit area, eliminating the impact of differences in the number of pixels contained in different areas to be confirmed on the evaluation of the electroplating uniformity of metal buttons. The comprehensive defect influence degree is used to evaluate the electroplating uniformity of metal buttons, solving the problem that different types of defects cannot be directly compared, leading to inaccurate evaluation of the electroplating uniformity of metal buttons.
[0071] The first uniformity evaluation threshold, the second uniformity evaluation threshold, and the third uniformity evaluation threshold are preset to determine the quality of metal buttons into four categories: excellent, good, medium, and poor. The value of the first uniformity evaluation threshold should be greater than or equal to 0.15 and less than or equal to 0.25, the value of the second uniformity evaluation threshold should be greater than or equal to 0.35 and less than or equal to 0.45, and the value of the third uniformity evaluation threshold should be greater than or equal to 0.55 and less than or equal to 0.65. In this embodiment, the values of the first uniformity evaluation threshold, the second uniformity evaluation threshold, and the third uniformity evaluation threshold are 0.2, 0.4, and 0.6, respectively.
[0072] Specifically, metal buttons with a comprehensive defect impact less than or equal to the first uniformity evaluation threshold are judged as excellent; metal buttons with a comprehensive defect impact greater than the first uniformity evaluation threshold and less than or equal to the second uniformity evaluation threshold are judged as good; metal buttons with a comprehensive defect impact greater than the second uniformity evaluation threshold and less than or equal to the third uniformity evaluation threshold are judged as medium; and metal buttons with a comprehensive defect impact greater than the third uniformity evaluation threshold are judged as poor.
[0073] Thus, based on machine vision, the uniformity of electroplating in metal buttons can be evaluated.
[0074] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A machine vision-based method for evaluating the uniformity of electroplating in metal buttons, characterized in that, The method includes the following steps: Acquire grayscale and depth maps of metal buttons after spatial alignment processing, and obtain the region to be confirmed in the depth map based on the difference between the depth values of all pixels in the depth map; Based on the grayscale and depth values of the pixels in the region to be confirmed, the base gradient, detail gradient, and depth gradient of the pixels are calculated respectively. Based on the depth gradient and base gradient of the pixels in the region to be confirmed, a guided filter is selected to perform the first denoising of the region to be confirmed, and the region to be confirmed with the first denoising effect quality meets the standard is obtained. The region to be confirmed with the first denoising effect quality meets the standard is then denoised a second time. Based on the difference in edge information of the detail gradient in the region to be confirmed before and after the second denoising, the region to be confirmed with the second denoising effect quality meets the standard, and the denoising base gradient and denoising detail gradient of the pixels are calculated. Based on the depth gradient and denoising base gradient of the pixel, as well as the denoising detail gradient of all pixels within the local window of the pixel and the position of edge pixels, a high-frequency texture feature vector of the pixel is established. Based on the high-frequency texture feature vector of all pixels in the region to be confirmed, the defect type corresponding to the region to be confirmed is determined. Based on the number of pixels in the area to be confirmed for all defect types and the denoising detail gradient, the overall defect impact of the metal button is calculated, and the electroplating uniformity evaluation result of the metal button is obtained based on the overall defect impact.
2. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The specific method for obtaining the region to be confirmed in the depth map is as follows: The positions of seed points for the region growing algorithm are randomly generated. The region growing algorithm is then used to divide pixels whose absolute difference in depth value with their neighboring pixels is less than or equal to the preset neighboring depth difference into the same connected region. The gradient value of the depth value of a pixel in the depth map is recorded as the slope value of the pixel. The mean of all depth values in the depth map that are greater than or equal to the 25th percentile and less than or equal to the 75th percentile is recorded as the baseline depth of the depth map. The difference between the depth value of a pixel in the depth map and the baseline depth of the depth map is recorded as the relative depth of the pixel. Based on the slope value and relative depth of the pixels within the connected region, as well as the circularity of the connected region, determine the slope area to be confirmed, the recessed LOGO area to be confirmed, and the inner wall area of the buttonhole to be confirmed. The area to be confirmed (sloping surface), the area to be confirmed (recessed logo), and the area to be confirmed (inner wall of buttonhole) are all recorded as areas to be confirmed.
3. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The specific calculation methods for the base gradient, detail gradient, and depth gradient of the pixel are as follows: The gradient value calculated by the Prewitt gradient operator on the gray value of a pixel is denoted as the basic gradient of the pixel. The gradient value calculated by the Sobel operator on the gray value of a pixel is denoted as the basic gradient of the pixel. The gradient value calculated from the depth value of a pixel is denoted as the depth gradient of the pixel.
4. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The method of selecting guided filtering to perform the first denoising of the region to be confirmed based on the depth gradient and basic gradient of the pixels in the region to be confirmed includes the following specific methods: The ratio of the number 1 to the depth gradient of the pixel is denoted as the adaptive guiding weight of the pixel. The adaptive guiding weight of each pixel is used as the guiding weight of the pixel in the guided filter, and the guided filter is used to perform the first denoising of the region to be identified.
5. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 4, characterized in that, The method for determining the region to be confirmed where the noise reduction effect meets the quality standard is as follows: The percentage reduction in the variance of the base gradient of the pixels contained in the region to be confirmed after the first denoising is compared with that in the region to be confirmed before denoising is denoised as the first denoising effect of the region to be confirmed. When the noise reduction effect of a single denoising operation in the area to be confirmed is greater than or equal to the preset noise reduction effect threshold, the noise reduction effect quality is deemed to meet the standard. When the denoising effect of the region to be confirmed is less than the preset denoising effect threshold, 85% of the adaptive guiding weight of the pixel is used as the new value of the adaptive guiding weight of the pixel. The region to be confirmed is denoised again, and it is determined whether the quality of the denoising effect meets the standard. If it does not meet the standard, the adaptive guiding weight of the pixel is reduced in a step of 0.05, the region to be confirmed is denoised again, and it is determined whether the quality of the denoising effect meets the standard, until the quality of the denoising effect meets the standard or the adaptive guiding weight of the pixel is less than 0.
1. When the adaptive guiding weight of a pixel is less than 0.1, the side length of the filter kernel is increased in steps of 2 to denoise the region to be confirmed, and it is determined whether the quality of the denoising effect meets the standard, until the quality of the denoising effect meets the standard.
6. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The method for obtaining the region to be confirmed that meets the quality standard of the second denoising effect based on the difference in edge information of the detail gradient within the region to be confirmed before and after the second denoising includes the following specific methods: The percentage reduction in the number of edge pixels in the region to be confirmed after the second denoising process compared to the region to be confirmed before denoising is denoised as the second denoising effect of the region to be confirmed. When the secondary denoising effect of the area to be confirmed is greater than or equal to the preset secondary denoising effect threshold, the quality of the secondary denoising effect is deemed to meet the standard. When the secondary denoising effect of the region to be confirmed is less than the preset secondary denoising effect threshold, connected component analysis is performed on all edge pixels in the region to be confirmed after the second denoising to obtain the edge pixel connected components. When the number of pixels contained in all edge pixel connected components is less than the first quantity threshold, 95% of the preset fixed weight is used as the new value of the guiding weight, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. If it is not, the guiding weight is decreased in steps of 0.02, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. This process continues until the quality of the secondary denoising effect is satisfactory. When the number of pixels contained in all edge pixel connected components is greater than or equal to the first quantity threshold, 105% of the preset fixed weight is used as the new value of the guiding weight, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. If it is not, the guiding weight is increased in steps of 0.02, and the region to be confirmed is denoised again. The quality of the secondary denoising effect is then determined. This process continues until the quality of the secondary denoising effect is satisfactory.
7. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The method for obtaining the denoising base gradient and denoising detail gradient of the pixel is as follows: Calculate the base gradient and detail gradient of each pixel in the region to be confirmed where the secondary denoising effect meets the quality standard, and record them as the denoising base gradient and denoising detail gradient of the pixel.
8. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The specific steps for establishing the high-frequency texture feature vector of the pixel are as follows: The average value of the denoising base gradients of all pixels within the four neighborhoods of a pixel is denoised as the neighboring denoising base gradient of the pixel. The absolute value of the difference between the denoising base gradient of a pixel and its neighboring denoising base gradients is denoised as the denoising base gradient difference of the pixel. The ratio of the denoising base gradient difference of the pixel to the depth gradient is denoised as the depth gradient coefficient of the pixel. The mean of the denoising detail gradients of all pixels within a local window centered on the pixel and with a side length of the first preset length is denoised as the adjacent denoising detail gradient of the centered pixel. The absolute value of the difference between the denoising detail gradient of the pixel and the adjacent denoising detail gradient is denoised as the grayscale anomaly deviation of the pixel. Perform connected component analysis on all edge pixels within a local window centered on a pixel with a side length of the first preset length, obtain the edge connected components, and record the maximum number of edge pixels contained in all edge connected components as the number of neighborhood edges in the same direction of the centered pixel. The minimum value of the denoising detail gradient of all pixels within a local window centered on the pixel and with a side length of the first preset length is denoted as the local grayscale feature value of the pixel at the center. The high-frequency texture feature vector of a pixel is obtained by sequentially arranging the pixel's depth gradient coefficient, gray-level anomaly deviation, number of neighborhood edges in the same direction, and local gray-level feature values.
9. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The method for determining the defect type corresponding to the area to be confirmed is as follows: The random forest algorithm is used to process the high-frequency texture feature vectors of all pixels in the region to be confirmed, and the defect type corresponding to the region to be confirmed is obtained. The defect types corresponding to the areas to be confirmed include pseudo-defects, yellowing defects, flow marks, and black corner defects.
10. The machine vision-based method for evaluating the uniformity of electroplating in metal buttons according to claim 1, characterized in that, The method for calculating the overall impact of defects in the metal button is as follows: The minimum value of the denoising detail gradient of all pixels in the region to be confirmed is recorded as the first minimum value. The normalized value of the mean of the absolute values of the differences between the denoising detail gradient of all pixels in the region to be confirmed of the same type of defect and the first minimum value is recorded as the gray-scale anomaly degree of the same type of defect. The ratio of the number of pixels in the region to be confirmed of the same type of defect to the total number of pixels in all regions to be confirmed is denoted as the defect density of the same type of defect. The ratio of the defect density of the same type of defect to the maximum value of the defect density of all types of defect is denoted as the relative defect density of the same type of defect. The positive correlation between the grayscale anomaly degree and the relative defect density of all defects of the same type is recorded as the comprehensive defect impact degree of the metal button.