A visual inspection method and system for hardware stamping defects
Through mutation pixel screening and grayscale difference analysis of edge images, a defect index of hardware is constructed, which solves the problem of misjudgment in burr detection in the existing technology and improves detection accuracy and efficiency.
Patent Information
- Application Number
- CN202411000830.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-25
AI Technical Summary
Existing hardware burr defect detection methods are difficult to accurately distinguish between burr areas and normal edges, leading to misjudgments and missed detections, affecting detection efficiency and production quality.
By obtaining the edge image of the hardware image, the mutation pixels are screened out according to the spatial distribution characteristics of adjacent edge pixels to form a data sequence, and the defect index of the hardware is constructed based on the grayscale difference and the size and number of burr areas, and then carried out Stamping defect detection.
It effectively reduces the missed detection and misdetection of burr defect areas, and improves the accuracy and efficiency of stamping defect detection of hardware parts.
Smart Images

Figure CN118552524B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for visually detecting stamping defects of hardware parts. Background Art
[0002] Automotive hardware stamping defect detection plays an important role and is widely used in the automotive manufacturing industry, especially for more sophisticated hardware structures. Various problems may occur during the stamping process, including but not limited to the possibility of twisting and breaking of slender hardware during the stamping process. This is usually avoided by multi-stage stamping. By splitting the stamping action, the torsion and fracture of slender hardware can be greatly reduced. The multi-stage action includes the following steps:
[0003] 1. Punch the positioning hole; 2. Rough punch the upper part of the hardware; 3. Rough punch the lower part of the hardware; 4. Rough punch the middle part of the hardware and cut off the upper part; 5. Cut off the lower part; 6. Beat the upper part and punch out the chamfer; 7. Beat the lower part and punch out the chamfer; 8. Fine punch the middle part; 9. Cut off the lower part; 10. Cut off the upper part. In this process, relatively more connections between the hardware and the material are maintained to keep the overall flatness to the greatest extent, thereby preventing the possibility of breakage and twisting in the traditional stamping process.
[0004] However, since zero error cannot be guaranteed and there are unavoidable objective factors such as punch wear, multi-stage stamping action will make product defect detection more important, especially the burr problem of hardware after multiple stamping.
[0005] Existing burr defect detection methods often use edge detection, but because the burr edge is connected to the normal hardware edge, it is often impossible to distinguish whether certain areas belong to normal shape features or burr areas. The judgment of the burr area will lead to misjudgment and missed judgment, affecting the detection efficiency and causing certain production losses. Summary of the invention
[0006] The invention provides a hardware stamping defect visual detection method and system to solve the existing problems.
[0007] A method and system for visually inspecting stamping defects of hardware parts of the present invention adopts the following technical solutions:
[0008] An embodiment of the present invention provides a method for visually detecting stamping defects of hardware parts, the method comprising the following steps:
[0009] Get hardware images;
[0010] Obtain edge images of hardware images; obtain mutation pixels based on the spatial distribution characteristics between adjacent edge pixels on the edge image to form a data sequence; filter out mutation sequences from the data sequence based on the variation characteristics of the element values in the data sequence; filter out mutation pixels that may belong to the burr region from the mutation sequence based on the edge performance of the burr region to obtain suspected burr regions; filter out suspected burr regions based on grayscale differences to obtain burr regions; construct a defect index for hardware based on the size and number of burr regions;
[0011] According to the defect index of the hardware, the detection results of the hardware stamping defects are obtained.
[0012] Furthermore, the method of obtaining mutation pixels according to the spatial distribution characteristics between adjacent edge pixels on the edge image to form a data sequence, and screening out the mutation sequence from the data sequence according to the variation characteristics of the element values in the data sequence, includes the following specific methods:
[0013] First, take the first pixel point from left to right and from top to bottom in the hardware image as the coordinate origin, establish the coordinate axis, and obtain the horizontal and vertical coordinates of the edge pixel points in the image;
[0014] Then, according to the spatial distribution characteristics between adjacent edge pixels on the edge image, the angle parameters, horizontal position parameters and vertical position parameters of the edge pixels are obtained. The angle mutation degree of the edge pixels on the hardware is calculated through the angle parameters, horizontal position parameters and vertical position parameters of the adjacent pixels. The threshold is preset. , the angle mutation degree is greater than or equal to the threshold The edge pixels are recorded as mutation pixels;
[0015] Finally, the angle mutation degrees of the mutation pixels are sorted from left to right and from top to bottom to form a data sequence of the angle mutation degrees of the mutation pixels. The mutation sequence is selected from the data sequence based on the performance characteristics of the edge pixels on the sharp shape part of the hardware itself.
[0016] Furthermore, the angle mutation degree of the pixel points on the edge of the hardware is calculated by using the angle parameters, horizontal position parameters and vertical position parameters of the adjacent pixel points, including the specific method of:
[0017] Will continue The average angle parameter of the edge pixels is recorded as The local angle coefficient of the edge pixel point, the sum of the average horizontal position parameter and the average vertical position parameter is recorded as the local position parameter, where is the preset first parameter;
[0018]
[0019] in, Indicates The degree of angle mutation of edge pixels, Indicates The angle parameter of the edge pixel, Indicates The local angle coefficient of edge pixels, Indicates The horizontal position parameters of edge pixels, Indicates The vertical position parameters of edge pixels, Indicates The local position coefficient of edge pixels, represents the linear normalization function.
[0020] Furthermore, the angle parameter, horizontal position parameter and vertical position parameter of the pixel point are specifically obtained by:
[0021] Get the edge image The edge pixel and the adjacent The line connecting the edge pixels is recorded as the first line segment, and the first line segment in the edge image is obtained. The edge pixel and the adjacent The line connecting the edge pixels is recorded as the second line segment, and the angle formed by the first line segment and the second line segment is recorded as the Angle parameters of edge pixels;
[0022] Get the edge image The edge pixel and the adjacent The difference of the horizontal coordinates of the edge pixels is recorded as the first difference, and the first The edge pixel and the adjacent The difference between the horizontal coordinates of the edge pixels is recorded as the second difference, and the absolute value of the difference between the first difference and the second difference is recorded as the The horizontal position parameters of edge pixels;
[0023] By analogy, we can obtain the edge image The vertical position parameters of the edge pixels are obtained in the same way as the horizontal position parameters.
[0024] Furthermore, the method of selecting a mutation sequence from the data sequence according to the performance characteristics of edge pixels on the sharp-shaped portion of the hardware itself includes the following specific methods:
[0025] Filter out repeated consecutive occurrences in a data sequence or more data, the mutation pixel points corresponding to the data are recorded as smooth pixel points, the angle mutation degree of the smooth pixel points in the data sequence is deleted, and the sequence composed of the angle mutation degree of the remaining mutation pixel points is recorded as the mutation sequence, where The second parameter is preset.
[0026] Furthermore, the method of screening the mutation pixels that may belong to the burr area from the mutation sequence according to the edge performance of the burr area to obtain the suspected burr area includes the following specific methods:
[0027] The number of pixels between any mutation pixel and the adjacent mutation pixel in the mutation sequence in the edge image is recorded as the spatial mutation parameter of the mutation pixel. Continuous adjacent The mutation pixel points are recorded as the endpoints of the suspected burr area;
[0028] in, is the preset threshold, are the preset hyperparameters;
[0029] According to the endpoints of the suspected burr area, a plurality of suspected burr areas are obtained.
[0030] Furthermore, the method of combining the grayscale difference to screen the suspected burr area to obtain the burr area includes the following specific methods:
[0031] Firstly, the average grayscale value of the normal area of the hardware is calculated through the grayscale image of the hardware image, and the gradient value of all pixels in the suspected burr area is obtained using the Sobel operator;
[0032] Then, according to the angle mutation degree and gray value difference of the mutation pixels in each suspected burr area, the The probability of a suspected burr area is calculated as follows:
[0033]
[0034] in, Indicates The possibility of a suspected burr area, Indicates The variance of the angle mutation degree of the mutation pixel points in the suspected burr area, Indicates the average gray value of the normal area of hardware. Indicates The average gray value of the suspected burr area, Indicates The variance of the grayscale value of the suspected burr area, Indicates The average gradient value of the suspected burr area is represents the linear normalization function, Indicates the absolute value symbol;
[0035] Traverse all suspected burr areas in the hardware image and preset the threshold , the probability is greater than or equal to the threshold The suspected burr area is recorded as the burr area.
[0036] Furthermore, the defect index of the hardware is constructed according to the size and number of the burr area, including the specific method of:
[0037]
[0038] in, Indicates the defect index of hardware. Indicates the first The number of pixels in the burr area, Indicates The number of sudden pixel points in the burr area, Indicates The possibility of a suspected burr area, Indicates the number of burr areas in the image, represents the linear normalization function.
[0039] Furthermore, the method of obtaining the hardware stamping defect detection result according to the defect index of the hardware includes:
[0040] The computer is used to record and count the defect index of the hardware parts on the conveyor belt. When the defective area of the hardware is identified and recorded; when the defect index of the hardware is When the hardware is destroyed; when continuous Defect index of hardware parts When the production is stopped immediately, the stamping equipment should be checked and repaired. To preset the threshold for screening unqualified hardware products, is the preset third parameter.
[0041] An embodiment of the present invention provides a visual inspection system for hardware stamping defects, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the steps of a method for visual inspection of hardware stamping defects when executing the computer program.
[0042] The beneficial effect of the technical solution of the present invention is: compared with the existing traditional hardware burr defect detection technology, the present invention takes into account the performance characteristics of the burr area and the normal hardware edge, obtains mutation pixel points according to the spatial distribution characteristics of pixel points on the edge image, and obtains a mutation sequence. According to the edge performance of the burr area, the mutation pixel points that may belong to the burr area are screened from the mutation sequence to obtain the suspected burr area, and the suspected burr area is accurately detected in combination with the grayscale difference, which can effectively reduce the missed detection and false detection of the burr defect area, and effectively improve the detection accuracy of the stamping effect of the hardware. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 The present invention is a flowchart of the steps of a method for visually detecting stamping defects of hardware. DETAILED DESCRIPTION
[0045] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a method and system for visual detection of hardware stamping defects proposed by the present invention, its specific implementation, structure, features and effects, in conjunction 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.
[0046] 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 invention belongs.
[0047] The specific scheme of a visual detection method and system for stamping defects of hardware provided by the present invention is described in detail below with reference to the accompanying drawings.
[0048] See also Figure 1 , which shows a flowchart of a method for visually detecting stamping defects of hardware provided by an embodiment of the present invention, the method comprising the following steps:
[0049] Step S001: Acquire hardware images.
[0050] It should be noted that during the stamping process, due to the influence of processing materials, stamping machines and other factors, there will be some burrs on the surface of the hardware produced and processed. Since the burr edge is connected to the smooth edge, it is impossible to accurately obtain the burr area by directly segmenting the hardware image obtained through image processing technology. Therefore, it is necessary to further analyze the hardware image after edge detection according to the characteristic differences of the burr area to improve the accuracy of detecting the burr area.
[0051] Specifically, in order to implement a visual inspection method for stamping defects of hardware parts proposed in this embodiment, it is first necessary to collect images of the hardware parts. The specific process is as follows:
[0052] First, an industrial camera and lights are arranged above the exit of the hardware production line. Under uniform lighting, the produced hardware is photographed with the industrial camera to obtain a first image. The first image is grayscaled and denoised to obtain a second image.
[0053] Then, a semantic segmentation neural network is used to obtain a hardware region in the second image, and an image corresponding to the hardware region is recorded as a hardware image.
[0054] So far, the hardware image is obtained through the above method.
[0055] Step S002: Obtain an edge image of the hardware image; obtain mutation pixels based on the spatial distribution characteristics between adjacent edge pixels on the edge image to form a data sequence, and filter out a mutation sequence from the data sequence based on the variation characteristics of the element values in the data sequence; filter out mutation pixels that may belong to the burr area from the mutation sequence based on the edge performance of the burr area to obtain a suspected burr area; filter out the suspected burr area based on the grayscale difference to obtain the burr area; and construct a defect index for the hardware based on the size and number of the burr area.
[0056] It should be noted that the angle change and position change of the normal smooth edge are consistent with that of the burr edge. Based on this, we can preliminarily obtain the suspected area on the edge image that belongs to the burr area; for hardware, there are also sharp parts of the hardware that have similar performances as the burr edge in the angle change and position change, so it is necessary to further screen the suspected area in combination with the performance characteristics of the sharp parts of the hardware itself to obtain the final burr area; thus, the defect index of the hardware can be obtained according to the distribution of the burr area.
[0057] Step 2.1, obtaining the edge image of the hardware image.
[0058] Specifically, in one embodiment of the present invention, the Canny edge detection algorithm is used to obtain an initial edge image of the hardware image, and the initial edge image is subjected to morphological corrosion processing to obtain an edge image of the hardware image.
[0059] It should be noted that the Canny edge detection algorithm is an existing edge detection algorithm, so it is not described in detail in this embodiment.
[0060] It should be noted that the burr area generated during the stamping process appears small and prominent. The corrosion operation is used to further improve the contrast between the burr edge and the normal smooth edge, making the burr edge in the image appear smaller, which facilitates the extraction of feature information of the burr edge in the subsequent process.
[0061] So far, the edge image of the hardware image is obtained through the above method.
[0062] Step 2.2, according to the spatial distribution characteristics between adjacent edge pixels on the edge image, the mutation pixels are obtained to form a data sequence, and according to the change characteristics of the element values in the data sequence, the mutation sequence is screened out from the data sequence.
[0063] It should be noted that the pixel points on the normal smooth edges of the hardware image are consistent in position and angle changes, while the burr area is sharp, and the position and angle changes of the pixels at the two end points and the vertex are complex and disordered: for hardware, the angle and position changes of the pixels at the two end points and the vertex on its sharp shape are also quite different, which affects the detection of the burr area and causes inaccurate results, so it needs to be excluded.
[0064] The degree of angle mutation of the pixel points on the edge of the hardware is calculated based on the angle difference between the lines connecting adjacent pixel points and the position change difference between adjacent pixel points.
[0065] Taking the first pixel point from left to right and from top to bottom in the hardware image as the coordinate origin, establish the coordinate axis and obtain the horizontal and vertical coordinates of the edge pixel points in the image.
[0066] Get the edge image The edge pixel and the adjacent The line connecting the edge pixels is recorded as the first line segment, and the first line segment in the edge image is obtained. The edge pixel and the adjacent The line connecting the edge pixels is recorded as the second line segment, and the angle formed by the first line segment and the second line segment is recorded as the The angle parameter of each edge pixel.
[0067] Get the edge image The edge pixel and the adjacent The difference of the horizontal coordinates of the edge pixels is recorded as the first difference, and the first The edge pixel and the adjacent The difference between the horizontal coordinates of the edge pixels is recorded as the second difference, and the absolute value of the difference between the first difference and the second difference is recorded as the The horizontal position parameters of edge pixels.
[0068] By analogy, we can obtain the edge image The vertical position parameters of the edge pixels are obtained in the same way as the horizontal position parameters.
[0069] Will continue The average angle parameter of the edge pixels is recorded as The local angle coefficient of the edge pixel point, the sum of the average horizontal position parameter and the average vertical position parameter is recorded as the local position parameter, where is the first parameter of the preset.
[0070] It should be noted that this embodiment is preset based on experience , which can be adjusted according to actual conditions and is not specifically limited in this embodiment.
[0071] As an embodiment, a method for obtaining the degree of angle mutation of edge pixels is as follows:
[0072]
[0073] in, Indicates The degree of angle mutation of edge pixels, Indicates The angle parameter of the edge pixel, Indicates The local angle coefficient of edge pixels, Indicates The horizontal position parameters of edge pixels, Indicates The vertical position parameters of edge pixels, Indicates The local position coefficient of edge pixels, Represents the linear normalization function processing, and the normalized result is .
[0074] It should be noted that, when the difference between the angle change of the edge pixel point and the angle change of the adjacent edge pixel point is greater, that is, the angle parameter of the edge pixel point is larger, the angle mutation degree of the edge pixel point is greater, and the possibility that the edge pixel point belongs to the endpoint or vertex of the burr part is greater; when the difference between the position change of the edge pixel point and the position change of the adjacent pixel point is greater, that is, the horizontal position parameter and the vertical position parameter are larger, the angle mutation degree of the edge pixel point is more obvious, and the possibility that the edge pixel point belongs to the endpoint or vertex of the burr part is greater.
[0075] Traverse all edge pixels in the hardware image and preset the threshold , the angle mutation degree is greater than or equal to the threshold The pixel point is recorded as the mutation pixel point.
[0076] It should be noted that the angle mutation degree threshold for selecting mutation pixels is preset based on experience. , which can be adjusted according to actual conditions and is not specifically limited in this embodiment.
[0077] The angle mutation degrees of the mutation pixels are sorted from left to right and from top to bottom to form a data sequence of the angle mutation degrees of the mutation pixels. The mutation sequence is screened out from the data sequence based on the performance characteristics of the edge pixels on the sharp shape part of the hardware itself.
[0078] It should be noted that since the angle mutation degree of the pixel points at the two end points and the vertex position on the sharp shape of the hardware itself is also large, it is necessary to screen the data that show regularity in the data sequence. Due to different stamping conditions, the shape of the burr area is complex, so the angle mutation degree of the pixel points at the two end points and the vertex of the burr area is disordered; for the sharp shape of the hardware itself, there are generally multiple areas with the same shape, and the angle mutation degree of the pixel points of the sharp part will show a certain regularity in the data sequence.
[0079] Specifically, filter out repeated consecutive or more data, the mutation pixel points corresponding to the data are recorded as smooth pixel points, the angle mutation degree of the smooth pixel points in the data sequence is deleted, and the sequence composed of the angle mutation degree of the remaining mutation pixel points is recorded as the mutation sequence, where The second parameter is preset.
[0080] It should be noted that this embodiment is preset based on experience , which can be adjusted according to actual conditions and is not specifically limited in this embodiment.
[0081] Step 2.3, according to the edge performance of the burr area, the mutation pixels that may belong to the burr area are screened from the mutation sequence to obtain the suspected burr area.
[0082] It should be noted that compared with normal edges, the burr region is relatively small, so the number of edge pixels between the mutation pixels at the two ends and the vertex of the burr region in the edge image is relatively small.
[0083] First, the number of pixels between any mutation pixel and the adjacent mutation pixel in the mutation sequence in the edge image is calculated. , recorded as the spatial mutation parameter of the mutation pixel point, and the spatial mutation parameter in the mutation sequence is less than Continuous adjacent The mutation pixel points are recorded as the endpoints of the suspected burr area.
[0084] Then, a plurality of suspected burr regions are obtained according to the endpoints of the suspected burr region.
[0085] As an embodiment, the method for obtaining the suspected burr area is: performing convex hull detection on all the endpoints to obtain a plurality of areas including the endpoints as the suspected burr areas.
[0086] in, is the preset threshold, are the preset hyperparameters.
[0087] It should be noted that the threshold value of the number of pixels between the lines connecting the adjacent mutation pixels in the mutation sequence in the edge image is preset based on experience. , ,Right now When , three consecutive adjacent mutation pixel points are recorded as the endpoints of the suspected burr area, which can be adjusted according to actual conditions, and this embodiment does not specifically limit it.
[0088] At this point, the suspected burr area in the edge image is obtained.
[0089] Step 2.4, combining the grayscale difference, the suspected burr area is screened to obtain the burr area.
[0090] It should be noted that during the stamping process of hardware, due to the operation of machine friction cutting and other activities, the burr area on the edge of the hardware often has scratches, friction-induced color differences, etc.
[0091] Firstly, the average grayscale value of the normal area of the hardware is calculated through the grayscale image of the hardware image, and the gradient values of all pixels in the suspected burr area are obtained using the Sobel operator.
[0092] Then, according to the angle mutation degree and gray value difference of the mutation pixels in each suspected burr area, the The possibility of a suspected burr area;
[0093] As an embodiment, a specific method for calculating the possibility of a suspected burr area is as follows:
[0094]
[0095] in, Indicates The possibility of a suspected burr area, Indicates The variance of the angle mutation degree of the mutation pixel points in the suspected burr area, Indicates the average gray value of the normal area of hardware. Indicates The average gray value of the suspected burr area, Indicates The variance of the grayscale value of the suspected burr area, Indicates The average gradient value of the suspected burr area is Represents the linear normalization function processing, and the normalized result is , Represents the absolute value symbol.
[0096] Traverse all suspected burr areas in the hardware image and preset the threshold , the probability is greater than or equal to the threshold The suspected burr area is recorded as the burr area.
[0097] It should be noted that the threshold for screening the suspected burr area is preset based on experience. , which can be adjusted according to actual conditions and is not specifically limited in this embodiment.
[0098] At this point, the burr area in the hardware image has been determined.
[0099] Step 2.5, construct the defect index of the hardware according to the size and number of the burr area.
[0100] It should be noted that the size and number of burr areas can reflect the degree of defects in hardware.
[0101] The defect index of hardware is constructed by using the relationship between the number of mutation pixels in the burr area, the number of pixels on the edge image of the hardware, and the number of burr areas:
[0102] As an embodiment, the specific method for constructing the defect index of hardware is:
[0103]
[0104] in, Indicates the defect index of hardware. Indicates the first The number of pixels in the burr area, Indicates The number of sudden pixel points in the burr area, Indicates The possibility of a suspected burr area, Indicates the number of burr areas in the image, Represents a linear normalization function, and the normalized result is .
[0105] It should be noted that the smaller the proportion of the number of mutation pixels in the burr area, the larger the area of the burr area, and the greater the burr problem of the hardware; the more burr areas there are, the greater the burr problem of the hardware. For hardware, since the burrs produced by stamping should be smaller and less, the defect index of the hardware is reflected according to the burr problem.
[0106] At this point, we have obtained the defect index of hardware.
[0107] Step S003: Obtaining the hardware stamping defect detection result according to the defect index of the hardware.
[0108] It should be noted that the burr part on the hardware after precision inspection is a very important inspection indicator for the automated assembly line. If product quality problems occur on multiple pieces of hardware in succession and the quality problems are serious, it means that there is a problem in the production process and production needs to be stopped immediately and the stamping equipment needs to be checked and repaired.
[0109] Specifically, a computer is used to record and count the defect index of continuous hardware on the conveyor belt. When the defective area of the hardware is identified and recorded; when the defect index of the hardware is When the hardware is destroyed; when continuous Defect index of hardware parts When the production is stopped immediately, the stamping equipment should be checked and repaired. To preset the threshold for screening unqualified hardware products, is the preset third parameter.
[0110] It should be noted that, based on experience, this embodiment presets the threshold for screening unqualified hardware. , the third parameter is preset It can be adjusted according to actual conditions and is not specifically limited in this embodiment.
[0111] It should be noted that when the defect index of hardware When the defect index of the hardware is When the burr size or quantity of the hardware does not meet the production requirements, the hardware is a substandard product and needs to be destroyed. When all the hardware parts are unqualified products, it means that there is a problem with the production equipment. It is necessary to stop production immediately and check and repair the stamping equipment.
[0112] Through the above steps, a visual detection method for stamping defects of hardware is completed.
[0113] On the other hand, an embodiment of the present invention provides a visual inspection system for stamping defects of hardware, which system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, it implements steps S001 to S003 of a method for visual inspection of stamping defects of hardware.
[0114] Compared with the existing traditional hardware burr defect detection technology, the present invention takes into account the performance characteristics of the burr area and the normal hardware edge, obtains mutation pixel points according to the spatial distribution characteristics of pixel points on the edge image, and obtains a mutation sequence. According to the edge performance of the burr area, the mutation pixel points that may belong to the burr area are screened from the mutation sequence to obtain the suspected burr area. Combined with the grayscale difference, the suspected burr area is accurately detected, which can effectively reduce the missed detection and false detection of the burr defect area, and effectively improve the detection accuracy of the stamping effect of hardware.
[0115] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for visual inspection of hardware stamping defects, characterized in that: The method comprises the following steps: Get hardware images; Obtain edge images of hardware images; obtain mutation pixels based on the spatial distribution characteristics between adjacent edge pixels on the edge image to form a data sequence; filter out mutation sequences from the data sequence based on the variation characteristics of the element values in the data sequence; filter out mutation pixels that may belong to the burr region from the mutation sequence based on the edge performance of the burr region to obtain suspected burr regions; filter out suspected burr regions based on grayscale differences to obtain burr regions; construct a defect index for hardware based on the size and number of burr regions; According to the defect index of the hardware, the detection results of the hardware stamping defects are obtained.
2. According to claim 1, a visual inspection method for stamping defects of hardware parts is characterized in that: The method of obtaining mutation pixels according to the spatial distribution characteristics between adjacent edge pixels on the edge image to form a data sequence and screening out the mutation sequence from the data sequence according to the variation characteristics of the element values in the data sequence includes the following specific methods: First, take the first pixel point from left to right and from top to bottom in the hardware image as the coordinate origin, establish the coordinate axis, and obtain the horizontal and vertical coordinates of the edge pixel points in the image; Then, according to the spatial distribution characteristics between adjacent edge pixels on the edge image, the angle parameters, horizontal position parameters and vertical position parameters of the edge pixels are obtained. The angle mutation degree of the edge pixels on the hardware is calculated through the angle parameters, horizontal position parameters and vertical position parameters of the adjacent pixels. The preset threshold , the angle mutation degree is greater than or equal to the threshold The edge pixels are recorded as mutation pixels; Finally, the angle mutation degrees of the mutation pixels are sorted from left to right and from top to bottom to form a data sequence of the angle mutation degrees of the mutation pixels. The mutation sequence is selected from the data sequence based on the performance characteristics of the edge pixels on the sharp shape part of the hardware itself.
3. According to claim 2, a visual detection method for stamping defects of hardware parts is characterized in that: The specific method of calculating the angle mutation degree of the pixel points on the edge of the hardware by using the angle parameters, horizontal position parameters and vertical position parameters of adjacent pixel points is as follows: Will continue The average angle parameter of the edge pixels is recorded as The local angle coefficient of the edge pixel point, the sum of the average horizontal position parameter and the average vertical position parameter is recorded as the local position parameter, where is the preset first parameter; in, Indicates The degree of angle mutation of edge pixels, Indicates The angle parameter of the edge pixel, Indicates The local angle coefficient of edge pixels, Indicates The horizontal position parameters of edge pixels, Indicates The vertical position parameters of edge pixels, Indicates The local position coefficient of edge pixels, represents the linear normalization function.
4. A method for visual inspection of metal stamping defects according to claim 3, characterized in that: The angle parameter, horizontal position parameter and vertical position parameter of the pixel point are specifically obtained as follows: Get the edge image The edge pixel and the adjacent The line connecting the edge pixels is recorded as the first line segment, and the first line segment in the edge image is obtained. The edge pixel and the adjacent The line connecting the edge pixels is recorded as the second line segment, and the angle formed by the first line segment and the second line segment is recorded as the Angle parameters of edge pixels; Get the edge image The edge pixel and the adjacent The difference of the horizontal coordinates of the edge pixels is recorded as the first difference, and the first The edge pixel and the adjacent The difference between the horizontal coordinates of the edge pixels is recorded as the second difference, and the absolute value of the difference between the first difference and the second difference is recorded as the The horizontal position parameters of edge pixels; And so on, get the edge image The vertical position parameters of the edge pixels are obtained in the same way as the horizontal position parameters.
5. According to claim 2, a visual inspection method for hardware stamping defects is characterized in that: The method of selecting a mutation sequence from a data sequence according to the performance characteristics of edge pixels on the sharp-shaped part of the hardware itself includes the following specific methods: Filter out repeated consecutive occurrences in a data sequence or more data, the mutation pixel points corresponding to the data are recorded as smooth pixel points, the angle mutation degree of the smooth pixel points in the data sequence is deleted, and the sequence composed of the angle mutation degree of the remaining mutation pixel points is recorded as the mutation sequence, where The second parameter is preset.
6. A method for visual inspection of metal stamping defects according to claim 1, characterized in that: The method of screening the mutation pixels that may belong to the burr area from the mutation sequence according to the edge performance of the burr area to obtain the suspected burr area includes the following specific methods: The number of pixels between any mutation pixel and the adjacent mutation pixel in the mutation sequence in the edge image is recorded as the spatial mutation parameter of the mutation pixel. Continuous adjacent The mutation pixel points are recorded as the endpoints of the suspected burr area; in, is the preset threshold, are the preset hyperparameters; According to the endpoints of the suspected burr area, a plurality of suspected burr areas are obtained.
7. A method for visually inspecting stamping defects of hardware according to claim 1, characterized in that: The method of combining the grayscale difference to screen the suspected burr area to obtain the burr area includes: Firstly, the average grayscale value of the normal area of the hardware is calculated through the grayscale image of the hardware image, and the gradient value of all pixels in the suspected burr area is obtained using the Sobel operator; Then, according to the angle mutation degree and gray value difference of the mutation pixels in each suspected burr area, the The probability of a suspected burr area is calculated as follows: in, Indicates The possibility of a suspected burr area, Indicates The variance of the angle mutation degree of the mutation pixel points in the suspected burr area, Indicates the average gray value of the normal area of hardware. Indicates The average gray value of the suspected burr area, Indicates The variance of the grayscale value of the suspected burr area, Indicates The average gradient value of the suspected burr area is represents the linear normalization function, Indicates the absolute value symbol; Traverse all suspected burr areas in the hardware image and preset the threshold , the probability is greater than or equal to the threshold The suspected burr area is recorded as the burr area.
8. A method for visual inspection of metal stamping defects according to claim 1, characterized in that: The specific method of constructing the defect index of the hardware according to the size and number of the burr area is as follows: in, Indicates the defect index of hardware. Indicates the first The number of pixels in the burr area, Indicates The number of sudden pixel points in the burr area, Indicates The possibility of a suspected burr area, Indicates the number of burr areas in the image, represents the linear normalization function.
9. A method for visually inspecting stamping defects of hardware according to claim 1, characterized in that: The method of obtaining the hardware stamping defect detection result according to the hardware defect index includes: The computer is used to record and count the defect index of the hardware parts on the conveyor belt. When the defective area of the hardware is identified and recorded; when the defect index of the hardware is When the hardware is destroyed; when continuous Defect index of hardware parts When the production is stopped immediately, the stamping equipment should be checked and repaired. To preset the threshold for screening unqualified hardware products, is the preset third parameter.
10. A visual inspection system for stamping defects of hardware parts, comprising a memory, a processor, and a computer program stored in the memory and executable 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 9 are implemented.
