A cable oil film uniformity detection method and system based on machine vision

Through machine vision-based detection methods, including image preprocessing, missing feature extraction and support vector machine classification, the subjectivity and accuracy of traditional cable oil film detection methods are solved, and efficient and accurate cable oil film uniformity detection is achieved.

CN119131516BActive Publication Date: 2025-04-15ZHEJIANG FIRE-PHOENIX WIRE&CABLE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411615369.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2025-04-15
Estimated Expiration
2044-11-13

AI Technical Summary

Technical Problem

The traditional cable oil film uniformity detection method relies on naked eye observation, has subjectivity, large errors, low accuracy, slow detection speed, expensive instruments, low applicability, and no machine vision and artificial intelligence technology are used.

Method used

Using machine vision-based detection method, by obtaining cable oil film images, noise reduction processing, image positioning and segmentation, missing features are extracted, missing areas are identified using support vector machine classifiers, and cable measurement diameters are calculated, and the diameter deviation rate is judged to complete uniformity detection.

Benefits of technology

It realizes efficient and accurate uniformity detection of cable oil film, reduces processing time and errors, and improves the accuracy and applicability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131516B_ABST
    Figure CN119131516B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and discloses a cable oil film uniformity detection method and system based on machine vision. The present invention first obtains an initial cable oil film image, and performs noise reduction processing, image positioning processing and image segmentation processing to obtain a processed cable oil film image; secondly, the processed cable oil film image is marked as missing cable oil film, and the cable oil film missing features are extracted to obtain a cable oil film image after feature extraction; then a support vector machine classifier is trained to identify whether the cable oil film is missing in the cable oil film image after feature extraction, and a cable oil film defect-free image is obtained; finally, the cable measurement diameter of the cable oil film defect-free image is calculated, and the cable oil film uniformity detection is realized by comparing the diameter deviation rate. The present invention achieves the purpose of cable oil film uniformity detection by processing and identifying the cable oil film image, and the method is objective and accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for detecting cable oil film uniformity based on machine vision. Background Art

[0002] Chinese patent CN112651928A discloses an online detection system for uniformity of polyester filaments based on a dynamic convolutional neural network. The method specifically includes the following steps: firstly, collecting electrical signal data and video data during spinning of polyester filaments, converting the electrical signal data into a frequency domain graph and a time domain graph, and then cutting the video data to obtain a video frame graph; using the data in the frequency domain graph, the time domain graph and the video frame graph as a training set, combining a gated recurrent unit network with a convolutional neural network, using the training set to train a model, and constructing a strip uniformity detection model based on a dynamic convolutional neural network algorithm; and then collecting real-time video data, inputting the real-time video data into the strip uniformity detection model based on the dynamic convolutional neural network algorithm, and outputting the detection result to realize online detection of uniformity of polyester filaments.

[0003] Traditional cable oil film uniformity detection methods mostly rely on visual observation of the color and gloss of the cable oil film surface. Limited by the subjectivity of the naked eye, it is unable to accurately identify small differences, resulting in large detection errors and low accuracy. When using detection equipment to detect cable oil film uniformity, the detection speed is slow and the instrument is expensive, and its applicability is not high. At the same time, high-tech technologies such as machine vision and artificial intelligence are not used, which brings inconvenience to cable production. Summary of the invention

[0004] In view of the problems in the related art, the present invention provides a cable oil film uniformity detection method and system based on machine vision to overcome the above-mentioned technical problems existing in the existing related art.

[0005] In order to solve the above technical problems, the present invention is achieved through the following technical solutions:

[0006] The present invention is a method for detecting cable oil film uniformity based on machine vision, comprising the following steps:

[0007] S1, acquiring a cable oil film surface image to obtain an initial cable oil film image set, performing noise reduction processing, image positioning processing and image segmentation processing on the initial cable oil film image in the initial cable oil film image set, segmenting the cable oil film area, and obtaining a processed cable oil film image set;

[0008] S2, marking the processed cable oil film images in the processed cable oil film image set as being missing cables, and extracting features of missing cables, to obtain a set of cable oil film images after feature extraction;

[0009] S3, training a support vector machine to obtain a support vector machine classifier, inputting the cable oil film image set after the feature extraction into the support vector machine classifier, and obtaining a cable oil film non-missing image set by identifying whether the cable oil film is missing;

[0010] S4. Based on the cable measurement diameter detection method, the cable measurement diameter of the cable oil film defect-free image in the cable oil film defect-free image set is calculated, and then the diameter deviation rate is calculated, and the cable oil film uniformity detection is completed according to the diameter deviation rate result.

[0011] The invention obtains the initial cable oil film image, generates the initial cable oil film image matrix, uses the adaptive median filter to perform noise reduction processing on the initial cable oil film image, then locates the cable, and performs image segmentation processing on the located cable oil film image; the above processing method effectively eliminates the noise in the image and retains the detail information, first removes most of the useless background images of the image, greatly reduces the processing time, and the improved K-means algorithm reduces the number of iterations and improves the algorithm execution efficiency; secondly, based on the directional gradient value and the grayscale value, the cable oil film missing area in the processed cable oil film image is found, the missing mark is made, and the cable oil film missing area is extracted The geometric features and texture features of the domain are obtained; this method does not need to binarize the image, which reduces the time spent on finding the missing area, and the feature extraction facilitates the identification in the subsequent steps; the support vector machine is then trained to obtain a support vector machine classifier to identify whether the cable oil film is missing. The classifier works well in dealing with small samples and nonlinear problems, and the classification of samples is achieved through iteration; finally, the cable measurement diameter of the cable oil film defect-free image is calculated, and the cable oil film uniformity detection is completed by judging the diameter deviation rate; this method detects the image preliminarily screened by the support vector machine classifier, realizes the cable oil film uniformity detection more accurately, and greatly reduces the image processing amount and processing time.

[0012] Preferably, the S1 comprises the following steps:

[0013] S11, running the cable production equipment, using the image acquisition device to acquire the cable oil film surface image, obtaining the initial cable oil film image, forming the initial cable oil film image set, selecting m×n sample points on the initial cable oil film image, the sample points are pixel points, and quantizing the sample points to generate the initial cable oil film image matrix A as follows:

[0014] ;

[0015] in, Indicates the mth horizontal and nth vertical pixel on the initial cable oil film image;

[0016] According to the initial cable oil film image matrix, an adaptive median filtering process is performed on the initial cable oil film images in the initial cable oil film image set, and the specific steps are as follows:

[0017] S111, select a size of Neighborhood window, set the maximum size of the neighborhood window to The minimum gray value of the pixel in the neighborhood window is , the maximum gray value of the pixel in the neighborhood window is , and calculate the mean gray value of the pixels in the neighborhood window, recorded as ; The adaptive median filtering process is divided into the first level and the second level. When the grayscale value mean of the pixels in the neighborhood window is greater than the minimum grayscale value of the pixels in the neighborhood window and less than the maximum grayscale value of the pixels in the neighborhood window, the second level of the adaptive median filtering process is entered; otherwise, the neighborhood window size is continuously increased, and the neighborhood window size is kept smaller than the maximum size of the neighborhood window until the grayscale value mean of the pixels in the neighborhood window is greater than the minimum grayscale value of the pixels in the neighborhood window and less than the maximum grayscale value of the pixels in the neighborhood window;

[0018] S112, in the second level of adaptive median filtering, select any pixel point in the neighborhood window and record it as the pixel point to be filtered. When the grayscale value of the pixel point to be filtered is greater than the minimum grayscale value of the pixel point in the neighborhood window and less than the maximum grayscale value of the pixel point in the neighborhood window, the pixel point to be filtered does not contain noise; when the grayscale value of the pixel point to be filtered is less than or equal to the minimum grayscale value of the pixel point in the neighborhood window or greater than or equal to the maximum grayscale value of the pixel point in the neighborhood window, the pixel point to be filtered contains noise, and the grayscale value of the pixel point to be filtered is replaced by the grayscale value mean of the pixel point in the neighborhood window; until the adaptive median filtering of all pixels in the initial cable oil film image matrix is ​​completed, a filtered cable oil film image set and a filtered cable oil film image matrix are obtained. as follows:

[0019] ;

[0020] in, The horizontal first , vertical pixels;

[0021] S12, selecting the first Row pixel points, get the cable positioning pixel point set ,in Indicates horizontal , vertical pixels, set the horizontal , vertical The gray value of a pixel is , then The calculation formula for the mean grayscale value of row pixels is as follows:

[0022] ;

[0023] in, Indicates The mean gray value of the row pixels, ;

[0024] The grayscale value mean of each row of the filtered cable oil film image matrix is ​​calculated in turn, and a convolution operation is performed to obtain a grayscale value mean image. The maximum peak and minimum peak are found on the grayscale value mean image and are recorded as and , the area within the maximum peak and minimum peak is taken as the cable positioning area, and the cable oil film image after filtering is As the left border of the image, The filtered cable oil film image is clipped as the right boundary of the image to obtain the located cable oil film image, which constitutes a located cable oil film image set;

[0025] S13, using an improved K-means algorithm to perform image segmentation processing on the located cable oil film images in the located cable oil film image set, the specific steps are as follows;

[0026] S131, generating a located cable oil film image matrix according to the located cable oil film image, setting the initial segmentation threshold to , the segmentation error parameter is , dividing the pixels in the located cable oil film image matrix into a first pixel set and a second pixel set, the grayscale value of the pixels in the first pixel set is greater than the initial segmentation threshold, and the grayscale value of the pixels in the second pixel set is less than or equal to the initial segmentation threshold; calculating the average values ​​of the pixels in the first pixel set and the second pixel set, respectively denoted as and , then the new segmentation threshold The calculation formula is as follows:

[0027] ;

[0028] Repeat S131 until the new segmentation threshold is less than the segmentation error parameter to obtain a final segmentation threshold;

[0029] S132. Use the final segmentation threshold to segment the located cable oil film image into a foreground image and a background image, select K pixels in the foreground image and the background image as initial clustering centers, calculate the Euclidean distance between the initial clustering centers and other pixels, perform clustering processing on the located cable oil film image, complete the segmentation of the cable oil film area in the located cable oil film image, obtain processed cable oil film images, and form a set of processed cable oil film images.

[0030] The invention obtains the initial cable oil film image and uses adaptive median filtering to perform denoising on the initial cable oil film image, thereby effectively eliminating the noise in the image and retaining the detail information; then the cable is located and most of the useless background images in the image are eliminated, which greatly reduces the processing time; and the located cable oil film image is segmented and an improved K-means algorithm is used to reduce the number of iterations and improve the algorithm execution efficiency.

[0031] Preferably, S2 comprises the following steps:

[0032] S21, generating a processed cable oil film image matrix according to the processed cable oil film image in the processed cable oil film image set as follows:

[0033] ;

[0034] in, Indicates the horizontal first , vertical pixels;

[0035] According to the processed cable oil film image matrix, the processed cable oil film image is marked as missing cable oil film to obtain a set of cable oil film images with missing marks. The specific steps are as follows:

[0036] S211, select any pixel point in the processed cable oil film image matrix, record it as a missing marked pixel point, and mark the position coordinate of the missing marked pixel point as , the gray value of the missing marked pixel is recorded as , then the horizontal gradient of the missing marked pixel , the longitudinal gradient of the missing marked pixel , pixel gradient threshold The calculation formula is as follows:

[0037] ;

[0038] S212, set the gray threshold to , traverse the processed cable oil film image matrix, add the pixel row and column numbers corresponding to the pixel row and column number direction gradient value greater than the pixel gradient threshold or the pixel gray value greater than the gray threshold to the missing mark queue, and form a local cable oil film image matrix according to the pixel row and column numbers in the missing mark queue;

[0039] S213, repeating S211 and S212 for the local cable oil film image matrix until the row and column direction gradient values ​​of all pixels in the local cable oil film image matrix are greater than the pixel gradient threshold or the gray value of the pixel is greater than the gray threshold, outputting the row and column numbers of the pixels corresponding to the missing area, realizing the cable oil film missing mark, obtaining the cable oil film image with missing mark, and forming a cable oil film image set with missing mark;

[0040] S22, according to the cable oil film image with missing mark in the cable oil film image set with missing mark, set a missing region pixel point coordinate set and a missing region pixel point boundary coordinate set, obtain missing area, missing circularity and missing rectangularity according to the missing region pixel point coordinate set, obtain boundary perimeter according to the missing region pixel point boundary coordinate set, and use the missing area, missing circularity, missing rectangularity and boundary perimeter as the cable oil film missing geometric features;

[0041] According to the cable oil film images with missing marks in the cable oil film image set with missing marks, the missing area contrast, missing area energy and missing area entropy are calculated, and the missing area contrast, missing area energy and missing area entropy are used as cable oil film missing texture features; the cable oil film missing geometric features and cable oil film missing texture features are used as cable oil film missing features to obtain the cable oil film image set after feature extraction.

[0042] The invention makes an image based on directional gradient values ​​and grayscale values, finds the cable oil film missing area in the processed cable oil film image, and marks the missing area, thereby reducing the time spent in finding the missing area. The method is simple; and the geometric features and texture features of the cable oil film missing area are extracted. The feature extraction facilitates identification in subsequent steps.

[0043] Preferably, S3 comprises the following steps:

[0044] S31, acquiring new cable oil film images to form a new cable oil film image set, extracting cable oil film missing features after preprocessing the new cable oil film image set, obtaining a cable oil film image sample set after feature extraction, and dividing the cable oil film image sample set after feature extraction into a sample training set and a sample test set; setting the kernel function of the support vector machine to F, inputting the sample training set into the support vector machine, iterating continuously until the support vector machine converges, and obtaining a trained support vector machine; then inputting the sample test set into the trained support vector machine, setting the error threshold to , when the output result error is less than the error threshold, the support vector machine classifier is obtained; otherwise, the parameters are adjusted until the output result error is less than the error threshold;

[0045] S32, input the cable oil film image set after the feature extraction into the support vector machine classifier, and output the recognition result. When the cable oil film is missing, the cable oil film uniformity is unqualified; when the cable oil film is not missing, a cable oil film non-missing image is obtained to form a cable oil film non-missing image set.

[0046] The invention obtains a support vector machine classifier by training a support vector machine, and classifies samples through iteration, so as to quickly identify whether the oil film of the cable is missing. The support vector machine classifier is effective in processing small samples and nonlinear problems.

[0047] Preferably, S4 comprises the following steps:

[0048] S41, quantizing the cable oil film defect-free images in the cable oil film defect-free image set to obtain a cable oil film defect-free image matrix as follows:

[0049] ;

[0050] in, Indicates the i-th horizontal and j-th vertical pixel on the cable oil film defect-free image;

[0051] According to the cable oil film defect-free image matrix, a cable measurement diameter detection method is used to perform diameter detection on the cable oil film defect-free image to obtain the cable measurement diameter. The specific steps are as follows:

[0052] S411, setting the coordinate value of any pixel point selected from the cable oil film defect-free image matrix , the gray value of the pixel is , the cable oil film defect-free image matrix is ​​scanned from left to right; when and At this time, the pixel is the upper boundary point of the cable oil film defect-free image, and Add to the first matrix, Add to the second matrix; when and At this time, the pixel is the lower boundary point of the cable oil film defect-free image, and Joined in the third matrix;

[0053] S412, pixel point The product of the horizontal and vertical coordinates is recorded as , the total number of pixels in the cable oil film defect-free image matrix is ,when When , the third matrix is ​​subtracted from the first matrix to obtain the fourth matrix; at this time, it is determined whether the cable oil film defect-free image matrix has multiple boundary points. When there are , then there are multiple boundary points in the second matrix, and the data of multiple boundary points are superimposed and added to the fourth matrix;

[0054] S413, compare other pixel points in the cable oil film defect-free image matrix, and when the horizontal and vertical coordinate products of other pixel points are greater than the number of pixel points in the second matrix, add the corresponding pixel points to the fourth matrix; until all pixel points in the cable oil film defect-free image matrix are detected, the fourth matrix is ​​obtained, and the data of the kth column in the fourth matrix is ​​set to , the number of columns in the fourth matrix is ​​l, then the cable measurement diameter H is calculated as follows:

[0055] ;

[0056] S42, set the cable theoretical diameter to p, diameter deviation rate The calculation formula is as follows:

[0057] ;

[0058] Set the deviation threshold to When the diameter deviation rate is less than the deviation threshold, the oil film uniformity of the cable oil film defect-free image corresponding to the cable oil film defect-free image matrix is ​​qualified, that is, the cable oil film uniformity is qualified; otherwise, the cable oil film uniformity is unqualified, and the cable oil film uniformity detection is completed.

[0059] The invention calculates the cable measurement diameter of the cable oil film defect-free image and completes the cable oil film uniformity detection by judging the diameter deviation rate. After the images are initially screened using the support vector machine classifier, the number of detection images is reduced, which greatly reduces the image processing amount and processing time. The cable diameter measurement method is simple and the result is accurate.

[0060] This embodiment also discloses a system for a cable oil film uniformity detection method based on machine vision, which specifically includes: an initial cable oil film image preprocessing module, a cable oil film missing marking and feature extraction module, a support vector machine classifier recognition module and a cable oil film uniformity detection module;

[0061] The initial cable oil film image preprocessing module is used to perform noise reduction processing, image positioning processing and image segmentation processing on the initial cable oil film image;

[0062] The cable oil film missing marking and feature extraction module is used to perform cable oil film missing marking and cable oil film missing feature extraction on the processed cable oil film image;

[0063] The support vector machine classifier identification module is used to use a support vector machine classifier to identify whether the cable oil film is missing;

[0064] The cable oil film uniformity detection module is used to calculate the cable measurement diameter and perform diameter deviation analysis to achieve cable oil film uniformity detection.

[0065] The present invention has the following beneficial effects:

[0066] 1. The invention uses adaptive median filtering to perform noise reduction processing on the initial cable oil film image, effectively eliminating the noise in the image and retaining the detail information; then the cable is positioned and most of the useless background images are eliminated, greatly reducing the processing time.

[0067] 2. The invention uses an improved K-means algorithm to perform image segmentation on the located cable oil film image, thereby reducing the number of iterations and improving the algorithm execution efficiency.

[0068] 3. The invention reduces the time spent on finding missing areas by marking missing areas based on directional gradient values ​​and grayscale values; and extracts the geometric features and texture features of the cable oil film missing area. Feature extraction facilitates identification in subsequent steps.

[0069] 4. The invention obtains a support vector machine classifier by training a support vector machine, and classifies samples through iteration, so as to quickly identify whether the oil film of the cable is missing.

[0070] 5. The present invention calculates the cable measurement diameter of the cable oil film defect-free image and completes the cable oil film uniformity detection by judging the diameter deviation rate. By preliminary screening of images, the number of detection images is reduced, which greatly reduces the image processing amount and processing time. The cable diameter measurement method is simple and the result is accurate.

[0071] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] In order to more clearly illustrate the technical solutions of the embodiments of the invention, the drawings required for describing the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For ordinary technicians in this field, they can also obtain drawings based on these drawings without paying creative work.

[0073] Figure 1 The present invention provides a schematic flow chart of a cable oil film uniformity detection system based on machine vision for detecting cable oil film uniformity. 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] In the description of the present invention, it is necessary to understand that the terms "opening", "upper", "lower", "top", "middle", "inside" and the like indicating orientation or positional relationship are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as limiting the invention.

[0076] Example 1

[0077] See also Figure 1 This embodiment discloses a cable oil film uniformity detection method based on machine vision, which specifically includes the following contents:

[0078] S1, acquiring a cable oil film surface image to obtain an initial cable oil film image set, performing noise reduction processing, image positioning processing and image segmentation processing on the initial cable oil film image in the initial cable oil film image set, segmenting the cable oil film area, and obtaining a processed cable oil film image set;

[0079] The S1 comprises the following steps:

[0080] S11, running the cable production equipment, using the image acquisition device to acquire the cable oil film surface image, obtaining the initial cable oil film image, forming the initial cable oil film image set, selecting m×n sample points on the initial cable oil film image, the sample points are pixel points, and quantizing the sample points to generate the initial cable oil film image matrix A as follows:

[0081] ;

[0082] in, Indicates the mth horizontal and nth vertical pixel on the initial cable oil film image;

[0083] According to the initial cable oil film image matrix, an adaptive median filtering process is performed on the initial cable oil film images in the initial cable oil film image set, and the specific steps are as follows:

[0084] S111, select a size of Neighborhood window, set the maximum size of the neighborhood window to The minimum gray value of the pixel in the neighborhood window is , the maximum gray value of the pixel in the neighborhood window is , and calculate the mean gray value of the pixels in the neighborhood window, recorded as ; The adaptive median filtering process is divided into the first level and the second level. When the grayscale value mean of the pixels in the neighborhood window is greater than the minimum grayscale value of the pixels in the neighborhood window and less than the maximum grayscale value of the pixels in the neighborhood window, the second level of the adaptive median filtering process is entered; otherwise, the neighborhood window size is continuously increased, and the neighborhood window size is kept smaller than the maximum size of the neighborhood window until the grayscale value mean of the pixels in the neighborhood window is greater than the minimum grayscale value of the pixels in the neighborhood window and less than the maximum grayscale value of the pixels in the neighborhood window;

[0085] S112, in the second level of adaptive median filtering, select any pixel point in the neighborhood window and record it as the pixel point to be filtered. When the grayscale value of the pixel point to be filtered is greater than the minimum grayscale value of the pixel point in the neighborhood window and less than the maximum grayscale value of the pixel point in the neighborhood window, the pixel point to be filtered does not contain noise; when the grayscale value of the pixel point to be filtered is less than or equal to the minimum grayscale value of the pixel point in the neighborhood window or greater than or equal to the maximum grayscale value of the pixel point in the neighborhood window, the pixel point to be filtered contains noise, and the grayscale value of the pixel point to be filtered is replaced by the grayscale value mean of the pixel point in the neighborhood window; until the adaptive median filtering of all pixels in the initial cable oil film image matrix is ​​completed, a filtered cable oil film image set and a filtered cable oil film image matrix are obtained. as follows:

[0086] ;

[0087] in, The horizontal first , vertical pixels;

[0088] S12, selecting the first Row pixel points, get the cable positioning pixel point set ,in Indicates horizontal , vertical pixels, set the horizontal , vertical The gray value of a pixel is , then The calculation formula for the mean grayscale value of row pixels is as follows:

[0089] ;

[0090] in, Indicates The mean gray value of the row pixels, ;

[0091] The grayscale value mean of each row of the filtered cable oil film image matrix is ​​calculated in turn, and a convolution operation is performed to obtain a grayscale value mean image. The maximum peak and minimum peak are found on the grayscale value mean image and are recorded as and , the area within the maximum peak and minimum peak is taken as the cable positioning area, and the cable oil film image after filtering is As the left border of the image, The filtered cable oil film image is clipped as the right boundary of the image to obtain the located cable oil film image, which constitutes a located cable oil film image set;

[0092] S13, using an improved K-means algorithm to perform image segmentation processing on the located cable oil film images in the located cable oil film image set, the specific steps are as follows;

[0093] S131, generating a located cable oil film image matrix according to the located cable oil film image, setting the initial segmentation threshold to , the segmentation error parameter is , dividing the pixels in the located cable oil film image matrix into a first pixel set and a second pixel set, the grayscale value of the pixels in the first pixel set is greater than the initial segmentation threshold, and the grayscale value of the pixels in the second pixel set is less than or equal to the initial segmentation threshold; calculating the average values ​​of the pixels in the first pixel set and the second pixel set, respectively denoted as and , then the new segmentation threshold The calculation formula is as follows:

[0094] ;

[0095] Repeat S131 until the new segmentation threshold is less than the segmentation error parameter to obtain a final segmentation threshold;

[0096] S132, using the final segmentation threshold to segment the located cable oil film image into a foreground image and a background image, selecting K pixels in the foreground image and the background image as initial clustering centers, calculating the Euclidean distance between the initial clustering centers and other pixels, performing clustering processing on the located cable oil film image, completing the segmentation of the cable oil film area in the located cable oil film image, obtaining processed cable oil film images, and forming a processed cable oil film image set;

[0097] S2, marking the processed cable oil film images in the processed cable oil film image set as being missing cables, and extracting features of missing cables, to obtain a set of cable oil film images after feature extraction;

[0098] The S2 comprises the following steps:

[0099] S21, generating a processed cable oil film image matrix according to the processed cable oil film image in the processed cable oil film image set as follows:

[0100] ;

[0101] in, Indicates the horizontal first , vertical pixels;

[0102] According to the processed cable oil film image matrix, the processed cable oil film image is marked as missing cable oil film to obtain a set of cable oil film images with missing marks. The specific steps are as follows:

[0103] S211, select any pixel point in the processed cable oil film image matrix, record it as a missing marked pixel point, and mark the position coordinate of the missing marked pixel point as , the gray value of the missing marked pixel is recorded as , then the horizontal gradient of the missing marked pixel , the longitudinal gradient of the missing marked pixel , pixel gradient threshold The calculation formula is as follows:

[0104] ;

[0105] S212, set the gray threshold to , traverse the processed cable oil film image matrix, add the pixel row and column numbers corresponding to the pixel row and column number direction gradient value greater than the pixel gradient threshold or the pixel gray value greater than the gray threshold to the missing mark queue, and form a local cable oil film image matrix according to the pixel row and column numbers in the missing mark queue;

[0106] S213, repeating S211 and S212 for the local cable oil film image matrix until the row and column direction gradient values ​​of all pixels in the local cable oil film image matrix are greater than the pixel gradient threshold or the gray value of the pixel is greater than the gray threshold, outputting the row and column numbers of the pixels corresponding to the missing area, realizing the cable oil film missing mark, obtaining the cable oil film image with missing mark, and forming a cable oil film image set with missing mark;

[0107] S22, according to the cable oil film image with missing mark in the cable oil film image set with missing mark, set a missing region pixel point coordinate set and a missing region pixel point boundary coordinate set, obtain missing area, missing circularity and missing rectangularity according to the missing region pixel point coordinate set, obtain boundary perimeter according to the missing region pixel point boundary coordinate set, and use the missing area, missing circularity, missing rectangularity and boundary perimeter as the cable oil film missing geometric features;

[0108] According to the cable oil film images with missing marks in the cable oil film image set with missing marks, the missing region contrast, missing region energy and missing region entropy are calculated, and the missing region contrast, missing region energy and missing region entropy are used as cable oil film missing texture features; the cable oil film missing geometric features and cable oil film missing texture features are used as cable oil film missing features to obtain a cable oil film image set after feature extraction;

[0109] S3, training a support vector machine to obtain a support vector machine classifier, inputting the cable oil film image set after the feature extraction into the support vector machine classifier, and obtaining a cable oil film non-missing image set by identifying whether the cable oil film is missing;

[0110] The S3 comprises the following steps:

[0111] S31, acquiring new cable oil film images to form a new cable oil film image set, extracting cable oil film missing features after preprocessing the new cable oil film image set, obtaining a cable oil film image sample set after feature extraction, and dividing the cable oil film image sample set after feature extraction into a sample training set and a sample test set; setting the kernel function of the support vector machine to F, inputting the sample training set into the support vector machine, iterating continuously until the support vector machine converges, and obtaining a trained support vector machine; then inputting the sample test set into the trained support vector machine, setting the error threshold to , when the output result error is less than the error threshold, the support vector machine classifier is obtained; otherwise, the parameters are adjusted until the output result error is less than the error threshold;

[0112] S32, inputting the cable oil film image set after the feature extraction into the support vector machine classifier, outputting the recognition result, when the cable oil film is missing, the cable oil film uniformity is unqualified; when the cable oil film is not missing, obtaining the cable oil film non-missing image, forming the cable oil film non-missing image set;

[0113] S4, based on the cable measurement diameter detection method, calculating the cable measurement diameter of the cable oil film defect-free image in the cable oil film defect-free image set, and then calculating the diameter deviation rate, and completing the cable oil film uniformity detection according to the diameter deviation rate result;

[0114] The S4 comprises the following steps:

[0115] S41, quantizing the cable oil film defect-free images in the cable oil film defect-free image set to obtain a cable oil film defect-free image matrix as follows:

[0116] ;

[0117] in, Indicates the i-th horizontal and j-th vertical pixel on the cable oil film defect-free image;

[0118] According to the cable oil film defect-free image matrix, a cable measurement diameter detection method is used to perform diameter detection on the cable oil film defect-free image to obtain the cable measurement diameter. The specific steps are as follows:

[0119] S411, setting the coordinate value of any pixel point selected from the cable oil film defect-free image matrix , the gray value of the pixel is , the cable oil film defect-free image matrix is ​​scanned from left to right; when and At this time, the pixel is the upper boundary point of the cable oil film defect-free image, and Add to the first matrix, Add to the second matrix; when and At this time, the pixel is the lower boundary point of the cable oil film defect-free image, and Joined in the third matrix;

[0120] S412, pixel point The product of the horizontal and vertical coordinates is recorded as , the total number of pixels in the cable oil film defect-free image matrix is ,when When , the third matrix is ​​subtracted from the first matrix to obtain the fourth matrix; at this time, it is determined whether the cable oil film defect-free image matrix has multiple boundary points. When there are , then there are multiple boundary points in the second matrix, and the data of multiple boundary points are superimposed and added to the fourth matrix;

[0121] S413, compare other pixel points in the cable oil film defect-free image matrix, and when the horizontal and vertical coordinate products of other pixel points are greater than the number of pixel points in the second matrix, add the corresponding pixel points to the fourth matrix; until all pixel points in the cable oil film defect-free image matrix are detected, the fourth matrix is ​​obtained, and the data of the kth column in the fourth matrix is ​​set to , the number of columns in the fourth matrix is ​​l, then the cable measurement diameter H is calculated as follows:

[0122] ;

[0123] S42, set the cable theoretical diameter to p, diameter deviation rate The calculation formula is as follows:

[0124] ;

[0125] Set the deviation threshold to When the diameter deviation rate is less than the deviation threshold, the oil film uniformity of the cable oil film defect-free image corresponding to the cable oil film defect-free image matrix is ​​qualified, that is, the cable oil film uniformity is qualified; otherwise, the cable oil film uniformity is unqualified, and the cable oil film uniformity detection is completed.

[0126] Example 2

[0127] This embodiment also discloses a system for a cable oil film uniformity detection method based on machine vision, which specifically includes: an initial cable oil film image preprocessing module, a cable oil film missing marking and feature extraction module, a support vector machine classifier recognition module and a cable oil film uniformity detection module;

[0128] The initial cable oil film image preprocessing module is used to perform noise reduction processing, image positioning processing and image segmentation processing on the initial cable oil film image;

[0129] The cable oil film missing marking and feature extraction module is used to perform cable oil film missing marking and cable oil film missing feature extraction on the processed cable oil film image;

[0130] The support vector machine classifier identification module is used to use a support vector machine classifier to identify whether the cable oil film is missing;

[0131] The cable oil film uniformity detection module is used to calculate the cable measurement diameter and perform diameter deviation analysis to achieve cable oil film uniformity detection.

[0132] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0133] The preferred embodiments of the invention disclosed above are only used to help explain the invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the invention, so that those skilled in the art can understand and use the invention well.

Claims

1. A cable oil film uniformity detection method based on machine vision, characterized in that: The steps include: S1, acquiring a cable oil film surface image to obtain an initial cable oil film image set, performing noise reduction processing, image positioning processing and image segmentation processing on the initial cable oil film image in the initial cable oil film image set, segmenting the cable oil film area, and obtaining a processed cable oil film image set; S2, marking the processed cable oil film images in the processed cable oil film image set as being missing cables, and extracting features of missing cables, to obtain a set of cable oil film images after feature extraction; The S2 comprises the following steps: S21, generating a processed cable oil film image matrix according to the processed cable oil film images in the processed cable oil film image set; marking the processed cable oil film images for missingness according to the processed cable oil film image matrix to obtain a set of cable oil film images with missingness marks; S22, extracting cable oil film geometric features and texture features as cable oil film missing features according to the cable oil film images with missing marks in the cable oil film image set with missing marks, and obtaining a cable oil film image set after feature extraction; The step of marking the cable oil film missing on the processed cable oil film image according to the processed cable oil film image matrix comprises the following steps: Select missing marked pixel points in the processed cable oil film image matrix, calculate the gradient threshold of the missing marked pixel points and the gradient value in the row and column direction; obtain the missing marked queue by comparing the gradient threshold of the missing marked pixel points and the gradient value in the row and column direction, and form a local cable oil film image matrix according to the row and column numbers of the pixels in the missing marked queue; output the row and column numbers of the pixels corresponding to the missing area according to the local cable oil film image matrix, realize the cable oil film missing marking, obtain the cable oil film image with the missing mark, and form a cable oil film image set with the missing mark; S3, training a support vector machine to obtain a support vector machine classifier, inputting the cable oil film image set after the feature extraction into the support vector machine classifier, and obtaining a cable oil film non-missing image set by identifying whether the cable oil film is missing; The S3 comprises the following steps: S31, acquiring new cable oil film images to form a new cable oil film image set, preprocessing the new cable oil film image set to extract cable oil film missing features, obtaining a cable oil film image sample set after feature extraction, and dividing the cable oil film image sample set after feature extraction into a sample training set and a sample test set; setting the kernel function of the support vector machine to F, inputting the sample training set into the support vector machine, iterating continuously until the support vector machine converges, and obtaining a trained support vector machine; then inputting the sample test set into the trained support vector machine, setting the error threshold to , when the output result error is less than the error threshold, the support vector machine classifier is obtained; otherwise, the parameters are adjusted until the output result error is less than the error threshold; S32, inputting the cable oil film image set after the feature extraction into the support vector machine classifier, outputting the recognition result, when the cable oil film is missing, the cable oil film uniformity is unqualified; When the cable oil film is not missing, a cable oil film missing image is obtained to form a cable oil film missing image set; S4. Based on the cable measurement diameter detection method, the cable measurement diameter of the cable oil film defect-free image in the cable oil film defect-free image set is calculated, and then the diameter deviation rate is calculated, and the cable oil film uniformity detection is completed according to the diameter deviation rate result.

2. The cable oil film uniformity detection method based on machine vision according to claim 1 is characterized in that: The S1 comprises the following steps: S11, using an image acquisition device to acquire cable oil film surface images to obtain initial cable oil film images, forming an initial cable oil film image set, and generating an initial cable oil film image matrix; performing adaptive median filtering on the initial cable oil film images in the initial cable oil film image set according to the initial cable oil film image matrix to obtain a filtered cable oil film image set and a filtered cable oil film image matrix; S12, performing image positioning processing on the filtered cable oil film images in the filtered cable oil film image set according to the filtered cable oil film image matrix to obtain a positioned cable oil film image set; S13, using an improved K-means algorithm to perform image segmentation processing on the located cable oil film images in the located cable oil film image set to obtain a processed cable oil film image set.

3. The cable oil film uniformity detection method based on machine vision according to claim 2 is characterized in that: The step of performing adaptive median filtering on the initial cable oil film images in the initial cable oil film image set according to the initial cable oil film image matrix comprises the following steps: A neighborhood window is selected on the initial cable oil film image matrix, and the noise pixel point is found by judging the relationship between the grayscale value of any pixel point in the neighborhood window and the minimum and maximum grayscale values ​​of the pixel points in the neighborhood window. The grayscale value of the noise pixel point is replaced by the mean grayscale value of the pixel points in the neighborhood window until all the pixels in the initial cable oil film image matrix are judged, thereby obtaining a filtered cable oil film image set and a filtered cable oil film image matrix.

4. The cable oil film uniformity detection method based on machine vision according to claim 3 is characterized in that: The S13 comprises the following steps: S131, generating a located cable oil film image matrix according to the located cable oil film image, setting the initial segmentation threshold to , dividing the pixels in the located cable oil film image matrix into a first pixel set and a second pixel set, and updating the initial segmentation threshold by calculating the average value of the pixels in the first pixel set and the second pixel set to obtain a final segmentation threshold; S132. Use the final segmentation threshold to segment the located cable oil film image into a foreground image and a background image, select K pixels in the foreground image and the background image as initial clustering centers, calculate the Euclidean distance between the initial clustering centers and other pixels, perform clustering processing on the located cable oil film image, complete the segmentation of the cable oil film area in the located cable oil film image, obtain processed cable oil film images, and form a set of processed cable oil film images.

5. The cable oil film uniformity detection method based on machine vision according to claim 4 is characterized in that: The S4 comprises the following steps: S41, obtaining a cable oil film defect-free image matrix according to the cable oil film defect-free image in the cable oil film defect-free image set; and performing diameter detection on the cable oil film defect-free image using a cable measurement diameter detection method according to the cable oil film defect-free image matrix to obtain a cable measurement diameter. H ; S42, set the cable theoretical diameter to p , diameter deviation rate The calculation formula is as follows: ; Set the deviation threshold to When the diameter deviation rate is less than the deviation threshold, the oil film uniformity of the cable oil film defect-free image corresponding to the cable oil film defect-free image matrix is ​​qualified, that is, the cable oil film uniformity is qualified; otherwise, the cable oil film uniformity is unqualified, and the cable oil film uniformity detection is completed.

6. A system for implementing the cable oil film uniformity detection method based on machine vision as described in any one of claims 1 to 5, characterized in that: Specifically include: Initial cable oil film image preprocessing module, cable oil film missing marking and feature extraction module, support vector machine classifier recognition module and cable oil film uniformity detection module; The initial cable oil film image preprocessing module is used to perform noise reduction processing, image positioning processing and image segmentation processing on the initial cable oil film image; The cable oil film missing marking and feature extraction module is used to perform cable oil film missing marking and cable oil film missing feature extraction on the processed cable oil film image; The support vector machine classifier identification module is used to use a support vector machine classifier to identify whether the cable oil film is missing; The cable oil film uniformity detection module is used to calculate the cable measurement diameter and perform diameter deviation analysis to achieve cable oil film uniformity detection.

Citation Information

Patent Citations

  • Polyester filament yarn uniformity online detection system based on dynamic convolutional neural network

    CN112651928A

  • A method for detecting and classifying pixel defects in inkjet printing of a printed display panel and a device thereof

    CN108986086A