CN114494256A - Electric wire production defect detection method based on image processing - Google Patents
Electric wire production defect detection method based on image processing Download PDFInfo
- Publication number
- CN114494256A CN114494256A CN202210391674.3A CN202210391674A CN114494256A CN 114494256 A CN114494256 A CN 114494256A CN 202210391674 A CN202210391674 A CN 202210391674A CN 114494256 A CN114494256 A CN 114494256A
- Authority
- CN
- China
- Prior art keywords
- image
- gray
- pixel points
- gray level
- equalization
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 230000007547 defect Effects 0.000 title claims abstract description 40
- 238000004519 manufacturing process Methods 0.000 title claims abstract description 25
- 238000012545 processing Methods 0.000 title claims abstract description 20
- 238000001514 detection method Methods 0.000 title claims abstract description 14
- 230000000694 effects Effects 0.000 claims abstract description 43
- 238000000034 method Methods 0.000 claims abstract description 24
- 238000003709 image segmentation Methods 0.000 claims abstract description 5
- 239000006185 dispersion Substances 0.000 claims description 8
- 241001270131 Agaricus moelleri Species 0.000 claims description 3
- 238000012935 Averaging Methods 0.000 claims 1
- 230000008569 process Effects 0.000 description 6
- 230000011218 segmentation Effects 0.000 description 3
- 230000002950 deficient Effects 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 208000003464 asthenopia Diseases 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 239000002245 particle Substances 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
- G06T5/92—Dynamic range modification of images or parts thereof based on global image properties
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Quality & Reliability (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
- Image Processing (AREA)
Abstract
The invention relates to the technical field of image processing, in particular to a wire production defect detection method based on image processing. The method comprises the following steps: acquiring pixel point equalization necessity through the gray level projection degree and the pixel point projection degree in the first gray level image, and selecting the pixel points in the first gray level image for continuous equalization according to the pixel point equalization necessity to acquire an equalized image; selecting the balance effect of the pixel points in the balance image with the maximum balance effect, and carrying out balance again on the pixel points which do not meet the balance requirement to obtain a final balance image; and carrying out image segmentation according to the final balanced image to obtain a wire defect area. According to the invention, by equalizing part of the pixel points in the first gray-scale image, the contrast of the gray-scale image containing the electric wire is improved, the accuracy of detecting the defects on the surface of the electric wire is improved, and the difficulty of detection is also reduced; and meanwhile, a final balanced image with the best balanced effect is obtained, and the detection accuracy is further improved.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a wire production defect detection method based on image processing.
Background
In life, the use of electric wires is increasing, so the production scale of electric wires is increasing, but some defects may be generated in the production process of electric wires, for example, the situation that a wire body is wrapped or cracks in a produced electric wire plastic shell, if the defects generated in the production process of the electric wires are not detected in time and are removed in time, great influence can be caused on the subsequent use of the electric wires, and even certain danger can be caused.
Most of the conventional detection methods are manual detection, but defects of the commonly produced electric wires are subjectively influenced by human observation and detection, and are easy to cause visual fatigue. Therefore, with the development of machine vision, the method for detecting the image by using the image acquisition equipment to acquire the image of the electric wire gradually becomes a mainstream detection method; however, in the process of collecting and transmitting the image, the image may be affected by noise, image compression and the like, and finally, when the image is observed by a machine, the contrast of the image is not clear enough, and the image needs to be enhanced, while the conventional histogram equalization stretches or merges the global pixels, which may cause the situation of over-equalization or under-equalization of the image, and cause the result of detecting the electric wire to be inaccurate.
Disclosure of Invention
In order to solve the above technical problems, an object of the present invention is to provide a method for detecting defects in electrical wire production based on image processing, which adopts the following technical solutions:
one embodiment of the invention provides an electric wire production defect detection method based on image processing, which comprises the following steps: obtaining a gray level image only containing the electric wire and a gray level histogram thereof, wherein the average value of the absolute value of the difference between the number of the pixel points of each gray level and the number of all the pixel points which are uniformly distributed to each gray level is the unbalance degree of the gray level histogram; the range of the gray level in the gray level map is the discrete degree of the gray level map; acquiring a gray level image needing equalization based on the image equalization necessity acquired by the unbalance degree and the dispersion degree, and recording the gray level image as a first gray level image;
the mean value of the absolute values of the slopes of the vertex corresponding to each gray level in the gray level histogram of the first gray level image and the vertexes of the left and right adjacent gray levels is the protrusion degree of the gray levels; selecting pixel points with the frequency greater than a preset threshold value, and calculating the mean value of the gray value difference values of the pixel points in the neighborhood of the selected pixel points as the protrusion degree of the selected pixel points; selecting pixel points in the first gray level image for continuous equalization by utilizing the pixel point equalization necessity obtained by the protrusion degree of the pixel points and the protrusion degree of the gray level corresponding to the pixel points, and obtaining a plurality of equalized images;
taking the balance necessity of the pixel points in the first gray scale image as the weight of the pixel points in the heat image to obtain a balance demand heat image; acquiring the balance effect of the balance images based on the projection degree of the pixel points with the frequency greater than the preset threshold value in each balance image in the first gray-scale image and the weight of the pixel points in the balance demand heat map; selecting a balanced image with the largest balanced effect to obtain the balanced effect of the pixel points, and carrying out balancing again on the pixel points which do not meet the balanced requirement based on the balanced effect to obtain a final balanced image; and performing image segmentation according to the final balanced image to obtain a wire defect area.
Preferably, the number of all the pixel points divided into the gray levels includes: and the ratio of the number of the pixel points in the gray-scale image only containing the electric wire to all the gray levels is the number of all the pixel points which are divided into all the gray levels.
Preferably, the image equalization necessity includes: the unbalance degree of the gray level histogram and the image balance necessity form a positive correlation; the degree of gray scale dispersion is inversely related to the image equalization necessity.
Preferably, the obtaining of the gray scale map requiring equalization based on the image equalization necessity obtained from the imbalance degree and the dispersion degree includes: and setting an equalization threshold value, wherein the gray-scale map only containing the electric wires and having the image equalization necessity greater than the equalization threshold value is the gray-scale map needing equalization.
Preferably, the protruding degree of the gray scale, which is an average of absolute values of slopes of a vertex corresponding to each gray scale and vertices of left and right adjacent gray scales in the gray histogram of the first gray scale map, includes: and obtaining the coordinates of the vertex corresponding to each gray level in the first gray level image, and obtaining the slope of the gray level and the gray level adjacent to the left and right according to the coordinates of the vertex corresponding to the gray level and the vertex corresponding to the gray level adjacent to the left and right.
Preferably, the necessity of balancing the pixels includes: the projecting degree of the pixel points and the projecting degree of the gray level and the necessity of pixel point balance form positive correlation.
Preferably, the selecting the pixel points in the first gray scale image to perform equalization continuously, and obtaining a plurality of equalized images includes: setting a pixel point balance threshold value, and selecting pixel points of which necessary rows of pixel points in the first gray-scale image are more than the pixel point balance threshold value for balancing; and setting the equalization times, carrying out equalization based on the first gray-scale image to obtain an equalized image, and carrying out equalization based on the equalized image obtained last time when carrying out equalization again, wherein the number of the equalized images is the same as the equalization times.
Preferably, the obtaining the balance requirement heat map by using the balance necessity of the pixel points in the first gray scale map as the weight of the pixel points in the heat map includes: and normalizing the balance necessity of each pixel point in the first gray-scale image to be used as the weight of each pixel point in the balance demand heat image.
Preferably, the equalization effect of the equalization image is:
wherein,representing an equalizing effect of equalizing the image;representing the weight of a corresponding pixel point of the a-th pixel point with the frequency greater than a preset threshold in the first gray-scale image in the equilibrium demand heat map;representing the protruding degree of the a-th pixel point with the frequency greater than a preset threshold value in the first gray-scale image in the balanced image; e represents a natural logarithm, and c represents the number of pixel points with the frequency larger than a preset threshold value in the balanced image.
The embodiment of the invention at least has the following beneficial effects: the method comprises the steps of obtaining a gray-scale image only containing electric wires, analyzing the gray-scale image and obtaining a first gray-scale image needing equalization; acquiring pixel point equalization necessity according to the degree of the gray level and the degree of the pixel point in the first gray level image, and selecting the pixel point in the first gray level image for equalization to acquire an equalized image; evaluating the balance effect of the balance image and the balance effect of the pixel points in the balance image, selecting the balance image with the best balance effect, and then carrying out balance again on the pixel points which do not meet the balance requirement according to the balance effect of the image pixel points to obtain the final balance image; and carrying out image segmentation according to the final balanced image to obtain a wire defect area. The embodiment of the invention equalizes the pixel points which can highlight the wire defects in the image, so that the contrast of the gray level image containing the wires is further improved, the defective area and the normal area of the wire image with the defects can be obviously separated, the accuracy rate of detecting the surface defects of the wires is improved, and the detection difficulty is also reduced; meanwhile, in the equalization process, the equalization effect is evaluated, further processing is carried out according to the equalization effect, so that the final image equalization effect is better, and the detection accuracy is further improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flow chart of a method for detecting defects in wire production based on image processing.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the method for detecting defects in electrical wire production based on image processing according to the present invention with reference to the accompanying drawings and preferred embodiments shows the following detailed descriptions. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following describes a specific scheme of the method for detecting the defects in the production of the electric wire based on image processing in detail with reference to the accompanying drawings.
Example 1
The main application scenarios of the invention are as follows: in the production process of the electric wire, defects such as particles, bulges or scratches may occur on the plastic shell, and the defective electric wire indicates that the production is not qualified, so that the surface image of the electric wire needs to be obtained by combining a computer and an image processing technology to detect the production defects of the electric wire.
Referring to fig. 1, a flowchart of a method for detecting defects in electrical wire production based on image processing according to an embodiment of the present invention is shown, where the method includes the following steps:
the method comprises the following steps: obtaining a gray level image only containing the electric wire and a gray level histogram thereof, wherein the average value of the absolute value of the difference between the number of the pixel points of each gray level and the number of all the pixel points which are uniformly distributed to each gray level is the unbalance degree of the gray level histogram; the range of the gray level in the gray level map is the discrete degree of the gray level map; a gray scale map requiring equalization is obtained based on the necessity of image equalization obtained from the degree of imbalance and the degree of dispersion, and is referred to as a first gray scale map.
Firstly, a collecting device is placed on a production line of the electric wire packaging plastic layer to collect images of the electric wire in the production process. Because there are interferences of noise, light and the like in the image acquisition process, the acquired image needs to be subjected to gaussian filtering and noise reduction. Obtaining the electric wire images of various colors on a white background, converting the images into gray images, carrying out threshold segmentation on the images, selecting a pixel point set with the gray value lower than 255, marking the point values of all areas with the gray values different from the white background area as 1, marking the point values of the white background area as 0, and obtaining a binary image. The binary image is multiplied by the original image to obtain an image including only the electric wire, and the image including only the electric wire is grayed to obtain a grayscale image.
Furthermore, in the natural environment, the illumination is continuously and gradually changed, so for a pure-color wire, the gray value of the wire should also be continuously and gradually changed. The abnormal defect is often expressed as a difference in gradation value and a statistic gradation value. The enhancement principle of histogram equalization is to make the gray distribution in the image area more balanced, and for the unbalanced pixel points, the change degree is often larger. In this embodiment, first, the enhancement requirement corresponding to the gray level is obtained from the gray level of the gray level histogram of the gray level image, and whether the gray level image only including the electric wire needs to be equalized is determined.
Obtaining a gray level histogram only containing electric wires, wherein the x axis represents the gray level of 0-255, and the y axis represents the number of pixel points corresponding to the gray level m in a gray level graph; the gray level histogram of an image with a high contrast ratio is relatively uniform in distribution of gray levels, and frequency distribution of pixel points is also relatively uniform, but for a gray level image only including wires, the frequency and gray level distribution of the pixel points may not be uniform, so that whether the image needs to be equalized or not needs to be judged according to the gray levels in the gray level histogram. Obtaining the unbalance degree of the gray histogram of the gray map:
wherein, S represents the unbalance degree of the gray histogram of the gray map;expressing the number of pixel points with m gray levels in the gray level image; m is the total number of pixel points in the gray-scale image; 256 denotes the number of all gray levels, i.e. 0-255; n represents the number of gray levels in the gray scale map;representing the equal division of all pixel points in the gray-scale imageTo the number of pixel points of each of the 256 gray levels. The larger the S, the larger the gradation histogram imbalance degree is, the smoother the gradation histogram imbalance degree is, and the greater the necessity of histogram equalization in the gradation map is.
Meanwhile, the degree of dispersion of the gray levels in the gray map is obtained:
wherein, Representing the maximum gray level in the gray scale map,representing the smallest gray level in the gray scale map; if the gray scale distribution of the gray scale map containing only wires is denser, i.e.The smaller the value of (2), the greater the necessity of equalizing the gray level map, and the more uniform the number of pixels distributed in each gray level of 256 gray levels from 0 to 255.
Finally, the image equalization necessity to obtain a gray map containing only wires:
wherein C represents the image equalization necessity of the grayscale, and determines whether the grayscale needs to be equalized or not according to the image equalization necessity, and sets an equalization threshold, preferably, the equalization threshold is 0.3 in this embodiment, and if the image equalization necessity of the grayscale is greater than the equalization threshold, the grayscale is equalized; up to this point, a gray scale map requiring equalization is obtained according to the image equalization necessity and the equalization threshold value of the gray scale map, and is referred to as a first gray scale map.
Step two: the mean value of the absolute values of the slopes of the vertex corresponding to each gray level in the gray level histogram of the first gray level image and the vertexes of the left and right adjacent gray levels is the protrusion degree of the gray levels; selecting pixel points with the frequency greater than a preset threshold value, and calculating the mean value of the gray value difference values of the pixel points in the neighborhood of the selected pixel points as the protrusion degree of the selected pixel points; and selecting the pixel points in the first gray level image for continuous equalization by utilizing the pixel point equalization necessity obtained by the protrusion degree of the pixel points and the protrusion degree of the gray level corresponding to the pixel points, so as to obtain a plurality of equalized images.
Firstly, under an ideal equilibrium condition, the frequency of each gray level in a gray level histogram of a first gray level image should be equal, that is, the number of pixel points corresponding to each gray level should be equal, and the pixel points are equally divided into each gray level; in the actual first gray scale map, the frequency of each gray scale is different from the frequency of the gray scale under ideal conditions, and the difference degree is different, so the necessity and degree of equalization for different gray scales are different.
Obtaining the coordinates of the vertex corresponding to each gray level in the gray level histogram of the first gray level image, namely the number of pixel points with the abscissa as the gray level and the ordinate as the gray level; obtaining the slope between the two gray levels according to the coordinates of the vertex corresponding to the gray level and the adjacent gray level on the leftMeanwhile, the slope between the gray level and the vertex corresponding to the adjacent gray level on the right side is obtained according to the coordinates of the gray level and the vertex corresponding to the adjacent gray level on the right sideWhereinandthe calculation formula of (2) is as follows:
wherein,representing the slope between the gray level in the middle and the adjacent gray level to the left,expressing the number of pixel points corresponding to the adjacent left gray level, and N expressing the adjacent left gray level;representing the slope between the gray level in the middle and the gray level to the adjacent right,expressing the number of pixel points corresponding to the adjacent right gray level, and expressing the adjacent right gray level by O;the number of pixels corresponding to the intermediate gray level is represented, and M represents the intermediate gray level.
The degree of protrusion of each gray level is:
the larger the slope between the intermediate gray level and the gray levels adjacent to the intermediate gray level, that is, the larger the degree of protrusion corresponding to the intermediate gray level, the larger the difference between the intermediate gray level and the gray levels adjacent to the intermediate gray level, and the greater the necessity for equalization.
Further, the difference between each pixel point and the pixel points of its neighboring neighborhood needs to be considered, if the pixel points are different from the pixel points of its neighboring neighborhood, the pixel points need to be equalized, and in selecting a pixel point, a pixel point with a higher frequency needs to be selected, because the pixel points with a lower frequency, that is, the pixel points with a smaller number have a large distribution probability that the difference between the pixel points with a relatively discrete number and the pixel points of the neighboring neighborhood is large enough, the equalization is not necessary, a preset threshold value is preferably set, the preset threshold value is 0.03 in this embodiment, and the salient degree of the pixel points with the selection frequency greater than 0.03 is calculated. Setting the size of the neighborhood, preferably, the size of the neighborhood in this embodiment is 8 neighborhoods, and obtaining the degree of protrusion of the pixel points according to the gray value difference between the pixel points with the frequency greater than 0.03 and the pixel points in the 8 neighborhoods:
wherein D represents the outstanding degree of the pixel point with the frequency greater than 0.03;representing the gray value of the pixel point with the frequency greater than 0.03;and representing the gray value of the ith pixel point in the 8-neighborhood of the pixel point with the frequency greater than 0.03. Calculating the difference between the gray values of the pixel points with the frequency greater than 0.03 and the pixel points in the neighborhood, and when the difference between the gray values of the pixel points with the frequency greater than 0.03 and the pixel points in the neighborhood indicates that the pixel points are definitely required to be equalized, the larger the difference is, the larger the equalization degree is, because the difference is not found between the pixel points in the first gray map if the edge of the electric wire is not considered, and the probability that the pixel points with the difference are the edge points of the defect area or the points in the defect area is very high, so the pixel points with the difference need to be equalized.
And finally, acquiring the pixel point balance necessity of the pixel point with the frequency greater than 0.03 in the first gray-scale image:
wherein,expressing the necessity of pixel point balance of the a-th pixel point in the pixel points with the frequency greater than 0.03 in the first gray scale image;representing the outstanding degree of the a-th pixel point in the pixel points with the frequency greater than 0.03;expressing the protruding degree of the gray level corresponding to the a-th pixel point in the pixel point with the frequency greater than 0.03; e denotes the natural logarithm.
Setting a pixel point equalization threshold, preferably, the value of the pixel point equalization threshold in this embodiment is 0.5, so that the necessity of selecting pixel point equalization among the pixel points with the frequency greater than 0.03 in the first gray-scale image is metPixels larger than the pixel point equalization threshold of 0.5 are equalized, the image after one equalization does not necessarily meet the requirement, and the equalization effect does not necessarily meet the requirement, so continuous equalization is performed to obtain an image with the best equalization effect.
Step three: taking the balance necessity of the pixel points in the first gray scale image as the weight of the pixel points in the heat image to obtain a balance demand heat image; acquiring the balance effect of the balance images based on the projection degree of the pixel points with the frequency greater than the preset threshold value in each balance image in the first gray-scale image and the weight of the pixel points in the balance demand heat map; selecting a balanced image with the largest balanced effect to obtain the balanced effect of the pixel points, and carrying out balancing again on the pixel points which do not meet the balanced requirement based on the balanced effect to obtain a final balanced image; and carrying out image segmentation according to the final balanced image to obtain a wire defect area.
Firstly, the 5 balanced images obtained in the second step need to be screened according to the balance requirement and the balanced effect, the balanced images with the best effect are obtained to be subsequently processed, and the purpose of detecting the defects of the outer skin in the production process of the electric wire is achieved.
Obtaining a balance demand heat map according to the balance necessity of the pixel points with the frequency greater than 0.03 in the first gray map, wherein the balance necessity of the pixel points in the first gray map is the weight of the pixel points in the balance demand heat mapWhen the balance necessity of the pixel points in the first gray-scale image is converted into the pixel points in the balance demand heat map, the balance necessity needs to be normalized, and the higher the weight value is, the higher the demand on the balance is.
Calculating the outstanding degree of pixel points with the frequency greater than 0.03 in the first gray level image in the equalized imageAnd obtaining the equalization effect of the equalized image:
wherein,representing an equalizing effect of equalizing the image;representing the weight of a corresponding pixel point of the a-th pixel point with the frequency greater than a preset threshold in the first gray-scale image in the equilibrium demand heat map;representing the protruding degree of the a-th pixel point with the frequency greater than a preset threshold value in the first gray-scale image in the balanced image; e represents the natural logarithm, and c represents the number of pixel points with the frequency greater than a preset threshold value in the balanced image.
When the value of QP is larger, it is indicated that the equalization effect of the pixel is more obvious, and the difference between the pixel and the surrounding pixels is increased. Otherwise, the difference between the pixel and the adjacent pixel is not increased, the equalization effect is not ideal, and the equalization requirement is not met, and the optimal equalization image is selected from the equalization images obtained by 5 times of equalization, namely the equalization effect is selectedThe largest equalized image.
Further, after the balanced image with the maximum balanced effect is obtained, the overall balanced effect of the image is good and the balanced requirement is met, but part of pixel points in the image can be combined or inhibited after multiple times of balancing. However, at this time, most of the pixels in the whole image are equalized again, so that some pixels are over-equalized, and some pixels which are combined or suppressed after being equalized for many times need to be separately found out and then processed, so that an equalization effect is obtainedThe equalization effect of pixel points with frequency greater than 0.03 in the first gray scale image in the largest equalization image:
Wherein,for equalizing effectsThe maximum balancing effect for balancing the pixel points in the image is achieved;for equalizing effectsThe maximum outstanding degree of the pixel points in the balanced image is obtained;and representing the weight of the corresponding pixel point of the a-th pixel point with the frequency greater than the preset threshold value in the equilibrium demand heat map in the first gray scale map, wherein e is a natural logarithm.
When the equalization effect of the pixel points in the equalized image with the largest equalization effect is larger than 0 and smaller than 0.3, the part of the pixel points is considered to be merged or suppressed in the equalization process, the part of the pixel points needs to be equalized again, and the final equalized image is obtained after the part of the pixel points are equalized again.
Finally, contrast enhancement in the image is balanced finally, the contrast of a defect-free area and a defect area is enhanced, and surface defects are more obvious in the production process of the electric wire.
And (3) extracting a defect area in the final equilibrium image by using a semantic segmentation mode: performing semantic segmentation by using a DNN (digital hierarchy network), wherein a data set used by DNN training is a final equilibrium image data set; the pixel points to be segmented are divided into two types, namely, the label labeling process corresponding to the training data set is as follows: corresponding semantics are divided into single channels, the pixel point of a defect-free area in the final balanced image is marked as 0, and the pixel point of the defect area is marked as 1; the task of the network is classification, and the loss function is a cross-entropy loss function.
And calculating the final equilibrium image by taking the image as a mask and taking the image as the mask to obtain a binary image of the defect area, thereby obtaining the area with the defects on the surface of the wire, namely the wire defect area.
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. And that specific embodiments have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (9)
1. An electric wire production defect detection method based on image processing is characterized by comprising the following steps: obtaining a gray level image only containing the electric wire and a gray level histogram thereof, wherein the average value of the absolute value of the difference between the number of pixel points of each gray level and the number of all the pixel points which are evenly distributed to each gray level is the unbalance degree of the gray level histogram; the range of the gray level in the gray level map is the discrete degree of the gray level map; acquiring a gray level image needing equalization based on the image equalization necessity acquired by the unbalance degree and the dispersion degree, and recording the gray level image as a first gray level image;
the mean value of the absolute values of the slopes of the vertexes corresponding to each gray level and the vertexes of the left and right adjacent gray levels in the gray level histogram of the first gray level graph is the protrusion degree of the gray levels; selecting pixel points with the frequency greater than a preset threshold value, and calculating the mean value of the gray value difference values of the pixel points in the neighborhood of the selected pixel points as the protrusion degree of the selected pixel points; selecting pixel points in the first gray level image for continuous equalization by utilizing the pixel point equalization necessity obtained by the protrusion degree of the pixel points and the protrusion degree of the gray level corresponding to the pixel points, and obtaining a plurality of equalized images;
taking the balance necessity of the pixels in the first gray scale image as the weight of the pixels in the heat image to obtain a balance requirement heat image; acquiring the balance effect of the balance images based on the projection degree of the pixel points with the frequency greater than the preset threshold value in each balance image in the first gray-scale image and the weight of the pixel points in the balance demand heat map; selecting a balanced image with the largest balanced effect to obtain the balanced effect of the pixel points, and carrying out balancing again on the pixel points which do not meet the balanced requirement based on the balanced effect to obtain a final balanced image; and carrying out image segmentation according to the final balanced image to obtain a wire defect area.
2. The method of claim 1, wherein the step of averaging all the pixels to the number of gray levels comprises: and the ratio of the number of the pixel points in the gray-scale image only containing the electric wire to all the gray levels is the number of all the pixel points which are divided into all the gray levels.
3. The method of claim 1, wherein the image equalization necessity comprises: the unbalance degree of the gray level histogram and the image balance necessity form a positive correlation; the degree of gray scale dispersion is inversely related to the image equalization necessity.
4. The method for detecting defects in production of electric wires based on image processing as claimed in claim 1, wherein said obtaining a gray scale map requiring equalization based on the necessity of image equalization obtained from the degree of unbalance and the degree of dispersion comprises: and setting an equalization threshold value, wherein the gray-scale map only containing the electric wires and having the image equalization necessity greater than the equalization threshold value is the gray-scale map needing equalization.
5. The method of claim 1, wherein the step of determining the degree of protrusion of gray scale as the mean of the absolute values of the slopes of the vertex corresponding to each gray scale and the vertices of the left and right adjacent gray scales in the gray histogram of the first gray scale map comprises: and obtaining the coordinates of the vertex corresponding to each gray level in the first gray level image, and obtaining the slope of the gray level and the gray level adjacent to the left and right according to the coordinates of the vertex corresponding to the gray level and the vertex corresponding to the gray level adjacent to the left and right.
6. The method of claim 1, wherein the necessity of pixel balancing comprises: the projecting degree of the pixel points, the projecting degree of the gray level and the balancing necessity of the pixel points form positive correlation.
7. The method for detecting the defect of the electric wire production based on the image processing as claimed in claim 1, wherein the selecting the pixel points in the first gray scale image to perform equalization continuously and obtaining a plurality of equalized images comprises: setting a pixel point balance threshold value, and selecting pixel points of which necessary rows of pixel points in the first gray-scale image are more than the pixel point balance threshold value for balancing; and setting the equalization times, carrying out equalization based on the first gray-scale image to obtain an equalized image, and carrying out equalization based on the equalized image obtained last time when carrying out equalization again, wherein the number of the equalized images is the same as the equalization times.
8. The method for detecting defects in electric wire production based on image processing as claimed in claim 1, wherein said obtaining the equilibrium requirement heat map by using the equilibrium necessity of the pixels in the first gray scale map as the weight of the pixels in the heat map comprises: and normalizing the balance necessity of each pixel point in the first gray-scale image to be used as the weight of each pixel point in the balance demand heat image.
9. The method for detecting the defect of the electric wire production based on the image processing as claimed in claim 1, wherein the equalization effect of the equalization image is as follows:
wherein,representing an equalizing effect of equalizing the image;representing the weight of a corresponding pixel point of the a-th pixel point with the frequency greater than a preset threshold in the first gray-scale image in the equilibrium demand heat map;representing the protruding degree of the a-th pixel point with the frequency greater than a preset threshold value in the first gray-scale image in the balanced image; e represents the natural logarithm, and c represents the number of pixel points with the frequency greater than a preset threshold value in the balanced image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210391674.3A CN114494256B (en) | 2022-04-14 | 2022-04-14 | Electric wire production defect detection method based on image processing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210391674.3A CN114494256B (en) | 2022-04-14 | 2022-04-14 | Electric wire production defect detection method based on image processing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114494256A true CN114494256A (en) | 2022-05-13 |
CN114494256B CN114494256B (en) | 2022-06-14 |
Family
ID=81489105
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210391674.3A Active CN114494256B (en) | 2022-04-14 | 2022-04-14 | Electric wire production defect detection method based on image processing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114494256B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114638827A (en) * | 2022-05-18 | 2022-06-17 | 卡松科技股份有限公司 | Visual detection method and device for impurities of lubricating oil machinery |
CN114693682A (en) * | 2022-06-01 | 2022-07-01 | 青岛大学附属医院 | Spine feature identification method based on image processing |
CN115049672A (en) * | 2022-08-17 | 2022-09-13 | 南通源钰新材料科技有限公司 | Computer vision-based method for detecting defects of phosphating film on surface of metal aluminum |
CN115294107A (en) * | 2022-09-29 | 2022-11-04 | 江苏三通科技有限公司 | Diode pin surface oxidation detection method based on image recognition |
CN116152133A (en) * | 2023-04-20 | 2023-05-23 | 山东超越纺织有限公司 | Blending defect detection method based on artificial intelligence |
WO2023126030A1 (en) * | 2022-09-28 | 2023-07-06 | 探长信息技术(苏州)有限公司 | Switch interface integrity inspection method |
CN117437238A (en) * | 2023-12-22 | 2024-01-23 | 深圳宝铭微电子有限公司 | Visual inspection method for surface defects of packaged IC |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101212611A (en) * | 2007-12-25 | 2008-07-02 | 青岛海信信芯科技有限公司 | Contrast enhancement method |
CN101706953A (en) * | 2009-11-13 | 2010-05-12 | 北京中星微电子有限公司 | Histogram equalization based image enhancement method and device |
CN102314673A (en) * | 2011-08-02 | 2012-01-11 | 中国科学院长春光学精密机械与物理研究所 | Self-adapting image enhancement method |
CN105374018A (en) * | 2015-12-18 | 2016-03-02 | 厦门大学 | Method for performing area enhancement on image |
CN105654438A (en) * | 2015-12-27 | 2016-06-08 | 西南技术物理研究所 | Gray scale image fitting enhancement method based on local histogram equalization |
CN107742301A (en) * | 2017-10-25 | 2018-02-27 | 哈尔滨理工大学 | Transmission line of electricity image processing method under complex background based on image classification |
CN107886493A (en) * | 2016-09-29 | 2018-04-06 | 成都思晗科技股份有限公司 | A kind of wire share split defect inspection method of transmission line of electricity |
CN108230321A (en) * | 2018-01-19 | 2018-06-29 | 深圳市亿图视觉自动化技术有限公司 | Defect inspection method and device |
CN112053309A (en) * | 2020-10-24 | 2020-12-08 | 北方民族大学 | Image enhancement method and image enhancement device |
CN112686120A (en) * | 2020-12-25 | 2021-04-20 | 国家电网有限公司 | Power transmission line anomaly detection method based on unmanned aerial vehicle aerial image |
-
2022
- 2022-04-14 CN CN202210391674.3A patent/CN114494256B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101212611A (en) * | 2007-12-25 | 2008-07-02 | 青岛海信信芯科技有限公司 | Contrast enhancement method |
CN101706953A (en) * | 2009-11-13 | 2010-05-12 | 北京中星微电子有限公司 | Histogram equalization based image enhancement method and device |
CN102314673A (en) * | 2011-08-02 | 2012-01-11 | 中国科学院长春光学精密机械与物理研究所 | Self-adapting image enhancement method |
CN105374018A (en) * | 2015-12-18 | 2016-03-02 | 厦门大学 | Method for performing area enhancement on image |
CN105654438A (en) * | 2015-12-27 | 2016-06-08 | 西南技术物理研究所 | Gray scale image fitting enhancement method based on local histogram equalization |
CN107886493A (en) * | 2016-09-29 | 2018-04-06 | 成都思晗科技股份有限公司 | A kind of wire share split defect inspection method of transmission line of electricity |
CN107742301A (en) * | 2017-10-25 | 2018-02-27 | 哈尔滨理工大学 | Transmission line of electricity image processing method under complex background based on image classification |
CN108230321A (en) * | 2018-01-19 | 2018-06-29 | 深圳市亿图视觉自动化技术有限公司 | Defect inspection method and device |
CN112053309A (en) * | 2020-10-24 | 2020-12-08 | 北方民族大学 | Image enhancement method and image enhancement device |
CN112686120A (en) * | 2020-12-25 | 2021-04-20 | 国家电网有限公司 | Power transmission line anomaly detection method based on unmanned aerial vehicle aerial image |
Non-Patent Citations (4)
Title |
---|
KAREL ZUIDERVELD: "Contrast Limited Adaptive Histogram Equalization", 《 GRAPHICS GEMS IV》 * |
NOR HIDAYAH SAAD 等: "Nonlinear Exposure Intensity Based Modification Histogram Equalization for Non-Uniform Illumination Image Enhancement", 《IEEE ACCESS》 * |
任洁: "彩色图像增强算法的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
邱贞光: "低照度水下堤坝裂缝图像检测算法的研究", 《中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114638827A (en) * | 2022-05-18 | 2022-06-17 | 卡松科技股份有限公司 | Visual detection method and device for impurities of lubricating oil machinery |
CN114693682A (en) * | 2022-06-01 | 2022-07-01 | 青岛大学附属医院 | Spine feature identification method based on image processing |
CN115049672A (en) * | 2022-08-17 | 2022-09-13 | 南通源钰新材料科技有限公司 | Computer vision-based method for detecting defects of phosphating film on surface of metal aluminum |
WO2023126030A1 (en) * | 2022-09-28 | 2023-07-06 | 探长信息技术(苏州)有限公司 | Switch interface integrity inspection method |
CN115294107A (en) * | 2022-09-29 | 2022-11-04 | 江苏三通科技有限公司 | Diode pin surface oxidation detection method based on image recognition |
CN116152133A (en) * | 2023-04-20 | 2023-05-23 | 山东超越纺织有限公司 | Blending defect detection method based on artificial intelligence |
CN116152133B (en) * | 2023-04-20 | 2023-07-07 | 山东超越纺织有限公司 | Blending defect detection method based on artificial intelligence |
CN117437238A (en) * | 2023-12-22 | 2024-01-23 | 深圳宝铭微电子有限公司 | Visual inspection method for surface defects of packaged IC |
CN117437238B (en) * | 2023-12-22 | 2024-03-29 | 深圳宝铭微电子有限公司 | Visual inspection method for surface defects of packaged IC |
Also Published As
Publication number | Publication date |
---|---|
CN114494256B (en) | 2022-06-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114494256B (en) | Electric wire production defect detection method based on image processing | |
CN113538433B (en) | Mechanical casting defect detection method and system based on artificial intelligence | |
CN114937055B (en) | Image self-adaptive segmentation method and system based on artificial intelligence | |
CN114972357B (en) | Roller surface defect detection method and system based on image processing | |
CN113808138B (en) | Artificial intelligence-based wire and cable surface defect detection method | |
CN115330767B (en) | Method for identifying production abnormity of corrosion foil | |
CN115619793B (en) | Power adapter appearance quality detection method based on computer vision | |
CN115147409B (en) | Mobile phone shell production quality detection method based on machine vision | |
CN114219805B (en) | Intelligent detection method for glass defects | |
CN113610862B (en) | Screen content image quality assessment method | |
CN115082451B (en) | Stainless steel soup ladle defect detection method based on image processing | |
CN115775250A (en) | Golden finger circuit board defect rapid detection system based on digital image analysis | |
CN114897896B (en) | Building wood defect detection method based on gray level transformation | |
CN116883408B (en) | Integrating instrument shell defect detection method based on artificial intelligence | |
CN117274113B (en) | Broken silicon wafer cleaning effect visual detection method based on image enhancement | |
CN105869135A (en) | Tire defect detection method and device | |
CN115330645A (en) | Welding image enhancement method | |
CN115272303B (en) | Textile fabric defect degree evaluation method, device and system based on Gaussian blur | |
CN117197140A (en) | Irregular metal buckle forming detection method based on machine vision | |
CN114550167B (en) | Artificial intelligence based pear quality classification method and device | |
CN115222735B (en) | Metal mold quality detection method based on pockmark defects | |
CN115131359A (en) | Method for detecting pitting defects on surface of metal workpiece | |
CN117058147A (en) | Environment-friendly plastic product defect detection method based on computer vision | |
CN115880280A (en) | Detection method for quality of steel structure weld joint | |
CN113673396B (en) | Spore germination rate calculation method, device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |