A hardware processing quality inspection method, electronic equipment and system

By calculating the edge similarity, curvature and grayscale variance sequences of hardware parts, the grayscale curvature index is constructed, which solves the problem of insufficient robustness in hardware crack recognition in the prior art, and achieves higher recognition accuracy and reliable detection sex.

CN118657740BActive Publication Date: 2024-11-22深圳市明鸿五金制品有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410830092.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-11-22
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

The existing automated detection technology has insufficient robustness in the identification of crack defects in hardware, especially in complex situations such as oil stains and shadows.

Method used

By obtaining the grayscale map and edge images of the hardware, calculate the edge similarity, curvature sequence and grayscale variance sequence, and construct the grayscale curvature index to improve the accuracy and robustness of crack feature matching and reduce the impact of external interference.

Benefits of technology

It improves the accuracy and robustness of crack defects in hardware, and can accurately identify crack defects in complex situations, improving the accuracy and reliability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657740B_ABST
    Figure CN118657740B_ABST
Patent Text Reader

Abstract

The present application relates to the field of image processing technology, and specifically to a method, electronic device and system for quality inspection of hardware processing, the method comprising: extracting edges from a hardware grayscale image to obtain a hardware edge image; determining the length of each edge in the hardware edge image; constructing the edge similarity of any two edges in the hardware edge image; determining the curvature of all pixel points on each edge in the hardware edge image; determining the grayscale variance of each pixel point on each edge in the hardware edge image, and forming a grayscale variance sequence of each edge in the hardware edge image; constructing the grayscale curvature index of any two edges in the hardware edge image to inspect the hardware. The present application effectively reduces the influence of external interference factors through multi-dimensional analysis, and improves the accuracy and reliability of hardware crack defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, electronic equipment and system for quality inspection of hardware processing. Background Art

[0002] With the vigorous development of the manufacturing industry, hardware, as the basic components in industrial production, has become the focus of the industry in the increasingly popular precision manufacturing and automated assembly. With the development of modern technology, in the quality inspection link after the hardware processing is completed, automated testing technology is often used for large-scale quality inspection.

[0003] Most of the existing automated inspection technologies focus on dimensional measurement and simple identification of surface defects. These technologies usually rely on a single image processing method, such as simple edge detection or template matching, and have certain limitations. Taking crack defects on hardware as an example, when using automated image processing methods for crack identification, cracks are determined based on whether there are obvious texture mutations or edge lines in the image, and less attention is paid to the specific characteristics of the cracks. However, when there are oil stains, shadows, etc. on the hardware, the image quality will be affected, making the texture changes or edges more obvious, which will affect the detection of crack defects. Therefore, there is an urgent need for a hardware processing quality inspection method with good robustness and the ability to accurately identify crack defects, so that crack defects can be accurately identified in various complex situations. Summary of the invention

[0004] In a first aspect, an embodiment of the present application provides a method for quality inspection of hardware processing, the method comprising the following steps:

[0005] Obtain the hardware grayscale image and hardware edge image of the hardware;

[0006] According to the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges, the edge similarity of the any two edges is constructed;

[0007] The curvature of each pixel on each edge is determined according to the grayscale distribution and change trend of each pixel and its neighboring pixels on each edge, and a curvature sequence of each edge in the hardware edge image is formed;

[0008] A neighborhood is set with each pixel on the edge as the center, and the grayscale variance of each pixel on each edge is determined according to the grayscale distribution of the pixels in the neighborhood of each pixel on each edge to form a grayscale variance sequence of each edge;

[0009] The first difference between the two edges is obtained according to the difference between the curvatures of all pixel points with the same horizontal coordinates on the two edges and the difference between the grayscale variances. The second difference between the two edges is determined according to the correlation between the curvature sequence and the grayscale variance sequence of each edge. In combination with the edge similarity, the grayscale curvature index of the two edges is constructed to perform quality inspection on hardware.

[0010] Preferably, the edge similarity between any two edges is a ratio of the similarity between the change trends of any two edges to the length difference.

[0011] Preferably, the method for determining the curvature of each pixel point on each edge in the hardware edge image is:

[0012] The grayscale values ​​of all pixels in the neighborhood of each pixel on each edge are fitted to obtain a fitting curve of each pixel on each edge, and the curvature of each pixel on each edge is the curvature of the fitting curve of each pixel.

[0013] Preferably, the process of constructing the grayscale variance of each pixel on each edge in the hardware edge image is as follows:

[0014] The grayscale histogram of the neighborhood of each pixel point on each edge is obtained, and the grayscale variance of each pixel point on each edge is the variance of the grayscale histogram of the neighborhood of each pixel point on each edge in the hardware edge image.

[0015] Preferably, the process of obtaining the first difference between any two edges is:

[0016] Determine the difference between the curvatures of the pixel pairs with the same horizontal coordinates on the two edges, recorded as the curvature difference of the pixel pairs with the same horizontal coordinates on the two edges;

[0017] Determine the difference between the grayscale variances of the pixel pairs with the same horizontal coordinates on the two arbitrary edges, recorded as the grayscale variance difference of the pixel pairs with the same horizontal coordinates on the two arbitrary edges;

[0018] Analyze the sum of the curvatures of the pixel pairs with the same horizontal coordinates on the two edges and the corresponding grayscale variance differences, and record it as the grayscale curvature variance sum of the pixel pairs with the same horizontal coordinates on the two edges;

[0019] The first difference between any two edges is the cumulative result of the grayscale curvature variance and value of all pixel points with the same horizontal coordinate on the any two edges.

[0020] Preferably, the second difference between any two edges is the sum of correlations between the curvature sequences and the grayscale variance sequences of the any two edges.

[0021] Preferably, the process of constructing the grayscale curvature index of any two edges in the hardware edge image is:

[0022] The product of the first difference and the second difference of the two arbitrary edges is recorded as the grayscale curvature product of the two arbitrary edges;

[0023] The grayscale curvature index of any two edges is the ratio of the edge similarity of the any two edges to the product of the grayscale curvature.

[0024] Preferably, the quality inspection of the hardware includes:

[0025] Using all the grayscale curvature indices as inputs of a threshold segmentation algorithm to obtain a segmentation threshold;

[0026] When the grayscale curvature index is greater than the segmentation threshold, the corresponding two edges are crack edges and the hardware has crack defects; otherwise, the hardware does not have crack defects.

[0027] In a second aspect, an embodiment of the present application further provides a hardware processing quality inspection device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of any one of the above methods when executing the computer program.

[0028] In a third aspect, an embodiment of the present application provides a hardware processing quality inspection system, the system comprising:

[0029] Hardware image acquisition module, to obtain the hardware grayscale image and hardware edge image of the hardware;

[0030] The hardware image analysis module constructs the edge similarity of any two edges according to the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges;

[0031] The curvature of each pixel on each edge is determined according to the grayscale distribution and change trend of each pixel and its neighboring pixels on each edge, and a curvature sequence of each edge in the hardware edge image is formed;

[0032] A neighborhood is set with each pixel on the edge as the center, and the grayscale variance of each pixel on each edge is determined according to the grayscale distribution of the pixels in the neighborhood of each pixel on each edge to form a grayscale variance sequence of each edge;

[0033] The hardware quality inspection module obtains the first difference between the arbitrary two edges according to the difference between the curvatures of all pixel points with the same horizontal coordinates on the arbitrary two edges and the difference between the grayscale variances, determines the second difference between the arbitrary two edges according to the correlation between the curvature sequence and the grayscale variance sequence of each edge, and constructs the grayscale curvature index of the arbitrary two edges in combination with the edge similarity to perform quality inspection on the hardware.

[0034] It can be seen from the above embodiments that the hardware processing quality inspection method provided in the embodiments of the present application has at least the following beneficial effects:

[0035] This application calculates the edge similarity between any two edges based on the trend characteristics and length characteristics of the edges on both sides of the crack, so that it can more accurately measure whether the edges meet the characteristics of the crack; then combined with the curvature of each pixel point on the edge, the grayscale distribution changes, and the curvature and grayscale distribution differences between pixels with the same horizontal coordinates, the grayscale curvature index between the two edges is calculated, which further improves the accuracy of edge and crack feature matching, thereby improving the accuracy and robustness of crack identification. In this way, the constructed grayscale curvature index comprehensively considers multiple characteristics of the crack (edge ​​direction, length, slope sequence correlation, curvature and grayscale distribution), providing a more sophisticated crack identification method, which can effectively reduce the impact of external interference factors (such as oil stains, shadows) through multi-dimensional analysis, and improve the accuracy and reliability of hardware crack defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0037] Figure 1 It is a flow chart of the steps of a method for quality inspection of hardware processing;

[0038] Figure 2 It is the grayscale image of the curvature of hardware;

[0039] Figure 3 It is the hardware edge curve fitting diagram;

[0040] Figure 4 Schematic diagram for grayscale curvature index extraction;

[0041] Figure 5 This is a schematic diagram of the hardware quality inspection process;

[0042] Figure 6 This is a block diagram of a hardware processing quality inspection system. DETAILED DESCRIPTION

[0043] In order to further explain the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the following is a detailed description of a hardware processing quality inspection method and system proposed in the present application, its specific implementation method, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0044] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0045] The specific scheme of a hardware processing quality inspection method and system provided by the present application is described in detail below with reference to the accompanying drawings.

[0046] See also Figure 1 , which shows a flowchart of a method for quality inspection of hardware processing provided by an embodiment of the present application, the method comprising the following steps:

[0047] Step S1: Acquire the original image of the hardware and pre-process the original image.

[0048] First, the camera is used to shoot the processed hardware to obtain the original image of the hardware. Then the original image of the hardware is used as input, the filtering algorithm is used to pre-process it, and the denoised image is grayed to obtain the hardware grayscale image.

[0049] It should be noted that there are many commonly used filtering algorithms. As an embodiment of the present application, the median filtering algorithm is used in the present embodiment to denoise the image. The implementer may also use Gaussian filtering, mean filtering or bilateral filtering to denoise the image. Among them, the median filtering algorithm is a well-known technology, and the specific process of denoising is not repeated here.

[0050] Step S2: constructing edge similarity of any two edges in the hardware edge image according to the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges.

[0051] S201: Determine the length of each edge in the hardware edge image according to the difference between adjacent pixel points on each edge in the hardware edge image, and determine the slope sequence.

[0052] Cracks are usually caused by uneven stress inside the hardware, which causes the material to crack in a certain direction. This cracking usually occurs along the direction of the force, so the direction of the edges on both sides of the crack should be consistent, otherwise it will not be a crack, but damage or material peeling. To this end, by extracting the edges in the hardware grayscale image, the direction of the edges is analyzed, specifically:

[0053] The hardware grayscale image is taken as input, and the edge detection algorithm is used to extract the edges in the hardware grayscale image to obtain the hardware edge image.

[0054] The number of pixels on each edge of the hardware edge image is counted as the length of each edge.

[0055] Furthermore, the slopes of the lines between all adjacent pixels on each edge in the hardware edge image are analyzed, and the slopes are organized into a slope sequence of each edge in the hardware edge image according to the position sequence of the pixels.

[0056] S202: constructing edge similarity between any two edges in the hardware edge image according to the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges.

[0057] In the hardware grayscale image, the edges of the crack area should have the following characteristics: the trend direction of the two edges of the same crack area is basically the same; and because the force direction and the trend of the edges on both sides are consistent, the lengths of the two edges are basically the same or similar. When there are oil stains, shadows, etc. on the hardware, they are often irregular geometric shapes, and there may be multiple discontinuous distributions, which makes the edge mutation more obvious. The edges caused by oil stains are often not guaranteed to have similar trends and lengths.

[0058] Therefore, the edge similarity between any two edges in the hardware edge image is determined by the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges, specifically:

[0059] The ratio of the maximum value to the minimum value of the lengths of any two edges in the hardware edge image is recorded as the edge difference between any two edges in the hardware edge image;

[0060] Analyze the similarity between the slope sequences of any two edges in the hardware edge image;

[0061] It should be noted that, for ease of understanding and description, in this embodiment, the ratio of the maximum value to the minimum value of the lengths of any two edges in the hardware edge image is recorded as the edge difference between any two edges in the hardware edge image.

[0062] It should be noted that there are many methods for measuring the similarity between sequences. As an embodiment of the present application, the Pearson correlation coefficient is used in this embodiment to determine the similarity between the slope sequences. The implementer may also use methods such as cosine similarity or Kendall rank correlation coefficient to measure the similarity between sequences. This embodiment does not impose any special restrictions.

[0063] The edge similarity between any two edges is determined based on the edge difference and the similarity, and the edge similarity between any two edges is the ratio of the similarity between the change trends of any two edges to the length difference.

[0064] It can be understood that when two edges are curves on both sides of the same crack, the two edges should have similar trend directions, that is, there should be a positive correlation between the corresponding slope sequences, so the Pearson correlation coefficient between the slope sequences of the two edges should be close to 1;

[0065] Secondly, the lengths of the two edges are basically the same or similar, so the edge difference is also close to 1; therefore, when the two edges are curves on both sides of the same crack, the edge similarity between the two is relatively large, and the closer to 1, the higher the similarity.

[0066] On the contrary, when the two edges are not curves on both sides of the same crack, or are curves of oil stains, shadows, etc., due to the existence of multiple discontinuous and irregular distribution areas, it is impossible to ensure that the trend and length of the edges on both sides are similar, and thus the edge similarity of the two edges is small.

[0067] S3: Based on the difference between the curvatures of all pixels with the same horizontal coordinates on any two edges in the hardware edge image, the difference between the grayscale variances of all pairs of pixels with the same horizontal coordinates, and the correlation and edge similarity between the curvature sequence and grayscale variance sequence of any two edges, the grayscale curvature index of any two edges in the hardware edge image is constructed.

[0068] Because edge similarity only considers the direction and length relationship of the edge, it is not enough to make an accurate judgment. Further analysis is also needed in combination with the grayscale change and curvature change of the edge.

[0069] First, the grayscale value of the pixel points located in the normal area of ​​the hardware is relatively large; when cracks appear on the hardware, the crack area is often darker in color, that is, the grayscale value of the pixel points is relatively small.

[0070] Secondly, the curvature of the curve at the pixel point on the edge of the crack has a great influence on the grayscale distribution around the pixel point. When the curvature of the curve at the pixel point is more serious, the area on the same side in the surrounding neighborhood of the pixel point is larger. The area on the same side refers to the normal area or the crack area with the edge as the boundary. Since the grayscale values ​​on both sides of the curve are inconsistent, the larger the area on the same side, the more consistent the distribution of grayscale values ​​in the surrounding neighborhood of the pixel point;

[0071] On the contrary, the smoother the curve changes at the pixel point, the worse the distribution consistency of the grayscale value in the neighborhood around the pixel point.

[0072] Preferably, as an embodiment of the present application, the hardware curvature grayscale map is as follows: Figure 2 As shown in the figure, 1 is the 3*3 neighborhood of the pixel, 2 and 3 are the edges on both sides of the crack, 4 is the pixel, and 5 is the crack area.

[0073] S301: Determine the curvature of all pixel points on each edge in the hardware edge image according to the distribution and change trend of all pixel points on each edge in the hardware edge image.

[0074] On the edge of the crack, the degree of curvature of the curve at the pixel location will significantly affect the grayscale distribution of the surrounding pixels. Specifically, when the curve at the pixel is more severely curved, the area near the pixel, whether normal or cracked, will be wider on the same side. Therefore, the characteristics of the hardware crack are further determined by analyzing the curvature of each pixel on each edge in the hardware edge image.

[0075] The grayscale values ​​of all pixels in the neighborhood of each pixel on each edge are fitted to obtain a fitting curve of each pixel on each edge, and the curvature of each pixel on each edge is the curvature of the fitting curve of each pixel.

[0076] It should be noted that the value of the neighborhood size is manually set. In this embodiment, the neighborhood size is set to 5. The implementer can set it according to the specific situation. This embodiment does not impose any special restrictions.

[0077] The curvatures of all the pixels on each edge in the hardware edge image form a curvature sequence of each edge in the hardware edge image in the order of the pixels.

[0078] It should be noted that there are many fitting methods. This embodiment adopts a polynomial fitting method to fit the fitting sequence of each pixel point. The implementer may adopt other fitting methods such as least squares to fit the fitting sequence, and this embodiment does not impose any special restrictions.

[0079] The polynomial fitting and the curvature calculation are both well-known technologies, and the specific process will not be described in detail.

[0080] Preferably, as an embodiment of the present application, the hardware edge curve fitting diagram is as follows: Figure 3 Wherein, F1 is a pixel point, F2 is the overall fitting curve of all pixel points, and F3 is the local fitting curve of each first preset number of pixel points before and after the pixel point.

[0081] S302: Calculate a grayscale curvature index according to grayscale and curvature changes between two edges.

[0082] The edge of the crack may have irregular textures, which appear as different grayscale patterns on the curve. The greater the curvature of the curve, the more complex the texture changes, which affects the surrounding grayscale values. When the curve is more curved, the neighborhood of the pixel point may contain more curvature and angle changes, which will affect the distribution of grayscale values ​​around the pixel point. Therefore, the grayscale curvature index is determined based on the difference between the curvatures of all pixels with the same horizontal coordinates on any two edges in the hardware edge image, the difference between the grayscale variances of all pairs of pixels with the same horizontal coordinates, and the correlation and edge similarity between the curvature sequence and grayscale variance sequence of any two edges, as follows:

[0083] (1) Obtain the grayscale variance sequence of each edge in the hardware edge image.

[0084] The W neighborhood is set with each pixel point on each edge in the hardware edge image as the center, the histogram of the W neighborhood of each pixel point on each edge in the hardware edge image is counted, and the variance of the grayscale histogram of the W neighborhood of each pixel point on each edge in the hardware edge image is calculated, which is recorded as the grayscale variance of each pixel point on each edge in the hardware edge image.

[0085] It should be noted that the calculation of the gray histogram and the gray histogram variance are both well-known technologies, and the specific process will not be repeated. Among them, the value of the neighborhood W is artificially set. In this embodiment, the value of the neighborhood W is 8, and the implementer can set it according to the specific situation. This embodiment does not make special restrictions.

[0086] The grayscale variances of all pixels on each edge in the hardware edge image form a grayscale variance sequence of each edge in the hardware edge image according to the position order of the pixels.

[0087] (2) Determine the grayscale curvature index of any two edges in the hardware edge image.

[0088] Furthermore, according to the difference in curvature of all pixels with the same horizontal coordinates on any two edges in the hardware edge image, the difference in grayscale variance of all pixels with the same horizontal coordinates, and the correlation and edge similarity between the curvature sequence and grayscale variance sequence of any two edges, the grayscale curvature index between any two edges is constructed, which is:

[0089] The first difference between any two edges: determine the difference between the curvatures of the pixel pairs with the same horizontal coordinates on any two edges in the hardware edge image, recorded as the curvature difference of the pixel pairs with the same horizontal coordinates on any two edges in the hardware edge image;

[0090] Determine the difference between the grayscale variances of the pixel pairs with the same horizontal coordinates on any two edges in the hardware edge image, and record it as the grayscale variance difference of the pixel pairs with the same horizontal coordinates on any two edges in the hardware edge image;

[0091] It should be noted that there are many methods for measuring differences, and the methods for measuring differences are not limited to methods such as taking the absolute value of the difference and the ratio. In this embodiment, the curvature difference and the grayscale variance difference are obtained by taking the absolute value of the difference. The implementer can select a suitable difference measurement method according to the specific application scenario, data characteristics and tracking target requirements, and this embodiment does not impose any special restrictions.

[0092] Further, the sum of the curvature and the corresponding grayscale variance difference of the pixel pairs with the same horizontal coordinates on any two edges in the hardware edge image is analyzed, and recorded as the grayscale curvature variance sum of the pixel pairs with the same horizontal coordinates on any two edges in the hardware edge image;

[0093] The first difference between any two edges in the hardware edge image is determined based on all the grayscale curvature variances and values. The first difference between any two edges in the hardware edge image is the cumulative result of the grayscale curvature variances and values ​​of the pixel pairs with the same horizontal coordinates on any two edges in the hardware edge image.

[0094] The second difference between any two edges: Analyze the correlation between the curvature sequence and the grayscale variance sequence of each edge in the hardware edge image, and record it as the grayscale curvature similarity between the curvature sequence and the grayscale variance sequence of each edge in the hardware edge image;

[0095] The second difference between any two edges in the hardware edge image is determined based on the grayscale curvature similarity, and the second difference between any two edges in the hardware edge image is the sum of the grayscale curvature similarities of any two edges in the hardware edge image.

[0096] It should be noted that there are many methods for measuring the similarity, i.e., correlation, between sequences. As an embodiment of the present application, the Pearson correlation coefficient is used in this embodiment to determine the similarity between the curvature sequence and the grayscale variance sequence. The implementer may also use methods such as cosine similarity or Kendall rank correlation coefficient to measure the similarity between sequences. This embodiment does not impose any special restrictions.

[0097] Further, the grayscale curvature index of any two edges in the hardware edge image is determined based on the first difference, the second difference and the edge similarity. The grayscale curvature index of any two edges in the hardware edge image is constructed as follows:

[0098] The product of the first difference and the second difference of any two edges in the hardware edge image is recorded as the grayscale curvature product of any two edges in the hardware edge image; the grayscale curvature index of any two edges in the hardware edge image is the ratio of the edge similarity of any two edges in the hardware edge image to the grayscale curvature product.

[0099] It can be understood that when two edges are curves on both sides of the same crack, the edge similarity between the two edges is large and close to 1; and because the crack area and the area outside the crack have color differences, the corresponding grayscale changes are different when the curve is bent to a different degree. When the curve is severely bent, that is, the curvature is large, the consistency of the grayscale distribution in the neighborhood around the pixel point is higher, so the grayscale variance of the neighborhood is smaller, that is, the curvature sequence of the same edge is negatively correlated with the grayscale variance sequence, so the grayscale curvature similarity is closer to -1;

[0100] Since the directions of the edges on both sides of the same crack are relatively consistent, the curvature between the pixels with the same horizontal coordinate is close, so the consistency of the grayscale distribution is also close, that is, the curvature difference and grayscale variance difference between the pixels with the same horizontal coordinate are small, and the second difference is small;

[0101] Therefore, when the two edges are curves on both sides of the same crack, the grayscale curvature index between the two edges is larger. On the contrary, when the two edges are not curves on both sides of the same crack, or are curves in situations such as oil stains and shadows, it is often impossible to ensure that the curvature and grayscale distribution between pixels with the same horizontal coordinates are similar, resulting in a smaller grayscale curvature index between the two edges.

[0102] Preferably, as an embodiment of the present application, the grayscale curvature index extraction schematic diagram is as follows: Figure 4 shown.

[0103] Step S4: Quality inspecting hardware based on the grayscale curvature index of any two edges in the hardware edge image.

[0104] Take a second preset number of sample images of hardware, at least half of which contain cracks, and calculate the grayscale curvature index between any two edges in each sample image according to the grayscale curvature index calculation method of step S3. Use all the grayscale curvature indexes as inputs to the threshold segmentation algorithm to obtain the segmentation threshold; when the grayscale curvature index is greater than the preset segmentation threshold, the two edges are the edges on both sides of the crack on the hardware, thereby determining that there is a crack defect on the hardware; conversely, when the grayscale curvature index is less than or equal to the segmentation threshold, there is no crack defect on the hardware. And locate the crack defect according to the position of the edge.

[0105] It should be noted that there are many commonly used threshold segmentation algorithms. In this embodiment, the Otsu threshold segmentation algorithm is used to obtain the segmentation threshold. The implementer may also use other threshold segmentation methods to automatically obtain the optimal threshold, and this embodiment does not impose any special restrictions.

[0106] Among them, the Otsu threshold segmentation algorithm is a well-known technology, and the specific process will not be repeated here.

[0107] By analyzing the specific features of the edge changes on both sides of the crack, rather than just focusing on the degree of texture and edge abnormalities in the image, the impact of oil stains, shadows, etc. can be reduced, and the presence of cracks can be more accurately identified, as well as the edges corresponding to the cracks, thereby determining the location of the cracks. In the process of hardware processing quality inspection, this method helps to improve the processing quality inspection effect and quality of hardware.

[0108] Preferably, as an embodiment of the present application, the hardware quality inspection process diagram is as follows Figure 5 shown.

[0109] At this point, the quality inspection of hardware is completed based on the grayscale curvature index of any two edges in the hardware edge image.

[0110] Based on the same inventive concept as the above method, an embodiment of the present application also provides a hardware processing quality inspection device, including a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, the steps of any one of the above-mentioned hardware processing quality inspection methods are implemented.

[0111] Based on the same inventive concept as the above method, the embodiment of the present application also provides a hardware processing quality inspection system, including:

[0112] Hardware image acquisition module, to obtain the hardware grayscale image and hardware edge image of the hardware;

[0113] The hardware image analysis module constructs the edge similarity of any two edges according to the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges;

[0114] The curvature of each pixel on each edge is determined according to the grayscale distribution and change trend of each pixel and its neighboring pixels on each edge, and a curvature sequence of each edge in the hardware edge image is formed;

[0115] A neighborhood is set with each pixel on the edge as the center, and the grayscale variance of each pixel on each edge is determined according to the grayscale distribution of the pixels in the neighborhood of each pixel on each edge to form a grayscale variance sequence of each edge;

[0116] The hardware quality inspection module obtains the first difference between the arbitrary two edges according to the difference between the curvatures of all pixel points with the same horizontal coordinates on the arbitrary two edges and the difference between the grayscale variances, determines the second difference between the arbitrary two edges according to the correlation between the curvature sequence and the grayscale variance sequence of each edge, and constructs the grayscale curvature index of the arbitrary two edges in combination with the edge similarity to perform quality inspection on the hardware.

[0117] The block diagram of a hardware processing quality inspection system provided in the embodiment of the present application is as follows: Figure 6 shown.

[0118] It should be noted that the above sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above is a description of a specific embodiment of this specification. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0119] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0120] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for quality inspection of hardware processing, characterized in that: The method comprises the following steps: Obtain the hardware grayscale image and hardware edge image of the hardware; According to the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges, the edge similarity of the any two edges is constructed; The curvature of each pixel on each edge is determined according to the grayscale distribution and change trend of each pixel and its neighboring pixels on each edge, and a curvature sequence of each edge in the hardware edge image is formed; A neighborhood is set with each pixel on the edge as the center, and the grayscale variance of each pixel on each edge is determined according to the grayscale distribution of the pixels in the neighborhood of each pixel on each edge to form a grayscale variance sequence of each edge; The first difference between the two edges is obtained according to the difference between the curvatures of all pixel points with the same horizontal coordinates on the two edges and the difference between the grayscale variances, the second difference between the two edges is determined according to the correlation between the curvature sequence and the grayscale variance sequence of each edge, and the grayscale curvature index of the two edges is constructed in combination with the edge similarity to perform quality inspection on the hardware; The process of obtaining the first difference between any two edges is as follows: Determine the difference between the curvatures of the pixel pairs with the same horizontal coordinates on the two edges, recorded as the curvature difference of the pixel pairs with the same horizontal coordinates on the two edges; Determine the difference between the grayscale variances of the pixel pairs with the same horizontal coordinates on the two arbitrary edges, recorded as the grayscale variance difference of the pixel pairs with the same horizontal coordinates on the two arbitrary edges; Analyze the sum of the curvatures of the pixel pairs with the same horizontal coordinates on the two edges and the corresponding grayscale variance differences, and record it as the grayscale curvature variance sum of the pixel pairs with the same horizontal coordinates on the two edges; The first difference between any two edges is the cumulative result of the grayscale curvature variance and value of all pixel points with the same horizontal coordinates on the any two edges; The second difference between any two edges is the sum of the correlations between the curvature sequence and the grayscale variance sequence of the any two edges; The construction process of the grayscale curvature index of any two edges in the hardware edge image is: The product of the first difference and the second difference of the two arbitrary edges is recorded as the grayscale curvature product of the two arbitrary edges; The grayscale curvature index of any two edges is the ratio of the edge similarity of the any two edges to the product of the grayscale curvature.

2. A method for quality inspection of hardware processing as claimed in claim 1, characterized in that: The edge similarity between any two edges is a ratio of the similarity between the change trends of any two edges to the length difference.

3. A method for quality inspection of hardware processing as claimed in claim 1, characterized in that: The method for determining the curvature of each pixel point on each edge in the hardware edge image is: The grayscale values ​​of all pixels in the neighborhood of each pixel on each edge are fitted to obtain a fitting curve of each pixel on each edge, and the curvature of each pixel on each edge is the curvature of the fitting curve of each pixel.

4. A method for quality inspection of hardware processing as claimed in claim 1, characterized in that: The construction process of the grayscale variance of each pixel on each edge in the hardware edge image is: The grayscale histogram of the neighborhood of each pixel point on each edge is obtained, and the grayscale variance of each pixel point on each edge is the variance of the grayscale histogram of the neighborhood of each pixel point on each edge in the hardware edge image.

5. A method for quality inspection of hardware processing as claimed in claim 1, characterized in that: The quality inspection of hardware includes: Using all the grayscale curvature indices as inputs of a threshold segmentation algorithm to obtain a segmentation threshold; When the grayscale curvature index is greater than the segmentation threshold, the corresponding two edges are crack edges and the hardware has crack defects; otherwise, the hardware does not have crack defects.

6. A hardware processing quality inspection device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

7. A hardware processing quality inspection system, implementing the method as claimed in claim 1, characterized in that: The system comprises: Hardware image acquisition module, to obtain the hardware grayscale image and hardware edge image of the hardware; The hardware image analysis module constructs the edge similarity of any two edges according to the length difference between any two edges in the hardware edge image and the similarity between the change trends of any two edges; The curvature of each pixel on each edge is determined according to the grayscale distribution and change trend of each pixel and its neighboring pixels on each edge, and a curvature sequence of each edge in the hardware edge image is formed; A neighborhood is set with each pixel on the edge as the center, and the grayscale variance of each pixel on each edge is determined according to the grayscale distribution of the pixels in the neighborhood of each pixel on each edge to form a grayscale variance sequence of each edge; The hardware quality inspection module obtains the first difference between the arbitrary two edges according to the difference between the curvatures of all pixel points with the same horizontal coordinates on the arbitrary two edges and the difference between the grayscale variances, determines the second difference between the arbitrary two edges according to the correlation between the curvature sequence and the grayscale variance sequence of each edge, and constructs the grayscale curvature index of the arbitrary two edges in combination with the edge similarity to perform quality inspection on the hardware.