CN115272321B - Textile defect detection method based on machine vision - Google Patents
Textile defect detection method based on machine vision Download PDFInfo
- Publication number
- CN115272321B CN115272321B CN202211185741.2A CN202211185741A CN115272321B CN 115272321 B CN115272321 B CN 115272321B CN 202211185741 A CN202211185741 A CN 202211185741A CN 115272321 B CN115272321 B CN 115272321B
- Authority
- CN
- China
- Prior art keywords
- suspected defect
- defect area
- smaller
- pixel points
- gray
- 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
Links
- 230000007547 defect Effects 0.000 title claims abstract description 229
- 239000004753 textile Substances 0.000 title claims abstract description 63
- 238000001514 detection method Methods 0.000 title claims abstract description 30
- 230000011218 segmentation Effects 0.000 claims abstract description 136
- 238000000034 method Methods 0.000 claims abstract description 28
- 238000009499 grossing Methods 0.000 claims abstract description 4
- 238000004364 calculation method Methods 0.000 claims description 10
- 239000000126 substance Substances 0.000 claims description 6
- 238000001914 filtration Methods 0.000 claims description 2
- 238000012216 screening Methods 0.000 abstract description 3
- 238000012549 training Methods 0.000 description 8
- 230000002950 deficient Effects 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 230000002411 adverse Effects 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000000354 decomposition reaction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000003709 image segmentation Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000011430 maximum method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000005215 recombination Methods 0.000 description 1
- 230000006798 recombination 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
- G06T3/00—Geometric image transformation in the plane of the image
- G06T3/40—Scaling the whole image or part thereof
- G06T3/4007—Interpolation-based scaling, e.g. bilinear interpolation
-
- 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 by the use of histogram techniques
-
- G06T5/70—
-
- 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
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/25—Determination of region of interest [ROI] or a volume of interest [VOI]
Abstract
The invention discloses a textile defect detection method based on machine vision, and relates to the field of defect detection. The method mainly comprises the following steps: dividing pixel blocks of the surface gray level image of the textile to be detected; screening out suspected defect pixel blocks from all the pixel blocks to obtain suspected defect areas; smoothing the gray histogram of the suspected defect area through a linear interpolation algorithm to obtain a gray curve; and determining a strategy for determining the segmentation threshold of the suspected defect area according to the peak characteristics of the gray curve so as to obtain the segmentation threshold, and performing threshold segmentation on the suspected defect area to obtain the defect area. The embodiment of the invention can realize effective detection of the defect area in the textile.
Description
Technical Field
The invention relates to the field of defect detection, in particular to a textile defect detection method based on machine vision.
Background
The textile is an indispensable article in daily life of people, the requirements of people on the quality of the textile are higher and higher along with the continuous improvement of the living standard, and the defects in the textile not only have an influence on the quality, but also have a bad influence on the aesthetic property and the fashion property of the textile.
At present, defect detection in textiles is mainly realized in a machine learning mode, however, in order to ensure accuracy of a machine learning result, images of textiles with various types of defects need to be adopted for training, and meanwhile, the number of training samples needed for training is large, so that before training, the acquisition of the images of the textiles with various types of defects needs to be completed, and a large amount of manpower and material resources need to be consumed in the acquisition process of the images adopted for training.
Disclosure of Invention
Aiming at the technical problem, the invention provides a textile defect detection method based on machine vision, which is characterized in that pixel blocks are divided through a surface gray image of a textile to be detected, a suspected defect area formed by the screened pixel blocks is determined, the suspected defect area is divided according to the gray histogram characteristics of the suspected defect area to obtain a final defect area, images containing various defects and used for training do not need to be collected, and meanwhile, the effective detection of the defect area in the textile is realized.
The embodiment of the invention provides a textile defect detection method based on machine vision, which comprises the following steps:
obtaining a surface gray image of a textile to be detected, and dividing the surface gray image into a plurality of pixel blocks with the same size;
and taking pixel blocks of which the gray mean values of the contained pixel points are greater than a preset gray threshold and the gray variance of the contained pixel points is greater than a preset variance threshold as suspected defect pixel blocks, and merging all the suspected defect pixel blocks to obtain a suspected defect area.
Smoothing the gray histogram of the suspected defect area by a linear interpolation algorithm to obtain a gray curve, and determining the number of main peaks in the gray curve; the main peak is the largest peak in the peak with the distance from the largest peak in the gray scale curve larger than a preset distance threshold value, or the largest peak in the gray scale curve.
And under the condition that the number of the main wave peaks is larger than 1, determining the inter-class variance corresponding to a segmentation threshold for segmenting the suspected defect area by the threshold.
Under the condition that the number of the main wave peaks is 1, determining an inter-class variance corresponding to a segmentation threshold for threshold segmentation of the suspected defect area according to the number ratio of pixel points smaller than the segmentation threshold in the suspected defect area and the number ratio of pixel points not smaller than the segmentation threshold in the suspected defect area, wherein the inter-class variance has a calculation formula as follows:
wherein the content of the first and second substances,dividing inter-class variance corresponding to a threshold t under the condition that the number of pixel points smaller than the division threshold in the suspected defect area is larger than the number of pixel points not smaller than the division threshold in the suspected defect area;the ratio of the number of pixel points smaller than the segmentation threshold t in the suspected defect area to the number of pixel points not smaller than the segmentation threshold t in the suspected defect area is obtained;the number of the pixel points which are smaller than the segmentation threshold value in the suspected defect area is calculated;the number of pixel points which are not less than a segmentation threshold value in a suspected defect area is compared;the gray level mean value of each pixel point which is smaller than the segmentation threshold value in the suspected defect area is obtained;the gray level mean value of each pixel point which is not less than the segmentation threshold value in the suspected defect area is obtained;the gray average value of the pixel points in the suspected defect area is obtained;
and performing threshold segmentation on the suspected defect area by using a segmentation threshold corresponding to the maximum between-class variance to obtain the defect area.
Further, in the textile defect detection method based on machine vision, under the condition that the number of pixel points smaller than the segmentation threshold in the suspected defect area is larger than the number of pixel points not smaller than the segmentation threshold in the suspected defect area, the larger the number of pixel points not smaller than the segmentation threshold in the suspected defect area is, the larger the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect area is.
Further, in the textile defect detection method based on machine vision, under the condition that the number of pixel points smaller than the segmentation threshold in the suspected defect area is larger than the number of pixel points not smaller than the segmentation threshold in the suspected defect area, the larger the number of pixel points smaller than the segmentation threshold in the suspected defect area is, the larger the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect area is.
Further, in the textile defect detection method based on machine vision, the segmentation threshold is located between the minimum gray level of the suspected defect area and the gray level with the largest frequency number in the gray histogram of the suspected defect area.
Further, in the textile defect detection method based on machine vision, the segmentation threshold is located between the gray level with the largest frequency number in the gray histogram of the suspected defect area and the maximum gray level of the suspected defect area.
Further, in a textile defect detection method based on machine vision, the segmentation threshold is selected from all gray levels in the suspected defect area.
Further, in a machine vision based textile defect detection method, the method further comprises determining a size of the divided pixel block, wherein the determining of the size of the divided pixel block comprises:
and taking the pixel points with the gray values larger than the average gray value of the pixel points in the surface gray image as the interested pixel points, and determining the maximum continuous occurrence times of the interested pixel points, wherein the continuous occurrence direction is any one of horizontal, vertical and 135 degrees.
And determining the size of the divided pixel blocks according to the maximum continuous occurrence times of the interested pixel points.
Further, in the textile defect detection method based on machine vision, after the surface gray level image of the textile to be detected is obtained, the method further comprises the step of carrying out mean value filtering denoising on the surface gray level image.
Further, in the textile defect detection method based on machine vision, a surface gray image of a textile to be detected is obtained, and the method comprises the steps of segmenting the surface image of the textile to be detected from the included image of the surface of the textile to be detected, and carrying out graying on the surface image to obtain the surface gray image.
Further, in a textile defect detection method based on machine vision, the surface image of the textile to be detected is segmented from the images of the surface of the textile to be detected contained therein, and DNN is used for realizing the segmentation.
The invention provides a textile defect detection method based on machine vision, compared with the prior art, the embodiment of the invention has the beneficial effects that: the method comprises the steps of dividing pixel blocks of a surface gray image of a textile to be detected, determining a suspected defect area formed by the screened pixel blocks, and dividing the suspected defect area according to the gray histogram characteristics of the suspected defect area to obtain a final defect area, wherein images containing various defects for training are not required to be acquired, so that the defect area in the textile can be quickly and effectively detected.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flow chart of a textile defect detection method based on machine vision according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature; in the description of the present embodiment, "a plurality" means two or more unless otherwise specified.
The embodiment of the invention provides a textile defect detection method based on machine vision, which comprises the following steps of:
step S101, obtaining a surface gray image of a textile to be detected, and dividing the surface gray image into a plurality of pixel blocks with the same size.
Firstly, setting a lighting source to enable the illumination in an image acquisition environment to be uniform, acquiring a surface image of a textile to be detected through image acquisition equipment arranged on transportation equipment, and carrying out graying on the surface image to obtain a corresponding surface gray level image, wherein the graying can be realized through a maximum method or a weighted average method; because the textile to be detected can be positioned on the conveying device, the image acquisition can be carried out in a mode that the image acquisition frequency is consistent with the conveying speed of the textile to be detected, so that the detection of unnecessary overlapped areas can be reduced while the complete surface image of the textile to be detected is obtained.
Optionally, the surface image of the textile to be detected may be segmented from the image of the surface of the textile to be detected, where the segmentation of the surface image of the textile to be detected from the image of the surface of the textile to be detected may be implemented by DNN (Deep Neural Networks), so that adverse effects of regions outside the textile on subsequent detection results may be avoided.
Because the defects of the textile surface are usually very small, the calculation amount required for separating small targets by directly carrying out an image segmentation algorithm is large, excessive phenomena can be caused, and meanwhile, the accuracy rate is difficult to guarantee, so that the surface gray level image is divided into a plurality of pixel blocks with the same size in the embodiment of the invention.
Meanwhile, the pixel points with the gray values larger than the average gray value of the pixel points in the surface gray image can be used as interested pixel points, and the maximum continuous occurrence times of the interested pixel points are determined, wherein the continuous occurrence direction is any one of horizontal, vertical and 135 degrees; determining the size of the divided pixel blocks according to the maximum continuous occurrence frequency of the interested pixel points, for example, when the maximum continuous occurrence frequency of the interested pixel points is 7, determining the size of the divided pixel blocks to be 7 × 7; in this way, the size of the divided pixel block can be matched with the size of a possible defect in the surface gray image as much as possible, so that the calculation amount of the subsequent process is reduced.
And S102, screening out suspected defect pixel blocks from all the pixel blocks to form a suspected defect area.
Specifically, the pixel blocks, which contain pixel points whose gray mean value is greater than a preset gray threshold and whose gray variance of the pixel points is greater than a preset variance threshold, are taken as suspected defect pixel blocks, and all the suspected defect pixel blocks are merged to obtain a suspected defect area.
It should be noted that the preset gray threshold in the embodiment of the present invention may be determined according to a gray mean of pixel points in the surface image of the defect-free textile, and meanwhile, the preset variance threshold may also be determined according to a variance of gray values of pixel points in the surface image of the defect-free textile; by determining the suspected defective pixel blocks, the method can realize preliminary screening of the pixel blocks and avoid processing all the pixel blocks, thereby reducing the calculated amount in the defect detection process, and simultaneously, because the interference of other pixel blocks except the suspected defective pixel blocks is eliminated, the accuracy of the defect detection process can be improved.
And then, combining all the suspected defect pixel blocks to obtain a suspected defect area.
Step S103, smoothing the gray level histogram of the suspected defect area through a linear interpolation algorithm to obtain a gray level curve, and determining the number of main wave peaks in the gray level curve.
The gray level histogram of the suspected defect area is smoothed through a linear interpolation algorithm to obtain a gray level curve, the number of main peaks in the gray level curve is conveniently determined according to the gray level curve, and therefore a strategy for determining the segmentation threshold value is adopted according to the difference of the number of the main peaks.
It should be noted that, in the embodiment of the present invention, the main peak is a maximum peak in peaks of the gray scale curve, where a distance between the main peak and the maximum peak is greater than a preset distance threshold, or the maximum peak in the gray scale curve.
And step S104, under the condition that the number of the main wave peaks is 1, determining the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect area according to the number ratio of the pixel points smaller than the segmentation threshold in the suspected defect area and the number ratio of the pixel points not smaller than the segmentation threshold in the suspected defect area.
The general Otsu method adopts a strategy of exhaustively dividing gray levels, when an optimal segmentation threshold is found, all gray levels need to be traversed, and a calculation formula of the inter-class variance in the general Otsu method is as follows:
wherein the content of the first and second substances,dividing the inter-class variance corresponding to a threshold t;the ratio of the number of pixel points smaller than the segmentation threshold t in the suspected defect area to the number of pixel points not smaller than the segmentation threshold t in the suspected defect area is obtained;the number of pixel points which are smaller than a segmentation threshold value in the suspected defect area is compared;the number of pixel points which are not less than a segmentation threshold value in a suspected defect area is compared;the gray average value of each pixel point which is smaller than the segmentation threshold value in the suspected defect area is obtained;the gray average value of each pixel point which is not less than the segmentation threshold value in the suspected defect area is obtained;the gray level average value of the pixel points in the suspected defect area is obtained.
When the number of main peaks is 1, it is indicated that most of the suspected defect regions are regions where defects are located, or most of the suspected defect regions are normal regions other than defects.
In the embodiment of the present invention, under the condition that the number of the pixels in the suspected defect region that are smaller than the segmentation threshold is larger than the number of the pixels in the suspected defect region that are not smaller than the segmentation threshold, it is indicated that the percentage of the background portion other than the defect in the suspected defect region is smaller, the percentage of the defect region in the suspected defect region is larger, and meanwhile, the pixel value of the pixel belonging to the defect is often smaller than the gray value of the pixel under normal conditions, so that the pixel in the suspected defect region that the gray value is not smaller than the segmentation threshold, that is, the contribution of the background portion other than the defect to the inter-class variance can be weakened, and meanwhile, since the percentage of the pixel in the background portion is smaller than 1 number, the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect region is larger when the number of the pixels in the suspected defect region that are not smaller than the segmentation threshold is larger; in this way, a more accurate segmentation threshold is facilitated.
Meanwhile, under the condition that the number of the pixel points smaller than the segmentation threshold in the suspected defect area is larger than the number of the pixel points not smaller than the segmentation threshold in the suspected defect area, the occupation ratio of the background part except the defect in the suspected defect area is smaller, and the optimal segmentation threshold is more likely to be larger than or equal to the gray level corresponding to the main peak, so that the segmentation threshold can be selected from the gray level with the largest frequency number in the gray histogram of the suspected defect area to the maximum gray level of the suspected defect area, and thus the segmentation threshold can be determined more quickly.
As a feasible implementation manner, under the condition that the ratio of the number of the pixels smaller than the segmentation threshold in the suspected defect region is greater than the ratio of the number of the pixels not smaller than the segmentation threshold in the suspected defect region, the calculation formula of the inter-class variance may be determined as:
wherein the content of the first and second substances,dividing inter-class variance corresponding to a threshold t under the condition that the number of pixel points smaller than the division threshold in the suspected defect area is larger than the number of pixel points not smaller than the division threshold in the suspected defect area;the ratio of the number of pixel points smaller than the segmentation threshold t in the suspected defect area to the number of pixel points not smaller than the segmentation threshold t in the suspected defect area is obtained;the number of pixel points which are smaller than a segmentation threshold value in the suspected defect area is compared;the number of pixel points which are not less than a segmentation threshold value in a suspected defect area is compared;the gray average value of each pixel point which is smaller than the segmentation threshold value in the suspected defect area is obtained;the gray average value of each pixel point which is not less than the segmentation threshold value in the suspected defect area is obtained;the gray average value of the pixel points in the suspected defect area is obtained; in the calculation formula, the corresponding part of the pixel points which are not less than the segmentation threshold value in the suspected defect area in the formula is reduced, and the contribution of the pixel points which are not less than the segmentation threshold value in the suspected defect area to the inter-class variance is weakened.
In the embodiment of the present invention, under the condition that the number of the pixels in the suspected defect region that are smaller than the segmentation threshold is not greater than the number of the pixels in the suspected defect region that are not smaller than the segmentation threshold, it is indicated that the ratio of the defect region in the suspected defect region is smaller, and at the same time, the gray value of the pixel belonging to the defect is often smaller than the gray value of the pixel under normal conditions, so that the contribution of the pixels in the suspected defect region that have gray values smaller than the segmentation threshold to the inter-class variance can be weakened, and meanwhile, the ratio of the defect region in the suspected defect region is a number smaller than 1, so that the larger the number ratio of the pixels in the suspected defect region that are smaller than the segmentation threshold is, the larger the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect region is set; in this way, a more accurate segmentation threshold is facilitated.
Meanwhile, under the condition that the number of the pixel points smaller than the segmentation threshold in the suspected defect area is smaller than the number of the pixel points not smaller than the segmentation threshold in the suspected defect area, the occupation ratio of the defect area in the suspected defect area is smaller, and the optimal segmentation threshold is more likely to be smaller than or equal to the gray level corresponding to the main peak, so that the segmentation threshold can be selected from the maximum gray level of the suspected defect area to the gray level with the maximum frequency number in the gray histogram of the suspected defect area, and the optimal segmentation threshold can be determined more quickly.
As a feasible implementation manner, under the condition that the ratio of the number of the pixels smaller than the segmentation threshold in the suspected defect region is not greater than the ratio of the number of the pixels not smaller than the segmentation threshold in the suspected defect region, the calculation formula of the inter-class variance may be determined as:
wherein the content of the first and second substances,dividing inter-class variance corresponding to a threshold t under the condition that the number of pixel points smaller than the division threshold in a suspected defect area accounts for a ratio and the number of pixel points not smaller than the division threshold in the suspected defect area accounts for a ratio;the ratio of the number of the pixel points smaller than the segmentation threshold t in the suspected defect area to the number of the pixel points not smaller than the segmentation threshold t in the suspected defect area is obtained;the number of pixel points which are smaller than a segmentation threshold value in the suspected defect area is compared;the number of pixel points which are not less than a segmentation threshold value in a suspected defect area is compared;the gray average value of each pixel point which is smaller than the segmentation threshold value in the suspected defect area is obtained;the gray level mean value of each pixel point which is not less than the segmentation threshold value in the suspected defect area is obtained;the gray average value of the pixel points in the suspected defect area is obtained; in the calculation formula, the corresponding part of the pixel point smaller than the segmentation threshold in the suspected defect area in the formula is reduced, and the contribution of the pixel point with the gray value smaller than the segmentation threshold in the suspected defect area to the inter-class variance is weakened.
Step S105, when the number of main peaks is greater than 1, determines an inter-class variance corresponding to a segmentation threshold for performing threshold segmentation on the suspected defect region.
If two main peaks exist in the gray level histogram of the suspected defect region, it is indicated that the difference between the areas of the defect region and the regions other than the defect region in the suspected defect region is not large, or the suspected defect region has a relatively obvious defect, and at this time, the threshold segmentation is directly performed by the Otsu method, which does not cause an excessive phenomenon, and the segmentation threshold for performing threshold segmentation can be directly determined by using the Otsu method, so that the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect region is directly determined.
And step S106, performing threshold segmentation on the suspected defect area by using the segmentation threshold corresponding to the maximum inter-class variance to obtain the defect area.
And after a segmentation threshold for performing threshold segmentation on the suspected defect area is determined, forming the defect area by the pixel points with the gray values smaller than the segmentation threshold in the suspected defect area. In this way, in the case of a defect present on the surface of the textile to be inspected, a specific location is obtained in which the defect present is located.
In summary, embodiments of the present invention provide a textile defect detection method based on machine vision, which divides a gray level image of a surface of a textile to be detected by pixel blocks, determines a suspected defect area formed by the screened pixel blocks, and divides the suspected defect area according to a gray level histogram feature of the suspected defect area to obtain a final defect area, without acquiring images containing various types of defects for training, and meanwhile, realizes effective detection of the defect area in the textile.
The use of words such as "including," "comprising," "having," and the like in this disclosure is an open-ended term that means "including, but not limited to," and is used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
It should also be noted that the various components or steps may be broken down and/or re-combined in the methods and systems of the present invention. These decompositions and/or recombinations are to be considered equivalents of the present disclosure.
The above-mentioned embodiments are merely examples for clearly illustrating the present invention and do not limit the scope of the present invention. It will be apparent to those skilled in the art that other variations and modifications may be made in the foregoing description, and it is not necessary or necessary to exhaustively enumerate all embodiments herein. All designs identical or similar to the present invention are within the scope of the present invention.
Claims (10)
1. A textile defect detection method based on machine vision is characterized by comprising the following steps:
obtaining a surface gray image of a textile to be detected, and dividing the surface gray image into a plurality of pixel blocks with the same size;
taking pixel blocks which contain pixel points with the gray mean value larger than a preset gray threshold value and the gray variance of the contained pixel points larger than a preset variance threshold value as suspected defect pixel blocks, and combining all the suspected defect pixel blocks to obtain suspected defect areas;
smoothing the gray histogram of the suspected defect area by a linear interpolation algorithm to obtain a gray curve, and determining the number of main peaks in the gray curve; the main peak is the maximum peak in the peaks of the gray scale curve, wherein the distance between the main peak and the maximum peak is larger than a preset distance threshold value, or the maximum peak in the gray scale curve;
under the condition that the number of the main wave peaks is larger than 1, determining inter-class variance corresponding to a segmentation threshold for segmenting the suspected defect area by using the threshold;
under the condition that the number of the main wave peaks is 1, determining an inter-class variance corresponding to a segmentation threshold for performing threshold segmentation on a suspected defect area according to the number ratio of pixel points smaller than the segmentation threshold in the suspected defect area and the number ratio of pixel points not smaller than the segmentation threshold in the suspected defect area, wherein under the condition that the number ratio of the pixel points smaller than the segmentation threshold in the suspected defect area is larger than the number ratio of the pixel points not smaller than the segmentation threshold in the suspected defect area, the calculation formula of the inter-class variance is determined as follows:
wherein the content of the first and second substances,dividing inter-class variance corresponding to a threshold t under the condition that the number of pixel points smaller than the division threshold in a suspected defect area accounts for the ratio and the number of pixel points not smaller than the division threshold in the suspected defect area accounts for the ratio;the ratio of the number of pixel points smaller than the segmentation threshold t in the suspected defect area to the number of pixel points not smaller than the segmentation threshold t in the suspected defect area is obtained;the number of pixel points which are smaller than a segmentation threshold value in the suspected defect area is compared;the number of pixel points which are not less than a segmentation threshold value in a suspected defect area is compared;the gray level mean value of each pixel point which is smaller than the segmentation threshold value in the suspected defect area is obtained;the gray average value of each pixel point which is not less than the segmentation threshold value in the suspected defect area is obtained;the gray average value of the pixel points in the suspected defect area is obtained;
under the condition that the number of the pixel points smaller than the segmentation threshold in the suspected defect area is less than the number of the pixel points not smaller than the segmentation threshold in the suspected defect area, the calculation formula of the inter-class variance is determined as follows:
wherein the content of the first and second substances,dividing inter-class variance corresponding to a threshold t under the condition that the number of pixel points smaller than the division threshold in a suspected defect area accounts for a ratio and the number of pixel points not smaller than the division threshold in the suspected defect area accounts for a ratio;the ratio of the number of pixel points smaller than the segmentation threshold t in the suspected defect area to the number of pixel points not smaller than the segmentation threshold t in the suspected defect area is obtained;the number of pixel points which are smaller than a segmentation threshold value in the suspected defect area is compared;the number of the pixel points which are not less than the segmentation threshold value in the suspected defect area is calculated;the gray average value of each pixel point which is smaller than the segmentation threshold value in the suspected defect area is obtained;the gray average value of each pixel point which is not less than the segmentation threshold value in the suspected defect area is obtained;the gray level mean value of the pixel points in the suspected defect area is obtained;
and performing threshold segmentation on the suspected defect area by using a segmentation threshold corresponding to the maximum inter-class variance to obtain the defect area.
2. The method according to claim 1, wherein if the ratio of the number of pixels smaller than the segmentation threshold in the suspected defect region is greater than the ratio of the number of pixels not smaller than the segmentation threshold in the suspected defect region, the larger the ratio of the number of pixels not smaller than the segmentation threshold in the suspected defect region is, the larger the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect region is.
3. The method according to claim 1, wherein when the ratio of the number of pixels smaller than the segmentation threshold in the suspected defect region is not greater than the ratio of the number of pixels not smaller than the segmentation threshold in the suspected defect region, the larger the ratio of the number of pixels smaller than the segmentation threshold in the suspected defect region is, the larger the inter-class variance corresponding to the segmentation threshold for performing threshold segmentation on the suspected defect region is.
4. The method of claim 2, wherein the segmentation threshold is between the highest gray level of the frequency in the gray histogram of the suspected defect area and the highest gray level of the suspected defect area.
5. The method of claim 3, wherein the segmentation threshold is between a minimum gray level of the suspected defect region and a maximum gray level of the frequency in the gray histogram of the suspected defect region.
6. A method according to claim 2 or 3, wherein the segmentation threshold is selected from all grey levels in the suspected defect area.
7. The method of claim 1, further comprising determining a size of the partitioned block of pixels, wherein determining the size of the partitioned block of pixels comprises:
taking the pixel points with the gray values larger than the average gray value of the pixel points in the surface gray image as interested pixel points, and determining the maximum continuous occurrence times of the interested pixel points, wherein the continuous occurrence direction is any one of horizontal, vertical and 135 degrees;
and determining the size of the divided pixel blocks according to the maximum continuous occurrence times of the interested pixel points.
8. The method of claim 1, wherein after obtaining the surface gray scale image of the textile to be detected, the method further comprises performing mean filtering denoising on the surface gray scale image.
9. The method according to claim 1, wherein obtaining the surface gray scale image of the textile to be detected comprises segmenting the surface image of the textile to be detected from the image of the surface of the textile to be detected contained therein and graying the surface image to obtain the surface gray scale image.
10. Method according to claim 9, characterized in that the segmentation of the surface image of the textile to be detected from the included image of the surface of the textile to be detected is carried out by DNN.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211185741.2A CN115272321B (en) | 2022-09-28 | 2022-09-28 | Textile defect detection method based on machine vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211185741.2A CN115272321B (en) | 2022-09-28 | 2022-09-28 | Textile defect detection method based on machine vision |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115272321A CN115272321A (en) | 2022-11-01 |
CN115272321B true CN115272321B (en) | 2023-01-10 |
Family
ID=83757354
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211185741.2A Active CN115272321B (en) | 2022-09-28 | 2022-09-28 | Textile defect detection method based on machine vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115272321B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115457035B (en) * | 2022-11-10 | 2023-03-24 | 山东鲁旺机械设备有限公司 | Machine vision-based construction hanging basket welding quality detection method |
CN115496762B (en) * | 2022-11-21 | 2023-01-24 | 深圳市富安娜家居用品股份有限公司 | Textile technology-based dyeing defect identification method |
CN116309671B (en) * | 2023-05-23 | 2023-08-11 | 浩珂科技有限公司 | Geosynthetic fabric quality detection system |
CN116823808B (en) * | 2023-08-23 | 2023-11-17 | 青岛豪迈电缆集团有限公司 | Intelligent detection method for cable stranded wire based on machine vision |
CN117309766B (en) * | 2023-10-20 | 2024-03-29 | 苏州宣雄智能科技有限公司 | Visual detection method and system for product surface defects |
CN117237350B (en) * | 2023-11-14 | 2024-01-26 | 青岛三合山精密铸造有限公司 | Real-time detection method for quality of steel castings |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1491879A2 (en) * | 2003-06-10 | 2004-12-29 | hema electronic GmbH | Method for the adaptive recognition of a defect on a structured surface |
CN103778624A (en) * | 2013-12-20 | 2014-05-07 | 中原工学院 | Fabric defect detection method based on optical threshold segmentation |
CN110163857A (en) * | 2019-05-24 | 2019-08-23 | 上海联影医疗科技有限公司 | Detection method, device, storage medium and the x-ray system of image background regions |
CN114757949A (en) * | 2022-06-15 | 2022-07-15 | 济宁市海富电子科技有限公司 | Wire and cable defect detection method and system based on computer vision |
CN114782416A (en) * | 2022-06-16 | 2022-07-22 | 启东市固德防水布有限公司 | Textile quality detection method and system based on image recognition |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108108739B (en) * | 2017-12-18 | 2021-11-16 | 上海联影医疗科技股份有限公司 | Method and device for detecting image target area, X-ray system and storage medium |
CN114494318B (en) * | 2022-02-17 | 2023-05-23 | 天津市眼科医院 | Cornea contour extraction method based on cornea dynamic deformation video of Ojin algorithm |
-
2022
- 2022-09-28 CN CN202211185741.2A patent/CN115272321B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1491879A2 (en) * | 2003-06-10 | 2004-12-29 | hema electronic GmbH | Method for the adaptive recognition of a defect on a structured surface |
CN103778624A (en) * | 2013-12-20 | 2014-05-07 | 中原工学院 | Fabric defect detection method based on optical threshold segmentation |
CN110163857A (en) * | 2019-05-24 | 2019-08-23 | 上海联影医疗科技有限公司 | Detection method, device, storage medium and the x-ray system of image background regions |
CN114757949A (en) * | 2022-06-15 | 2022-07-15 | 济宁市海富电子科技有限公司 | Wire and cable defect detection method and system based on computer vision |
CN114782416A (en) * | 2022-06-16 | 2022-07-22 | 启东市固德防水布有限公司 | Textile quality detection method and system based on image recognition |
Non-Patent Citations (2)
Title |
---|
"Otsu"s thresholding method based on gray level-gradient two-dimensional histogram";Chen Yu et al.;《2010 2nd International Asia Conference on Informatics in Control, Automation and Robotics (CAR 2010)》;20101231;第282-285页 * |
"小型平板玻璃表面缺陷检测系统";李长有 等;《计算机应用》;20171231;第167-182页 * |
Also Published As
Publication number | Publication date |
---|---|
CN115272321A (en) | 2022-11-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115272321B (en) | Textile defect detection method based on machine vision | |
CN115311292B (en) | Strip steel surface defect detection method and system based on image processing | |
CN106251361B (en) | A kind of rail surface defects image self-adapting division method | |
CN107507173B (en) | No-reference definition evaluation method and system for full-slice image | |
CN116758061B (en) | Casting surface defect detection method based on computer vision | |
CN107657606B (en) | Method and device for detecting brightness defect of display device | |
CN116168026B (en) | Water quality detection method and system based on computer vision | |
CN115170576A (en) | Aluminum pipe surface defect detection method based on machine vision | |
CN115018828A (en) | Defect detection method for electronic component | |
CN114219805B (en) | Intelligent detection method for glass defects | |
CN111681240A (en) | Bridge surface crack detection method based on YOLO v3 and attention mechanism | |
CN111161222B (en) | Printing roller defect detection method based on visual saliency | |
CN115861320B (en) | Intelligent detection method for automobile part machining information | |
CN115546203B (en) | Production monitoring and analyzing method based on image data algorithm | |
CN115496692B (en) | Lubricating oil abrasive particle image enhancement method | |
CN115049736B (en) | Method for accurately positioning surface defects of cable | |
CN110111301A (en) | Metal based on frequency-domain transform aoxidizes surface defect visible detection method | |
CN110648330B (en) | Defect detection method for camera glass | |
CN114820625B (en) | Automobile top block defect detection method | |
CN116152242B (en) | Visual detection system of natural leather defect for basketball | |
CN116883408B (en) | Integrating instrument shell defect detection method based on artificial intelligence | |
CN114581692B (en) | Vibration damper fault detection method and system based on intelligent pattern recognition | |
CN108889635B (en) | Online visual inspection method for manufacturing defects of ring-pull cans | |
CN116630813A (en) | Highway road surface construction quality intelligent detection system | |
CN116152115A (en) | Garbage image denoising processing method based on computer vision |
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 |