Cable production detection method and system based on machine vision

By conducting high-resolution shooting, preprocessing and feature analysis on the cable appearance, the defect recognition model is trained, which solves the problems of unclear judgment basis and incomplete image acquisition in the existing technology, and improves the accuracy and reliability of cable appearance defect detection. sex.

CN119516254AActive Publication Date: 2025-02-25SUZHOU DAOWANG ELECTRONIC TECH CO LTD

Patent Information

Application Number
CN202411504103.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-02-25
Estimated Expiration
2044-10-25

AI Technical Summary

Technical Problem

The existing cable appearance defect detection technology has insufficient basis for judging cable appearance defects and the comprehensive image information process of collecting cables is not clear enough, resulting in insufficient reliability of the detection results.

Method used

By using a high-resolution camera to capture the appearance of the cable, obtain the appearance image and preprocess it, extract the edge information and contour images of the cable, filter the defect-free cable samples, extract their appearance characteristics and perform feature analysis, and train the defect recognition model. Perform defect detection.

Benefits of technology

Improve the accuracy and reliability of cable appearance defect detection, ensuring a comprehensive and accurate judgment of cable appearance defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119516254A_ABST
    Figure CN119516254A_ABST
Patent Text Reader

Abstract

The invention discloses a cable production detection method and system based on machine vision, and relates to the technical field of cable appearance defect detection.The cable production detection method comprises the following steps that a high-resolution camera is used for shooting the appearance of a cable, and an appearance image is obtained; preprocessing the appearance image, and obtaining an appearance grey-scale map after the image quality is improved; extracting edge information of the cable in the appearance grey-scale map, and delimiting a contour image of the cable based on the edge information; extracting appearance features of the contour image, performing feature analysis on the appearance features, and training a defect identification model to perform defect detection on the appearance of the cable; the cable appearance defect detection method is used for solving the problems that the existing cable appearance defect detection technology is not clear enough in judgment basis of cable appearance defects and not clear enough in the process of collecting comprehensive image information of the cable, so that the reliability of cable appearance defect detection results is insufficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cable appearance defect detection, and in particular to a cable production detection method and system based on machine vision. Background Art

[0002] Cable appearance defect detection technology refers to the use of various sensors and image processing technologies to scan and analyze the external surface of the cable in order to timely detect and identify possible defects on the outside of the cable, such as scratches, cracks, wear and deformation. This technology is usually used to ensure the quality and safety of the cable, as well as to improve production efficiency and reduce failure rates. Through the automated detection process, it can effectively reduce errors caused by human factors and improve the accuracy and reliability of detection.

[0003] Existing cable appearance defect detection technology usually forms a defect data set by collecting defect images, and then determines whether the cable appearance has defects by performing similarity analysis with the defect data set. At the same time, since the cable is cylindrical and long, the existing cable appearance defect detection technology does not have a complete image acquisition solution. It usually performs single-point acquisition and then single-point judgment. The specific operation process when collecting cable images and how to collect comprehensive image information of the cable are not described. For example, in a patent application with publication number CN117571714A, a cable sheath appearance defect detection device and method based on machine vision are disclosed. When judging whether the cable appearance has defects, this solution compares and judges with the image data processing library, and does not describe the specific judgment process. The specific judgment basis for the cable appearance defects is not clear enough. The existing cable appearance defect detection technology also has the problem that the judgment basis for the cable appearance defects is not clear enough and the process of collecting comprehensive image information of the cable is not clear enough, resulting in insufficient reliability of the cable appearance defect detection results. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems in the prior art to a certain extent, by using a high-resolution camera to photograph the appearance of a cable to obtain an appearance image, then preprocessing the appearance image to improve the image quality to obtain an appearance grayscale image, then extracting edge information of the cable in the appearance grayscale image, delineating a contour image of the cable based on the edge information, then screening cables with no defects in appearance and marking them as sample cables, extracting appearance features of the sample cables and performing feature analysis, training a defect recognition model, and after the training is completed, performing defect detection on the appearance of the cable through the defect recognition model, so as to solve the problem that the existing cable appearance defect detection technology still has unclear basis for judging the appearance defects of the cable and the process of collecting comprehensive image information of the cable is unclear, resulting in insufficient reliability of the cable appearance defect detection results.

[0005] To achieve the above objectives, in a first aspect, the present application provides a cable production detection method based on machine vision, comprising the following steps:

[0006] Use a high-resolution camera to shoot the appearance of the cable and obtain an appearance image;

[0007] Preprocess the appearance image to improve the image quality and obtain the appearance grayscale image;

[0008] Extract edge information of the cable in the appearance grayscale image, and delineate the contour image of the cable based on the edge information;

[0009] The appearance features of the contour image are extracted and feature analysis is performed on the appearance features. The grayscale floating threshold and grayscale floating area of ​​the cable are analyzed through the sample cable. The defect recognition model is then trained and the defect detection on the cable appearance is performed through the defect recognition model.

[0010] Furthermore, the appearance of the cable is photographed using a high-resolution camera, and obtaining the appearance image includes the following sub-steps:

[0011] A support structure is provided, on which a rolling device and two retractable rings are installed, which are named as a first ring and a second ring from left to right respectively;

[0012] Pass the cable through the first ring and the second ring, and pass one end of the cable through the rolling device, clamp the cable through the rolling device, and then control the first ring and the second ring to contract to clamp the cable;

[0013] Photograph the cables.

[0014] Furthermore, photographing the cable includes the following sub-steps:

[0015] A high-resolution camera is arranged on the front side of the midpoint between the first circular ring and the second circular ring to photograph the cable between the first circular ring and the second circular ring to obtain an appearance image;

[0016] Release the rolling device, control the first and second rings to rotate 90° clockwise at the same time, and take pictures again. The same section of cable needs to be rotated three times, and a total of four appearance images are taken;

[0017] The length of the cable in each appearance image is the length of the first shot;

[0018] Loosen the first ring and the second ring, then control the rolling device to clamp the cable and roll it, which will drive the cable to move to the left;

[0019] When the cable moves to the first shooting length, the rolling is stopped, and the first ring and the second ring are controlled to shrink, and the appearance image is shot again;

[0020] Multiple sets of appearance images will be taken for one cable.

[0021] Furthermore, preprocessing the appearance image to improve the image quality to obtain an appearance grayscale image includes the following sub-steps:

[0022] The appearance image is filtered by Gaussian filtering;

[0023] After the processing is completed, the image is grayed out to obtain an appearance grayscale image.

[0024] Furthermore, extracting edge information of the cable in the appearance grayscale image and delineating the contour image of the cable based on the edge information includes the following sub-steps:

[0025] When photographing the cable, a pure white baffle is set in the background. Except for the cable part, the rest of the appearance image is pure white, and the grayscale value after grayscale conversion is 255.

[0026] Eliminate pixels with a grayscale value of 255 and mark the remaining pixels as cable points;

[0027] The cable points form a contour image.

[0028] Furthermore, the appearance features of the contour image are extracted, the appearance features are analyzed, the grayscale floating threshold and grayscale floating area of ​​the cable are analyzed through the sample cable, the defect recognition model is trained, and the defect detection of the cable appearance is performed through the defect recognition model, including the following sub-steps:

[0029] Screen cables with no defects in appearance, mark them as sample cables, extract appearance features of the sample cables, perform feature analysis, and train a defect recognition model;

[0030] After the training is completed, the defect recognition model is used to detect defects on the appearance of the cable.

[0031] Furthermore, cables with no defects in appearance are screened and marked as sample cables. Appearance features of the sample cables are extracted and feature analysis is performed. Training the defect recognition model includes the following sub-steps:

[0032] Select sample cables with no defects in appearance and shoot them, mark the outline images obtained by shooting and processing as sample images, obtain multiple groups of sample images, and integrate the sample images of the same cable into homologous images;

[0033] For any homologous image, the gray value of the cable point in the homologous image is obtained and marked as a single point gray value;

[0034] Count the number of different single-point grayscale values, mark them as the number of same values, find the maximum value among the number of same values, mark it as the maximum proportion value, obtain the single-point grayscale value corresponding to the maximum proportion value, and mark it as the reference grayscale value;

[0035] Calculate the absolute value of the difference between the single point gray value except the reference gray value and the reference gray value, and mark it as the gray difference;

[0036] Count the number of different grayscale differences, mark them as difference numbers, establish a plane rectangular coordinate system with grayscale difference as X-axis and difference number as Y-axis, name it grayscale floating distribution map, enter the grayscale difference and the corresponding difference number into the grayscale floating distribution map;

[0037] The coordinate points in the grayscale floating distribution graph are marked as grayscale floating points, and the grayscale floating points adjacent to each other are connected by a smooth curve, and the obtained curve is named grayscale floating curve;

[0038] Analyze the remaining homologous images, and obtain a grayscale floating curve for each group of homologous images. All grayscale floating curves are plotted in the grayscale floating distribution diagram.

[0039] The grayscale floating distribution map is further analyzed to extract the features of the grayscale floating curve and perform training.

[0040] Furthermore, further analyzing the grayscale floating distribution map, extracting the features of the grayscale floating curve and training it include the following sub-steps:

[0041] Get the maximum value of X of the grayscale floating point in the grayscale floating distribution map, marked as the grayscale floating threshold;

[0042] Mark the grayscale floating point with the minimum X and the maximum X in the grayscale floating curve as the minimum floating point and the maximum floating point respectively;

[0043] In the order of Y from small to large, the adjacent minimum floating points are connected by smooth curves, and the adjacent maximum floating points are connected by smooth curves to obtain the minimum closed curve and the maximum closed curve;

[0044] Based on the minimum closed curve and the maximum closed curve, fill the area between any two gray floating curves with gray, and repeat the process until the area between any two gray floating curves is all gray, and obtain a gray area marked as the gray floating area;

[0045] The graphics of the grayscale floating area are extracted, and the grayscale floating area and the grayscale floating threshold at this time are the characteristics of the grayscale floating curve.

[0046] Furthermore, after the training is completed, defect detection of the cable appearance is performed using the defect recognition model, which includes the following sub-steps:

[0047] After the defect recognition model is trained by the features of the grayscale floating curve, when it is necessary to detect the appearance defects of the cable, the contour image of the cable is obtained and marked as the pattern to be recognized;

[0048] A grayscale floating distribution map and a grayscale floating curve of the to-be-recognized figure are obtained based on the to-be-recognized figure, and are marked as a to-be-recognized distribution map and a to-be-recognized curve respectively;

[0049] Extract the maximum value of X of the coordinate point in the distribution map to be identified, mark it as the maximum deviation value, compare the maximum deviation value with the grayscale floating threshold, if the maximum deviation value is less than or equal to the grayscale floating threshold, output a normal deviation signal; if the maximum deviation value is greater than the grayscale floating threshold, output an abnormal deviation signal;

[0050] Extract the curve to be identified, mark the coordinate point with the smallest X in the curve to be identified as the reference moving point, place the reference moving point in the minimum closed curve, move the reference moving point in the order of Y from small to large, and the curve to be identified moves along with the reference moving point, and detect whether the curve to be identified is completely within the grayscale floating area. If so, output a floating normal signal; if not, output a moving continuation signal;

[0051] If the moving continuation signal is output, the reference moving point will continue to be moved and judged; if the floating normal signal is output, the movement will be stopped;

[0052] The output signals are counted. If an abnormal deviation signal is output or a normal floating signal is not output, it indicates that there are defects on the surface of the marked cable. If a normal deviation signal and a normal floating signal are output at the same time, it indicates that there are no defects on the surface of the marked cable.

[0053] In a second aspect, the present application provides a cable production inspection system based on machine vision, including an appearance shooting module, a preprocessing module, an appearance extraction module and a feature analysis module; the appearance shooting module, the preprocessing module and the appearance extraction module are respectively connected to the feature analysis module data;

[0054] The appearance shooting module is used to shoot the appearance of the cable using a high-resolution camera to obtain an appearance image;

[0055] The preprocessing module is used to preprocess the appearance image to obtain an appearance grayscale image after improving the image quality;

[0056] The appearance extraction module is used to extract the edge information of the cable in the appearance grayscale image, and to delineate the contour image of the cable based on the edge information;

[0057] The feature analysis module is used to extract the appearance features of the contour image, perform feature analysis on the appearance features, analyze the grayscale floating threshold and grayscale floating area of ​​the cable through the sample cable, retrain the defect recognition model and perform defect detection on the appearance of the cable through the defect recognition model.

[0058] Beneficial effects of the present invention: The present invention sets a support structure, and a rolling device and two retractable rings are installed on the support structure. The cable is passed through the first ring and the second ring, and one end of the cable is passed through the rolling device. The cable is clamped by the rolling device, and then the first ring and the second ring are controlled to shrink, the cable is clamped and the cable is photographed. The advantage is that the cable can be moved and rotated by the rotation of the rolling device and the ring, and the appearance image of the cable can be automatically and comprehensively collected, thereby improving the comprehensiveness and effectiveness of the cable appearance defect detection;

[0059] The present invention preprocesses the appearance image to improve the image quality to obtain an appearance grayscale image, then extracts edge information of the cable in the appearance grayscale image, delineates the contour image of the cable based on the edge information, and then screens cables with no defects in appearance and marks them as sample cables. The appearance features of the sample cables are extracted and feature analysis is performed, and a defect recognition model is trained. After the training is completed, defect detection is performed on the appearance of the cable through the defect recognition model. The advantage is that by extracting the appearance features of the sample cables, the change features of the grayscale values ​​of the pixels in the cable appearance under normal circumstances are analyzed. If there are defects in the appearance, the change in the grayscale value will deviate from the change features, thereby judging whether the cable appearance has defects, thereby improving the accuracy and rationality of cable appearance defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 is a functional block diagram of the system of the present invention;

[0061] Figure 2 is a schematic diagram of a shooting environment of the present invention;

[0062] Figure 3 A schematic diagram of the placement of the cable of the present invention in the rolling device, the first ring and the second ring;

[0063] Figure 4 is the appearance grayscale image of the present invention;

[0064] Figure 5 is a contour image of the present invention;

[0065] Figure 6 is a schematic diagram of a grayscale floating curve of the present invention;

[0066] Figure 7 is a schematic diagram of a grayscale floating distribution diagram of the present invention;

[0067] Figure 8 A schematic diagram of the minimum floating point and the maximum floating point of the present invention;

[0068] Fig. 9 A schematic diagram of connecting the minimum floating point and the maximum floating point through a smooth curve according to the present invention;

[0069] Fig.10 Schematic diagram of the minimum closed curve and the maximum closed curve of the present invention;

[0070] Fig.11 is a schematic diagram of a grayscale floating area of ​​the present invention;

[0071] Fig.12 A schematic diagram of a distribution map to be identified and a curve to be identified of the present invention;

[0072] Fig.13 It is a schematic diagram of detecting whether all the curves to be identified are in the gray floating area according to the present invention;

[0073] Fig.14 The figure is a flow chart of the steps of the method of the present invention. DETAILED DESCRIPTION

[0074] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0075] Example 1, please refer to Figure 1 As shown, the present application provides a cable production inspection system based on machine vision, including an appearance shooting module, a preprocessing module, an appearance extraction module and a feature analysis module; the appearance shooting module, the preprocessing module and the appearance extraction module are respectively connected to the feature analysis module data;

[0076] The appearance shooting module is used to shoot the appearance of the cable using a high-resolution camera to obtain an appearance image; the appearance shooting module includes an environment construction unit and a cable shooting unit;

[0077] The environment construction unit is configured with an environment construction strategy, which includes:

[0078] See also Figure 2 As shown, a support structure is provided, on which a rolling device and two retractable rings are installed, which are named as the first ring and the second ring from left to right respectively;

[0079] Pass the cable through the first ring and the second ring, and pass one end of the cable through the rolling device, clamp the cable through the rolling device, and then control the first ring and the second ring to contract to clamp the cable;

[0080] Photograph the cables;

[0081] In practical applications, the shooting environment is constructed by using the support structure, the rolling device, the first ring and the second ring. Figure 2 As shown, in order to facilitate the identification of cables, a pure white baffle is set up in the shooting environment as the shooting background;

[0082] The cable shooting unit is equipped with a cable shooting strategy, which includes:

[0083] A high-resolution camera is arranged on the front side of the midpoint between the first circular ring and the second circular ring to photograph the cable between the first circular ring and the second circular ring to obtain an appearance image;

[0084] See also Figure 3 As shown, release the rolling device, control the first ring and the second ring to rotate 90° clockwise at the same time, and shoot again. The same section of cable needs to be rotated three times, and a total of four appearance images are taken;

[0085] The length of the cable in each appearance image is the length of the first shot;

[0086] Loosen the first ring and the second ring, then control the rolling device to clamp the cable and roll it, which will drive the cable to move to the left;

[0087] When the cable moves to the first shooting length, the rolling is stopped, and the first ring and the second ring are controlled to shrink, and the appearance image is shot again;

[0088] One cable will capture multiple sets of appearance images;

[0089] In practical applications, the cable is placed in the rolling device, the first ring and the second ring as follows: Figure 3 As shown, the cable is rotated by the rotation of the ring to capture the appearance image of each side of the cable, and then the cable is rolled to the left by the rotating device to capture the appearance images of other parts of the cable. For a cable, multiple appearance images will be captured due to its length and different sides.

[0090] The preprocessing module is used to preprocess the appearance image and obtain the appearance grayscale image after improving the image quality;

[0091] The preprocessing module is configured with preprocessing strategies, which include:

[0092] The appearance image is filtered by Gaussian filtering;

[0093] See also Figure 4 As shown, after the processing is completed, the image is grayed to obtain an appearance grayscale image;

[0094] In practical applications, Gaussian filtering is performed using existing Gaussian filtering technology. After the processing is completed, the image is grayed to obtain an appearance grayscale image such as Figure 4 shown.

[0095] The appearance extraction module is used to extract the edge information of the cable in the appearance grayscale image, and to delineate the contour image of the cable based on the edge information;

[0096] The appearance extraction module is configured with an appearance extraction strategy, which includes:

[0097] See also Figure 5 As shown, when the cable is photographed, a pure white baffle is set in the background, so the appearance image obtained by the photographing is pure white except for the cable part, and the grayscale value after grayscale conversion is 255;

[0098] Eliminate pixels with a grayscale value of 255 and mark the remaining pixels as cable points;

[0099] The cable points form a contour image;

[0100] In practical applications, the contour image composed of cable points is as follows: Figure 5 shown.

[0101] The feature analysis module is used to extract the appearance features of the contour image, perform feature analysis on the appearance features, analyze the grayscale floating threshold and grayscale floating area of ​​the cable through the sample cable, retrain the defect recognition model, and perform defect detection on the appearance of the cable through the defect recognition model; the feature analysis module includes a floating distribution extraction unit, a floating feature analysis unit, and a defect recognition unit;

[0102] The floating distribution extraction unit and the floating feature analysis unit are used to screen cables with no defects in appearance, mark them as sample cables, extract the appearance features of the sample cables and perform feature analysis, and train a defect recognition model;

[0103] The floating distribution extraction unit is configured with a floating distribution extraction strategy, which includes:

[0104] Select sample cables with no defects in appearance and shoot them, mark the outline images obtained by shooting and processing as sample images, obtain multiple groups of sample images, and integrate the sample images of the same cable into homologous images;

[0105] For any homologous image, the gray value of the cable point in the homologous image is obtained and marked as a single point gray value;

[0106] Count the number of different single-point grayscale values, mark them as the number of same values, find the maximum value among the number of same values, mark it as the maximum proportion value, obtain the single-point grayscale value corresponding to the maximum proportion value, and mark it as the reference grayscale value;

[0107] In practical applications, the number of sample cables is usually as large as possible, and should not be less than 100 to provide a sufficient data basis. 100 cables with no defects in appearance are used as sample cables. For the same sample cable, the sample images taken are homologous images. The homologous images include multiple groups of sample images, and one sample cable corresponds to a group of homologous images. For a group of homologous images, the single-point grayscale values ​​of all sample images are counted. When counting the number of same values, taking the single-point grayscale value of 131 as an example, the number of single-point grayscale values ​​with a grayscale value of 131 is 52630, that is, the number of single-point grayscale values ​​with a grayscale value of 131 is 52630, and the maximum value of the number of same values ​​is 63249, that is, the maximum proportion is 63249, and the single-point grayscale value corresponding to the maximum proportion is 135, that is, the reference grayscale value is 135;

[0108] Calculate the absolute value of the difference between the single point gray value except the reference gray value and the reference gray value, and mark it as the gray difference;

[0109] See also Figure 6 As shown in the figure, the number of different grayscale differences is counted, marked as the difference number, and a plane rectangular coordinate system is established with the grayscale difference as the X-axis and the difference number as the Y-axis, named as the grayscale floating distribution map, and the grayscale difference and the corresponding difference number are entered into the grayscale floating distribution map;

[0110] The coordinate points in the grayscale floating distribution graph are marked as grayscale floating points, and the grayscale floating points adjacent to each other are connected by a smooth curve, and the obtained curve is named grayscale floating curve;

[0111] See also Figure 7 As shown, the remaining homologous images are analyzed, and each group of homologous images can obtain a grayscale floating curve, and all grayscale floating curves are plotted in the grayscale floating distribution diagram;

[0112] Further analyze the grayscale floating distribution map, extract the characteristics of the grayscale floating curve and conduct training;

[0113] In practical applications, the difference between the grayscale values ​​of other single points except 135 and 135 is calculated. For example, the grayscale difference between the single point grayscale value 131 and 135 is 4, and the number of single point grayscale values ​​131 with the same value is 52630, that is, the number of differences with a grayscale difference of 4 is 52630. Through statistical calculation, the grayscale floating distribution diagram is constructed as follows Figure 6 As shown, Figure 6Only one grayscale floating curve is shown, that is, the grayscale floating curve of a sample cable. After analyzing all sample cables, Figure 7 , since different cable lengths will result in different numbers of sample images captured, and thus different numbers of pixels, the lengths of the sample cables captured in this embodiment are all uniform to ensure that the number of sample images captured is the same;

[0114] The floating feature analysis unit is configured with a floating feature analysis strategy, which includes:

[0115] Get the maximum value of X of the grayscale floating point in the grayscale floating distribution map, marked as the grayscale floating threshold;

[0116] See also Figure 8 As shown, the grayscale floating points with the minimum X and the maximum X in the grayscale floating curve are marked as the minimum floating point and the maximum floating point respectively;

[0117] See also Figures 9 and 10 As shown, in the order of Y from small to large, the adjacent minimum floating points are connected by smooth curves, and the adjacent maximum floating points are connected by smooth curves to obtain the minimum closed curve and the maximum closed curve;

[0118] See also Fig.11 As shown, based on the minimum closed curve and the maximum closed curve, the area between any two gray floating curves is filled with gray, and the process is repeated until the area between any two gray floating curves is all gray, and a gray area is obtained and marked as a gray floating area;

[0119] The graphics of the grayscale floating area are extracted, and the grayscale floating area and the grayscale floating threshold at this time are the characteristics of the grayscale floating curve;

[0120] In actual applications, the maximum value of X obtained from the grayscale floating point is 21, that is, the grayscale floating threshold is 21. Figure 8 The black circle in the figure is the minimum floating point, and the black triangle is the maximum floating point. The minimum floating point and the maximum floating point are connected by a smooth curve to obtain Fig. 9 , in order to distinguish the minimum closed curve and the maximum closed curve, Fig.10 The grayscale floating curve is removed to show the minimum closed curve and the maximum closed curve; the grayscale floating area is obtained by filling. Fig.11 As shown, the grayscale floating distribution diagram in this embodiment only shows a part of the grayscale floating curve, so the grayscale floating area obtained is small and is only used for reference when explaining this embodiment, not the accurate result in actual application;

[0121] The defect recognition unit is used to detect defects on the appearance of the cable through the defect recognition model after training;

[0122] The defect identification unit is configured with a defect identification strategy, which includes:

[0123] After the defect recognition model is trained by the features of the grayscale floating curve, when it is necessary to detect the appearance defects of the cable, the contour image of the cable is obtained and marked as the pattern to be recognized;

[0124] See also Fig.12 As shown, a grayscale floating distribution map and a grayscale floating curve of the figure to be identified are extracted based on the figure to be identified, and are marked as a distribution map to be identified and a curve to be identified respectively;

[0125] Extract the maximum value of X of the coordinate point in the distribution map to be identified, mark it as the maximum deviation value, compare the maximum deviation value with the grayscale floating threshold, if the maximum deviation value is less than or equal to the grayscale floating threshold, output a normal deviation signal; if the maximum deviation value is greater than the grayscale floating threshold, output an abnormal deviation signal;

[0126] In practical applications, in this embodiment, after photographing and analyzing the cables that need to be inspected for appearance, the distribution map to be identified and the curve to be identified are obtained. Fig.12 As shown, the maximum deviation value is 20, and through comparison, it is found that the maximum deviation value 20 is less than the grayscale floating threshold 21, and a normal deviation signal is output;

[0127] See also Fig.13 As shown, extract the curve to be identified, mark the coordinate point with the smallest X in the curve to be identified as the reference moving point, place the reference moving point in the minimum closed curve, move the reference moving point in the order of Y from small to large, and the curve to be identified moves following the reference moving point, and detect whether the curve to be identified is all in the grayscale floating area. If so, output a floating normal signal; if not, output a moving continuation signal;

[0128] If the moving continuation signal is output, the reference moving point will continue to be moved and judged; if the floating normal signal is output, the movement will be stopped;

[0129] Count the output signals. If an abnormal deviation signal is output or a normal floating signal is not output, it indicates that there is a defect on the cable surface. If a normal deviation signal and a normal floating signal are output at the same time, it indicates that there is no defect on the cable surface.

[0130] In practical applications, such as Fig.13As shown, it is found through movement that there is a situation that all the curves to be analyzed are within the grayscale floating area, and a floating normal signal is output. Since the floating normal signal is output at the same time as the deviation normal signal, it means that there is no defect in the appearance of the cable tested this time; since the outside of the cable is usually wrapped with insulating material, and the color of the external insulating material of a cable is usually the same color, and when the computer displays an image, the pixel value usually varies within a certain range, making the image look more natural and smooth, and this change has a certain rule. As long as it conforms to the analyzed rule, it means that there is no defect in the appearance of the cable. On the contrary, if there are defects in the appearance of the cable, whether there are protrusions or scratches and other appearance defects, it will destroy the balance rule of the grayscale value on the cable surface, causing the curve to be analyzed to exceed the grayscale floating area.

[0131] Example 2, please refer to Figure 4 As shown, the present application provides a cable production detection method based on machine vision, comprising the following steps:

[0132] Step S1, using a high-resolution camera to photograph the appearance of the cable to obtain an appearance image; Step S1 includes the following sub-steps:

[0133] Step S101, setting a support structure, on which a rolling device and two retractable rings are installed, which are named as a first ring and a second ring from left to right respectively;

[0134] Step S102, passing the cable through the first ring and the second ring, and passing one end of the cable through the rolling device, clamping the cable through the rolling device, and then controlling the first ring and the second ring to contract to clamp the cable;

[0135] Step S103, photographing the cable;

[0136] Step S103 includes the following sub-steps:

[0137] Step S103.1, a high-resolution camera is arranged on the front of the midpoint between the first circular ring and the second circular ring to photograph the cable between the first circular ring and the second circular ring to obtain an appearance image;

[0138] Step S103.2, release the rolling device, control the first ring and the second ring to rotate 90° clockwise at the same time, and shoot again. The same section of cable needs to be rotated three times, and a total of four appearance images are taken;

[0139] Step S103.3, the length of the cable in each captured appearance image is the first captured length;

[0140] Step S103.4, loosen the first ring and the second ring, and then control the rolling device to clamp the cable and roll it, which drives the cable to move to the left;

[0141] Step S103.5, when the cable moves to the first shooting length, the rolling is stopped, and the first ring and the second ring are controlled to shrink, and the appearance image is shot again;

[0142] Step S103.6, a cable will be photographed to obtain multiple sets of appearance images;

[0143] Step S2, preprocessing the appearance image to obtain an appearance grayscale image after improving the image quality; Step S2 includes the following sub-steps:

[0144] Step S201, filtering the appearance image by Gaussian filtering;

[0145] Step S202, after the processing is completed, the image is grayed to obtain an appearance grayscale image;

[0146] Step S3, extracting edge information of the cable in the appearance grayscale image, and delineating a contour image of the cable based on the edge information; Step S3 includes the following sub-steps:

[0147] Step S301, when photographing the cable, a pure white baffle is set in the background, so that except for the cable part, the rest of the appearance image obtained by photographing is all pure white, and the grayscale value after grayscale conversion is 255;

[0148] Step S302, removing pixels with a gray value of 255 and marking the remaining pixels as cable points;

[0149] Step S303, forming a contour image from the cable points;

[0150] Step S4, extracting the appearance features of the contour image, performing feature analysis on the appearance features, analyzing the grayscale floating threshold and grayscale floating area of ​​the cable through the sample cable, retraining the defect recognition model and performing defect detection on the appearance of the cable through the defect recognition model; Step S4 includes the following sub-steps:

[0151] Step S401, screening cables with no defects in appearance, marking them as sample cables, extracting appearance features of the sample cables and performing feature analysis, and training a defect recognition model;

[0152] Step S401 includes the following sub-steps:

[0153] Step S401.1, selecting sample cables without defects in appearance and photographing them, marking the contour images obtained by photographing and processing as sample images, obtaining multiple groups of sample images, and integrating the sample images of the same cable into homologous images;

[0154] Step S401.2, for any homologous image, obtain the gray value of the cable point in the homologous image and mark it as a single point gray value;

[0155] Step S401.3, counting the number of different single-point grayscale values, marking them as the number of same values, finding the maximum value among the number of same values, marking it as the maximum proportion value, obtaining the single-point grayscale value corresponding to the maximum proportion value, marking it as the reference grayscale value;

[0156] Step S401.4, calculating the absolute value of the difference between the single point gray value other than the reference gray value and the reference gray value, and marking it as the gray difference;

[0157] Step S401.5, counting the number of different grayscale differences, marking them as difference numbers, establishing a plane rectangular coordinate system with the grayscale difference as the X-axis and the difference number as the Y-axis, named grayscale floating distribution map, and entering the grayscale difference and the corresponding difference number into the grayscale floating distribution map;

[0158] Step S401.6, marking the coordinate points in the grayscale floating distribution diagram as grayscale floating points, connecting the X-adjacent grayscale floating points by a smooth curve, and naming the obtained curve a grayscale floating curve;

[0159] Step S401.7, analyzing the remaining homologous images, each group of homologous images can obtain a grayscale floating curve, and all grayscale floating curves are plotted in a grayscale floating distribution diagram;

[0160] Step S401.8, further analyzing the grayscale floating distribution graph, extracting the features of the grayscale floating curve and performing training;

[0161] Step S401.8 includes the following sub-steps:

[0162] Step S401.8.a, obtaining the maximum value of X of the grayscale floating point in the grayscale floating distribution graph, and marking it as the grayscale floating threshold;

[0163] Step S401.8.b, marking the grayscale floating point with the minimum X and the maximum X in the grayscale floating curve as the minimum floating point and the maximum floating point respectively;

[0164] Step S401.8.c, in the order of Y from small to large, connect the adjacent minimum floating points with a smooth curve, and connect the adjacent maximum floating points with a smooth curve to obtain a minimum closed curve and a maximum closed curve;

[0165] Step S401.8.d, based on the minimum closed curve and the maximum closed curve, fill the area between any two gray floating curves with gray, and repeat until the area between any two gray floating curves is all gray, and obtain a gray area marked as the gray floating area;

[0166] Step S401.8.e, extracting the grayscale floating area graph, the grayscale floating area and the grayscale floating threshold at this time are the characteristics of the grayscale floating curve;

[0167] Step S402, after the training is completed, the defect detection of the cable appearance is performed through the defect recognition model;

[0168] Step S402 includes the following sub-steps:

[0169] Step S402.1, after the defect recognition model is trained by the features of the grayscale floating curve, when it is necessary to detect the appearance defects of the cable, a contour image of the cable is obtained and marked as a pattern to be recognized;

[0170] Step S402.2, extracting a grayscale floating distribution map and a grayscale floating curve of the figure to be identified based on the figure to be identified, and marking them as a distribution map to be identified and a curve to be identified respectively;

[0171] Step S402.3, extract the maximum value of X of the coordinate point in the distribution map to be identified, mark it as the maximum deviation value, compare the maximum deviation value with the grayscale floating threshold, if the maximum deviation value is less than or equal to the grayscale floating threshold, then output a normal deviation signal; if the maximum deviation value is greater than the grayscale floating threshold, then output an abnormal deviation signal;

[0172] Step S402.4, extract the curve to be identified, mark the coordinate point with the smallest X in the curve to be identified as the reference moving point, place the reference moving point in the minimum closed curve, move the reference moving point in the order of Y from small to large, and the curve to be identified moves following the reference moving point, and detect whether the curve to be identified is all in the grayscale floating area. If so, output a floating normal signal; if not, output a moving continuation signal;

[0173] Step S402.5, if the moving continuation signal is output, the reference moving point is continuously moved and judged; if the floating normal signal is output, the movement is stopped;

[0174] Step S402.6, counting the output signals, if an abnormal deviation signal is output or a normal floating signal is not output, it is marked that there are defects on the cable surface; if a normal deviation signal is output and a normal floating signal is output at the same time, it is marked that there are no defects on the cable surface.

[0175] Embodiment 3, the present application provides an electronic device, which may include: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps in the cable production detection method based on machine vision are executed to achieve the following functions: use a high-resolution camera to shoot the appearance of the cable to obtain an appearance image; pre-process the appearance image to improve the image quality and obtain an appearance grayscale image; extract the edge information of the cable in the appearance grayscale image, and delineate the contour image of the cable based on the edge information; extract the appearance features of the contour image, perform feature analysis on the appearance features, and then train the defect recognition model to perform defect detection on the appearance of the cable.

[0176] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0177] Embodiment 4, the present application also provides a computer-readable storage medium, the present application provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned cable production inspection method based on machine vision are executed to achieve the following functions: use a high-resolution camera to photograph the appearance of the cable to obtain an appearance image; preprocess the appearance image to improve the image quality and obtain an appearance grayscale image; extract edge information of the cable in the appearance grayscale image, and define the contour image of the cable based on the edge information; extract appearance features of the contour image, perform feature analysis on the appearance features, and then train a defect recognition model to perform defect detection on the appearance of the cable.

[0178] Through the description of the above implementation methods, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on such an understanding, the above technical solutions can be essentially or partly contributed to the prior art in the form of software products, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and include several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0179] In the embodiments provided in the present application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.

[0180] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A cable production detection method based on machine vision, characterized in that: The steps include: Use a high-resolution camera to shoot the appearance of the cable and obtain an appearance image; Preprocess the appearance image to improve the image quality and obtain the appearance grayscale image; Extract edge information of the cable in the appearance grayscale image, and delineate the contour image of the cable based on the edge information; The appearance features of the contour image are extracted and feature analysis is performed on the appearance features. The grayscale floating threshold and grayscale floating area of ​​the cable are analyzed through the sample cable. The defect recognition model is then trained and the defect detection on the cable appearance is performed through the defect recognition model.

2. The cable production detection method based on machine vision according to claim 1 is characterized in that: Use a high-resolution camera to capture the appearance of the cable. Acquiring the appearance image includes the following sub-steps: A support structure is provided, on which a rolling device and two retractable rings are installed, which are named as a first ring and a second ring from left to right respectively; Pass the cable through the first ring and the second ring, and pass one end of the cable through the rolling device, clamp the cable through the rolling device, and then control the first ring and the second ring to contract to clamp the cable; Photograph the cables.

3. The cable production detection method based on machine vision according to claim 2 is characterized in that: Photographing the cable includes the following sub-steps: A high-resolution camera is arranged on the front side of the midpoint between the first circular ring and the second circular ring to photograph the cable between the first circular ring and the second circular ring to obtain an appearance image; Release the rolling device, control the first and second rings to rotate 90° clockwise at the same time, and take pictures again. The same section of cable needs to be rotated three times, and a total of four appearance images are taken; The length of the cable in each appearance image is the length of the first shot; Loosen the first ring and the second ring, then control the rolling device to clamp the cable and roll it, which will drive the cable to move to the left; When the cable moves to the first shooting length, the rolling is stopped, and the first ring and the second ring are controlled to shrink, and the appearance image is shot again; Multiple sets of appearance images will be taken for one cable.

4. The cable production detection method based on machine vision according to claim 3 is characterized in that: Preprocessing the appearance image to improve the image quality and obtain the appearance grayscale image includes the following sub-steps: The appearance image is filtered by Gaussian filtering; After the processing is completed, the image is grayed out to obtain an appearance grayscale image.

5. The cable production detection method based on machine vision according to claim 4 is characterized in that: Extracting the edge information of the cable in the appearance grayscale image and delineating the contour image of the cable based on the edge information includes the following sub-steps: When photographing the cable, a pure white baffle is set in the background. Except for the cable part, the rest of the appearance image is pure white, and the grayscale value after grayscale conversion is 255. Eliminate pixels with a grayscale value of 255 and mark the remaining pixels as cable points; The cable points form a contour image.

6. The cable production detection method based on machine vision according to claim 5 is characterized in that: Extracting the appearance features of the contour image, performing feature analysis on the appearance features, analyzing the grayscale floating threshold and grayscale floating area of ​​the cable through the sample cable, and then training the defect recognition model and performing defect detection on the appearance of the cable through the defect recognition model include the following sub-steps: Screen cables with no defects in appearance, mark them as sample cables, extract appearance features of the sample cables, perform feature analysis, and train a defect recognition model; After the training is completed, the defect recognition model is used to detect defects on the appearance of the cable.

7. The cable production detection method based on machine vision according to claim 6 is characterized in that: Screen cables with no defects in appearance and mark them as sample cables. Extract the appearance features of the sample cables and perform feature analysis. Training the defect recognition model includes the following sub-steps: Select sample cables with no defects in appearance and shoot them, mark the outline images obtained by shooting and processing as sample images, obtain multiple groups of sample images, and integrate the sample images of the same cable into homologous images; For any homologous image, the gray value of the cable point in the homologous image is obtained and marked as a single point gray value; Count the number of different single-point grayscale values, mark them as the number of same values, find the maximum value among the number of same values, mark it as the maximum proportion value, obtain the single-point grayscale value corresponding to the maximum proportion value, and mark it as the reference grayscale value; Calculate the absolute value of the difference between the single point gray value other than the reference gray value and the reference gray value, and mark it as the gray difference; Count the number of different grayscale differences, mark them as difference numbers, establish a plane rectangular coordinate system with grayscale difference as X-axis and difference number as Y-axis, name it grayscale floating distribution map, enter the grayscale difference and the corresponding difference number into the grayscale floating distribution map; The coordinate points in the grayscale floating distribution graph are marked as grayscale floating points, and the adjacent grayscale floating points of X are connected by a smooth curve, and the obtained curve is named grayscale floating curve; Analyze the remaining homologous images, and obtain a grayscale floating curve for each group of homologous images. All grayscale floating curves are plotted in the grayscale floating distribution diagram. The grayscale floating distribution map is further analyzed to extract the features of the grayscale floating curve and perform training.

8. The cable production detection method based on machine vision according to claim 7 is characterized in that: Further analysis of the grayscale floating distribution graph, extraction of grayscale floating curve features and training includes the following sub-steps: Get the maximum value of X of the grayscale floating point in the grayscale floating distribution map, marked as the grayscale floating threshold; Mark the grayscale floating point with the minimum X and the maximum X in the grayscale floating curve as the minimum floating point and the maximum floating point respectively; In the order of Y from small to large, the adjacent minimum floating points are connected by smooth curves, and the adjacent maximum floating points are connected by smooth curves to obtain the minimum closed curve and the maximum closed curve; Based on the minimum closed curve and the maximum closed curve, fill the area between any two gray floating curves with gray, and repeat the process until the area between any two gray floating curves is all gray, and obtain a gray area marked as the gray floating area; The graphics of the grayscale floating area are extracted, and the grayscale floating area and the grayscale floating threshold at this time are the characteristics of the grayscale floating curve.

9. The cable production detection method based on machine vision according to claim 8, characterized in that: After the training is completed, the defect detection of the cable appearance through the defect recognition model includes the following sub-steps: After the defect recognition model is trained by the features of the grayscale floating curve, when it is necessary to detect the appearance defects of the cable, the contour image of the cable is obtained and marked as the pattern to be recognized; A grayscale floating distribution map and a grayscale floating curve of the to-be-recognized figure are obtained based on the to-be-recognized figure, and are marked as a to-be-recognized distribution map and a to-be-recognized curve respectively; Extract the maximum value of X of the coordinate point in the distribution map to be identified, mark it as the maximum deviation value, compare the maximum deviation value with the grayscale floating threshold, if the maximum deviation value is less than or equal to the grayscale floating threshold, output a normal deviation signal; if the maximum deviation value is greater than the grayscale floating threshold, output an abnormal deviation signal; Extract the curve to be identified, mark the coordinate point with the smallest X in the curve to be identified as the reference moving point, place the reference moving point in the minimum closed curve, move the reference moving point in the order of Y from small to large, and the curve to be identified moves along with the reference moving point, and detect whether the curve to be identified is completely within the grayscale floating area. If so, output a floating normal signal; if not, output a moving continuation signal; If the moving continuation signal is output, the reference moving point will continue to be moved and judged; if the floating normal signal is output, the movement will be stopped; Count the output signals. If an abnormal deviation signal is output or a normal floating signal is not output, it indicates that there is a defect on the cable surface. If the deviation normal signal is output and the floating normal signal is output at the same time, it indicates that there is no defect on the surface of the marker cable.

10. A machine vision-based cable production detection system, used to implement the machine vision-based cable production detection method according to any one of claims 1 to 9, characterized in that: It includes an appearance shooting module, a preprocessing module, an appearance extraction module and a feature analysis module; the appearance shooting module, the preprocessing module and the appearance extraction module are respectively connected to the feature analysis module data; The appearance shooting module is used to shoot the appearance of the cable using a high-resolution camera to obtain an appearance image; The preprocessing module is used to preprocess the appearance image to obtain an appearance grayscale image after improving the image quality; The appearance extraction module is used to extract the edge information of the cable in the appearance grayscale image, and to delineate the contour image of the cable based on the edge information; The feature analysis module is used to extract the appearance features of the contour image, perform feature analysis on the appearance features, analyze the grayscale floating threshold and grayscale floating area of ​​the cable through the sample cable, retrain the defect recognition model and perform defect detection on the appearance of the cable through the defect recognition model.

Citation Information

Patent Citations

  • Cable sheath appearance defect detection device and method based on machine vision

    CN117571714A

  • Surface defect detection method for guide rail based on image processing

    CN118015000A

  • Visual inspection system for workpiece appearance defects based on image processing

    CN118470016A

  • Bearing defect detection method and system based on computer vision

    CN118799706A

  • Machine vision-based battery surface defect detection method and system and related device

    WO2023226357A1

Cited By

  • Visual quality inspection method, system and equipment suitable for gas hose

    CN119845726A

  • Intelligent monitoring system for cable production quality

    CN120276298A