Surface polishing quality detection method and system for connecting bar production
By calculating the gradient energy and geometric anisotropy index of the connecting surface, elliptical structural elements matching the defects are dynamically generated, solving the problems of missed detection and false detection in the prior art and achieving high-accuracy defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGGUAN ZHONGQI ELECTRONIC TECH CO LTD
- Filing Date
- 2026-01-07
- Publication Date
- 2026-05-01
AI Technical Summary
Existing morphological inspection methods cannot adaptively match polishing defects in the connecting rows, leading to missed and false detections.
By calculating the gradient energy and geometric anisotropy index of the connecting row surface, elliptical structural elements matching the defects are dynamically generated for morphological inspection, thereby improving the accuracy and generalization ability of the inspection.
It significantly improves the accuracy of detecting surface defects in connectors, avoids missed and false detections, and enhances the stability of test results.
Smart Images

Figure CN121962047A_ABST
Abstract
Description
A method and system for surface polishing quality inspection in connector production Technical Field
[0001] This invention relates to the field of quality inspection, and in particular to a method and system for inspecting the surface polishing quality of connecting bars in production. Background Technology
[0002] Connector strips are components in electronic devices that enable electrical connections, and their surface quality significantly impacts the overall stability of the equipment. Therefore, during the production of connector strips, their surfaces need to be polished to achieve a smooth and even finish. However, due to factors such as material properties and fluctuations in process parameters, polished connector strip surfaces may contain various minor defects such as scratches, pits, pinholes, and orange peel texture, affecting product quality. In existing technologies, machine vision technology can be used to inspect the surface polishing quality of connector strips and determine the presence of defects. In machine vision-based inspection, morphological algorithms, particularly top-hat and bottom-hat transformations, have advantages such as suppressing uneven lighting and highlighting small targets, making them suitable for surface defect extraction. The core of traditional morphological algorithms lies in their structuring elements (SEs). In practical applications, the size and shape of the structuring elements usually need to be pre-defined by the operator based on the typical characteristics of the target defect.
[0003] However, when the actual size of the defect is much smaller than the preset structuring element, the defect may be over-smoothed during morphological opening or closing operations, resulting in missed detections. Conversely, when a large defect or multiple closely adjacent small defects appear, the fixed structuring element may not be able to completely separate them from the background, leading to incomplete extraction or misclassification of multiple independent defects as one, affecting the quantitative evaluation of defects. This results in insufficient generalization ability and stability of the detection algorithm, easily leading to missed detections and false detections. Summary of the Invention
[0004] To address the problem that existing morphological inspection methods cannot adaptively match polishing defects in connector bars, thus easily leading to missed and false detections, this invention provides a surface polishing quality inspection method and system for connector bar production.
[0005] In a first aspect, the present invention provides a surface polishing quality inspection method for connector production, employing the following technical solution: acquiring a grayscale image of the connector surface; calculating the gradient energy of each pixel in the grayscale image; identifying gradient energy regions exceeding a preset energy threshold as candidate regions; dividing the candidate regions into at least one sub-candidate region; calculating the geometric anisotropy index of each sub-candidate region, wherein the geometric anisotropy index is positively correlated with the difference in eigenvalues of the average structure tensor of all pixels within the sub-candidate region and negatively correlated with the sum of the eigenvalues; generating a structuring element based on the geometric anisotropy index and the equivalent diameter of the corresponding sub-candidate region; and performing morphological inspection on each sub-candidate region using the corresponding structuring element to obtain defect detection results.
[0006] By calculating the geometric anisotropy index of the candidate region and dynamically generating an elliptical structural element that matches the index and the defect size, adaptive detection of defects of different types (such as scratches and dents) and sizes is achieved. This allows the structural element to closely fit the actual contour of the defect, thereby significantly improving the accuracy of defect detection and the generalization ability of the algorithm, improving the accuracy of the detection results, and avoiding the problems of missed detections and false detections.
[0007] Preferably, a window region is constructed centered on the pixel whose gradient energy is to be calculated, the gradient magnitude of each pixel within the window region is calculated, and the sum of the squares of the gradient magnitudes of each pixel within the window region is taken as the gradient energy of the central pixel of the window region.
[0008] By summing the squared gradient magnitudes of each pixel within the window region in the x and y directions, the degree of grayscale change in local image regions can be effectively quantified. Compared with simple gradient calculation, this energy calculation method has better robustness to noise and can more stably and accurately identify potential defect regions with obvious edge features, providing a reliable basis for subsequent defect screening.
[0009] Preferably, the method for dividing the candidate region into at least one sub-candidate region is as follows: In the grayscale image, extract the edge pixels of the candidate region, calculate the gradient direction of the edge pixels, standardize the gradient direction, construct the minimum bounding rectangle for the candidate region, uniformly construct multiple sub-rectangles along the length direction, calculate the standard deviation of the gradient direction of the edge pixels in each sub-rectangle, use the obtained multiple standard deviations to arrange them according to the position order of the sub-rectangles to construct a standard deviation sequence, judge the stability of the standard deviation sequence, if the standard deviation sequence is unstable, use an ordered sample clustering algorithm to cluster to obtain multiple clusters, each cluster has multiple sub-rectangles corresponding to data points, and the candidate regions in multiple sub-rectangles constitute a sub-candidate region, further obtaining multiple sub-candidate regions.
[0010] By analyzing the gradient direction of edge pixels and using an ordered sample clustering algorithm to analyze the standard deviation sequence of gradient direction, a complex candidate region can be intelligently decomposed into multiple sub-candidate regions that correspond to a single type of defect (such as scratches or pits), thereby improving the accuracy of subsequent targeted analysis.
[0011] Preferably, the stability of the standard deviation sequence is determined using the unit root test.
[0012] Preferably, before calculating the geometric anisotropy index of each sub-candidate region, the method further includes: for each pixel (u,v) within the sub-candidate region k, its structure tensor... for:
[0013] In the formula, Let represent the structure tensor of pixel (u,v) within the sub-candidate region k. This represents the eight neighboring pixels of pixel (u,v). This represents the gradient magnitude of a neighboring pixel in the x-direction. This represents the gradient magnitude of a neighboring pixel in the y-direction.
[0014] The structure tensor describes the local structural features in the pixel neighborhood more comprehensively and robustly than gradient information alone. Using the structure tensor for analysis can better suppress noise interference, providing a more stable and reliable foundation for subsequent accurate calculation of geometric anisotropy indices characterizing the shape of defects.
[0015] Preferably, the method for calculating the geometric anisotropy index is as follows: calculate the average structure tensor of pixels within the sub-candidate region, and perform eigenvalue decomposition on the average structure tensor to obtain eigenvalues. , ,in Greater than ,calculate and The ratio of 1 to the ratio of the two is used as the geometric anisotropy index.
[0016] By using the average structure tensor decomposition to obtain two eigenvalues, this formula can accurately quantify the shape characteristics of a defect region. When the defect is an isotropic circle (such as a pit), the two eigenvalues are similar, and the index approaches 0. When the defect is an anisotropic line (such as a scratch), the two eigenvalues differ greatly, and the index approaches 1, providing quantitative parameters for the shape of the subsequent dynamically generated structural elements.
[0017] The preferred expression for the average structure tensor is:
[0018] In the formula, Let represent the average structure tensor of pixels within sub-candidate region k. This represents the weight of pixel (u,v) within the sub-candidate region k. Let represent the structure tensor of pixel (u,v) within the sub-candidate region k. This represents the total number of pixels within the sub-candidate region k. This represents the weight of pixel (u,v) within the sub-candidate region k.
[0019] Preferably, the structural element includes the major axis. and short axis The expression is:
[0020]
[0021] In the formula, This represents the major axis of the ellipse constructed based on the sub-candidate region k. This represents the minor axis of the ellipse constructed based on the sub-candidate region k. Let represent the diameter of the equivalent circle constructed based on the sub-candidate region k. Let α represent the geometric anisotropy index of the sub-candidate region k, α represent the first adjustment coefficient, and β represent the second adjustment coefficient.
[0022] The defect size and shape information analyzed in the previous steps are transformed into a specific, matching elliptical structural element, so that the generated structural element is similar to the defect in size and shape, thus achieving adaptive matching.
[0023] Preferably, the method for performing morphological detection on each sub-candidate region using the corresponding structuring element is as follows: if the average gray level of the sub-candidate region is lower than the average gray level of its surrounding region, then a bottom-hat transformation is performed to obtain a defect image; if the average gray level of the sub-candidate region is higher than the average gray level of its surrounding region, then a top-hat transformation is performed to obtain a defect image.
[0024] Based on the average grayscale comparison between the sub-candidate region and the surrounding region, the system automatically selects to perform either top-hat transformation or bottom-hat transformation. The bottom-hat transformation can effectively detect defects darker than the background (such as scratches and dents), while the top-hat transformation can effectively detect defects brighter than the background (such as protrusions and bright spots), ensuring the completeness of the detection.
[0025] Secondly, the present invention provides a surface polishing quality inspection system for connecting busbar production, which adopts the following technical solution: a surface polishing quality inspection system for connecting busbar production, comprising: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the surface polishing quality inspection method for connecting busbar production described above is implemented.
[0026] The above-mentioned surface polishing quality inspection method for connecting strip production is generated into a computer program and stored in a memory so that it can be loaded and executed by a processor. Thus, a system is made based on the memory and processor for convenient use.
[0027] The present invention has the following technical effects: By calculating the geometric anisotropy index and equivalent diameter of the defect area, the present invention quantitatively analyzes the shape and size of the defect, and dynamically generates a matching elliptical structural element for each defect, thereby improving the detection accuracy and robustness of different types and sizes of defects such as scratches and pits, improving the accuracy of detection results, and avoiding the problems of missed detection and false detection. Attached Figure Description
[0028] Figure 1 is a flowchart of a surface polishing quality inspection method for connecting bar production according to the present invention. Detailed Implementation
[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0030] This invention discloses a surface polishing quality inspection method for connecting bar production. Referring to Figure 1, the method includes the following steps: S1: Obtaining a grayscale image of the connecting bar surface.
[0031] The original image of the surface of the connector to be inspected is acquired by an industrial camera, the original image is converted into a grayscale image, and bilateral filtering is performed to suppress high-frequency noise in the grayscale image and preserve edge information.
[0032] S2: Calculate the gradient energy of pixels in the grayscale image to obtain candidate regions.
[0033] A rectangular coordinate system is constructed with any pixel in the grayscale image as the origin. The rectangular coordinate system includes the horizontal axis (x-axis) and the vertical axis (y-axis). The Sobel operator is used to calculate the gradient magnitude of each pixel in the grayscale image in the x-axis direction and the gradient magnitude in the y-axis direction, and the gradient direction of the pixel is further obtained.
[0034] The gradient energy is calculated as follows: a 5×5 window region is constructed centered on the pixel whose gradient energy is to be calculated. The expression for the gradient energy is:
[0035] in, This represents the gradient energy of pixel (m,n). , These represent the gradient magnitudes of pixel (p) along the x-axis and y-axis, respectively. This represents a window region centered on pixel (m,n), which can also be understood as the neighboring pixels of pixel (m,n).
[0036] The larger the gradient value of a neighboring pixel, the more drastic the grayscale change in that region, and the greater the corresponding gradient energy. This further indicates the discontinuity of the connecting surface, meaning the corresponding pixel region may be a defective area. Each pixel corresponds to a gradient energy, which is then used to obtain a gradient energy map. This map is then thresholded, with gradient energies exceeding a preset threshold designated as high gradient energies. The continuous regions formed by pixels corresponding to these high gradient energies are then considered candidate regions. It's understandable that multiple candidate regions may exist in a grayscale image.
[0037] S3: Divide each candidate region into sub-candidate regions.
[0038] After polishing the connecting strip, surface defects typically manifest as incomplete polishing, leaving scratches, pits, and spots caused by corrosion. Therefore, in an independent candidate region, the corresponding defect is one or more combinations of these defects. These combinations can be understood as scratched areas and pitted areas being connected. Thus, each candidate region needs to be divided into one or more sub-candidate regions, ensuring that each sub-candidate region corresponds to only one type of defect, in order to determine the shape of the structural element.
[0039] In a grayscale image, edge pixels of candidate regions are extracted, and the gradient direction of the edge pixels is calculated using the Sobel operator. The gradient direction is then standardized. Specifically, the plane angle is divided into 12 directional intervals: (0-30°), (30-60°), ..., (330-360°). The gradient direction of pixels with gradients in the directional interval (0-30°) is denoted as 30°, the gradient direction of pixels with gradients in the directional interval (30-60°) is denoted as 60°, ..., and the gradient direction of pixels with gradients in the directional interval (330-360°) is denoted as 0°. Since 0° coincides with 360°, 360° is denoted as 0° here.
[0040] The minimum bounding rectangle is constructed for the candidate region, and multiple sub-rectangles are uniformly constructed along the length direction. The standard deviation of the gradient direction of the edge pixels within each sub-rectangle is calculated. It can be understood that each sub-rectangle corresponds to a standard deviation. The obtained standard deviations are arranged according to the position order of the sub-rectangles to construct a standard deviation sequence. The stability of the standard deviation sequence is determined by the unit root test. If the standard deviation sequence is unstable, the ordered sample clustering algorithm is used to cluster the data points to obtain multiple clusters. The data points within each cluster correspond to multiple sub-rectangles. The candidate regions within multiple sub-rectangles constitute a sub-candidate region. That is, one cluster corresponds to one sub-candidate region. This process is repeated to obtain multiple sub-candidate regions. The unit root test is an existing technology, and the specific steps are not described here.
[0041] Scratches are approximately straight lines, while pits and spots caused by corrosion are approximately circular. Therefore, the gradient direction of the edge pixels in the scratch area is relatively regular, and the standard deviation of the gradient direction is small; while the gradient direction of the edge pixels in the pits and spots is more divergent, and the standard deviation of the gradient direction is larger.
[0042] Therefore, if the defect corresponding to the candidate region is a combination of scratches and pits (or spots), the detection result of the standard deviation sequence is unstable. The scratch region and the pit (or spot) are distinguished by the ordered sample clustering algorithm to obtain sub-candidate regions, that is, one sub-candidate region corresponds to one type of defect.
[0043] If the defect corresponding to the candidate region is one of scratches, pits, or spots, the detection result of the standard deviation sequence is stable, and the candidate region is no longer divided. In order to facilitate the understanding of subsequent schemes, the candidate region is recorded as a sub-candidate region.
[0044] S4: Calculate the geometric anisotropy index of the sub-candidate region.
[0045] For each pixel (u,v) within the sub-candidate region k, its structure tensor Defined as:
[0046] In the formula, Let represent the structure tensor of pixel (u,v) within the sub-candidate region k. This represents the eight neighboring pixels of pixel (u,v). This represents the gradient magnitude of a neighboring pixel in the x-direction. This represents the gradient magnitude of a neighboring pixel in the y-direction.
[0047] As shown in step S3, one sub-candidate region corresponds to multiple sub-rectangles. The standard deviation of the gradient direction for each sub-rectangle is calculated. Assign a uniform weight to all pixels (u,v) within the i-th sub-rectangle. , ; Calculate the average structure tensor of pixels within sub-candidate region k. The expression is:
[0048] In the formula, This represents the weight of pixel (u,v) within the sub-candidate region k. Let represent the structure tensor of pixel (u,v) within the sub-candidate region k. This represents the total number of pixels within the sub-candidate region k.
[0049] The main body of a real scratch has relatively straight edges, and pixels in that area receive higher weights. Conversely, tiny burrs or irregularities that may exist at the ends or in the middle of the scratch receive lower weights. When calculating the average structure tensor, pixels with high weights and linear characteristics dominate, while the influence of low-weight pixels prone to noise interference is suppressed.
[0050] For an approximately circular pit, the gradient directions at all points along its edge are relatively divergent. Therefore, the standard deviation of most sub-rectangles is relatively large, and the weights of all pixels are relatively low and their values are similar. When calculating the average structure tensor, gradients in all directions are considered fairly. An isotropic average structure tensor is correctly calculated, with its two eigenvalues being similar in magnitude, accurately classifying the defect as a point defect.
[0051] For the average structure tensor Eigenvalues are obtained by performing eigenvalue decomposition. , and eigenvectors , ,in Greater than .
[0052] The expression for the geometric anisotropy index is:
[0053] In the formula, The geometric anisotropy index represents the sub-candidate region k. , Represents the average structure tensor Two eigenvalues, This represents a hyperparameter with a value of 0.1 to prevent the denominator from being 0.
[0054] When the defects within the sub-candidate region k are pits or spots, the gradient direction is uniformly distributed. and Similar in size, leading to Approaching 0 indicates that its geometry is isotropic; when there are linear scratches in the sub-candidate region k, the gradient direction is highly concentrated in the direction perpendicular to the scratch, leading to Much larger , making The value of approaches 1, indicating that its geometry is anisotropic.
[0055] S5: Generate dynamic structuring elements based on geometric anisotropy indices.
[0056] The equivalent diameter of the sub-candidate region is obtained by constructing an equivalent circle based on the area of the sub-candidate region, and then obtaining the diameter of this equivalent circle, which represents the basic scale of the corresponding defect. Then, the specific shape and size of the final structural element are determined by combining the geometric anisotropy index of the sub-candidate region. The method is as follows: a scratch defect can be approximated as an ellipse with a major axis much larger than its minor axis, while a circular defect can be approximated as an ellipse with its major and minor axes approximately equal. Therefore, an ellipse is constructed as the basic shape of the structural element, with its major axis... and short axis The expression is:
[0057]
[0058] In the formula, This represents the major axis of the ellipse constructed based on the sub-candidate region k. This represents the minor axis of the ellipse constructed based on the sub-candidate region k. Let represent the diameter of the equivalent circle constructed based on the sub-candidate region k. This represents the geometric anisotropy index of the sub-candidate region k. α represents the first adjustment coefficient, and β represents the second adjustment coefficient. α and β are used to control the adjustment magnitude of the anisotropy index on the major and minor axes. Their values are set manually according to the actual situation. For example, the value of α is 0.6 and the value of β is 0.7.
[0059] when When it approaches 0 (isotropic defect). and The generated structuring element It is an approximately circular structure, suitable for circular defects (pits, spots); when When it approaches 1 (anisotropic defect), the long axis Significantly elongated, while the short axis Significantly shortened, resulting in structural elements It is a slender ellipse, suitable for matching linear scratches.
[0060] Since scratches have two main directions: length and width, the grayscale value of a pixel remains relatively constant along the length of the scratch, while the grayscale value changes drastically along the width of the scratch. This affects the feature vector. The feature vector points in the direction of the most drastic grayscale change within the region, i.e., the width direction of the scratch. The direction pointing to the area where the grayscale change is gradual is the direction of the scratch length. This applies to structural elements in approximately circular defect areas. Direction determination method and structural elements of scratch defect area The method for determining the direction is the same.
[0061] In summary, structural elements The major axis direction corresponds to the eigenvector. The direction of the minor axis corresponds to the eigenvector. The direction.
[0062] S6: Detect defects on the surface of the connecting row based on the generation of dynamic structural elements.
[0063] Each sub-candidate region corresponds to a dynamically generated structuring element. Morphological transformations are performed using the dynamically generated structuring element. For example, if the average gray level of the sub-candidate region is lower than the average gray level of its surrounding regions (such as scratches or pits), a bottom-hat transformation is performed to obtain the defect image; conversely, if the average gray level of the sub-candidate region is higher than the average gray level of its surrounding regions (such as bright spots or protrusions), a top-hat transformation is performed to obtain the defect image. The bottom-hat and top-hat transformations are existing technologies, and the specific steps will not be described here.
[0064] By binarizing the defect image, the segmentation results of all defects on the surface of the connecting strip can be obtained, thus completing the defect detection on the surface of the connecting strip.
[0065] This invention also discloses a surface polishing quality inspection system for connector production, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement a surface polishing quality inspection method for connector production according to the present invention.
[0066] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.
[0067] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for inspecting the surface polishing quality of connecting bars during production, characterized in that, The steps include: acquiring a grayscale image of the connected surface, calculating the gradient energy of each pixel in the grayscale image, and selecting regions with gradient energy greater than a preset energy threshold as candidate regions; dividing the candidate regions into at least one sub-candidate region. Calculate the geometric anisotropy index for each sub-candidate region. The geometric anisotropy index is positively correlated with the difference in eigenvalues of the average structure tensor of all pixels in the sub-candidate region and negatively correlated with the sum of the eigenvalues. Generate structuring elements based on the geometric anisotropy index and the equivalent diameter of the corresponding sub-candidate region. Morphological detection is performed on each sub-candidate region using the corresponding structuring element to obtain the defect detection results.
2. The surface polishing quality inspection method for connecting bar production according to claim 1, characterized in that, A window region is constructed centered on the pixel whose gradient energy is to be calculated. The gradient magnitude of each pixel within the window region is calculated. The sum of the squares of the gradient magnitudes of each pixel within the window region is taken as the gradient energy of the central pixel of the window region.
3. The surface polishing quality inspection method for connecting bar production according to claim 1, characterized in that, The method for dividing the candidate region into at least one sub-candidate region is as follows: In the grayscale image, extract the edge pixels of the candidate region, calculate the gradient direction of the edge pixels, standardize the gradient direction, construct the minimum bounding rectangle for the candidate region, uniformly construct multiple sub-rectangles along the length direction, calculate the standard deviation of the gradient direction of the edge pixels in each sub-rectangle, use the obtained multiple standard deviations to arrange them according to the position order of the sub-rectangles to construct a standard deviation sequence, judge the stability of the standard deviation sequence, if the standard deviation sequence is unstable, use the ordered sample clustering algorithm to cluster to obtain multiple clusters, each cluster has multiple sub-rectangles corresponding to data points, and the candidate regions in multiple sub-rectangles constitute a sub-candidate region, further obtaining multiple sub-candidate regions.
4. The surface polishing quality inspection method for connecting bar production according to claim 2, characterized in that, The stability of a standard deviation series can be determined using the unit root test.
5. The surface polishing quality inspection method for connecting bar production according to claim 1, characterized in that, Before calculating the geometric anisotropy index of each sub-candidate region, the following is also included: for each pixel (u,v) within the sub-candidate region k, its structure tensor for: In the formula, Let represent the structure tensor of pixel (u,v) within the sub-candidate region k. This represents the eight neighboring pixels of pixel (u,v). This represents the gradient magnitude of a neighboring pixel in the x-direction. This represents the gradient magnitude of a neighboring pixel in the y-direction.
6. A surface polishing quality inspection method for connecting bar production according to claim 5, characterized in that, The geometric anisotropy index is calculated as follows: the average structure tensor of pixels within the sub-candidate region is calculated, and eigenvalues are obtained by eigenvalue decomposition of the average structure tensor. 、 ,in Greater than ,calculate and The ratio of 1 to the ratio of the two is used as the geometric anisotropy index.
7. The surface polishing quality inspection method for connecting bar production according to claim 6, characterized in that, The expression for the average structure tensor is: In the formula, Let represent the average structure tensor of pixels within sub-candidate region k. This represents the weight of pixel (u,v) within the sub-candidate region k. Let represent the structure tensor of pixel (u,v) within the sub-candidate region k. This represents the total number of pixels within the sub-candidate region k. This represents the weight of pixel (u,v) within the sub-candidate region k.
8. The surface polishing quality inspection method for connecting bar production according to claim 1, characterized in that, Structural elements include the major axis and short axis The expression is: ; In the formula, This represents the major axis of the ellipse constructed based on the sub-candidate region k. This represents the minor axis of the ellipse constructed based on the sub-candidate region k. Let represent the diameter of the equivalent circle constructed based on the sub-candidate region k. Let α represent the geometric anisotropy index of the sub-candidate region k, α represent the first adjustment coefficient, and β represent the second adjustment coefficient.
9. A surface polishing quality inspection method for connecting bar production according to claim 1, characterized in that, The method for morphological detection of each sub-candidate region using the corresponding structuring element is as follows: if the average gray level of the sub-candidate region is lower than the average gray level of its surrounding region, then a bottom-hat transformation is performed to obtain the defect image. If the average gray level of a sub-candidate region is higher than the average gray level of its surrounding regions, a top-hat transformation is performed to obtain the defect image.
10. A surface polishing quality inspection system for connecting bar production, characterized in that, include: A processor and a memory, the memory storing computer program instructions that, when executed by the processor, implement a surface polishing quality inspection method for connecting bar production according to any one of claims 1-9.