CN107945164B - Textile flaw detection method based on peak threshold, rotational alignment and composite character - Google Patents

Textile flaw detection method based on peak threshold, rotational alignment and composite character Download PDF

Info

Publication number
CN107945164B
CN107945164B CN201711188161.8A CN201711188161A CN107945164B CN 107945164 B CN107945164 B CN 107945164B CN 201711188161 A CN201711188161 A CN 201711188161A CN 107945164 B CN107945164 B CN 107945164B
Authority
CN
China
Prior art keywords
map grid
value
index
image
calculates
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
CN201711188161.8A
Other languages
Chinese (zh)
Other versions
CN107945164A (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.)
Changzhou University
Original Assignee
Changzhou University
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 Changzhou University filed Critical Changzhou University
Priority to CN201711188161.8A priority Critical patent/CN107945164B/en
Publication of CN107945164A publication Critical patent/CN107945164A/en
Application granted granted Critical
Publication of CN107945164B publication Critical patent/CN107945164B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06T7/001Industrial image inspection using an image reference approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • 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/20Special algorithmic details
    • G06T2207/20048Transform domain processing
    • G06T2207/20061Hough transform
    • 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
    • G06T2207/30124Fabrics; Textile; Paper

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Probability & Statistics with Applications (AREA)
  • Quality & Reliability (AREA)
  • Other Investigation Or Analysis Of Materials By Electrical Means (AREA)
  • Image Analysis (AREA)

Abstract

The present invention provides a kind of textile flaw detection method based on peak threshold, rotational alignment and composite character, this method analyzes the Pixel of Digital Image grayscale information based on textile surface flat under lighting source, divide the image into the grid not overlapped, calculate the IRM of each grid, HOG, GLCM and Gabor characteristic value are automatically positioned textile surface flaw according to feature Distribution value.The present invention is especially suitable for the textile surface flaws being automatically identified in the textile flat surfaces gray-scale image acquired under steady illumination light source.

Description

Textile flaw detection method based on peak threshold, rotational alignment and composite character
Technical field
The present invention relates to textile Defect Detection technical fields, are based on peak threshold, rotational alignment more particularly to one kind With the textile flaw detection method of composite character.
Background technique
Traditional textile flaw manual identified accuracy rate only have 60-75% (referring to document: K.Srinivasan, P.H.Dastoor,P.Radhakrishnaiah,et al..FDAS:a knowledge-based framework for analysis of defects in woven textiles tructures,J.Text.Inst.83(1992)431– 448.), the method for machine automatic identification textile flaw has practical application request.The digital picture of flat textile surface is adopted Sample (hereinafter referred to as textile images) belongs to 2 d texture, and 2 d texture has been demonstrated can be according to 17 kinds of wallpaper group (wallpaper Group the pattern arrangement method) defined generates (referring to document: H.Y.T.Ngan, G.K.H.Pang, N.H.C.Yung.Motif- based defect detection for patterned fabric,Pattern Recognit.(2008)1878– 1894.), for generate the pattern of 2 d texture be known as map grid (lattice) (referring to: https: //en.wikipedia.org/ Wiki/Wallpaper_group), pattern is known as motif inside map grid.Most textile flaw automatic detection methods can only be located Manage wallpaper group in p1 type textile images (referring to document: H.Y.T.Ngan, G.K.H.Pang, N.H.C.Yung.Automated fabric defect detection—Areview,Image and Vision Computing 29 (7) (2011) 442-458.), only a few methods can handle other than p1 type textile images (referring to Document: H.Y.T.Ngan, G.K.H.Pang, N.H.C.Yung.Motif-based defect detection for Patterned fabric, Pattern Recognit. (2008) 1878-1894.), such as the benchmark based on wavelet pretreatment Image difference method (wavelet-pre-processed golden image subtraction, hereinafter referred to as WGIS) (ginseng See document: H.Y.T.Ngan, G.K.H.Pang, N.H.C.Yung, et al., Wavelet based methods on Patterned fabric defect detection, Pattern Recognit.38 (4) (2005) 559-576.), symbiosis Matrix method is (referring to document: C.J.Kuo, T.Su, Gray relational analysis for recognizing Fabric defects, Text.Res.J.73 (5) (2003) 461-465.), cloth forest belt method (Bollinger bands, with Lower abbreviation BB) (referring to document: H.Y.T.Ngan, G.K.H.Pang, Novel method for patterned fabric Inspection using bollinger bands, Opt.Eng.45 (8) (2006) 087202-1-087202-15.), rule Band method (regular bands, hereinafter referred to as RB) is (referring to document: H.Y.T.Ngan, G.K.H.Pang, Regularity analysis for patterned texture inspection,IEEE Trans.Autom.Sci.Eng.6(1)(2009) 131-144.), Elo appraisal procedure (Elo rating method, hereinafter referred to as ER) (referring to document: C.S.C.Tsang, H.Y.T.Ngan,G.K.H.Pang,Fabric inspection based on the Elo rating method, Pattern Recognit.51 (2016) 378-394.) etc..Although these methods can handle the textile images other than p1, But their calculation method is built upon on the pattern (hereinafter referred to as map grid) of the similar lattice based on artificial selection more.Such as WGIS requires the size and texture of artificial selection map grid, and BB, RB and ER require the size of Manual definition's map grid.These priori knowledges The degree of automation of machine recognition textile flaw is reduced to a certain extent.
Summary of the invention
The technical problems to be solved by the present invention are: in order to improve the degree of automation of machine recognition textile flaw, this Invention provides a kind of textile flaw detection method based on peak threshold, rotational alignment and composite character, and main includes design A kind of automatic segmentation textile images be the method for map grid and based on map grid and hybrid feature extraction method HOG, GLCM and The flaw recognition methods that Gabor is combined.
It is cheer and bright to make to state, existing centralized definition partial symbols according to the present invention and concept.
Indicate Positive Integer Set.Indicate the integer set including zero.Indicate the positive real number set including zero.Table Show the real number set including zero.Indicate that element number isReal vector.Indicate plural number set.Indicate element Number isComplex vector.T representing matrix or vector transposition.Indicate the real matrix of n × m size, wherein Indicate k × n × m size real matrix, whereinIfAndThen Ai,:Indicate square The i-th row of battle array A, A:,jThe jth of representing matrix A arranges.
IfAndThen Al,:,:Indicate the l layer matrix that size is n × m in A, Al,i,:Table Show the i-th row of the l layer matrix that size is n × m in A, Al,:,jIndicate the jth column for the l layer matrix that size is n × m in A.
Indicate ratioSmall maximum integer, such as
{aiIndicate by index i determine by element aiThe set or multiset of composition.
| S | indicate the element number in set S, if S is vector, | S | indicate element number contained by vector, | S | it is known as Vector length.
Avg (S) or mean (S): the mean value of set of computations or multiset S, the element of S are real number.
Std (S): the standard deviation of set of computations or multiset S, the element of S are real number.Med (S): set of computations is more Collect the median of S again, the element of S is real number.Mod (S): the mode of multiset S is calculated, the element of S is real number.max(S) Set or the element maximum value of multiset S, such as max (I are found out in expressionc) represent IcThe maximum gradation value of middle pixel.Max (s " item Part) indicate find out it is qualifiedMaximum value.Set or the element minimum value of multiset S, example are found out in min (S) expression Such as min (Ic) represent IcThe minimum gradation value of middle pixel.
arg maxsF (s) is indicated in the value range of the domain internal variable s of function f, so that function f (s) takes maximum The s of value.
arg minsF (s) is indicated in the value range of the domain internal variable s of function f, so that function f (s) takes minimum The s of value.
arg maxsf1(s),f2(s) it indicates in function f1And f2Domain intersection internal variable s value range in so that Function f1(s) and f2(s) s being maximized.
argIndicate the domain internal variable s in function f (s)1And s2Value range in so that function f (s) s being maximized1And s2
arg modi({ai) indicate corresponding multiset { aiMode mod ({ ai) index.
dimx(I) total line number of two-dimensional image I, dim are indicatedy(I) total columns of I is indicated.
Image origin: the position that pixel column column index starts in image, the hypothesis on location is in the image upper left corner and value is (1,1)。
I (x, y) indicates the pixel value with ranks index (x, y) in two-dimensional image I.Line indexBy image original Point starts to be incremented by downwards with 1 for step-length, 1≤x≤dimx(I);Column indexBy image origin with 1 for step-length to the right It is incremented by, 1≤y≤dimy(I)。
Image boundary: there is line index dimx(I) row and column indexes dimy(I) column.
Textile images cartoon ingredient Ic: to the textile images of a width gray processing, using based on Qu Bo (curvelet) With the anatomic element analysis method of discrete cosine transform (local discrete cosine transform, hereinafter referred to as DCT) (morphological component analysis, hereinafter referred to as MCA) image calculated with smooth edge pattern Referred to as cartoon ingredient Ic, IcIt is a width gray level image.
DCT size: MCA is divided an image into first in image local application DCT and is not overlapped and has fixed size Then DCT is applied to each region in rectangular area, the size of rectangular area is known as DCT size, and unit is pixel, one in region Capable pixel number is known as the width of DCT size, and the pixel number of a column is known as the height of DCT size.
Threshold coefficient fc: it is used for binaryzation IcParameter, which is calculated by step 2.
Binaryzation cartoon ingredient Itc: use fc·max(Ic) it is used as threshold binarization IcObtained bianry image, wherein 1 Indicate foreground pixel, i.e. IcMiddle gray value is not less than the pixel of threshold value, and 0 indicates background pixel.ItcWith IcLine number and columns phase Together.
Transverse projection It isMultiset, wherein1≤k ≤dimy(I), i.e.,Indicate that line index is the background pixel number of x.
Longitudinal projection It isMultiset, wherein1≤l ≤dimx(I), i.e.,Indicate that column index is the background pixel number of y.
It indicatesPeak value multiset,In element be known as peak value, peak value refers toMiddle satisfaction WithElementWherein x indicates line index.
It indicatesPeak value multiset,In element be known as peak value, peak value refers toMiddle satisfactionWithElementWherein y indicates column index.
Two value object mass centers: ItcIn the included foreground pixel image line index of two value objects average value and column index it is flat Mean value.
It indicates to be linked in sequence by operand and generates vector, such as scalar v1=1 and vector v2=[2 3]T,For scalar s1=8, s2=1, s3=5,For vector v1=[2 3]T, v2=[5 0 4]T,
It indicates by element vector multiplication, such as vector v1=[5 0.9 4]T, v2=[1 0 1]T, then
Wherein
Map grid indexes (ir,ic): after image segmentation is nonoverlapping map grid, according to the arrangement position of map grid in the picture, Each map grid has unique map grid line index irWith unique map grid column index ic, in image upper left corner map grid index for (1, 1) it is, (1,2) close to the right side map grid index of the map grid, is (2,1) close to the downside map grid index that index is (1,1) map grid, The rest may be inferred.Indicate that map grid index is (ir,ic) map grid, wherein L1,1Referred to as first map grid.
Map grid pixel index: map grid is made of pixel, therefore map grid is a sub-picture, image origin and pixel column column index Definition be also applied for map grid pixel index.
Map grid size: number of lines of pixels and columns contained by map grid.
Map grid texture type: the type of map grid texture is generated based on map grid segmentation and textile gray level image, such as Fig. 9 institute Show, image placed in the middle produces 5 × 7 map grids according to map grid segmentation, and according to the texture of map grid, 35 map grids can be divided into 3 classes.
Map grid matrix: the matrix as unit of map grid, i.e., each element is a map grid in matrix.As shown in Figure 10, Each image includes 2 × 2 map grid, and corresponding one 2 × 2 map grid matrix, i.e., element index is identical as map grid index in matrix.
Eigenmatrix: using feature extracting method calculate map grid matrix in each element feature vector, with feature to Amount is that unit forms matrix, i.e., each element is the feature vector of a map grid in matrix, and element index is right with it in matrix Index of the map grid answered in map grid matrix is identical.
Training sample set: N sub-picture I1,I2…INResolution ratio it is identical, all images according to map grid segmentation generate map grid Texture type and its quantity is all identical and arrangement angle is 0 °, if map grid texture species number isAnd do not consider that shape is abnormal Change and illumination variation etc. influence under the factor of image sampling, the i-th sub-picture IiIn map gridWithWithTexture is identical and L1,1, L2,1…Lt,1Texture be all different, whereinSuch as attached fourth officer shown in Fig. 10 Image I1, I2, I3And I4Divided according to map grid, each image generates 4 map grids, and the map grid of four sub-pictures only has 2 kinds of texture classes Type, and arrangement mode is all satisfied above-mentioned condition.IiReferred to as training sample.
Test sample collection: similar with training sample set, all image resolution ratios are identical, and the figure generated according to map grid segmentation Check manages type and its quantity is all identical, consistent described in arrangement mode and the training sample set definition of each image map grid, Unlike training sample set, the image that test sample is concentrated contains position at random and texture is not belonging to map grid texture type Irregular area, the region are defined as flaw.The image that test sample is concentrated is known as test sample.
Feature extracting method title ordered set T: feature extracting method f is indicated1, f2…f|T|Name set, such as T= { HOG, LBP }, then | T |=2 and f1Indicate HOG method, f2Indicate LBP method.
maxx(a) it indicates in the set a comprising ranks index (x, y), the maximum value of line index x.minx(a) indicate include Ranks index in the set a of (x, y), the minimum value of line index x.maxy(a) it indicates in the set a comprising ranks index (x, y), The maximum value of column index y.miny(a) it indicates in the set a comprising ranks index (x, y), the minimum value of column index y.
It indicates according to transverse projectionThe entropy that the background pixel number for including calculates.It indicates according to transverse projectionInclude Background pixel number calculate entropy.Entropy threshold exIndicate the flawless textile gray level image for being 0 ° according to a group picture lattice arrangement angle It calculatesThe integer part of mean value.Entropy threshold eyIndicate the flawless textile grayscale image for being 0 ° according to a group picture lattice arrangement angle As calculatingThe integer part of mean value.
On the basis of being as defined above, the technical solution adopted by the present invention to solve the technical problems is: one kind being based on peak It is worth the textile flaw detection method of threshold value, rotational alignment and composite character, including two stages: training stage and test rank Section.Training stage is according to a series of indefectible textile images (hereinafter referred to as flawless image) segmentation map grids and calculates flaw identification Required parameter;The parameter that test phase is obtained according to the training stage carries out map grid segmentation to a secondary textile images and judges map grid It whether include flaw, finally label contains map grid defective.Inventive method assumes that textile images have a characteristic that relatively In the row and column of textile images, map grid is transversely arranged according to the direction of image line, and by the direction longitudinal arrangement of column;MCA's Cartoon ingredient IcIn, map grid have geometry and and background pixel there were significant differences in gray scale.
Training stage includes three steps: the segmentation of step 1 training sample map grid, step 2 calculate threshold coefficient and entropy threshold, Step 3 calculates test phase parameter.Test phase includes three steps: step 4 image calibration, step 5 test sample map grid point It cuts and is identified with step 6 flaw.
The segmentation of step 1 training sample map grid.For a training sample, using morphology component analyzing method (MCA, out From document Jia L., Liang J., Fabric defect inspection based on isotropic lattice Segmentation, Journal of the Franklin Institute 354 (13) (2017) 5694-5738) calculate instruction Practice sample cartoon ingredient Ic, use threshold value fc·max(Ic) binaryzation IcObtain bianry image Itc, by Moore-Neighbor with (Moore-Neighbor tracing algorithm comes from document Jia L., Liang J., Fabric defect to track algorithm inspection based on isotropic lattice segmentation,Journal of the Franklin Institute 354 (13) (2017) 5694-5738) obtain ItcThe closure edge of middle object.There is closure edge for each Object, find out the object ranks index extreme value, if the absolute value of the difference of the object line index extreme value is more than 0.75 dimx(Itc) or the absolute value of the difference of column index extreme value be more than 0.75dimy(Itc), then from ItcMiddle deletion object.Statistics ItcThe background pixel number of every row and each column, index in rows and columns arrange the cross that background pixel number constitutes background pixel respectively To projectionAnd longitudinal projectionWithPeak value be denoted as multiset respectivelyWithIt is rightWithAdaptive K- is applied respectively Mean algorithm (Adaptive K-means) algorithm (Jia L., Liang J., Fabric defect inspection based on isotropic lattice segmentation,Journal of the Franklin Institute 354(13) (2017) 5694-5738, hereinafter referred to as self-adaption cluster algorithm) it is clustered, cluster centre saves as multiset respectivelyWith WithIt is possible that the minimum value in these close cluster centres is selected as threshold respectively comprising multiple similar cluster centres ValueWith In be not less thanPeak value press corresponding line index, be denoted as S 'hIn be not less thanPeak Value presses corresponding column index, is denoted as S 'v.For S 'h, by S 'hMiddle element does ascending order arrangement, and the multiset of line index spacing is fixed Justice is Multiset with the continuous stable line space of line indexIt is fixed Justice is as follows.
Wherein xi∈S′h, i is the continuous positive integer of numerical value.As map grid boundary set ShInitial value, be defined as follows.
Similarly, it can calculate And SvIt is initial Value, is defined as follows.
According to ideal line numberWith ideal columnsWhereinWithRespectively Indicate that there are most elementsWithTo ShAnd SvIt is extended, it may be assumed that from min (Sh) start, with step-lengthTo ItcLine index Minimum value 1 is mobile, that is, calculatesIt checks forMeetIf there is x ', then x ' is added to Sh, x is otherwise added to ShAnd keep ShMiddle element ascending order arrangement, again It calculatesAnd it repeats the above steps;Similarly, from max (Sh) start, with step-lengthTo ItcLine index maximum value dimx(Ic) mobile, that is, it calculatesIt checks forMeetIf there is x ', then x ' is added to Sh, x is otherwise added to Sh, calculate againLay equal stress on Multiple above-mentioned steps.To SvWith step-lengthDo similar extension.According to ShWith SvThe row and column index separately included, can be by IcBy this Row and column where a little indexes is split, and is divided resulting region and is defined as map grid, is defined as follows.
Wherein1≤ir≤|Sh| -1 and 1≤ic≤|Sv| -1, therefore IcBe partitioned into (| Sh|-1)·(|Sv | -1) it is aAnd irAnd icIt is respectivelyRow and column index as unit of map grid.
Step 2 calculates threshold coefficient and entropy threshold.For training sample set I1,I2…INWith a f of N 'cSelectable value c1, c2…cN′, according to wherein any training sample Ii(i=1,2 ... N) can calculate a ideal line number of N ' by step 1With A ideal columns of N 'Wherein l=1,2 ... N '.In IiMultisetAnd multisetMiddle appearance F corresponding to the most elements of numbercValue be denoted as c respectivelyh(i, l) and cv(i, l) is defined as follows.
For IiIf ch(i, l) and cv(i, l) is identical, then respective index (i, l) is stored in setIn,Definition such as Under.
For eachI.e. for IiIf at least there is a l ' makes ch(i,l′)≡cv(i, l ') set up, then with med({cl) apart from nearest ch(i, l ') participates in fcCalculating, fcIt is defined as follows.
Wherein chThe index of (i, l)Expression, which takes, to be metI value in definition.For training sample set I1, I2…INIn the i-th width image Ii, it is f according to parametercThe calculated I of step 1iTransverse projectionAnd longitudinal projectionIt calculates separatelyEntropyWithEntropyFor all training samplesWithThe integer part of the mean value of these entropys is taken to obtain threshold respectively Value exAnd ey
Step 3 calculates test phase parameter.The step specifically includes the following three steps: step 3.1 calculates the map grid period; The ideal statistical value of step 3.2 calculating each feature of map grid;Step 3.3 calculates the ideal statistical value threshold value of each feature.
Step 3.1 calculates the map grid period.For training sample set I1,I2…INInA instruction Practice sample Ii, according to step 2 threshold coefficient calculated to IiS can be obtained by repeating step 1hAnd Sv, according to ShAnd SvBy IiIt is divided into m × n map grid (m=| Sh| -1, n=| Sv|-1).I is calculated using HOG feature extracting methodiMap gridFeature vector and make It is identical that feature vector indexes corresponding map grid index.It calculatesWith i-thrThe Euclidean distance of all map grids in row, by calculating The column index ascending order of involved map grid arranges, then may make up distance vector.ForIt willCorresponding distance vector presses icIt rises Sequence arranges to obtain i-thrCapable n × n distance matrix.ForBy i-thrCorresponding n × n the distance matrix of row presses irAscending order arranges To IiRow distance matrixSimilarly, I can be calculatediColumn distance matrixTo vector(1≤l1≤ m, 1≤l3≤ n) Fourier transform is carried out, it obtainsPeriod and frequency spectrum.According to(With) period and frequency spectrum, calculating cycle median and frequency spectrum median, i.e. image line period and image line frequency spectrum.It is similar Ground can construct IiColumn distance matrixAnd calculate image column period and image column frequency spectrum.According to I1,I2… IN, N number of image line period and corresponding N number of image line frequency spectrum can be calculated, image line frequency spectrum median is calculatedIt finds out and is higher than Image line frequency spectrum corresponding to the image line period, calculate the median in these image lines periodTo image column period and image Column frequency spectrum repeats same steps and obtains image column frequency spectrum medianWith image column period medianIfOrOrThen t value is 1, otherwise by comparingWithCorresponding frequency spectrum size determines the value of t, it may be assumed that ifThen T takesOtherwise t takes
The ideal statistical value of step 3.2 calculating each feature of map grid.The step includes four sub-steps: step 3.2.1 is calculated Characteristic statistics value, step 3.2.2 calculate the sequence of characteristic statistics value, and step 3.2.3 calculates invariant feature element, step 3.2.4 meter Calculate ideal statistical value.
Step 3.2.1 calculates characteristic statistics value, calculates training sample set I according to step 3.11,I2…INMap grid period t. For i-th of training sample Ii, I is divided according to step 2iObtain map gridPass through | T | it is a that (T is characterized extracting method title Ordered set) input is 2-D gray image matrix and output is the feature extracting method f of one-dimensional real vector1, f2…f|T|It calculates IiMap gridFeature vectorBased on fjFeature vector length be defined as fjSpy Levy first prime number Fj.According to assumed condition and map grid period t, IiIn map gridWith WithLine Manage identical and L1,1, L2,1…Lt,1Texture be all different, whereinTherefore there are the different map grid of t class texture and Kth (1≤k≤t) class map grid is i-thrCapable and (ir+l1T) column index of row is identical, therefore the identical kth of column index Class map grid can index ascending order by ranks and form map grid matrix.For kth class map grid, at most there is t map grid Matrix C1,C2…Ct, According to the map grid of composition map grid matrix, kth class map grid is calculated by following formula and is based on fjIiCharacteristic statistics valueWith
WhereinIndicate that map grid L is i-thtA map grid matrixArbitrary element,It indicates Based on fjMap grid matrixI-th in the feature vector of middle all elements (map grid)FThe multiset of a element (real number), whereinAnd 1≤iF≤Fj, when opt is replaced with mean, std, max or min, thenDefinition is correspondingWith
Step 3.2.2 calculates the sequence of characteristic statistics value.Calculate training sample I1,I2…INBetween be based on fj'sEurope Formula distance average d (j) is defined as follows.
For f1, f2…f|T|, it can obtain corresponding d (1), d (2) ... d (| T |).It is special for kth class map grid texture and j-th Levy extracting method fj(i.e. fixed indices k and j), according to I1,I2…IN, step 3.2.1 can produce N number ofUsing clustering algorithm To N number ofIt is clustered, clustering algorithm classification parameter is set as t, obtains t class centerForCalculate according to the following formula fromClass label u corresponding to nearest class center*
IfWhereinIt indicates in the classification in the classification of t clustering algorithm generation with most element numbers The heart then exchanges characteristic statistics value determined by index (i, j, k) and index (i, j, k*) determined by characteristic statistics value, wherein k* It is defined as follows.
For indexing all fixed Combinations of k and j, for eachIt repeats above-mentionedu*WithCalculating and judgementIt is whether true, k is repeated if setting up*Calculating and exchange determined by index (i, j, k) Characteristic statistics value and index (i, j, k*) determined by characteristic statistics value.According to the definition of d (j), training sample I is calculated again1, I2…INBetween be based on fj'sEuclidean distance average value, obtain corresponding f1, f2…f|T|D ' (1), d ' (2) ... d ' (| T |).If d (j) >=d ' (j) forIt all sets up, then retains the exchange of features described above statistical value as a result, otherwise arranging characteristic statistics value Sequence is restored to the state at the end of step 3.2.1.
Step 3.2.3 calculates invariant feature element.For kth class map grid texture and j-th of feature extracting method fjIt is (i.e. solid Standing wire draws k and j), according to above-mentioned steps and I1,I2…INWhat is calculated is N number ofI-thF(1≤iF≤Fj) a elementWithI-thFA elementKth class map grid texture can be calculated and be based on fjFeature vector i-thFA member The stationary value s of element(j,k)(iF), it is defined as follows.
By s(j,k)(iF) by index iFAscending order arrangement then obtains kth class map grid texture and is based on fjStationary value vector s(j,k)。 If parameter nfPredefined minimal characteristic vector length is indicated, then working as nf<FjWhen establishment, using self-adaption cluster algorithm pair s(j,k)(1), s(j,k)(2)…s(j,k)(Fj) clustered, if the classification that self-adaption cluster algorithm is generated by since 1 just Integer number consecutively, i-thFA stationary value s(j,k)(iF) generic number be denoted as Ls(iF), then these number definition set Ls。 If defining parameter preset minimal characteristic numberThen kth class map grid texture is based on fjFeature vector i-thFThe stabilization of a element PropertyIt is defined as follows.
Indicate the preceding n for arranging the classification that self-adaption cluster algorithm generates by its number of elements descendingfA classification Number set.It willBy index iFAscending order arrangement then obtains kth class map grid texture and is based on fjStability vectorIt is right In all fixed Combinations of index k and j, repeat above-mentionedCalculating.
Step 3.2.4 calculates ideal statistical value.For kth class map grid texture and j-th of feature extracting method fjIt is (i.e. fixed K and j) is indexed, according to above-mentioned steps and I1,I2…INIt can calculateWithBy adaptively gathering Class algorithm, can be to vector It is clustered, if self-adaption cluster is calculated The classification that method generates is by the positive integer number consecutively and i-th of vector since 1Generic number is denoted asThen these number definition setFor A classification, kth class Map grid texture is based on fjIdeal statistical valueIt is defined as follows.
Expression belongs to kth class map grid texture and is based on fjI-thuIn the characteristic statistics value of a subclass map grid texture The average value of value.For indexing all fixed Combinations of k and j, repeat above-mentionedCalculating.
Step 3.3 calculates the ideal statistical value threshold value of each feature.According to training sample set and above-mentioned steps, it can calculate and be based on J-th of feature extracting method fjKth class map grid texture i-thuThe ideal statistical value of a subclass map grid textureIt is (i.e. fixed Index j, k and iu).For any map grid L that any training sample is generated by step 2, according to its feature vector fj(L) as the following formula It calculates ideal statistical value and indexes k*With
ForThere may be multiple L, its ideal statistical value index meets k*=k andThese map grids composition collection It closesWhenWhen establishment, the kth class map grid texture based on j-th of feature extracting method can be calculated as follows I-thuThe maximum distance of a subclass map grid textureI.e. ideal statistical value threshold value.
For indexing j, k and iuAll fixed Combinations, repeat it is above-mentionedCalculating.
Step 4 gamma correction.The test sample I unknown for map grid arrangement angle, uses Canny edge detection method meter Calculate I edge, using Hough transform by edge projection into parameter space, take preceding n in parameter spaceθCorresponding to a peak value The angle, θ of straight slope rotates I according to taken θ, obtains nθA rotation image, according to each rotation imageWithIt calculates WithIt takesWithThe corresponding angle of middle maximum valueI is rotatedObtain final calibration result.
The segmentation of step 5 test sample map grid.To the calibration result that step 4 generates, the threshold coefficient weight obtained according to step 2 Multiple step 1 obtains the row division position of test sample calibration resultWith column split positionAnd according toWithBy test sample It is divided into map grid.
The identification of step 6 flaw.To any map grid of test sampleAccording to feature extracting method f1, f2…f|T|It calculates special Levy vector For fjThe feature vector of calculatingAccording to step 3.2 and step 3.3, which calculate ideal statistical value, indexes k*WithWithIfThen Labeled as there is flaw, otherwise labeled as indefectible.When all map grids are based on fjLabel terminate, check each there is a flaw map grid Ll 8 face domainThe label of interior map grid, if it exists flawless map gridThen judgeWhether at It is vertical, it is marked if setting upTo have flaw and enablingAnd d is calculated as followsl+1, continue checkingInterior map grid Label and repeat the above steps until dl+1For
Wherein threshold coefficient0 < γ≤1,L1It indicates to be based on fjLabel terminate obtain have flaw figure Lattice.When dynamic threshold isWhen, all having the ranks index of the included pixel of flaw map grid is testing result.
The beneficial effects of the present invention are: provided by the invention a kind of based on peak threshold, rotational alignment and composite character Textile flaw detection method, Pixel of Digital Image gray scale letter of this method analysis based on textile surface flat under lighting source Breath, divides the image into the grid not overlapped, the IRM of each grid, HOG, GLCM and Gabor characteristic value is calculated, according to spy Value indicative distribution automatic positioning textile surface flaw.The present invention is especially suitable for be automatically identified in acquire under steady illumination light source Textile surface flaw in textile flat surfaces gray-scale image.
Detailed description of the invention
Present invention will be further explained below with reference to the attached drawings and examples.
Fig. 1 is main-process stream schematic diagram of the invention;Fig. 2 is assumed condition schematic diagram of the invention;Fig. 3 is step of the invention The flow diagram of rapid 1 training sample map grid segmentation;Fig. 4 is that S is calculated in step 1 of the inventionhThe basic principle of initial value is shown It is intended to;Fig. 5 is the textile images background pixel distribution schematic diagram that texture is identical in step 2 of the invention but direction is different;Fig. 6 It is image calibration schematic diagram in step 4 of the invention;Fig. 7 is image rotation schematic diagram in step 4 of the invention;Fig. 8 is this hair Bright step 3.1 is fallen into a trap nomogram lattice cyclic flow schematic diagram;Fig. 9 is that each flawless weaving is calculated in step 3.2.1 of the invention The characteristic statistics value flow diagram of product gray level image;Figure 10 is training sample set schematic diagram in step 3.2.2 of the invention;Figure 11 be the flow diagram that sorts in step 3.2.2 of the invention;Figure 12 is the ideal that each feature is calculated in step 3.3 of the invention Statistical value threshold value flow diagram;Figure 13 is flaw identification process schematic diagram in step 6 of the invention;Figure 14 is step 1 map grid Flow chart of segmentation algorithm;Figure 15 is that step 2 calculates threshold coefficient and entropy threshold algorithm flow chart;Figure 16 is step 3.1 calculating figure Lattice periodical algorithms flow chart;Figure 17 is that A.1 algorithm calculates eigenmatrix algorithm flow chart;Figure 18 is that A.2 algorithm calculates distance calculation Method flow chart;Figure 19 is that A.3 algorithm calculates signal period algorithm flow chart;Figure 20 is that step 3.2.1 calculates the calculation of characteristic statistics value Method flow chart;Figure 21 is that step 3.2.2 calculates characteristic statistics value sort algorithm flow chart;Figure 22 is that step 3.2.3 calculates stabilization Characteristic element algorithm flow chart;Figure 23 is that step 3.2.4 calculates ideal statistical value algorithm flow chart;Figure 24 is that step 3.3 calculates The ideal statistical value thresholding algorithm flow chart of each feature;Figure 25 is step 4 image calibration algorithm flow chart;Figure 26 be algorithm A.4 Image rotation algorithm flow chart;Figure 27 is step 6 flaw recognizer flow chart.
Specific embodiment
Presently in connection with attached drawing, the present invention is described in detail.This figure is simplified schematic diagram, is only illustrated in a schematic way Basic structure of the invention, therefore it only shows the composition relevant to the invention.
The embodiment of calculation method of the present invention is completed by writing computer program, and specific implementation process is related to customized Algorithm is described by pseudocode.Program input is the textile images of gray processing, and program output is the map grid set containing flaw.This hair Bright embodiment includes six steps, first three step is the training stage, and rear three steps are test phase.
The training stage is the following steps are included: step 1: calculating training sample cartoon using morphology component analyzing method Ingredient Ic, by IcIt is split by the row and column where index, obtains training sample map grid;Step 2: according to what is obtained in step 1 Training sample map grid calculates the ideal line number and ideal columns of any training sample, to obtain threshold coefficient, then according to training The transverse projection of sample and longitudinal projection calculate entropy threshold, repeat the above steps so that the threshold value system of all training samples is calculated Several and entropy threshold;Step 3: any training sample being concentrated for training sample, according to threshold coefficient calculated in step 2 and entropy Threshold value is calculated the feature vector of map grid using HOG feature extracting method, distance matrix is calculated by feature vector, by distance matrix It obtains calculating the map grid period by Fourier transformation;The ideal statistical value of each feature of map grid is calculated according to the map grid period;
The test phase is the following steps are included: step 4: image calibration, the test specimens unknown for map grid arrangement angle This, the edge of test sample is calculated using Canny edge detection method, using Hough transform by edge projection to parameter space In, take preceding n in parameter spaceθThe angle, θ of straight slope corresponding to a peak value obtains n according to taken θ rotary test sampleθ A rotation image calculates transverse projection entropy and longitudinal projection's entropy most according to the transverse projection of each rotation image and longitudinal projection It is worth corresponding angle greatlyTest sample is rotatedObtain final calibration result;Step 5: the segmentation of test sample map grid, it is right The calibration result that step 4 generates, the threshold coefficient obtained according to step 2 repeat step 1 and obtain the row of test sample calibration result Division positionWith column split positionAnd according toWithTest sample is divided into map grid;Step 6: flaw identification, according to step Rapid 3 method calculates feature vector, map grid period, the ideal statistical value of each feature of map grid and the ideal statistical value of test sample Threshold value, and calculated result is compared with ideal statistical value threshold value, to identify map grid defective.It the sequence of this method and patrols The relationship of collecting is detailed in Fig. 1.
As shown in Fig. 2, inventive method assumes that textile images have a characteristic that relative to textile images row and Column, map grid is transversely arranged according to the direction of image line, and by the direction longitudinal arrangement of column;In the cartoon ingredient I of MCAcIn, map grid tool Have geometry and and background pixel there were significant differences in gray scale.Show that three kinds of situations, every a line show a kind of feelings in Fig. 2 Condition, every row first row are textile images, and secondary series is Ic, third column are IcThree-dimensional Mesh figure, the 4th column be binaryzation cartoon The number of the every row background pixel of ingredient is distributed, and the abscissa of the 4th column figure is line index, and ordinate is background pixel number.Fig. 2 The map grid of middle the first row textile images does not have geometry, and which results in background pixel distributions to lack significantly periodically;The Although the map grid of two row textile images has geometry, but shape in map grid and background are in IcIn difference it is small, i.e., accordingly Mesh scheme most of region and be almost flat, this causes background pixel quantity excessive, and background pixel distribution lacks apparent Periodically;The third line textile images map grid has geometry and in IcIn it is big with the difference of background, background pixel distribution With periodicity.
Explanation is unfolded to this six steps individually below.
1, the training stage
Join needed for map grid segmentation as shown in Figure 1, the training stage calculates according to a series of flawless textile gray level images first Number then carries out map grid segmentation to flawless image and calculates parameter needed for test phase.Training stage includes three steps: step The segmentation of 1 training sample map grid, step 2 calculate threshold coefficient and entropy threshold, and step 3 calculates test phase parameter.The present invention proposes The parameter that is obtained according to step 2 of map grid dividing method, pass through step 1 and divide map grid.
The segmentation of step 1 training sample map grid.As shown in figure 3, for the textile images that a width gives, according to such as Figure 14 institute The map grid partitioning algorithm shown calculates I using MCAcWith texture ingredient, according to calculating threshold coefficient as shown in figure 15 and entropy threshold Algorithm, the threshold coefficient f being calculatedc, use threshold value fc·max(Ic) binaryzation IcObtain Itc.I is shown in Fig. 3c's Mesh figure, IcIn two-dimensional pattern three-dimensional " mountain peak ", binaryzation I are shown as in Mesh figurecIt is equivalent to and is cut with a gray plane Disconnected mountain peak, pixel corresponding to the part above the plane of mountain peak save as 1, and pixel corresponding to the part below the plane of mountain peak is protected 0 is saved as, this binarization result is Itc, i.e., the lower right Fig. 3 arrow " use threshold binarization IcObtain Itc" signified pattern.
Assuming that textile images are at least made of 4 map grids, then ItcThe object size of middle corresponding map grid should be less than image The half of size, so if there is oversized situation, then this object is not then map grid, Ying Cong ItcMiddle deletion ruler Very little excessive object, it may be assumed that by Moore-Neighbor track algorithm (Moore-Neighbor tracing algorithm, out From document Jia L., Liang J., Fabric defect inspection based on isotropic lattice Segmentation, Journal of the Franklin Institute 354 (13) (2017) 5694-5738) obtain Itc The closure edge of middle object.For each object with closure edge, the extreme value of object ranks index is found out, if this is right As the absolute value of the difference of line index extreme value is more than 0.75dimx(Itc) or the absolute value of the difference of column index extreme value be more than 0.75 dimy(Itc), then from ItcMiddle deletion object, i.e., be set to 0 for the pixel of oversized object.
The geometry of textile images map grid is by ItcIn two value objects described by, the rich and varied of map grid results in two The diversity of value object geometry, but between two value objects the distribution of background pixel influenced by its shape it is small, it may be assumed that different shape Two value objects, if its distribution in same direction is identical, the distribution of background pixel in this direction is similar.Such as Fig. 3 It is shown, the background pixel number of binaryzation cartoon ingredient every row and each column is counted, order in rows and columns arranges background picture respectively Plain number constitutes the transverse projection of background pixelAnd longitudinal projectionWithPeak value be denoted as multiset respectivelyWithThat is close to label " transverse projection in transverse projection and longitudinal projection's diagram in Fig. 3" and " longitudinal projection" dark color it is small Point, these peak values reflect ItcThe boundary of middle map grid.
Other peak values are filtered to obtain these peak values, it is rightWithAdaptive K-mean algorithm is applied respectively (Adaptive K-means) algorithm (Jia L., Liang J., Fabric defect inspection based on isotropic lattice segmentation,Journal of the Franklin Institute 354(13) (2017) 5694-5738, hereinafter referred to as self-adaption cluster algorithm) it is clustered, cluster centre saves as multiset respectivelyWith
Due to the randomness of data,WithIt is possible that comprising multiple similar cluster centres, these close cluster centres In minimum value be selected as threshold value respectivelyWithThat is: willDescending arrangement, fromStart, calculates front and back two-spot The absolute value of the difference of element, it is high that difference is greater than DCT sizeFirst element beSimilarly, willDescending arrangement, fromStart, calculates the absolute value of the difference of two elements of front and back, it is wide that difference is greater than DCT sizeFirst element be In be not less thanPeak value press corresponding line index, be denoted as S 'hIn be not less thanPeak value press corresponding column Index, is denoted as S 'v
Due to the interference of the factors such as flaw, S 'hWith S 'vIn ranks index not necessarily accurately reflect the boundary of map grid.Cause This, needs to assess S 'hIn with the presence or absence of with stablizing line index and the S ' of line spacevIn with the presence or absence of have stablize column pitch Column index, these ranks index as map grid boundary to divide map grid.For S 'h, by S 'hMiddle element does ascending order arrangement, row The multiset of index spacing is defined as Continuously stablize with line index The multiset of line spaceIt is defined as follows.
Wherein xi∈S′h, i is the continuous positive integer of numerical value, such as i can take 2,3,4, but cannot only take 2 and 4.Due to can There can be multiple meetThe continuous spacing of definition, it is possible that there are multipleWherein with most element numbers It (is denoted as) corresponding to line index as map grid demarcate set ShInitial value, be defined as follows.
As shown in Figure 4, it is shown that with a secondary textile images transverse projectionBased on calculate ShThe process of initial value, it is left Side is shownPeak valueIt is indicated with dark dot, it is rightIt is clustered, is obtainedPass through cluster in Fig. 47 are obtained The cluster centre of class, according toCluster centre threshold value is calculatedIndicated in figureStraight line on fork.According toScreeningElement, the diagram compared with small leak, i.e. among Fig. 4 is deleted, according to the line index meter of the continuous peak value of line index Its line space is calculated, then obtains that there is different length (element number)Wherein with most elementsIt (is i.e. indicated in Fig. 4 It is " maximum") beShInitial value beAs shown in the rightmost side Fig. 4.Similarly, it can calculate WithInitial value, be defined as follows.
Because of ShWith SvCorresponding to initial valueWithIt separately includes stable line space and stablizes column pitch, thereforeWithMedian is defined as ideal line numberWith ideal columnsShWith Sv's Initial value example is shown in attached drawing 3, as shown in figure 3, textile images only partial region by ShAnd SvInitial value cover simultaneously, i.e. Fig. 3 Indicate " ShAnd SvInitial value " diagram in grid, the region of only vertical straight line only has SvCovering.ShAnd SvExtension be based onWithIt carries out.Due to ShIn line index by ascending order arrange, from min (Sh) start, with step-lengthTo ItcLine index minimum value 1 It is mobile, that is, it calculatesIt checks for MeetSuch as There are x ' for fruit, then x ' are added to Sh, x is otherwise added to ShAnd keep ShMiddle element ascending order arrangement, calculates againAnd it repeats the above steps;Similarly, from max (Sh) start, with step-lengthTo ItcLine index maximum value dimx(Ic) It is mobile, that is, it calculatesIt checks forMeetSuch as There are x ' for fruit, then x ' are added to Sh, x is otherwise added to Sh, calculate againAnd it repeats the above steps. To SvWith step-lengthSimilar extension is done, map grid partitioning algorithm process shown in Figure 14 is detailed in.Extend obtained ShWith SvBasic covering Textile images major part region, as shown in Figure 3.According to ShWith SvThe row and column index separately included, can be by IcBy these Row and column where index is split, and is divided resulting region and is defined as map grid, is defined as follows.
Wherein1≤ir≤|Sh| -1 and 1≤ic≤|Sv| -1, therefore IcBe partitioned into (| Sh|-1)·(| Sv| -1) it is aAnd irAnd icIt is respectivelyRow and column index as unit of map grid.
Step 2 calculates threshold coefficient and entropy threshold.One important parameter of map grid segmentation is threshold coefficient fc, such as Fig. 3 institute Show, IcBinaryzation be based on threshold value fc·max(Ic) complete, and the threshold value depends on fc.For training sample set I1,I2…IN IiUsing based on different fcThe map grid partitioning algorithm (its process is as shown in figure 14) of value can obtain multipleWithCalculate institute ?WithHistogram, wherein frequency of occurrence is mostWithAnd its corresponding fcValue is to determining fcFinal value With reference significance.For training sample set I1,I2…INWith a f of N 'cSelectable value c1,c2…cN′, enableWithRespectively indicating input is Ii, i=1,2 ... N and fc=cl, l=1, what the step 1 of 2 ... N ' was calculatedWithIt is right In each IiIt is a all to there is N 'It is a with N 'About IiMultisetAnd multisetF corresponding to the middle most elements of frequency of occurrencecValue is denoted as c respectivelyh(i, l) and cv(i, l) is defined as follows.
For IiIf ch(i, l) and cv(i, l) is identical, then respective index (i, l) is stored in setIn,Definition such as Under.
For eachI.e. for IiIf at least there is a l ' makes ch(i,l′)≡cv(i, l ') set up, then with med({cl) apart from nearest ch(i, l ') participates in fcCalculating, fcIt is defined as follows.
Wherein chThe index of (i, l)Expression, which takes, to be metI value in definition.Image calibration is established right In the analysis that background pixel is distributed in binaryzation textile images cartoon ingredient, as shown in Figure 5.In Fig. 5, centrally located spinning Fabric image is primary every 15 ° of rotations since 0o, has rotated altogether 7 times (i.e. 0 °, 15 °, 30 ° ...), the image of rotation is pressed It is arranged clockwise about original image, each image is f according to parametercStep 1 transverse projection calculatedWith longitudinal throwing ShadowIt shows to graphically, is labeled with basis respectively below figureWithThe entropy of calculatingWithIt observes attached shown in fig. 5 WithIt can be found that the entropy of 0 ° and 90 ° image is more than the entropy of other rotation images.For training sample set I1,I2…IN, calculate every Width imageWithThe integer part of the mean value of these entropys is taken to obtain two threshold value exAnd ey, can be used for judging the row of map grid Whether column angle is close to 0 ° or 90 ° of multiple.exAnd eyCalculating process pseudocode description calculating threshold value system as shown in Figure 15 Several and entropy threshold algorithm flow.
Step 3 calculates test phase parameter.The step specifically includes the following three steps: step 3.1 calculates the map grid period; The ideal statistical value of step 3.2 calculating each feature of map grid;Step 3.3 calculates the ideal statistical value threshold value of each feature.
Step 3.1 calculates map grid cyclic flow and is detailed in Fig. 8.According to training sample set I1,I2…INIt can be calculated with step 1.3 Map grid ideal dimensions line numberAnd columnsAgain by step 2 segmentation i-th (1≤i≤N) a training sample IiObtain IiM × n map grid.Assuming that in IiEvery row and each column map grid in, be often separated byTwo map grids of a map grid Texture is identical, and the minimum value in t ' value is known as map grid period t.Such as when t=1, IiAll map grids texture it is identical;T=2 When, IiMap grid texture it is then identical every a map grid.By the Texture classification of map grid, then IiThere is the map grid texture of t type.Make With HOG (Dalal, N., Triggs B., Histograms of Oriented Gradients for Human Detection,IEEE Comput.Soc.Conf.on Comput.Vision and Pattern Recognition 1 (2005) 886-893) feature extracting method (hereinafter referred to as HOG method) calculates IiThe feature vector of map grid simultaneously makes feature vector rope It is identical to draw corresponding map grid index, i.e., arranges feature vector corresponding to map grid by the arrangement mode of map grid.For Ii's Map grid(1≤ir≤ m, 1≤ic≤ n), it calculatesWith i-thrThe Euclidean distance of all map grids in row, by the involved figure of calculating The column index ascending order of lattice arranges, then may make up distance vector.Therefore i-th is fixedrEach map grid in row, according to i-thrCapable is all Map grid can all calculate a distance vector, these distance vectors are arranged by related fixed map grid column index ascending order is calculated, It then obtains based on i-thrDistance matrix is pressed i by capable n × n distance matrixrAscending order arrangement, obtains IiRow distance matrixSimilarly, I can be calculatediColumn distance matrixBy vectorAs One-dimensional signal carries out Fast Fourier Transform (fast Fourier transform, hereinafter referred to as FFT), then can be obtained's Period and frequency spectrum, this period and frequency spectrum are defined as IiThe row period and line frequency spectrum, calculate all 1≤l1≤ m and 1≤l3≤n CorrespondingThe row period and line frequency compose and calculate row period median and line frequency spectrum median, gained median is fixed respectively Justice is image line period and image line frequency spectrum.Similarly, according to column distance matrix D(c), I can be calculatediThe column period and column frequency Spectrum, and calculate corresponding image column period and image column frequency spectrum.Attached drawing 8 illustrates I1,I2…INThe row period and line frequency spectrum it is general The property read two dimension scatter plot arranges the conceptual two-dimentional scatter plot of period and column frequency spectrum.According to I1,I2…IN, N number of image line can be calculated Period and corresponding N number of image line frequency spectrum calculate image line frequency spectrum medianIt finds out and is higher thanImage line frequency spectrum corresponding to The image line period, calculate the median in these image lines periodSame steps are repeated to image column period and image column frequency spectrum Obtain image column frequency spectrum medianWith image column period medianIfOrOrThen t value It is 1, otherwise by comparingWithCorresponding frequency spectrum determines the value of t, it may be assumed that ifThen t takesOtherwise t takesStep 3.1 algorithm flows are detailed in calculating map grid periodical algorithms flow chart shown in Figure 16, and A.1 algorithm shown in Figure 17 calculates eigenmatrix Algorithm flow chart, A.2 A.3 the algorithm shown in the computational algorithm flow chart and Figure 19 calculates signal week to algorithm shown in Figure 18 Phase algorithm flow chart.
Step 3.2 includes four sub-steps: step 3.2.1 calculates characteristic statistics value, and step 3.2.2 calculates characteristic statistics value Sequence, step 3.2.3 calculate invariant feature element, and step 3.2.4 calculates ideal statistical value.
Step 3.2.1 calculates the characteristic statistics value of each flawless textile gray level image.Training sample is calculated according to above-mentioned steps This collection I1,I2…INMap grid period t, i.e. the arrangement regulation of the identical map grid of texture.For i-th (1≤i≤N) the flawless figure of pair As Ii, it can be divided into the different map grid of t class texture, i-thrRow kth (1≤k≤t) class map grid and (ir+ t) row such figure The map grid column index value of lattice is identical, thus can be in IiIn only access belong to a kind of map grid, for kth class map grid, i-thrRow, the (ir+ t) row, (ir+ 2t) row ..., such map grid constitute matrix, which is known as map grid matrix, for kth class map grid, figure Lattice matrix at most may be present t, i.e. C1,C2…Ct.As shown in figure 9, the 3rd class map grid has 3 matrixes: C as t=31By the 1st row It is formed with the 3rd class map grid of the 4th row (i.e. 1+t row), C2It is made of the 3rd class map grid of the 5th row of the 2nd row, C3By the 3rd class figure of the 3rd row Lattice composition.Assuming that in the presence of | T | a input is 2-D gray image matrix and output is the feature extracting method f of one-dimensional real vector1, f2…f|T|, these feature extracting methods generate the identical feature vector of length for line number and the identical input picture of columns, then IiIn map gridIt can be according to f1, f2…f|T|Calculate | T | a feature vectorIf IiInstitute There is the size of map grid according to I1,I2... pixel minimum line number n contained by map grid in INrWith minimum columns ncIt is adjusted, i.e., only retains The 1st row is to n-th in map gridrIt goes and the 1st row to n-thcThe pixel of column, then IiMiddle any two map gridWithIt is based onFeature vector length it is identical, i.e.,This is based on fjFeature vector it is long Degree is defined as fjCharacteristic element prime number Fj.For IiMiddle kth class map grid, can be according to the map grid Matrix C of such map grid1,C2…CtMeter It calculates and is based on fjFeature vector in each element mean valueStandard deviationMaximum valueAnd minimum valueThis 4 A value is defined as IiCharacteristic statistics value, that is, be defined by the formula.
WhereinIndicate that map grid L is i-thtA map grid matrixArbitrary element,WhereinIt indicates to be based on fjMap grid matrixI-th in the feature vector of middle all elements (map grid)FA element is (real Number) multiset, when opt is replaced with mean, std, max or min, thenDefinition is corresponding WithStep 3.2.1 process is detailed in calculating characteristic statistics value-based algorithm flow chart shown in Figure 20.
Step 3.2.2 calculates the sequence of characteristic statistics value.Although I1,I2…INFor the flawless sample of same training sample set, but The definition of training sample set does not guarantee that first map grid L in each sample1,1Texture it is identical.Training sample as shown in Figure 10 This collection, the training sample set include 4 secondary flawless image I1, I2, I3And I4, wherein I3Middle L1,1Texture and other samples in One map grid texture is different.If the texture of first map grid of all training samples is different, step 3.2.1 calculates feature Statistical value just needs to resequence.As shown in figure 11, training sample set includes training sample I1, I2, I3, I4, I5And I6, wherein I4 L1,1It is different from first map grid texture of other samples, cause characteristic statistics value and the sequence of other samples also different.If First map grid texture of all training samples is all identical, then it is then nonsensical to sort.It is whether necessary in order to detect sequence, it counts Calculate training sample I1,I2…INBetween be based on fj'sThe Euclidean distance average value d (j) of (1≤i≤N, 1≤k≤t) determines Justice is as follows.
For f1, f2…f|T|, corresponding d (1) can be obtained, d (2) ... d (| T |) correspondingly can root again after completing sequence Calculate d ' (1) according to above formula, d ' (2) ... d ' (| T |), the relatively two groups of distance averages in front and back, if d (j) >=d ' (j) for 1≤j≤ | T | it all sets up, then retains ranking results, otherwise restore the state before sequence.The process that sorts is as shown in figure 11.For kth class figure Check is managed N number of(1≤i≤N) clusters it using clustering algorithm, and clustering algorithm classification parameter is set as t, then obtains t A class centerForCalculate according to the following formula fromClass corresponding to nearest class center Label u*
IfWhereinThe center for indicating the class in t classification with most element numbers, then exchange index Characteristic statistics value determined by (i, j, k) and index (i, j, k*) determined by characteristic statistics value, wherein k*It is defined as follows.
For indexing all fixed Combinations of k and j, for eachIt repeats above-mentionedu*With Calculating and judgementIt is whether true, k is repeated if setting up*Calculating and exchange feature determined by index (i, j, k) Statistical value and index (i, j, k*) determined by characteristic statistics value.Step 3.2.2 process is detailed in calculating feature system shown in Figure 21 Evaluation sort algorithm flow chart.
Step 3.2.3 calculates invariant feature element.I is concentrated according to training sample1,I2…INT kind map grid texture can calculate Based on fjN × t group characteristic statistics value, for kth (1≤k≤t) class map grid texture, according to it(1≤ I≤N) i-thF(1≤iF≤Fj) a elementWithI-thFA elementWherein FjFor fj(1≤j≤| T |) characteristic element prime number, can calculate kth class map grid texture be based on fjFeature vector i-thFA element it is steady Definite value s(j,k)(iF), it is defined as follows.
By s(j,k)(iF) by index iFAscending order arrangement then obtains kth class map grid texture and is based on fjStationary value vector s(j,k)。 If parameter nfIndicate predefined minimal characteristic vector length, this method nfValue is nf=8, then working as nf<FjWhen establishment, application Self-adaption cluster algorithm is based on f to kth class map grid texturejFjA stationary value is clustered, if self-adaption cluster algorithm is generated Classification by positive integer number consecutively and i-th since 1FA stationary value s(j,k)(iF) number of generic is denoted as Ls(iF), Then these number definition set Ls.If defining parameter preset minimal characteristic numberThen kth class map grid texture is based on fjSpy Levy vector i-thFThe stability of a elementIt is defined as follows.
Wherein δ is Dirac delta function,It indicates to include first prime number by the classification category that self-adaption cluster algorithm generates The preceding n that descending arrangesfThe number set of a classification.It willBy index iFAscending order arrangement then obtains kth class map grid line Reason is based on fjStability vectorFor indexing all fixed Combinations of k and j, repeat above-mentionedCalculating.Step 3.2.3 process is detailed in algorithm flow chart shown in Figure 22.
Step 3.2.4 calculates ideal statistical value.I is concentrated for training sample1,I2…INKth (1≤k≤t) Class map grid texture can calculate kth class map grid texture according to step 3.2.3 and be based on fj(1≤j≤| T |) stability vectorIt, can be to vector by self-adaption cluster algorithmIt is clustered, If the classification that self-adaption cluster algorithm is generated by the positive integer number consecutively since 1 and i-th (1≤i≤N) it is a to AmountThe number of generic is denoted asThen these number definition setIn a practical situation, may It can occurThe case where close to N, therefore defined parametersIf U(j,k)>nK, then cluster is re-started, we Method nKValue is nK=5.For i-thu(1≤iu≤U(j,k)) a classification, kth class map grid texture is based on fjIdeal system EvaluationIt is defined as follows.
Expression belongs to kth class map grid texture and is based on fjI-thuIn the characteristic statistics value of a subclass map grid texture The average value of value.For indexing all fixed Combinations of k and j, repeat above-mentionedCalculating.Step 3.2.4 process is detailed in figure The ideal statistical value algorithm pattern of calculating shown in 23.
Step 3.3 calculates the ideal statistical value threshold value of each feature.I is concentrated for training sample1,I2…IN, according to step 3.2.4 can be obtained kth (1≤k≤t) class map grid texture be based on fj(1≤j≤| T |) i-thu(1≤iu≤ U(j,k)) a subclass map grid texture ideal statistical valueThe Subgraph generated for any training sample according to map grid segmentation Lattice L can be calculated based on fjFeature vector fj(L) and its Euclidean distance between all ideal statistical values it, can find out wherein most Ideal statistical value corresponding to small distance indexes k*WithIt is defined as follows.
Therefore, f is based on for kth class map grid texturejI-thuThe ideal statistical value of a subclass map grid textureIt may There are multiple map grids and the relevant k of map grid*WithWithIndex k and iuIt is identical, these map grids composition setWhenWhen establishment, it can calculateThe feature vector of middle map grid withMaximum distanceIt is defined as follows.
For indexing j, k and iuAll fixed Combinations, repeat it is above-mentionedCalculating.As ideal statistical value Threshold value, calculating process are as shown in Fig. 12.In attached drawing 12, left side is the textile gray level image that map grid segmentation is completed, should Image includes 2 class map grid textures, for any map grid in imageAccording to f1, f2…f|T|Calculate the map grid | T | a spy Levy vectorFor j-th of feature vectorCalculate k*WithAs a result comprising right Answering the image of map grid position gray scale color lump indicates, wherein dark gray scale color lump indicates small distance, it is digital from a left side on each color lump K is followed successively by the right side*WithForCorresponding index k and iu, delete correspondingStep 3.3 process is detailed in figure The ideal statistical value thresholding algorithm flow chart of each feature of calculating shown in 24.
2, test phase
On the parameter basis that the training stage obtains, test phase carries out flaw inspection to the sub-picture that test sample is concentrated It surveys and positions.Test phase includes three steps: step 4 gamma correction, the segmentation of step 5 test sample map grid and step 6 flaw Identification.
Step 4 gamma correction.I is successively rotated θ=1 ° by the test sample I unknown for map grid arrangement angle, and 2 °, It 3 ° ... 360 ° and calculates correspondingWithIt is corresponded to if existed in angle, θWithMaximum valueSoIt is referred to as ideal Collimation angle,Corresponding rotation image is then used as calibration result.It is defined as follows.
Above-mentioned calculatingProcess due to the value of θ it is excessive, computational efficiency is not high, this law use process meter as shown in FIG. 6 It calculatesApproximation.As shown in fig. 6, the textile images I unknown for map grid arrangement angle, the present invention are examined using the edge Canny Survey method calculate I edge, using Hough transform by edge projection into parameter space, take preceding n in parameter spaceθA peak value The angle, θ of corresponding straight slope rotates I according to taken θ, obtains nθA rotation image, according to each rotation imageWithIt calculatesWithIt takesWithThe corresponding angle of middle maximum value, with angle approximation Corresponding rotation image Then as final calibration result.The pseudocode for calibrating process describes image calibration algorithm flow chart as shown in Figure 25.
Although image rotation can be completed by affine transformation, the corner parts by the image of affine transformation are sky, such as Shown in Fig. 7.Number has been arranged successively 5 width images from left to right in Fig. 7, and the first width shows the textile figure that map grid is arranged by 37 ° As I, the second pair, which is shown, rotates minus 37 ° obtained image (original Is using affine transformationr), occur in the image leaving a blank (as Element value is 4 delta-shaped regions 0)If not handling these regions of leaving a blank, these regions not only be will affectWith Calculating, it is also possible to flaw is identified as by subsequent step.For fillingThis invention takes found outBevel edgeEndpoint and It is parallel toLonger right-angle side straight line, the original rotation image I for being obtained affine transformation as symmetry axis using the straight liner's Pixel is copied toThird width several from left to right and fourth officer the image vision process, pseudocode description in attached drawing 7 Image rotation algorithm flow chart as shown in Figure 26.Fig. 7 rightmost indicates " final Ir" image be image rotation algorithm rotation As a result, although region of leaving a blank is filled, some artifacts (artifacts) are appeared in rotation results, such as the lower left corner There is dislocation in map grid arrangement.
The segmentation of step 5 test sample map grid.To the calibration result that step 4 generates, the threshold coefficient weight obtained according to step 2 Multiple step 1 obtains the row division position of test sample calibration resultWith column split positionAnd according toWithBy test sample It is divided into map grid.
The identification of step 6 flaw, process are as shown in Fig. 13.Given textile gray level image I secondary for one, is produced by step 5 The map grid of raw I, to any map grid in IAccording to feature extracting method f1, f2…f|T|It calculates| T | a feature vectorFor being based on fj(1≤j≤| T |) feature vectorCalculate step The ideal statistical value of 3.3 definition indexes k*WithAnd comparative feature value distanceWithSize, ifThenLabeled as there is flaw, otherwise labeled as indefectible.
When all map grids are based on fjLabel terminate, check each there is a flaw map grid Ll8 face domainThe mark of interior map grid Remember, if it exists flawless map gridThen compareWith dynamic threshold dlSize, ifThenIt is labeled as There is flaw and enablesAnd d is calculated as followsl+1, continue checkingThe label of interior map grid, and repeat the above steps Until the dynamic threshold newly calculated is
Wherein0 < γ≤1, this method value are γ=0.93,L1It indicates to be based on fjLabel knot What beam obtained has flaw map grid.When dynamic threshold isWhen, all having the ranks index of the included pixel of flaw map grid is detection knot Fruit.
Step 6 process flaw recognizer flow chart as shown in Figure 27 in detail.
High efficiency of the invention experiments have shown that:
Use the industry of Hong Kong University's Electrical and Electronic engineering department automatic in the Defect Detection recruitment evaluation of the method for the present invention Change the 56 width pixel sizes that laboratory provides as 256 × 256 24 color textile product images, these images are turned in an experiment It is changed to 8 gray level images.56 width images include a kind of pattern: box-shaped image.Box-shaped image includes 26 indefectible and 30 width There is flaw image.There are flaw textile images A.4 to generate 10 width rotation image using algorithm with random angles to each, then deletes There are the images of serious artifact, and finally obtain 251 map grids has flaw textile images as test specimens by what random direction arranged This collection and 26 flawless textile images without rotation are as training sample set.Training sample set includes 5 kinds of flaw types: disconnected It holds (broken end), hole (hole), reticulate pattern (netting multiple), cord (thick bar) and stria (thin bar), the particular number first row that see Table 1 for details of every kind of flaw type.All flaw images have the flaw of same size Defect reference map (ground-truth image), flaw reference map are 2 value images, wherein 1 indicates flaw, 0 indicates background.For The algorithm compared includes WGIS, BB, RB and ER, the parameter setting and document (Jia L., Liang J., Fabric of these algorithms defect inspection based on isotropic lattice segmentation,Journal of the Franklin Institute 354 (13) (2017) 5694-5738) it is identical.The method of the present invention is selected based on the parameter of the data set It is selected as: minimal characteristic number nf=8, classification number limit nK=5, threshold coefficient γ=0.93, T=" HOG ", " GLCM ", “Gabor”}。
Index for assessment includes true positives (true positive, hereinafter referred to as TP), false positive (positiverate, hereinafter referred to as FPR), true positive rate (truepositiverate, hereinafter referred to as TPR), false positive rate (positiverate, hereinafter referred to as FPR), positive predictive value (positivepredictivevalue, hereinafter referred to as PPV) and Negative predictive value negativepredictivevalue, hereinafter referred to as NPV).TPR, which is measured, indicates flaw in flaw reference map Pixel is correctly demarcated as the ratio of flaw by algorithm, and FPR, which is measured, indicates the pixel of background by algorithmic error mark in flaw reference map It is set to the ratio of flaw, the flaw proportion in the flaw of PPV measure algorithm output in flaw reference map, NPV measure algorithm Background proportion in the background of output in flaw reference map.For TPR, PPV and NPV, index value is the bigger the better, for FPR is then the smaller the better.Related mathematical definition can document (M.K.Ng, H.Y.T.Ngan, X.Yuan, et al., Patterned fabric inspection and visualization by the method of image Decomposition, IEEETrans.Autom.Sci.Eng.11 (3) (2014) 943-947) in find.The method of the present invention, The index calculating method and document (Jia L., Liang J., Fabric defect inspection of WGIS, BB, RB and ER based on isotropic lattice segmentation,Journal of the Franklin Institute 354 (13) (2017) 5694-5738) it is identical.Experimental Hardware platform is the CoreTMi7-3610QM of Intel containing processor 230-GHz With the laptop of 8.00GB memory, software is Windows 10 and Maltab8.4.
Table 1 enumerates box-shaped image Defect Detection as a result, wherein marking every row index value of flaw type is corresponding method To the index average value of all test sample operation results of the flaw type.According to 1 overview of table, one column, the method for the present invention has most Excellent global TPR (0.724) and overall situation NPV (0.994), the overall situation TPR ratio WGIS times high global TPR (0.558) is much higher, But the global FPR of WGIS is lower.For hole, the TPR of the flaw of reticulate pattern and stria type, the method for the present invention is optimal, FPR is bigger than normal simultaneously.The broken ends of fractured bone and cord TPR (0.68;0.85) than WGIS (0.98;1.00) low, but FPR (0.2,0.3) compares WGIS (0.12,0.16) is high.To sum up, the method for the present invention has reached global optimum TPR and NPV, and overall situation FPR is larger, while this Hole of the inventive method especially suitable for detecting box-shaped image, the flaw of reticulate pattern and stria type.
1 box-shaped image Defect Detection result of table
Taking the above-mentioned ideal embodiment according to the present invention as inspiration, through the above description, relevant staff Various changes and amendments can be carried out without departing from the scope of the present invention completely.The technical scope of this invention is not The content being confined on specification, it is necessary to which the technical scope thereof is determined according to the scope of the claim.

Claims (2)

1. a kind of textile flaw detection method based on peak threshold, rotational alignment and composite character, it is characterised in that: including Two stages of training stage and test phase;Training stage, according to a series of indefectible textile gray level images, hereinafter referred to as without Flaw image or training sample calculate parameter needed for map grid is divided, and then carry out map grid segmentation to flawless image and calculate test rank Parameter needed for section flaw identifies;Test phase, the parameter obtained according to the training stage carry out map grid point to a secondary textile images It cuts and judges whether map grid includes flaw, finally label contains map grid defective;
The training stage the following steps are included:
Step 1: calculating training sample cartoon ingredient I using morphology component analyzing methodc, by IcBy the row and column where index It is split, obtains training sample map grid;
Step 2: according to the training sample map grid obtained in step 1, the ideal line number and ideal columns of any training sample are calculated, To obtain threshold coefficient, entropy threshold is then calculated according to the transverse projection of training sample and longitudinal projection, repeat the above steps with The threshold coefficient and entropy threshold of all training samples is calculated;
Step 3: concentrating any training sample to be adopted according to threshold coefficient calculated in step 2 and entropy threshold training sample The feature vector that map grid is calculated with HOG feature extracting method, calculates distance matrix by feature vector, by distance matrix by Fu Leaf transformation obtains calculating the map grid period;The ideal statistical value of each feature of map grid is calculated according to the map grid period;
The test phase the following steps are included:
Step 4: image calibration, the test sample unknown for map grid arrangement angle are calculated using Canny edge detection method and are surveyed The edge of sample sheet, using Hough transform by edge projection into parameter space, take preceding n in parameter spaceθCorresponding to a peak value The angle, θ of straight slope n is obtained according to taken θ rotary test sampleθA rotation image, according to the cross of each rotation image To projection angle corresponding with the maximum value that longitudinal projection calculates transverse projection entropy and longitudinal projection's entropyTest sample is rotatedHinder final calibration result;
Step 5: the segmentation of test sample map grid repeats the calibration result that step 4 generates according to the threshold coefficient that step 2 obtains Step 1 obtains the row division position of test sample calibration resultWith column split positionAnd according toWithBy test specimens one's duty It is segmented into map grid;
Step 6: flaw identification calculates feature vector, map grid period, each feature of map grid of test sample according to the method for step 3 Ideal statistical value and ideal statistical value threshold value, and calculated result is compared with ideal statistical value threshold value, is had to identify The map grid of flaw;
Step 1 training sample map grid segmentation specifically includes the following steps:
For a training sample, training sample cartoon ingredient I is calculated using morphology component analyzing methodc, use threshold value fc· max(Ic) binaryzation IcObtain bianry image Itc, I is obtained by Moore-Neighbor track algorithmtcThe closure edge of middle object, Wherein, fcFor threshold coefficient;For each object with closure edge, the extreme value of object ranks index is found out, if should The absolute value of the difference of object line index extreme value is more than 0.75dimx(Itc) or the absolute value of the difference of column index extreme value be more than 0.75·dimy(Itc), then from ItcMiddle deletion object, wherein dimx(I) total line number of two-dimensional image I, dim are indicatedy(I) table Show total columns of I;Count ItcThe background pixel number of every row and each column, index in rows and columns arrange background pixel number respectively Constitute the transverse projection of background pixelAnd longitudinal projectionWithPeak value be denoted as multiset respectivelyWithIt is rightWith It is clustered respectively using self-adaption cluster algorithm, cluster centre saves as multiset respectivelyWith WithIt is possible that wrapping Containing multiple similar cluster centres, the minimum value in these close cluster centres is selected as threshold value respectivelyWith In It is not less thanPeak value press corresponding line index, be denoted as S 'hIn be not less thanPeak value press corresponding column rope Draw, is denoted as S 'v;For S 'h, by S 'hMiddle element does ascending order arrangement, and the multiset of line index spacing is defined asMultiset with the continuous stable line space of line indexDefinition It is as follows:
Wherein xi∈S′h, i is the continuous positive integer of numerical value, as map grid boundary set ShInitial value, be defined as follows:
Similarly, it calculates And SvInitial value, definition It is as follows:
According to ideal line numberWith ideal columnsWhereinWithIt respectively indicates With most elementsWithTo ShAnd SvIt is extended, it may be assumed that from min (Sh) start, with step-lengthTo ItcLine index is minimum Value 1 is mobile, that is, calculatesIt checks forMeet If there is x ', then x ' is added to Sh, x is otherwise added to ShAnd keep ShMiddle element ascending order arrangement, calculates againAnd it repeats the above steps;Similarly, from max (Sh) start, with step-lengthTo ItcLine index maximum value dimx (Ic) mobile, that is, it calculatesIt checks forMeet If there is x ', then x ' is added to Sh, x is otherwise added to Sh, calculate againAnd repeat above-mentioned step Suddenly;To SvWith step-lengthDo similar extension;According to ShWith SvThe row and column index separately included, by IcBy these index places Row and column is split, and is divided resulting region and is defined as map grid, is defined as follows:
Wherein ir, ic, k1,And 1≤ic≤|Sv| -1, therefore IcBe partitioned into (| Sh|-1)·(|Sv | -1) it is aAnd irAnd icIt is respectivelyRow and column index as unit of map grid;
Step 2 calculate threshold coefficient and entropy threshold specifically includes the following steps:
For training sample set I1, I2...INWith a f of N 'cSelectable value c1, c2...cN′, according to wherein any training sample Ii(i =1,2...N), a ideal line number of N ' can be calculated by step 1With a ideal columns of N 'L=1 in altogether, 2...N′;In IiMultisetAnd multisetThreshold coefficient f corresponding to the middle most elements of frequency of occurrencec Value be denoted as c respectivelyh(i, l) and cv(i, l) is defined as follows:
For IiIf ch(i, l) and cv(i, l) is identical, then respective index (i, l) is stored in setIn,It is defined as follows:
For eachI.e. for IiIf at least there is a l ' makes ch(i, l ') three cv(i, l ') set up, then with med ({cl) apart from nearest ch(i, l ') participates in fcCalculating, fcIt is defined as follows:
Wherein chThe index of (i, l)Expression, which takes, to be metI value in definition;For training sample set I1, I2...INIn the i-th width image Ii, it is f according to parametercThe calculated I of step 1iTransverse projectionAnd longitudinal projectionIt counts respectively It calculatesEntropyWithEntropyFor all training samplesWithThe integer part of the mean value of these entropys is taken to obtain respectively Threshold value exAnd ey
Step 3 calculate test phase parameter specifically includes the following steps:
Step 3.1 calculates the map grid period, for training sample set I1, I2...INIn i-thA trained sample This Ii, according to step 2 threshold coefficient calculated to IiS can be obtained by repeating step 1hAnd Sv, according to ShAnd SvBy IiIt is divided into m × n A map grid (m=| Sh| -1, n=| Sv|-1);I is calculated using HOG feature extracting methodiMap gridFeature vector and make feature The corresponding map grid index of vector index is identical;It calculatesWith i-thrThe Euclidean distance of all map grids in row, involved by calculating And the column index ascending order arrangement of map grid, then it may make up distance vector;ForIt willCorresponding distance vector presses icAscending order row Column obtain i-thrCapable n × n distance matrix;ForBy i-thrCorresponding n × n the distance matrix of row presses irAscending order arranges to obtain Ii Row distance matrixSimilarly, I is calculatediColumn distance matrix To vectorFourier transform is carried out, is obtainedPeriod and frequency spectrum;According toPeriod and frequency spectrum, calculating cycle median and frequency spectrum median, i.e. image line period and image line frequency spectrum;Similarly, Construct IiColumn distance matrixAnd calculate image column period and image column frequency spectrum;According to I1, I2...IN, can count It calculates N number of image line period and corresponding N number of image line frequency spectrum, calculates image line frequency spectrum medianIt finds out and is higher thanImage In the line frequency spectrum corresponding image line period, calculate the median in these image lines periodTo image column period and image column frequency spectrum It repeats same steps and obtains image column frequency spectrum medianWith image column period medianIfOrOrThen t value is 1, otherwise by comparingWithCorresponding frequency spectrum size determines the value of t, it may be assumed that if Then t takesOtherwise t takesWherein,Indicate map grid ideal row size line number,Indicate map grid ideal row size columns;
Step 3.2 calculates the ideal statistical value of each feature of map grid, which includes four sub-steps: step 3.2.1 calculates feature Statistical value, step 3.2.2 calculate the sequence of characteristic statistics value, and step 3.2.3 calculates invariant feature element, and step 3.2.4 calculates reason Think statistical value;
Step 3.2.1 calculates characteristic statistics value, calculates training sample set I according to step 3.11, I2...INMap grid period t, it is right In i-th of training sample Ii, I is divided according to step 2iObtain map gridPass through | T | it is a input be 2-D gray image matrix and Output is the feature extracting method f of one-dimensional real vector1, f2...f|T|Calculate IiMap gridFeature vectorWherein, T is characterized extracting method title ordered set;Based on fjFeature vector it is long Degree is defined as fjCharacteristic element prime number Fj;According to assumed condition and map grid period t, IiIn map gridWithWithTexture is identical and L1,1, L2,1...LT, 1Texture be all different, wherein l1, Therefore there are the different map grid of t class texture and kthClass map grid is i-thrCapable and (ir+l1T) it goes Column index is identical, therefore the identical kth class map grid of column index can index ascending order by ranks and form map grid matrix;For kth class figure At most there is t map grid Matrix C in lattice1, C2...Ct, according to the map grid of composition map grid matrix, kth class map grid base is calculated by following formula In fjIiCharacteristic statistics valueWith
WhereinIndicate that map grid L is i-thtA map grid matrixArbitrary element,Expression is based on fjMap grid matrixI-th in the feature vector of middle all elementsFThe multiset of a element, whereinAnd 1≤iF≤Fj, When opt is replaced with mean, std, max or min, thenDefinition is correspondingWith
Step 3.2.2 calculates the sequence of characteristic statistics value, calculates training sample I1, I2...INBetween be based on fj'sIt is European away from From average value d (j), it is defined as follows:
For f1, f2...f|T|, it can obtain corresponding d (1), d (2) ... d (| T |);For kth class map grid texture and j-th of feature Extracting method fj, according to I1, I2...IN, step 3.2.1 can produce N number ofUsing clustering algorithm to N number ofGathered Class, clustering algorithm classification parameter are set as t, obtain t class centerForIt calculates according to the following formula FromClass label u corresponding to nearest class center*
IfWhereinIndicate the class center in the classification of t clustering algorithm generation with most element numbers, then Characteristic statistics value determined by exchange index (i, j, k) and index (i, j, k*) determined by characteristic statistics value, wherein k*Definition is such as Under:
For indexing all fixed Combinations of k and j, for eachIt repeats above-mentionedu*With's It calculates and judgesIt is whether true, k is repeated if setting up*Calculating and exchange feature determined by index (i, j, k) system Evaluation and index (i, j, k*) determined by characteristic statistics value;According to the definition of d (j), training sample I is calculated again1, I2...IN Between be based on fj'sEuclidean distance average value, obtain corresponding f1, f2...f|T|D ' (1), d ' (2) ... d ' (| T |); If d (j) >=d ' (j) forIt all sets up, then retains the exchange of features described above statistical value as a result, otherwise characteristic statistics value sorts extensive The state at the end of step 3.2.1 is arrived again;
Step 3.2.3 calculates invariant feature element, for kth class map grid texture and j-th of feature extracting method fj, according to above-mentioned Step and I1, I2...INWhat is calculated is N number ofI-thF A elementWithI-thF A elementKth class map grid texture can be calculated and be based on fjFeature vector i-thFThe stationary value s of a element(j, k)(iF), It is defined as follows:
By s(j, k)(iF) by index iFAscending order arrangement then obtains kth class map grid texture and is based on fjStationary value vector s(j, k);If parameter nfPredefined minimal characteristic vector length is indicated, then working as nf< FjWhen establishment, using self-adaption cluster algorithm to s(j, k)(1), s(j, k)(2)...s(j, k)(Fj) clustered, if the classification that self-adaption cluster algorithm is generated by the positive integer since 1 successively Number, i-thFA stationary value s(j, k)(iF) generic number be denoted as Ls(iF), then these number definition set Ls;If definition is pre- Setting parameter minimal characteristic numberThen kth class map grid texture is based on fjFeature vector i-thFThe stability of a elementIt is defined as follows:
Indicate the preceding n for arranging the classification that self-adaption cluster algorithm generates by its number of elements descendingfThe number of a classification Set;It willBy index iFAscending order arrangement then obtains kth class map grid texture and is based on fjStability vectorFor rope Draw all fixed Combinations of k and j, repeats above-mentionedCalculating;
Step 3.2.4 calculates ideal statistical value, for kth class map grid texture and j-th of feature extracting method fj, according to above-mentioned step Rapid and I1, I2...INIt can calculateWithIt, can be to vector by self-adaption cluster algorithm It is clustered, if the classification that self-adaption cluster algorithm generates is pressed Positive integer number consecutively and i-th of vector since 1Generic number is denoted asThen these are compiled Number definition setFor i-thu A classification, kth class map grid texture are based on fj's Ideal statistical valueIt is defined as follows:
Expression belongs to kth class map grid texture and is based on fjI-thuMean value is flat in the characteristic statistics value of a subclass map grid texture Mean value;For indexing all fixed Combinations of k and j, repeat above-mentionedCalculating;
The ideal statistical value threshold value that step 3.3 calculates each feature can be calculated according to training sample set and above-mentioned steps based on jth A feature extracting method fjKth class map grid texture i-thuThe ideal statistical value of a subclass map grid textureFor any Any map grid L that training sample is generated by step 2, according to its feature vector fj(L) ideal statistical value index k is calculated as follows*With
ForThere may be multiple L, its ideal statistical value index meets k*=k andThese map grids composition setWhenWhen establishment, of the kth class map grid texture based on j-th of feature extracting method can be calculated as follows iuThe maximum distance of a subclass map grid textureI.e. ideal statistical value threshold value:
For indexing j, k and iuAll fixed Combinations, repeat it is above-mentionedCalculating.
2. special as described in claim 1 based on the textile flaw detection method of peak threshold, rotational alignment and composite character Sign is: the identification of step 6 flaw specifically includes: to any map grid of test sampleLimit is according to feature extracting method f1, f2...f|T| Calculate feature vectorFor fjThe feature vector of calculatingAccording to step 3.2 Ideal statistical value index k is calculated with step 3.3*WithWithIf ThenLabeled as there is flaw, otherwise labeled as indefectible;When all map grids are based on fjLabel terminate, check each there is a flaw Map grid Ll8 face domainThe label of interior map grid, if it exists flawless map gridThen judge It is whether true, it is marked if setting upTo have flaw and enablingAnd d is calculated as followsl+1, continue checking The label of interior map grid simultaneously repeats the above steps until dl+1ForWherein,
Wherein threshold coefficient0 γ≤1 <,L1It indicates to be based on fjLabel terminate obtain have flaw figure Lattice;When dynamic threshold isWhen, all having the ranks index of the included pixel of flaw map grid is testing result.
CN201711188161.8A 2017-11-24 2017-11-24 Textile flaw detection method based on peak threshold, rotational alignment and composite character Active CN107945164B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711188161.8A CN107945164B (en) 2017-11-24 2017-11-24 Textile flaw detection method based on peak threshold, rotational alignment and composite character

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711188161.8A CN107945164B (en) 2017-11-24 2017-11-24 Textile flaw detection method based on peak threshold, rotational alignment and composite character

Publications (2)

Publication Number Publication Date
CN107945164A CN107945164A (en) 2018-04-20
CN107945164B true CN107945164B (en) 2019-07-26

Family

ID=61948619

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711188161.8A Active CN107945164B (en) 2017-11-24 2017-11-24 Textile flaw detection method based on peak threshold, rotational alignment and composite character

Country Status (1)

Country Link
CN (1) CN107945164B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108765401B (en) * 2018-05-29 2019-08-20 电子科技大学 A kind of thermal imaging testing method based on ranks variable step segmentation and region-growing method
CN108717069B (en) * 2018-05-29 2020-08-11 电子科技大学 High-pressure container thermal imaging defect detection method based on line variable step length segmentation
CN109886952B (en) * 2019-02-25 2021-04-23 京东方科技集团股份有限公司 Screen defect point detection method and device and computer readable medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101976440A (en) * 2010-11-09 2011-02-16 东华大学 Sobel operator-based extraction method of profile and detail composite characteristic vector used for representing fabric texture
CN106770323A (en) * 2016-12-15 2017-05-31 常州大学 Based on the textile flaw detection method that hierarchical clustering and Gabor are filtered
CN107248152A (en) * 2017-05-18 2017-10-13 常州大学 Textile flaw detection method based on class grid pattern and its area features
CN107274385A (en) * 2017-05-18 2017-10-20 常州大学 Textile flaw detection method based on class grid pattern and its Gabor characteristic

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101976440A (en) * 2010-11-09 2011-02-16 东华大学 Sobel operator-based extraction method of profile and detail composite characteristic vector used for representing fabric texture
CN106770323A (en) * 2016-12-15 2017-05-31 常州大学 Based on the textile flaw detection method that hierarchical clustering and Gabor are filtered
CN107248152A (en) * 2017-05-18 2017-10-13 常州大学 Textile flaw detection method based on class grid pattern and its area features
CN107274385A (en) * 2017-05-18 2017-10-20 常州大学 Textile flaw detection method based on class grid pattern and its Gabor characteristic

Also Published As

Publication number Publication date
CN107945164A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN106770323B (en) The textile flaw detection method filtered based on hierarchical clustering and Gabor
CN107705306B (en) Fabric defect detection method based on multi-feature matrix low-rank decomposition
CN107274385A (en) Textile flaw detection method based on class grid pattern and its Gabor characteristic
US9740957B2 (en) Learning pixel visual context from object characteristics to generate rich semantic images
CN107248152A (en) Textile flaw detection method based on class grid pattern and its area features
CN106780485A (en) SAR image change detection based on super-pixel segmentation and feature learning
CN105550660B (en) A kind of recognition methods of woven fabric structure structure species
CN107945164B (en) Textile flaw detection method based on peak threshold, rotational alignment and composite character
CN105068918B (en) A kind of page method of testing and device
CN109726649B (en) Remote sensing image cloud detection method and system and electronic equipment
CN104282008B (en) The method and apparatus that Texture Segmentation is carried out to image
CN116188475B (en) Intelligent control method, system and medium for automatic optical detection of appearance defects
EP2269163A2 (en) System and method for illumination invariant image segmentation
CN103218832A (en) Visual saliency algorithm based on overall color contrast ratio and space distribution in image
CN109949287A (en) A kind of fabric defects detection method based on adaptivenon-uniform sampling and template correction
CN114862855B (en) Textile defect detection method and system based on template matching
CN108764361A (en) The operating mode&#39;s switch method of beam type oil pumping machine indicating diagram based on integrated study
CN112001901A (en) Apple defect detection method and system based on convolutional neural network
Xiao et al. Recognition for woven fabric pattern based on gradient histogram
Jia et al. Fabric defect inspection based on lattice segmentation and lattice templates
CN113689431B (en) Industrial product appearance defect detection method and device
He et al. Robust illumination invariant texture classification using gradient local binary patterns
CN107895371A (en) Textile flaw detection method based on peak value coverage values and Gabor characteristic
CN107977961B (en) Textile flaw detection method based on peak value coverage values and composite character
Krishnan et al. Performance analysis of texture classification techniques using shearlet transform

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
EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20180420

Assignee: Shandong Hongde Yuheng Information Technology Co.,Ltd.

Assignor: CHANGZHOU University

Contract record no.: X2023980051060

Denomination of invention: Textile defect detection method based on peak threshold, rotation calibration, and mixed features

Granted publication date: 20190726

License type: Common License

Record date: 20231209