A method, system and electronic equipment for visual inspection of plug production quality
Through visual detection methods, the defect characteristics and curvature in the plug detection image are calculated, and combined with the plug extension direction, the cracked area of the insulating layer inside the plug is accurately identified, which solves the problem of inaccurate detection in the prior art and improves the accuracy of plug quality detection. .
Patent Information
- Application Number
- CN202411161531.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-08-23
AI Technical Summary
The existing X-ray non-destructive flaw detection technology is difficult to directly identify the cracked core area of the insulating layer inside the plug through the detection image, resulting in inaccurate detection.
The plug production quality visual detection method is used to obtain the plug detection image, calculate the degree of defects of each pixel point, determine the suspected area, analyze its edge characteristics and curvature, combine the plug extension direction, calculate the defect characteristics and overlapping characteristics, and then judge the defect areas. .
The accuracy of the separation between the cracked area of the insulating layer inside the plug is improved and the reliability of the detection results is enhanced.
Smart Images

Figure CN118691605B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method, system and electronic equipment for visually inspecting plug production quality. Background Art
[0002] With the development of economy, more and more electrical products are applied to daily life. Among them, plugs are widely used in life and industrial production as a bridge between electrical products and power systems. However, while it provides convenience for people, it also has many safety hazards. The production of plugs requires multiple processes such as processing, transportation, and assembly. During this process, the insulation layer of the wire core inside the plug may be broken, which may endanger the personal safety of the user or cause property loss during use. Therefore, the quality of the wire core inside the plug is tested.
[0003] Existing X-ray nondestructive flaw detection technology mainly relies on the difference in the degree of attenuation of the radiation energy between the object under inspection and its internal defective medium, that is, the different radiation intensities passing through the normal area and the wire core area with broken insulation layer, so that there is a difference in brightness between the normal area and the wire core area with broken insulation layer in the final imaging result, thereby achieving defect detection. However, since the grayscale values of some pixels in the normal area in the X-ray detection image are similar to those of the pixels in the wire core area with broken insulation layer, it is impossible to directly obtain the wire core area with broken insulation layer inside the plug based on the grayscale value of each pixel in the X-ray detection image. Summary of the invention
[0004] The invention provides a plug production quality visual inspection method, system and electronic equipment to solve the existing problems.
[0005] A plug production quality visual inspection method, system and electronic equipment of the present invention adopt the following technical solutions:
[0006] The present invention proposes a method for visually inspecting the production quality of a plug, the method comprising the following steps:
[0007] Acquire a plug detection image, and obtain a plug outline in the plug detection image;
[0008] According to the gray value of each pixel in the plug detection image and the distribution of the gray values of the pixels around each pixel, the defect degree of each pixel is obtained, and then the suspected area is obtained;
[0009] According to the plug contour in the plug detection image and the edge of each suspected area, the extension direction of the plug and the extension direction of each suspected area are obtained; according to the defect degree of all pixels in each suspected area and the difference between the extension direction of each suspected area and the extension direction of the plug, the defect characteristic degree of each suspected area is obtained;
[0010] Obtaining the degree of overlapping characteristics of each suspected region according to the grayscale value of each suspected region edge pixel and the grayscale values of the pixels surrounding each suspected region edge pixel;
[0011] According to the curvature of the edge pixel points of each suspected area, the defect manifestation degree of each suspected area is obtained;
[0012] According to the defect manifestation degree, defect characteristic degree and overlapping characteristic degree of each suspected area, the final defectivity of each suspected area is obtained, and then the defective area is obtained and tested.
[0013] Furthermore, the defect degree of each pixel is obtained according to the gray value of each pixel in the plug detection image and the distribution of the gray values of the pixels around each pixel, and then the suspected area is obtained, including the specific method of:
[0014]
[0015] In the formula, Indicates The degree of defect of each pixel, Indicates The average gray value of a pixel and all pixels in its 8-neighborhood. Represents the mean grayscale value of all pixels in the plug detection image, Indicates The maximum grayscale value of a pixel and all pixels in its 8-neighborhood. Indicates The minimum gray value of a pixel and all pixels in its 8-neighborhood. Represents the sigmoid function;
[0016] Preset possible threshold , the defect level is greater than the possible threshold The pixel points are recorded as suspected defective pixels; according to the suspected defective pixels, several suspected areas are obtained.
[0017] Furthermore, the method of obtaining the extension direction of the plug and the extension direction of each suspected area according to the plug contour in the plug detection image and the edge of each suspected area includes the following specific methods:
[0018] Get the edge chain code of the plug contour;
[0019] Subtract 4 from the chain code values greater than 3 in the edge chain code of the plug contour to obtain a new edge chain code of the plug contour; the direction represented by the chain code value that appears most times in the new edge chain code of the plug contour is recorded as the extension direction of the plug;
[0020] Pass The first Pixels are used as the The tangent line of the edge of the suspected area is obtained to obtain two tangent directions. The tangent direction with the smallest angle with the extension direction of the plug is recorded as the first The suspected area tangent directions;
[0021] Set the vector length to 1 and the direction to The suspected area The vector in the direction of the tangent line is denoted as The suspected area vectors;
[0022] The first The direction of the sum of all vectors of the suspected edge is recorded as The extension direction of the suspected area.
[0023] Furthermore, the defect characteristic degree of each suspected area is obtained according to the defect degree of all pixels in each suspected area and the difference between the extension direction of each suspected area and the extension direction of the plug, including the specific method of:
[0024] The first The ratio of the mean defect level of all pixels in the suspected area to the mean defect level of all defective pixels is recorded as The overall defect level of pixels in the suspected area;
[0025] The first The angle between the extension direction of the first suspected area and the extension direction of the plug is equal to the angle between the first suspected area and the extension direction of the plug. The product of the overall defect levels of the pixels in the suspected area is recorded as The degree of defect characteristics of the suspected area.
[0026] Furthermore, the method of obtaining the overlapping feature degree of each suspected region according to the grayscale value of each suspected region edge pixel and the grayscale value of the pixels around each suspected region edge pixel includes the following specific methods:
[0027]
[0028] In the formula, Indicates The degree of overlap of the suspected regions, Indicates The number of pixels on the edge of the suspected area, Indicates On the edge of the suspected area The gray value of a pixel, Indicates On the edge of the suspected area The non-first The grayscale mean of the pixels in the suspected area is represents the absolute value function, Represents a symbolic function.
[0029] Furthermore, the defect manifestation degree of each suspected area is obtained according to the curvature of the edge pixel points of each suspected area, and the specific method includes:
[0030] The first The mean curvature of all edge pixels in the suspected area is recorded as The degree of defect manifestation in a suspected area.
[0031] Furthermore, the final defectivity of each suspected area is obtained according to the defect manifestation degree, defect feature degree and overlapping feature degree of each suspected area, including the specific method of:
[0032]
[0033] In the formula, Indicates The probability that the suspected area is a defect area, Indicates The degree of defect characteristics of the suspected area, Indicates The degree of defect manifestation in the suspected area Indicates The degree of overlap of the suspected regions, To avoid hyperparameters with denominators equal to zero, Represents the sigmoid function.
[0034] Furthermore, the specific method of obtaining the defective area includes:
[0035] Preset likelihood threshold , the suspected area whose possibility of being a defect area is greater than the possibility threshold is recorded as a defect area.
[0036] The present invention also proposes an electronic device for visually inspecting the production quality of plugs, the device comprising:
[0037] An image acquisition module, a quality inspection module and a mechanical control module; wherein the image acquisition module is used to acquire an inspection image of the plug to be inspected, the quality inspection module obtains qualified plugs and unqualified plugs by calling a computer program to implement the steps of a plug production quality visual inspection method, and the mechanical control module transfers the qualified plugs and unqualified plugs to different areas.
[0038] The present invention also proposes a plug production quality visual inspection system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above method.
[0039] The beneficial effects of the technical solution of the present invention are as follows: when obtaining the damaged insulation layer area inside the plug, based on the feature that the grayscale value of each pixel point in the damaged insulation layer area is different from that of the surrounding pixels due to the dispersion of copper wires in the damaged insulation layer area inside the plug, the defect degree of each pixel point is calculated, so that the defect degree of the pixel points in the damaged insulation layer area is greater than the defect degree of the pixel points in the normal area; based on the feature that the extension direction of the damaged insulation layer area is significantly different from the extension direction of the plug, the defect characteristic degree of each suspected area is calculated, so that the defect characteristic degree of the suspected area representing the damaged insulation layer area is greater than the defect characteristic degree of the suspected area representing the gap ... According to the feature that the grayscale value of the pixel point in the gap area is greater than the pixel points on both sides, the degree of overlapping characteristics of each suspected area is calculated, so that the degree of overlapping characteristics of the suspected area representing the insulation layer rupture area is smaller than that of the suspected area representing the gap area; based on the feature that the copper wire in the insulation layer rupture area is less affected by the insulation layer, resulting in a larger curvature of the edge pixel points in the insulation layer rupture area, the degree of defect manifestation of each suspected area is calculated, so that the degree of defect manifestation of the suspected area representing the insulation layer rupture area is greater than that of the suspected area representing the gap area; the insulation layer rupture area is distinguished from the gap area by relying on the degree of defect, so that the detection result is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] 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.
[0041] Figure 1 A flowchart of the steps of a method for visually inspecting the production quality of a plug according to the present invention;
[0042] Figure 2 It is an X-ray inspection image of the plug to be inspected;
[0043] Figure 3 An image of the void area created by the overlap of the insulation damage area and the wire core. DETAILED DESCRIPTION
[0044] 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 the specific implementation, structure, features and effects of a plug production quality visual inspection method, system and electronic device proposed by the present invention 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.
[0045] 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.
[0046] The following is a detailed description of a method, system and electronic device for visual inspection of plug production quality provided by the present invention in conjunction with the accompanying drawings.
[0047] See also Figure 1 , which shows a flowchart of a method for visually inspecting plug production quality provided by an embodiment of the present invention, the method comprising the following steps:
[0048] Step S001: Acquire a plug detection image to obtain a plug outline in the plug detection image.
[0049] This embodiment performs quality inspection on the plug, so an X-ray inspection image of the plug to be inspected is obtained. There is only one plug in the light detection image, so it is directly from The plug area is obtained from the light detection image.
[0050] Specifically, through Optical machine, get the plug to be tested The X-ray detection image is recorded as the plug detection image, such as Figure 2 As shown in Figure 2, the plug outline is obtained from the plug detection image.
[0051] Step S002: According to the gray value of each pixel in the plug detection image and the distribution of the gray values of the pixels around each pixel, the defect degree of each pixel is obtained, and then the suspected area is obtained.
[0052] It should be noted that when the insulation layer of the wire core inside the plug is broken, the copper wires in the broken insulation layer area are scattered, while the copper wires in the intact insulation layer area are relatively concentrated, making the grayscale value of the pixel points in the broken insulation layer area greater than the grayscale value of the pixel points in the intact insulation layer area. Due to the uneven dispersion of the copper wires in the broken insulation layer area, the broken insulation layer area has uneven absorption capacity for X-rays, making the grayscale value of each pixel point in the broken insulation layer area have a certain difference from the grayscale value of the surrounding pixels, such as Figure 3Therefore, according to the difference in grayscale values between each pixel and the surrounding pixels and the grayscale value between each pixel and the surrounding pixels, the defect degree of each pixel is obtained, and then the suspected area is obtained.
[0053] Specifically, the specific calculation formula for obtaining the defect degree of each pixel is as follows:
[0054]
[0055] In the formula, Indicates The degree of defect of each pixel, Indicates The average gray value of a pixel and all pixels in its 8-neighborhood. Represents the mean grayscale value of all pixels in the plug detection image, Indicates The maximum grayscale value of a pixel and all pixels in its 8-neighborhood. Indicates The minimum gray value of a pixel and all pixels in its 8-neighborhood. Represents the sigmoid function, which is used for normalization.
[0056] It should be noted that The larger the value, the The larger the gray value of the pixel and the surrounding pixels, the The more the pixel points conform to the characteristics of the larger gray value of the pixel points in the insulation layer rupture area; The larger the value, the The greater the difference in grayscale values of the pixels around the pixel, the greater the The more pixels there are, the more they conform to the characteristic that the grayscale values of pixels in the insulation layer rupture area are greatly different.
[0057] Furthermore, a possible threshold value is preset , the defect level is greater than the possible threshold The pixel points are recorded as suspected defective pixels. According to the suspected defective pixels, several suspected areas are obtained. The possible threshold value preset in this embodiment , this is used as an example for description, and other values may be set in other implementation modes.
[0058] Step S003: Obtain the extension direction of the plug and the extension direction of each suspected area based on the plug outline in the plug detection image and the edge of each suspected area; obtain the defect feature degree of each suspected area based on the defect degree of all pixels in each suspected area and the difference between the extension direction of each suspected area and the extension direction of the plug.
[0059] It should be noted that, since the plug contains at least two wire cores, one wire core may overlap with another wire core in some positions of the plug, resulting in a gap area. When one wire core overlaps with another wire core, the density of the medium in the gap area changes, so that the gray value of each pixel in the gap area has a certain difference with the surrounding pixels, so that the pixels in the gap area may be regarded as suspected defect area pixels, resulting in the suspected area containing a gap area. Therefore, the gap area in the suspected area is removed.
[0060] It should be further explained that, since the wire core is wrapped in the plug, the extension direction of the plug is the same as the extension direction of the normal wire core in the plug. Since the gap area caused by the overlapping of the wire cores is generated by the overlap of multiple normal wire cores, the extension direction of the gap area is similar to the extension direction of the plug. Since the copper wire in the area of the damaged insulation layer is less constrained by the insulation layer, the extension direction of the area of the broken insulation layer is greatly different from the extension direction of the plug. Therefore, the extension direction of the plug and the extension direction of each suspected area are calculated, and the degree of defect characteristics of each suspected area is obtained according to the difference between the extension direction of the plug and the extension direction of each suspected area.
[0061] It should be further explained that when calculating the extension direction of the plug, since the chain code of the edge pixel points reflects the positional relationship between each edge pixel point and the next edge pixel point, the extension direction of the plug is obtained according to the edge chain code of the plug contour.
[0062] Specifically, the edge chain code of the plug contour is obtained, where the maximum value of the chain code is 7 and the minimum value is 0. The chain code values greater than 3 in the edge chain code of the plug contour are subtracted by 4 to obtain a new edge chain code of the plug contour. The direction represented by the chain code value that appears the most times in the new edge chain code of the plug contour is recorded as the extension direction of the plug. Among them, obtaining the edge chain code of the plug contour is an existing well-known technology and is not described in detail in this embodiment.
[0063] Further, after The first Pixels are used as the The tangent line of the edge of the suspected area is obtained to obtain two tangent directions. The tangent direction with the smallest angle with the extension direction of the plug edge is recorded as the first The suspected area The tangent direction. Set the vector length to 1 and the direction to The suspected area The vector in the direction of the tangent line is denoted as The suspected area vector. The direction of the sum of all vectors in the suspected area is recorded as The extension direction of the suspected area.
[0064] Furthermore, according to the defect degree of all pixels in each suspected area and the difference between the extension direction of each suspected area and the extension direction of the plug, the specific calculation formula for the defect characteristic degree of each suspected area is obtained as follows:
[0065]
[0066] In the formula, Indicates The degree of defect characteristics of the suspected area, Indicates The average defect level of all pixels in the suspected area, Represents the mean value of the defect degree of all suspected defective pixels, Indicates The number of edge pixels in the suspected area, Indicates The maximum number of occurrences of all values in the edge chain code of the suspected area, Indicates The minimum angle between the extension direction of the suspected area and the extension direction of the plug, Indicates The overall defect degree of pixels in the suspected area.
[0067] It should be noted that The larger the value, the The degree of defect of the pixels in the suspected area is relatively large, which further explains The greater the possibility that the suspected area is a defect area; The larger the value, the The more the extension direction of the suspected area is different from the extension direction of the plug, the more it is explained. The greater the possibility that the suspected area is a defect area.
[0068] At this point, the defect characteristic level of each suspected area is obtained.
[0069] Step S004: Obtain the overlapping feature degree of each suspected region according to the grayscale value of each suspected region edge pixel and the grayscale values of the pixels surrounding each suspected region edge pixel.
[0070] It should be noted that the gap area generated by the overlap of two cores is surrounded by two normal cores, and the core area has a weaker ability to absorb X-rays and appears darker, while the gap area has a stronger ability to absorb X-rays and appears brighter. Therefore, the grayscale value of the gap area is higher than the grayscale value of the surrounding adjacent areas, that is, compared with the adjacent areas, this area is a highlight area; and the area with damaged insulation layer is brighter than the normal core area, and lower than the empty area (that is, the area without core). That is, in the image, the grayscale value of the pixel in the defective area is greater than the grayscale value on one side and smaller than the grayscale value on the other side; and the grayscale value of the pixel in the gap area is greater than the grayscale value of the pixel on both sides. Therefore, the degree of overlapping characteristics of each suspected area is obtained according to the change in the grayscale value of the pixels on both sides of each suspected area and the grayscale value of the pixels in each suspected area. Among them, the gap area and the area with broken insulation layer are as follows: Figure 3 shown.
[0071] Specifically, according to the grayscale values of the pixels in each suspected area and the grayscale values of the pixels in the surrounding area, the calculation formula for obtaining the overlapping feature degree of each suspected area is as follows:
[0072]
[0073] In the formula, Indicates The degree of overlap of the suspected regions, Indicates The number of pixels on the edge of the suspected area, Indicates On the edge of the suspected area The gray value of a pixel, Indicates On the edge of the suspected area The non-first The grayscale mean of the pixels in the suspected area is represents the absolute value function, represents a symbolic function, when hour, ;when hour, ;when hour, .
[0074] It should be noted that , explain On the edge of the suspected area The gray value of the pixel is greater than that of its surrounding non- The gray value of the pixel in the suspected area is ; , explain On the edge of the suspected area The gray value of a pixel is not greater than that of its surrounding non- The gray value of the pixel in the suspected area is ; The larger the value, the The more a suspected area conforms to the characteristic that the gray value of the pixel point in the gap area is greater than the gray value of the pixel point in the non-gap area on both sides.
[0075] At this point, the overlapping features of each suspected area are obtained.
[0076] Step S005: Obtain the defect manifestation degree of each suspected area according to the curvature of the edge pixel points of each suspected area.
[0077] It should be noted that since the copper wire in the area where the insulation layer is damaged is less affected by the wire core insulation layer, the copper wire in the area where the insulation layer is damaged is relatively curved, which in turn causes the edge of the area where the insulation layer is damaged to have a strong curvature. Therefore, the defect manifestation degree of each suspected area is calculated based on the area of the edge pixel points of each suspected area.
[0078] Specifically, get the The curvature of each edge pixel point of the suspected region. Obtaining the region of each pixel point on the edge of a region is a well-known technique, which will not be described in detail in this embodiment. The curvature of each edge pixel point of the suspected area is obtained The specific calculation formula for the defect manifestation degree of a suspected area is as follows:
[0079]
[0080] In the formula, Indicates The degree of defect manifestation in the suspected area Indicates The number of edge pixels in the suspected area, Indicates The suspected area The curvature of the edge pixels.
[0081] It should be noted that The larger the value, the The less the suspected area is constrained by the insulating layer, the more The greater the possibility that the suspected area is a defect area.
[0082] At this point, the degree of defect manifestation of each suspected area is obtained.
[0083] Step S006: According to the defect manifestation degree, defect characteristic degree and overlapping characteristic degree of each suspected area, the final defectivity of each suspected area is obtained, and then the defect area is obtained and detected.
[0084] Specifically, according to the defect manifestation degree, defect feature degree and overlapping feature degree of each suspected area, the specific calculation formula for obtaining the possibility that each suspected area is a defect area is as follows:
[0085]
[0086] In the formula, Indicates The probability that the suspected area is a defect area, Indicates The degree of defect characteristics of the suspected area, Indicates The degree of defect manifestation in the suspected area Indicates The degree of overlap of the suspected regions, To avoid hyperparameters with a denominator of 0, this embodiment uses To narrate, Represents the sigmoid function, which is used for normalization.
[0087] Furthermore, a preset possibility threshold , the suspected area whose probability of being a defect area is greater than the probability threshold is recorded as the defect area, and the pixels in the defect area are recorded as defect pixels. The pixels within the plug outline are recorded as plug pixels.
[0088] Furthermore, a ratio threshold is preset If the ratio of the number of defective pixels to the number of plug pixels is greater than the ratio threshold, the plug to be tested is unqualified. , the preset ratio threshold , this is used as an example for description, and other values can be set in other implementation modes and are not limited in this embodiment.
[0089] At this point, this embodiment is completed.
[0090] The present invention also provides an electronic device for visual inspection of plug production quality, the device comprising: an image acquisition module, a quality inspection module and a mechanical control module; wherein the image acquisition module is used to obtain an inspection image of the plug to be inspected, the quality inspection module obtains qualified plugs and unqualified plugs by calling a computer program to implement the steps of a plug production quality visual inspection method, and the mechanical control module transfers the qualified plugs and unqualified plugs to different areas.
[0091] Another embodiment of the present invention provides a plug production quality visual inspection system, which includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the above method steps S001 to S006 are implemented.
[0092] 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 visual inspection method for plug production quality, It is characterized in that The method comprises the following steps: Acquire a plug detection image, and obtain a plug outline in the plug detection image; According to the gray value of each pixel in the plug detection image and the distribution of the gray values of the pixels around each pixel, the defect degree of each pixel is obtained, and then the suspected area is obtained; According to the plug contour in the plug detection image and the edge of each suspected area, the extension direction of the plug and the extension direction of each suspected area are obtained; according to the defect degree of all pixels in each suspected area and the difference between the extension direction of each suspected area and the extension direction of the plug, the defect characteristic degree of each suspected area is obtained; Obtaining the degree of overlapping characteristics of each suspected region according to the grayscale value of each suspected region edge pixel and the grayscale values of the pixels surrounding each suspected region edge pixel; According to the curvature of the edge pixel points of each suspected area, the defect manifestation degree of each suspected area is obtained; According to the defect manifestation degree, defect characteristic degree and overlapping characteristic degree of each suspected area, the final defectivity of each suspected area is obtained, and then the defective area is obtained and tested.
2. A method for visually inspecting plug production quality according to claim 1, It is characterized in that The method of obtaining the defect degree of each pixel point according to the gray value of each pixel point in the plug detection image and the distribution of the gray value of the pixels around each pixel point, and then obtaining the suspected area, includes the following specific methods: In the formula, Indicates The degree of defect of each pixel, Indicates The average gray value of a pixel and all pixels in its 8-neighborhood. Represents the mean grayscale value of all pixels in the plug detection image, Indicates The maximum grayscale value of a pixel and all pixels in its 8-neighborhood. Indicates The minimum gray value of a pixel and all pixels in its 8-neighborhood. Represents the sigmoid function; Preset possible threshold , the defect level is greater than the possible threshold The pixel points are recorded as suspected defective pixels; according to the suspected defective pixels, several suspected areas are obtained.
3. A method for visually inspecting plug production quality according to claim 1, It is characterized in that The specific method of obtaining the extension direction of the plug and the extension direction of each suspected area according to the plug contour in the plug detection image and the edge of each suspected area is as follows: Get the edge chain code of the plug contour; Subtract 4 from the chain code values greater than 3 in the edge chain code of the plug contour to obtain a new edge chain code of the plug contour; the direction represented by the chain code value that appears most times in the new edge chain code of the plug contour is recorded as the extension direction of the plug; Pass The first Pixels are used as the The tangent line of the edge of the suspected area is obtained to obtain two tangent directions. The tangent direction with the smallest angle with the extension direction of the plug is recorded as the first The suspected area tangent direction; Set the vector length to 1 and the direction to The suspected area The vector in the direction of the tangent line is denoted as The suspected area vectors; The first The direction of the sum of all vectors of the suspected edge is recorded as The extension direction of the suspected area.
4. A method for visually inspecting plug production quality according to claim 1, It is characterized in that The defect characteristic degree of each suspected area is obtained according to the defect degree of all pixels in each suspected area and the difference between the extension direction of each suspected area and the extension direction of the plug, including the specific method of: The first The ratio of the mean defect level of all pixels in the suspected area to the mean defect level of all defective pixels is recorded as The overall defect level of pixels in the suspected area; The first The angle between the extension direction of the first suspected area and the extension direction of the plug is equal to the angle between the first suspected area and the extension direction of the plug. The product of the overall defect levels of the pixels in the suspected area is recorded as The degree of defect characteristics of the suspected area.
5. A method for visually inspecting plug production quality according to claim 1, It is characterized in that The method of obtaining the overlapping feature degree of each suspected region according to the grayscale value of each suspected region edge pixel and the grayscale value of the pixels around each suspected region edge pixel includes: In the formula, Indicates The degree of overlap of the suspected regions, Indicates The number of pixels on the edge of the suspected area, Indicates On the edge of the suspected area The gray value of a pixel, Indicates On the edge of the suspected area The non-first The grayscale mean of the pixels in the suspected area is represents the absolute value function, Represents a symbolic function.
6. A method for visually inspecting plug production quality according to claim 1, It is characterized in that The method of obtaining the degree of defect manifestation of each suspected area according to the curvature of the edge pixel points of each suspected area includes: The first The mean curvature of all edge pixels in the suspected area is recorded as The degree of defect manifestation in a suspected area.
7. A method for visually inspecting plug production quality according to claim 1, It is characterized in that The method of obtaining the final defectivity of each suspected area according to the defect manifestation degree, defect feature degree and overlapping feature degree of each suspected area includes: In the formula, Indicates The probability that the suspected area is a defect area, Indicates The degree of defect characteristics of the suspected area, Indicates The degree of defect manifestation in the suspected area Indicates The degree of overlap of the suspected regions, To avoid hyperparameters with denominators equal to zero, Represents the sigmoid function.
8. A method for visually inspecting plug production quality according to claim 1, It is characterized in that The specific method of obtaining the defective area includes: Preset likelihood threshold , the suspected area whose possibility of being a defect area is greater than the possibility threshold is recorded as a defect area.
9. An electronic device for visual inspection of plug production quality, It is characterized in that The device comprises: An image acquisition module, a quality inspection module and a mechanical control module; wherein the image acquisition module is used to obtain an inspection image of the plug to be inspected, the quality inspection module obtains qualified plugs and unqualified plugs by calling a computer program to implement the steps of a plug production quality visual inspection method as described in any one of claims 1 to 8, and the mechanical control module transfers qualified plugs and unqualified plugs to different areas.
10. A plug production quality visual inspection system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, It is characterized in that When the processor executes the computer program, the steps of the method for visually inspecting plug production quality as described in any one of claims 1 to 8 are implemented.
