CN114494256B - Electric wire production defect detection method based on image processing - Google Patents

Electric wire production defect detection method based on image processing Download PDF

Info

Publication number
CN114494256B
CN114494256B CN202210391674.3A CN202210391674A CN114494256B CN 114494256 B CN114494256 B CN 114494256B CN 202210391674 A CN202210391674 A CN 202210391674A CN 114494256 B CN114494256 B CN 114494256B
Authority
CN
China
Prior art keywords
image
gray
equalization
gray level
pixel points
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.)
Active
Application number
CN202210391674.3A
Other languages
Chinese (zh)
Other versions
CN114494256A (en
Inventor
任康龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Jinlong Wire And Cable Co ltd
Original Assignee
Wuhan Jinlong Wire And Cable Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuhan Jinlong Wire And Cable Co ltd filed Critical Wuhan Jinlong Wire And Cable Co ltd
Priority to CN202210391674.3A priority Critical patent/CN114494256B/en
Publication of CN114494256A publication Critical patent/CN114494256A/en
Application granted granted Critical
Publication of CN114494256B publication Critical patent/CN114494256B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/92Dynamic range modification of images or parts thereof based on global image properties
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30168Image 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 the pixel point equalization necessity through the gray level projection degree and the pixel point projection degree in the first gray image, and selecting the pixel point in the first gray 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 balancing the pixel points which do not meet the balance requirement again to obtain a final balance image; and performing 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

Electric wire production defect detection method based on image processing
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 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 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.
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 gray scale, which is 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 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 coordinates of the vertex corresponding to the gray level adjacent to the left and right.
Preferably, the necessity of pixel point balancing 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 equalized image is:
Figure DEST_PATH_IMAGE001
wherein the content of the first and second substances,
Figure 600720DEST_PATH_IMAGE002
representing an equalizing effect of equalizing the image;
Figure 783439DEST_PATH_IMAGE003
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;
Figure 828756DEST_PATH_IMAGE004
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.
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 embodiments or the description of 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 will be given to a 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. In the following description, the different references to "one embodiment" or "another embodiment" do not necessarily refer to 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 defect in the wire production based on the 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 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 is noise and interference of light in the image acquisition process, the acquired image needs to be subjected to gaussian filtering and noise reduction processing. 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 the distribution of gray levels, and the frequency distribution of pixel points is also relatively uniform, but for a gray level image only including wires, the frequency and the distribution of gray levels 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:
Figure 223965DEST_PATH_IMAGE005
Wherein, S represents the gray histogram unbalance degree of the gray image;
Figure 303916DEST_PATH_IMAGE006
expressing the number of pixel points with m gray levels in the gray-scale 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;
Figure 391958DEST_PATH_IMAGE007
the expression divides all pixel points in the gray scale map equally into 256The number of pixels per gray level in the gray level. 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:
Figure 658991DEST_PATH_IMAGE008
wherein
Figure 123471DEST_PATH_IMAGE009
Representing the maximum gray level in the gray scale map,
Figure 808661DEST_PATH_IMAGE010
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.
Figure 802025DEST_PATH_IMAGE011
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:
Figure 821934DEST_PATH_IMAGE012
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 left
Figure 824525DEST_PATH_IMAGE013
Meanwhile, 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 side
Figure 347910DEST_PATH_IMAGE014
Wherein, in the process,
Figure 43333DEST_PATH_IMAGE013
and
Figure 284959DEST_PATH_IMAGE014
the calculation formula of (2) is as follows:
Figure DEST_PATH_IMAGE015
wherein the content of the first and second substances,
Figure 91241DEST_PATH_IMAGE013
representing the slope between the gray level in the middle and the adjacent gray level to the left,
Figure 734712DEST_PATH_IMAGE016
expressing the number of pixel points corresponding to the adjacent left gray level, and N expressing the adjacent left gray level;
Figure 335457DEST_PATH_IMAGE014
representing the slope between the gray level in the middle and the gray level to the adjacent right,
Figure 329958DEST_PATH_IMAGE017
expressing the number of pixel points corresponding to the adjacent right gray level, and expressing the adjacent right gray level by O;
Figure 408773DEST_PATH_IMAGE018
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:
Figure DEST_PATH_IMAGE019
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:
Figure 923062DEST_PATH_IMAGE020
Wherein D represents the protrusion degree of the pixel point with the frequency greater than 0.03;
Figure 960288DEST_PATH_IMAGE021
representing the gray value of the pixel point with the frequency greater than 0.03;
Figure 176506DEST_PATH_IMAGE022
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:
Figure 59011DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure 677074DEST_PATH_IMAGE024
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;
Figure 885202DEST_PATH_IMAGE025
representing the outstanding degree of the a-th pixel point in the pixel points with the frequency greater than 0.03;
Figure 323136DEST_PATH_IMAGE026
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 met
Figure 9332DEST_PATH_IMAGE024
Pixels 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 an equilibrium demand heat map according to the equilibrium necessity of the pixel points with the frequency greater than 0.03 in the first gray map, wherein the equilibrium necessity of the pixel points in the first gray map is the weight value of the pixel points in the equilibrium demand heat map
Figure 747481DEST_PATH_IMAGE003
When the balance necessity of the pixel points in the first gray-scale image is converted into the pixel points in the balance requirement heat map, the balance necessity needs to be normalized, and the balance requirement is increased when the weight is increased.
Calculating the protrusion degree of pixel points with frequency greater than 0.03 in the first gray scale image in the equalized image
Figure 860931DEST_PATH_IMAGE004
And obtaining the equalization effect of the equalized image:
Figure 51741DEST_PATH_IMAGE001
wherein the content of the first and second substances,
Figure 276049DEST_PATH_IMAGE002
representing an equalizing effect of equalizing the image;
Figure 362646DEST_PATH_IMAGE003
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;
Figure 912576DEST_PATH_IMAGE004
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 denotes the natural logarithm, c denotes the frequency in the equalized image being greater than a predetermined threshold The number of pixels.
When the value of QP is larger, it is described 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 selected
Figure 325103DEST_PATH_IMAGE002
The 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 obtained
Figure 618681DEST_PATH_IMAGE002
The balance effect of the pixel points with the frequency greater than 0.03 in the first gray-scale image in the maximum balanced image
Figure 65843DEST_PATH_IMAGE027
Figure 255516DEST_PATH_IMAGE028
Wherein the content of the first and second substances,
Figure 420918DEST_PATH_IMAGE027
to balance the effect
Figure 252608DEST_PATH_IMAGE002
The maximum balancing effect of pixel points in the balanced image is achieved;
Figure 554276DEST_PATH_IMAGE029
to balance the effect
Figure 180430DEST_PATH_IMAGE002
The maximum outstanding degree of the pixel points in the balanced image is obtained;
Figure 833128DEST_PATH_IMAGE003
And e is a natural logarithm, and the weight of a corresponding pixel point of the a-th pixel point with the frequency larger than a preset threshold in the first gray-scale map in the equilibrium demand heat map is represented.
When the equalization effect of the pixel points in the equalization image with the maximum equalization effect is larger than 0 and smaller than 0.3, the part of the pixel points is considered to be combined or inhibited in the equalization process, the part of the pixel points needs to be equalized again, and the final equalization image is obtained after the part of the pixel points is 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 neural 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, and finally pixels in a defect-free area in the balanced image are marked as 0 and pixels in the defect area are marked as 1; the task of the network is classification, and the loss function is a cross-entropy loss function.
And calculating with the final balanced image by taking the image as a mask and taking the image as a mask to obtain a binary image of the defect area, thereby obtaining the area with the defect on the surface of the electric wire, namely the electric wire defect area.
It should be noted that: the sequence of the above embodiments of the present invention is only for description, and does not represent the advantages or disadvantages 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 can 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.
All 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 other embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and should not be taken as limiting the scope of the present invention, which is intended to cover any modifications, equivalents, improvements, etc. within the spirit and scope of the present invention.

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 map needing equalization based on image equalization necessity acquired by the unbalance degree and the dispersion degree, and recording the gray level map as a first gray level map;
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 larger 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 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 to obtain 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 protrusion degree of the pixel points with the frequency greater than a preset threshold value in each balance image in the first gray 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.
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 electric wire production based on image processing as claimed in claim 1, wherein the obtaining of the gray scale map requiring equalization based on the necessity of image equalization obtained from the degree of unbalance and the degree of dispersion 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.
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 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 coordinates of the vertex corresponding to the gray level adjacent to the left and right.
6. The image processing-based wire production defect detection method according to claim 1, wherein the necessity of pixel point equalization comprises: 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.
7. The image processing-based wire production defect detection method according to claim 1, wherein selecting the pixel points in the first gray-scale image for continuous equalization to obtain a plurality of equalized images comprises: setting a pixel point balance threshold value, and selecting pixel points of which necessary lines of pixel point balance in the first gray image are greater than the pixel point balance threshold value for balancing; and setting the equalization times, performing equalization based on the first gray-scale image to obtain an equalized image, and performing equalization based on the equalized image obtained last time when equalization is performed 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:
Figure 214718DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE003
Representing an equalizing effect of equalizing the image;
Figure 397438DEST_PATH_IMAGE004
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;
Figure DEST_PATH_IMAGE005
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.
CN202210391674.3A 2022-04-14 2022-04-14 Electric wire production defect detection method based on image processing Active CN114494256B (en)

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 CN114494256A (en) 2022-05-13
CN114494256B true 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)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114638827B (en) * 2022-05-18 2022-08-05 卡松科技股份有限公司 Visual detection method and device for impurities of lubricating oil machinery
CN114693682B (en) * 2022-06-01 2022-08-26 青岛大学附属医院 Spine feature identification method based on image processing
CN115049672B (en) * 2022-08-17 2022-11-25 南通源钰新材料科技有限公司 Computer vision-based method for detecting defects of phosphating film on surface of metal aluminum
CN115471486A (en) * 2022-09-28 2022-12-13 探长信息技术(苏州)有限公司 Switch interface integrity detection method
CN115294107B (en) * 2022-09-29 2022-12-27 江苏三通科技有限公司 Diode pin surface oxidation detection method based on image recognition
CN116152133B (en) * 2023-04-20 2023-07-07 山东超越纺织有限公司 Blending defect detection method based on artificial intelligence
CN117437238B (en) * 2023-12-22 2024-03-29 深圳宝铭微电子有限公司 Visual inspection method for surface defects of packaged IC

Citations (10)

* Cited by examiner, † Cited by third party
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

Patent Citations (10)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Title
Contrast Limited Adaptive Histogram Equalization;Karel Zuiderveld;《 Graphics Gems IV》;19941231;479-484 *
Nonlinear Exposure Intensity Based Modification Histogram Equalization for Non-Uniform Illumination Image Enhancement;NOR HIDAYAH SAAD 等;《IEEE access》;20210706;93033-93061 *
低照度水下堤坝裂缝图像检测算法的研究;邱贞光;《中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑》;20220315(第03期);C037-149 *
彩色图像增强算法的研究与实现;任洁;《中国优秀硕士学位论文全文数据库 信息科技辑》;20140615(第06期);I138-907 *

Also Published As

Publication number Publication date
CN114494256A (en) 2022-05-13

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
CN109342456B (en) Welding spot defect detection method, device and equipment and readable storage medium
CN109596634B (en) Cable defect detection method and device, storage medium and processor
CN114972357A (en) Roller surface defect detection method and system based on image processing
CN115601362B (en) Welding quality evaluation method based on image processing
CN115147409B (en) Mobile phone shell production quality detection method based on machine vision
CN114219805B (en) Intelligent detection method for glass defects
CN115619793B (en) Power adapter appearance quality detection method based on computer vision
CN113808138A (en) Artificial intelligence-based wire and cable surface defect detection method
CN114757900A (en) Artificial intelligence-based textile defect type identification method
CN113610862B (en) Screen content image quality assessment method
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
CN116137036B (en) Gene detection data intelligent processing system based on machine learning
CN114782329A (en) Bearing defect damage degree evaluation method and system based on image processing
CN115272303B (en) Textile fabric defect degree evaluation method, device and system based on Gaussian blur
CN115330767A (en) Method for identifying production abnormity of corrosion foil
CN115205289B (en) Vision-based cork wood floor raw material grading method
CN117058147A (en) Environment-friendly plastic product defect detection method based on computer vision
CN115272350A (en) Method for detecting production quality of computer PCB mainboard
Arya et al. Development of a seed analyzer using the techniques of computer vision
CN114550167B (en) Artificial intelligence based pear quality classification method and device

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