PRINTED FABRIC defect detection method based on gabor wave filter
Technical field
The invention belongs to textile defect detection method and technology field, it is related to a kind of knit based on the stamp of gabor wave filter
Thing defect detection method.
Background technology
Flaw on PRINTED FABRIC has a great impact to its selling price, and the price reduction scope that can lead to product is in original cost lattice
45%~65%.At present, in the detection of actual PRINTED FABRIC, manual detection occupies leading position, but there is detection speed relatively
Slow and detect the relatively low problem of success rate, according to statistics, typically artificial detection speed is about 15m/min~20m/min, and artificial
The accuracy of detection is only 60%~70%.Because accuracy rate is relatively low, enterprise's big more options detecting system replaces manually carrying out
Detection, existing most widely used detecting system is i-tex checking system, and high hardware maintenance result in i-tex checking system
Application have received restriction.
On the basis of a series of detection algorithm softwares based on PRINTED FABRIC, PRINTED FABRIC detection method is broadly divided into three
Kind, it is respectively: the PRINTED FABRIC flaw detection method based on statistics, model and spectrum.Statistics-Based Method is: by input figure
It is defined as " energy " as capturing textural characteristics in each image response of each pixel in a window, conci and
The proenca estimation (fd) of fractal dimension to check the fault of input PRINTED FABRIC image, by processing image information, modification
Different boxes counts, and decreases complexity of the calculation to greatest extent, improves work efficiency;But, unique weakness is
Detection flaw has high rate of false alarm and positioning precision is poor.It is can to build similar texture to mate based on the advantage of model method
The texture observed, the cohen of Drexel University of the U.S., submits to (gmrf) detection to spin using Gaussian Markovian at random
Woven fabric, its parameter is derived from indefectible PRINTED FABRIC image and obtained preferable testing result, but this method also have scarce
Point, such as: be difficult to reduce the complexity of input picture analysis it is impossible to realize the quick detection of fabric.Method based on spectrum is suitable for
In the material of random grain, tsai and heish detects the textural defect of directivity with the dft combining, can keep gray scale
Level image local flaw, and delete the information of the grain direction of all of homogeneity and directivity, but it is indefectible to manipulate homogeneity
The related frequency content in region brings tremendous influence may to the frequency content of defect areas.
Many studies demonstrate that, gabor wave filter widely uses in jet recorded matter on fabric defect detection field, in spatial domain and frequency domain
In, there is a unique best located and multiple directions and size.Generally, the Defect Detection side based on gabor function
Method can be divided into two classes: a class is to characterize channel characteristics with a series of gabor wave filter, can draw the inspection of fabric defects
Survey result;Another kind of method is to select optimal gabor wave filter.
Content of the invention
It is an object of the invention to provide a kind of PRINTED FABRIC defect detection method based on gabor wave filter, can improve
Detection efficiency and accuracy in detection.
The technical solution adopted in the present invention is, based on the PRINTED FABRIC defect detection method of gabor wave filter, specifically to press
Implement according to following steps:
Step 1, set up basic gabor wave filter, extract gabor parameter;
Step 2, utilize genetic algorithm, the gabor parameter extracted through step 1 is carried out successively select according to human body gene,
Intersect, make a variation, change the gabor parameter obtaining through step 1;Then the high parameter of selection target function fitness, through intersect and
The mutation operation parameter high to the fitness selected enters line translation, produces fitness highest parameter;
Step 3, the direction θ and mid frequency u of the gabor parameter being selected according to genetic algorithm0, to obtain through step 2
Gabor parameter carries out rotation transformation, after rotation transformation, extracts the textural characteristics letter of effectively indefectible PRINTED FABRIC
Breath;
Step 4, the convolution of gabor filtering of respectively PRINTED FABRIC image to be detected and indefectible PRINTED FABRIC image being carried out
Operation, extracts PRINTED FABRIC grain background information to be detected;
Step 5, the PRINTED FABRIC image to be detected processing through step 4 and indefectible PRINTED FABRIC image are carried out two respectively
Value is processed, and obtains PRINTED FABRIC Defect Detection result.
The feature of the present invention also resides in,
Step 1.1, set up 2-d-gabor filter function, specifically implement in accordance with the following methods:
The 2-d-gabor filter function frequency given sine wave and the direction of rotation respectively set up;2-d-gabor filters
Function is through two-dimensional Gaussian function modulation, is directed to three parameters in spatial domain, and three parameters are respectively (σx, σy)
With direction θ, x and y rotate to x' and y' value, σ with (0, π) scope by direction θxFor 2-d-gabor filter function along x-axis side
Difference, σyFor 2-d-gabor filter function along y-axis variance;
Will be as follows for the 2-d-gabor filter function in two-dimensional space domain:
The 2-d-gabor filter function specific algorithm obtaining after varied is as follows:
G (x, y)=ge(x,y)+jgo(x,y) (2);
Wherein,u0Represent mid frequency;
By 2-d-gabor filter function based on formula (1), in formula (3), the real part of 2-d-gabor filter function is as idol
Symmetrical gabor wave filter is detecting the blur portion of PRINTED FABRIC;In formula (4), the imaginary part of 2-d-gabor filter function is as strange
Symmetrical gabor wave filter, for detecting the marginal portion of PRINTED FABRIC;
Step 1.2, the real part of the 2-d-gabor filter function set up using step 1.1 build gabor wave filter, specifically
Implement in accordance with the following methods:
The real part of the 2-d-gabor filter function set up in step 1.1 is used for carrying out PRINTED FABRIC Defect Detection,
The 2d-gabor filter function algorithm specific as follows of gabor wave filter is implemented:
σy=λ σx(5);
Wherein, t1And t2It is the conversion parameter along x-axis and y-axis respectively, λ is the variance ratio between x-axis and y-axis, 2-d-
Gabor filter function is obtained by rotating and scaling basic gabor function;
Step 1.3, extraction gabor parameter:
Extract gabor parameter from the gabor wave filter constructing through step 1.2, the gabor parameter of extraction is: ω, t1,
t2,λ,θ,u0.
Step 2 is specifically implemented according to following steps:
Step 2.1, the gabor parameter extracting through step 1 is encoded:
In genetic algorithm, the individuality of each genetic algorithm gabor parameter is made up of 48 binary codes;48 ' 0' table
Show that the binary code parameter of minimum is individual;48 ' 1' represents that maximum binary code parameter is individual;Colony represents all ginsengs
Number group of individuals;
Step 2.2, construction object function e:
Object function e in genetic algorithm is the standard of assessment gabor parameter, by 2-d-gabor filter function and standard
The minima of PRINTED FABRIC difference assessing gabor parameter, for determining the gabor parameter of optimum;
Optimum gabor wave filter has the envelope most like with grey level's distribution of indefectible PRINTED FABRIC image,
Meet PRINTED FABRIC texture feature information, in order to construct an optimum gabor wave filter, object function e calculation specific as follows
Method is implemented:
In above formula, im is the indefectible PRINTED FABRIC image of input, and ω is that gabor coefficient is knitted for coordinating indefectible stamp
Dependency between the result of gray value im (x, y) of object image and 2-d-gabor function real part;
During optimizing, variance ratio is limited in [1.0,2.0];Radial frequency has the model of good experimental result
Enclose is [1.9,5.7];The size of the Gaussian envelope window of gabor wave filter is 1;Based on the balance of gabor function, direction θ
Scope be [0, π];
Step 2.3, selection gabor parameter are individual.
Step 2.3 is specifically implemented according to following steps:
Step 2.3.1, initial population:
Initial colony is built by binary code, characterizes gabor parameter ω, t using binary code (0 | 1)1, t2,
λ, θ, u0;
Step 2.3.2, the object function e obtaining through step 2.2, select in initial population, remove object function result
Maximum individuality, will select the individuality obtaining as optimum individual;
Step 2.3.3, gabor parameter forms two individualities, and two individualities are taken advantage of with crossover probability (0,1) and individual lengths
The long-pending crossover location determining is exchanged with each other;
Step 2.3.4, the individuality after step 2.3.3 is intersected, with the product of mutation probability (0,0.1) and individual lengths
The variable position determining enters row variation, the binary code 0 of individual variation position will be changed into 1,1 and be changed into 0:
In initial population, 100 change individuality individual by intersecting with mutation operation, using the result of object function e as choosing
Select the standard of individuality, often execute once selection step, reduce by 20 object function highest parameters individual, until 100 parameters
Individual amount becomes zero, obtains the minimum parameter individuality of object function result, finally will obtain parameter individuality and be converted to decimal scale
Gabor parameter.
The gabor parameter being obtained by genetic algorithm in step 3, is specifically pressed following algorithm and implements:
In above formula, parameter θgaWith parameter u0gaIt is the gabor parameter obtaining from genetic algorithm respectively, in genetic algorithm,
The mid frequency θ of gabor wave filtergaWith direction selection range respectively 1.9 multiple and increased with the multiple of π/6, converted after
The direction θ obtaining and mid frequency u0The gabor wave filter constructing is used for extracting indefectible PRINTED FABRIC grain background information;
The gabor parameter that remaining is obtained by genetic algorithm is directly used in the gabor wave filter of optimum.
The convolution operation method of the gabor filtering in step 4 is specific as follows:
The filtering image amplitude-frequency response of 2-d-gabor wave filter is implemented according to following algorithm:
I (x, y) is input PRINTED FABRIC image, the image i of outputi(x, y) is the PRINTED FABRIC figure after a filtration
Picture, the convolution algorithm that * represents, ge (x, y) and go(x, y) represents real part and the imaginary part of 2-d-gabor filter function respectively;
The real part of 2-d-gabor filter function as PRINTED FABRIC image filter, realize PRINTED FABRIC image filtering by
Following algorithm is implemented:
Step 5.1, before binaryzation is carried out to PRINTED FABRIC image to be detected and indefectible PRINTED FABRIC image, use
PRINTED FABRIC image to be detected after median filter smothing filtering and the noise of indefectible PRINTED FABRIC image generation;
Step 5.2, after step 5.1 Denoising disposal, respectively by the PRINTED FABRIC image to be detected obtaining and indefectible
PRINTED FABRIC image carries out binary conversion treatment, indefectible PRINTED FABRIC is carried out with threshold value determination, threshold value scope, to be detected
PRINTED FABRIC part defective carries out flaw segmentation;
Threshold value determination method, specifically implements in accordance with the following methods:
(1) indefectible PRINTED FABRIC image is selected to obtain the center window w of filter result b (x, y) through step 4;
(2) highest gray value and the lowest gray value of center window w are calculated respectively, using highest gray value as threshold value λmax,
Using lowest gray value as threshold value λmin, specifically implement according to following algorithm:
PRINTED FABRIC flaw dividing method, specifically implements in accordance with the following methods:
PRINTED FABRIC to be detected obtains filtered image b (x, y) through step 4, according to the segmentation threshold λ obtainingmax
With segmentation threshold λminSplit, obtained bianry image d (x, y), specifically obtained according to following algorithm:
If the gray value of PRINTED FABRIC image to be detected, within the threshold range obtaining through step 5.1, is entered as 0,
It is normal fabric region;
If the gray value of PRINTED FABRIC image to be detected, outside the threshold range obtaining through step 5.1, is entered as
255, as flaw fabric extent.
The beneficial effects of the present invention is:
(1) present invention avoids the limitation of gabor parameter based on the PRINTED FABRIC defect detection method of gabor wave filter
Property, so that the gabor wave filter of construction is mated most with PRINTED FABRIC background information;
(2) based in the PRINTED FABRIC defect detection method of gabor wave filter, gabor parameter binary system enters the present invention
Row coding, improves the precision of gabor parameter, makes the gabor wave filter of construction have the extractability of good texture information;
(3) based in the PRINTED FABRIC defect detection method of gabor wave filter, it is flawless that object function passes through standard to the present invention
Defect PRINTED FABRIC, to mate gabor wave filter, obtains gabor wave filter and the PRINTED FABRIC gray scale envelope of gabor parametric configuration
Closest, enable the gabor wave filter of construction to extract maximally effective PRINTED FABRIC to be detected;
(4) present invention, based in the PRINTED FABRIC defect detection method of gabor wave filter, is calculated in the training stage
Excellent gabor parameter ω, t1, t2, λ, θ, u0, by gabor parameter ω, t1, t2, λ, θ, u0The optimal gabor wave filter of construction
The various flaws of corresponding PRINTED FABRIC to be detected can be detected;In detection-phase, the high speed of PRINTED FABRIC defect detection makes it throw
Enter modern technologies industry and provide probability.
Brief description
Fig. 1 is the flow chart of the automatic defect inspection method that the present invention is processed based on graphic image.
Specific embodiment
The present invention is described in detail with reference to the accompanying drawings and detailed description.
The PRINTED FABRIC defect detection method based on gabor wave filter for the present invention, as shown in figure 1, specifically according to following step
Rapid enforcement:
Step 1, set up basic gabor wave filter, extract gabor parameter:
Step 1.1, set up 2-d-gabor filter function, specifically implement in accordance with the following methods:
Set up 2-d-gabor filter function, 2-d-gabor filter function is a complicated exponential function, gives respectively
The frequency of sine wave and the direction of rotation;2-d-gabor filter function is through two-dimensional Gaussian function modulation, is directed to
Three parameters in spatial domain, three parameters are respectively (σx, σy) and direction θ, x and y rotate to x' with (0, π) scope by direction θ
With y' value, σxFor 2-d-gabor filter function along x-axis variance, σyFor 2-d-gabor filter function along y-axis variance;
The 2-d-gabor filter function in two-dimensional space domain is expressed as:
The 2-d-gabor filter function specific algorithm obtaining after formula (1) is changed is as follows:
G (x, y)=ge(x,y)+jgo(x,y) (2);
Wherein,u0Represent mid frequency;
Using formula (1) as the basic 2-d-gabor filter function set up, the 2-d-gabor filtering letter shown in formula (3)
The real part of number to detect the blur portion of PRINTED FABRIC as even symmetry gabor wave filter;2-d-gabor shown in formula (4)
The imaginary part of filter function as odd symmetry gabor wave filter, for detecting the marginal portion of PRINTED FABRIC;
Step 1.2, the real part of the 2-d-gabor filter function set up using step 1.1 build gabor wave filter, specifically
Implement in accordance with the following methods:
The real part of the 2-d-gabor filter function set up in step 1.1 is used for carrying out PRINTED FABRIC Defect Detection, only transports
Extract being mainly due to of PRINTED FABRIC feature: 2-d-gabor filter function with the real part of 2-d-gabor filter function
Imaginary part not only need substantial amounts of calculating, and the effect also for Defect Detection is not significantly improved, therefore gabor filtering
The 2d-gabor filter function algorithm specific as follows of device is implemented:
σy=λ σx(5);
Wherein, t1And t2It is the conversion parameter along x-axis and y-axis respectively, λ is the variance ratio between x-axis and y-axis, 2-d-
Gabor filter function is obtained by rotating and scaling basic gabor function, and specific direction and size are to PRINTED FABRIC defect
Point has powerful power of influence, so it is most important for searching for optimal gabor wave filter in arbitrary direction and size;
Step 1.3, extraction gabor parameter:
Extract gabor parameter from the gabor wave filter constructing through step 1.2, the gabor parameter of extraction is: ω, t1,
t2,λ,θ,u0;
Gabor parameter ω, t1,t2,λ,θ,u0, determine gabor wave filter shape, the centre coordinate of gabor wave filter and
The envelope window of gabor wave filter, thus determining the filtering performance of gabor wave filter, is the important ginseng of construction gabor wave filter
Number.
Step 2, utilize genetic algorithm, the gabor parameter extracted through step 1 is carried out successively select according to human body gene,
Intersect, make a variation, change the gabor parameter obtaining through step 1;Then the high parameter of selection target function fitness, through intersect and
The mutation operation parameter high to the fitness selected enters line translation, generation fitness highest parameter:
Step 2.1, the gabor parameter extracting through step 1 is encoded:
In genetic algorithm, the individuality of each genetic algorithm gabor parameter is made up of 48 binary codes;48 ' 0' table
Show that the binary code parameter of minimum is individual;48 ' 1' represents that maximum binary code parameter is individual;Colony represents all ginsengs
Number group of individuals;
Step 2.2, construction object function e:
Object function e in genetic algorithm is the standard of assessment gabor parameter, by 2-d-gabor filter function and standard
The minima of PRINTED FABRIC difference, to assess gabor parameter, so can make the envelope of gabor wave filter and the information of PRINTED FABRIC
Distribution tends to closest, for determining the gabor parameter of optimum, is finally reached effective extraction PRINTED FABRIC texture feature information
Purpose;
Optimum gabor wave filter has the envelope most like with grey level's distribution of indefectible PRINTED FABRIC image,
To meet PRINTED FABRIC texture feature information, in order to construct an optimum gabor wave filter, object function e is specific as follows
Algorithm is implemented:
In formula (6), im is the indefectible PRINTED FABRIC image of input, and ω is gabor coefficient for coordinating indefectible stamp
Dependency between the result of gray value im (x, y) of textile image and 2-d-gabor function real part;
During optimizing, variance ratio is limited in [1.0,2.0];Radial frequency has the model of good experimental result
Enclose is [1.9,5.7];The size of the Gaussian envelope window of gabor wave filter is 1;Based on the balance of gabor function, direction θ
Generally scope is [0, π];
Step 2.3, selection gabor parameter are individual, specifically implement according to following steps:
Step 2.3.1, initial population:
Initial colony is built by binary code, characterizes gabor parameter ω, t using binary code (0 | 1)1, t2,
λ, θ, u0So that selection, intersection, mutation operation are conveniently;
Step 2.3.2, the object function e obtaining through step 2.2, select in initial population, remove object function result
Maximum individuality, will select the individuality obtaining as optimum individual;
Step 2.3.3, gabor parameter forms two individualities, and two individualities are taken advantage of with crossover probability (0,1) and individual lengths
The long-pending crossover location determining is exchanged with each other;
Step 2.3.4, the individuality after step 2.3.3 is intersected, with the product of mutation probability (0,0.1) and individual lengths
The variable position determining enters row variation, the binary code 0 of individual variation position will be changed into 1,1 and be changed into 0:
In initial population, 100 change individuality individual by intersecting with mutation operation, using the result of object function e as choosing
Select the standard of individuality, often execute once selection step, reduce by 20 object function highest parameters individual, until 100 parameters
Individual amount becomes zero, obtains the minimum parameter individuality of object function result, finally will obtain parameter individuality and be converted to decimal scale
Gabor parameter.
Step 3, the direction θ and mid frequency u of the gabor parameter being selected according to genetic algorithm0, to obtain through step 2
Gabor parameter carries out rotation transformation, and after specific rotation transformation, the texture extracting effectively indefectible PRINTED FABRIC is special
Reference ceases:
The gabor parameter being obtained by genetic algorithm, is specifically pressed following algorithm and implements:
The purpose of operation is to adapt to PRINTED FABRIC texture feature information, realizes Defect Detection;
In formula (7), parameter θgaWith parameter u0gaIt is the gabor parameter obtaining from genetic algorithm respectively, in genetic algorithm,
The mid frequency θ of gabor wave filtergaIncrease with the multiple of direction selection range difference 1.9 with the multiple of π/6, through formula
(7) the direction θ being converted to and mid frequency u0The gabor wave filter constructing is used for extracting indefectible PRINTED FABRIC texture
Background information;The gabor parameter that remaining is obtained by genetic algorithm is directly used in the gabor wave filter of optimum.
Step 4, the convolution of gabor filtering of respectively PRINTED FABRIC image to be detected and indefectible PRINTED FABRIC image being carried out
Operation, extracts PRINTED FABRIC grain background information to be detected, and the convolution operation method of gabor filtering is specific as follows:
The filtering image amplitude-frequency response of 2-d-gabor wave filter is implemented according to following algorithm:
I (x, y) is input PRINTED FABRIC image, the image i of outputi(x, y) is the PRINTED FABRIC figure after a filtration
Picture, the convolution algorithm that * represents, ge (x, y) and go(x, y) represents real part and the imaginary part of 2-d-gabor filter function respectively;
In the present invention, the real part of 2-d-gabor filter function, as PRINTED FABRIC image filter, realizes PRINTED FABRIC
Image filtering is pressed following algorithm and is implemented:
Step 5, the PRINTED FABRIC image to be detected processing through step 4 and indefectible PRINTED FABRIC image are carried out two respectively
Value is processed, and obtains PRINTED FABRIC Defect Detection result;
Step 5.1, before binaryzation is carried out to PRINTED FABRIC image to be detected and indefectible PRINTED FABRIC image, in order to
Mitigate various noises, with the PRINTED FABRIC image to be detected after median filter smothing filtering and indefectible PRINTED FABRIC image
The noise producing;
Step 5.2, after step 5.1 Denoising disposal, respectively by the PRINTED FABRIC image to be detected obtaining and indefectible
PRINTED FABRIC image carries out binary conversion treatment, indefectible PRINTED FABRIC is carried out with threshold value determination, threshold value scope, to be checked
Survey PRINTED FABRIC part defective and carry out flaw segmentation;
Indefectible PRINTED FABRIC image obtains filter result b (x, y) after step 4 process, by the maximum of filter result
Value and minima, respectively as max-thresholds and minimum threshold, form a threshold range;
Threshold value determination method, specifically implements in accordance with the following methods:
(1) indefectible PRINTED FABRIC image is selected to obtain the center window w of filter result b (x, y) through step 4;
(2) highest gray value and the lowest gray value of center window w are calculated respectively, using highest gray value as threshold value λmax,
Using lowest gray value as threshold value λmin, specifically implement according to following algorithm:
PRINTED FABRIC flaw dividing method, specifically implements in accordance with the following methods:
PRINTED FABRIC to be detected obtains filtered image b (x, y) through step 4, according to the segmentation threshold λ obtainingmax
With segmentation threshold λminSplit, obtained bianry image d (x, y), specifically obtained according to following algorithm:
If the gray value of PRINTED FABRIC image to be detected, within the threshold range obtaining through step 5.1, is entered as 0,
It is normal fabric region;
If the gray value of PRINTED FABRIC image to be detected, outside the threshold range obtaining through step 5.1, is entered as
255, as flaw fabric extent.
In the result of PRINTED FABRIC defect detection, false alarm (fa) the i.e. white portion of binary result image comprises phase
Defect area in the textile image answered, and comprise to occupy all result of the tests away from others white portion defective
5%.
In detection PRINTED FABRIC and greige goods fabric, the correct verification and measurement ratio of fabric defects reaches 95%.
The principle of the PRINTED FABRIC defect detection method based on gabor wave filter of the present invention and advantage:
The parameter that the PRINTED FABRIC defect detection approach application based on gabor wave filter for the present invention is selected constructs optimum
Gabor wave filter solving the problems, such as defect detection, in object function, indefectible PRINTED FABRIC image supervision gabor filtering
Device, genetic algorithm reaches the minima of object function, thus finding suitable parameter to generate the gabor wave filter of optimum;Profit
With optimum gabor wave filter texture feature extraction, thus detection obtains PRINTED FABRIC fault, the performance of gabor wave filter according to
Rely in parameter, and parameter is automatically selecting based on genetic algorithm, it is proposed that fabric defects detect on the basis of this idea
New method.
The present invention includes training part and Defect Detection part based on the automatic defect inspection method that graphic image is processed,
Escofet employs multiple dimensioned and multidirectional gabor wave filter and carries out fabric defects detection, and this proves a large amount of gabor filtering
The feature that device extracts can describe cloth textured feature.The shortcoming of said method is to be led to huge using substantial amounts of wave filter
Computation burden, thus stop effectively implement in real time;The present invention based on graphic image process automatic defect inspection method with
The method of escofet is compared, and realizes the little successful Defect Detection with pattern fabric of Defect Detection amount of calculation.
Embodiment:
Input indefectible PRINTED FABRIC image first, 100 parameters are individual to substitute into object function, removes object function the most every time
High 20 are individual, then individuality intersected, variation, then substitute into object function, selected, cross and variation, until parameter
Individuality is changed into 0, preserves object function minimum parameter individual;The parameter obtaining individuality is converted to decimal number, then by center
Frequency and direction are changed, and the parameter obtaining is substituted into gabor wave filter, first indefectible PRINTED FABRIC image is filtered
Ripple, obtains maximum gradation value and the minimum gradation value of filtering rear center window, using maximum gradation value and minimum gradation value as
Big threshold value and minimum threshold, then PRINTED FABRIC image to be measured is filtered, according to the threshold value obtaining, to testing image two-value
Change, obtain PRINTED FABRIC defect detection result.