[go: up one dir, main page]

CN105931246A - Fabric flaw detection method based on wavelet transformation and genetic algorithm - Google Patents

Fabric flaw detection method based on wavelet transformation and genetic algorithm Download PDF

Info

Publication number
CN105931246A
CN105931246A CN201610292018.2A CN201610292018A CN105931246A CN 105931246 A CN105931246 A CN 105931246A CN 201610292018 A CN201610292018 A CN 201610292018A CN 105931246 A CN105931246 A CN 105931246A
Authority
CN
China
Prior art keywords
image
scale
genetic algorithm
images
sub
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.)
Pending
Application number
CN201610292018.2A
Other languages
Chinese (zh)
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.)
Donghua University
Original Assignee
Donghua 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 Donghua University filed Critical Donghua University
Priority to CN201610292018.2A priority Critical patent/CN105931246A/en
Publication of CN105931246A publication Critical patent/CN105931246A/en
Pending legal-status Critical Current

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • 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/20024Filtering details
    • G06T2207/20032Median filtering
    • 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/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • 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)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本发明涉及一种基于小波变换和遗传算法的织物瑕疵检测方法,包括以下步骤:对采集的带有瑕疵的图像进行预处理;对预处理后的图像使用小波分解得到多尺度下的子图像;对子图像进行融合以得到最优的疵点边缘信息;对子图像利用遗传算法计算出阈值,并采用所述阈值对融合后的图像进行阈值分割;对经过阈值分割的图像进行形态学处理。本发明处理后的布匹瑕疵分割效果精准,分割速度快,并很好的保留了瑕疵原本的形态。

The invention relates to a fabric flaw detection method based on wavelet transform and genetic algorithm, comprising the following steps: preprocessing the collected image with flaws; using wavelet decomposition on the preprocessed image to obtain multi-scale sub-images; The sub-images are fused to obtain the optimal defect edge information; the threshold is calculated by genetic algorithm for the sub-images, and the fused image is thresholded using the threshold; the morphological processing is performed on the thresholded image. The processed cloth blemishes of the invention have accurate segmentation effect, fast segmentation speed, and well retain the original shape of blemishes.

Description

一种基于小波变换和遗传算法的织物瑕疵检测方法A Fabric Flaw Detection Method Based on Wavelet Transform and Genetic Algorithm

技术领域technical field

本发明涉及织物瑕疵检测技术领域,特别是涉及一种基于小波变换和遗传算法的织物瑕疵检测方法。The invention relates to the technical field of fabric flaw detection, in particular to a fabric flaw detection method based on wavelet transform and genetic algorithm.

背景技术Background technique

织物瑕疵检测时布料生产过程中不可缺少的一个环节,而一直以来在纺织企业中普遍采用的是人工检测的方式。这种传统的验布方式效率低下,工人劳动强度大,并且检测准确度得不到保证。由此可见,传统的人工检测方式已经难以复合企业的现代化管理要求。因此,发展一种织物自动检测设备对纺织企业的质量监控和节约人力成本具有重要的经济意义。Fabric defect detection is an indispensable link in the fabric production process, and the manual detection method has been widely used in textile enterprises for a long time. This traditional cloth inspection method is inefficient, the labor intensity of workers is high, and the detection accuracy cannot be guaranteed. It can be seen that the traditional manual inspection method has been difficult to meet the modern management requirements of enterprises. Therefore, the development of a fabric automatic detection equipment has important economic significance for the quality control of textile enterprises and the saving of labor costs.

目前,面向市场的织物瑕疵自动检测系统还比较少,生产出面向纺织企业的织物瑕疵检测系统也只有国外的少数公司,如以色列的EVS公司,瑞士的Barco公司。在织物瑕疵检测系统中,一般采用的是线阵相机作为图像传感器对织物图像进行采集。但由于在检测过程中,布匹运动速度快,布匹幅面较大,图片质量易受工业环境的影响,正确地提取出瑕疵区域称为布匹检测中的重点和难点。而织瑕疵的检测算法是自动检测系统的核心部分,因此设计出一种精度高、处理速度快的算法是实现在线织物瑕疵检测的关键。At present, there are relatively few automatic fabric defect detection systems facing the market, and only a few foreign companies have produced fabric defect detection systems for textile enterprises, such as EVS in Israel and Barco in Switzerland. In the fabric defect detection system, the line array camera is generally used as the image sensor to collect the fabric image. However, due to the fast movement of the cloth and the large size of the cloth during the detection process, the image quality is easily affected by the industrial environment, and the correct extraction of the defective area is called the key point and difficulty in the cloth detection. The detection algorithm of fabric defects is the core part of the automatic detection system, so designing an algorithm with high precision and fast processing speed is the key to realize the online detection of fabric defects.

发明内容Contents of the invention

本发明所要解决的技术问题是提供一种基于小波变换和遗传算法的织物瑕疵检测方法,使得布匹瑕疵分割效果精准,分割速度快。The technical problem to be solved by the present invention is to provide a fabric defect detection method based on wavelet transform and genetic algorithm, so that the cloth defect segmentation effect is accurate and the segmentation speed is fast.

本发明解决其技术问题所采用的技术方案是:提供一种基于小波变换和遗传算法的织物瑕疵检测方法,包括以下步骤:The technical solution adopted by the present invention to solve the technical problems is: provide a method for detecting fabric defects based on wavelet transform and genetic algorithm, comprising the following steps:

(1)对采集的带有瑕疵的图像进行预处理;(1) Preprocessing the collected images with defects;

(2)对预处理后的图像使用小波分解得到多尺度下的子图像;(2) Use wavelet decomposition on the preprocessed image to obtain multi-scale sub-images;

(3)对子图像进行融合以得到最优的疵点边缘信息;(3) Fusion the sub-images to obtain the optimal defect edge information;

(4)对子图像利用遗传算法计算出阈值,并采用所述阈值对融合后的图像进行阈值分割;(4) Utilize genetic algorithm to calculate threshold value to sub-image, and adopt described threshold value to carry out threshold value segmentation to the image after fusion;

(5)对经过阈值分割的图像进行形态学处理。(5) Perform morphological processing on the thresholded image.

所述步骤(1)具体为:将采集到的带有瑕疵的图像先进行灰度化处理,再使用直方图均值化和中值滤波使得原图像的质量得到整体改善。The step (1) specifically includes: performing grayscale processing on the collected image with defects first, and then using histogram averaging and median filtering to improve the quality of the original image as a whole.

所述步骤(2)具体为:分别对图像按行进行高通和低通滤波并进行下采样,得到两个输入图像一般大小的自图像,之后对其自图像按列进行高通和低通滤波并进行下采样,得到4个输入图像四分之一大小的子图像分别是Aj+1,Dj+1 H,Dj+1 V,Dj+1 D;其中,Aj+1是行和列两个方向上低通滤波的结果,代表下一尺度的概貌信号;Dj+1 H是行方向上低通滤波和列方向上高通滤波的结果,代表垂直方向上的细节信号在水平方向的概貌;Dj+1 V是行方向上高通滤波和列方向上低通滤波的结果,代表水平方向上的细节信号在垂直方向上的概貌;Dj+1 D是行和列两个方向上高通滤波的结果,代表对角方向的细节信号。Described step (2) is specifically: carry out high-pass and low-pass filter and carry out down-sampling to image respectively by row, obtain two self-images of general size of input image, carry out high-pass and low-pass filter to its self-image afterwards by column and Perform down-sampling to obtain 4 sub-images of a quarter size of the input image are A j+1 , D j+1 H , D j+1 V , D j+1 D ; where A j+1 is the row The result of low-pass filtering in the direction of row and column, representing the overview signal of the next scale; D j+1 H is the result of low-pass filtering in the row direction and high-pass filtering in the column direction, representing the detail signal in the vertical direction in the horizontal direction D j+1 V is the result of high-pass filtering in the row direction and low-pass filtering in the column direction, representing the overview of the detail signal in the horizontal direction in the vertical direction; D j+1 D is the result of the two directions of row and column The result of high-pass filtering, representing the detail signal in the diagonal direction.

所述步骤(3)具体包括以下子步骤:Described step (3) specifically comprises following substep:

(31)从最大尺度开始,令尺度j为最大尺度J,将边缘图像Ej(x,y)中模值与相角均相近的非零像素点进行链接,并且设置链长阈值,删除小于链长的短链,得到尺度j下的单像素宽的边缘图像Ej(x,y);(31) Starting from the largest scale, let the scale j be the largest scale J, link the non-zero pixels in the edge image E j (x, y) with similar modulus and phase angle, and set the chain length threshold, delete less than The short chain of the chain length obtains the single-pixel wide edge image E j (x, y) at the scale j;

(32)对于边缘图像Ej(x,y)中的每一个边缘像素点,搜索该点在尺度j-1下对应的像素点为中心的3×3邻域,将邻域内模值相角均相近的点作为边缘点添加到边缘图像Ej(x,y)中去,将边缘图像Ej(x,y)中模值相近、相角相近的非零像素点进行链接,并且设置链长阈值,删除小于链长的短链,从而得到了尺度j-1下的疵点边缘图像Ej-1(x,y);(32) For each edge pixel in the edge image E j (x, y), search for a 3×3 neighborhood centered on the pixel corresponding to the point at scale j-1, and calculate the phase angle of the model value in the neighborhood All similar points are added to the edge image E j (x, y) as edge points, and the non-zero pixels with similar modulus and phase angles in the edge image E j (x, y) are linked, and the chain Long threshold, delete short chains smaller than the chain length, so as to obtain the defect edge image E j-1 (x, y) under the scale j-1;

(33)若尺度j>1,则返回步骤(32),若j=1,则得到的边缘图像E1(x,y)即为多尺度融合后的疵点边缘图像;(33) If the scale j>1, then return to step (32), if j=1, then the obtained edge image E 1 (x, y) is the defect edge image after multi-scale fusion;

其中,Ej(x,y)为各个尺度j下的边缘图像,其中,j=1,2,3,...,J。Wherein, E j (x, y) is an edge image at each scale j, where j=1, 2, 3, . . . , J.

所述步骤(4)具体包括以下子步骤:Described step (4) specifically comprises the following substeps:

(41)对子图像进行直方图计算,得到低分辨率版本的直方图;(41) Perform histogram calculation on the sub-image to obtain a low-resolution version of the histogram;

(42)在所述低分辨率版本的直方图基础上产生初始种群;(42) generating an initial population based on the histogram of the low-resolution version;

(43)定义适应度函数;(43) Define the fitness function;

(44)应用学习策略改进字符串的适应值;(44) applying the learning strategy to improve the fitness value of the character string;

(45)比较最优字符串和当前字符串,如果最优字符串优于当前字符串,则用最优字符串代替当前字符串;否则,进行选择、交叉和变异操作来生成下一种群,并返回步骤(42);(45) Compare the optimal character string and the current character string, if the optimal character string is better than the current character string, replace the current character string with the optimal character string; otherwise, perform selection, crossover and mutation operations to generate the next population, And return to step (42);

(46)把得到的最佳阈值投射到原始空间得到原始图像的最佳阈值分割效果。(46) Project the obtained optimal threshold to the original space to obtain the optimal threshold segmentation effect of the original image.

有益效果Beneficial effect

由于采用了上述的技术方案,本发明与现有技术相比,具有以下的优点和积极效果:本发明结合了小波变换和遗传算法,先用离散小波变换对预处理后的图像进行分解,提取出图像的不同维度上的分量,得到较低分辨率的图像,达到了降维的目的。再使用遗传算法对小波分解后的近似图像直方图进行处理,得到一个阈值,再对原图像进行阈值分割,将疵点部分与织物背景分隔开。先经过小波分解,在使用遗传算法,使得相比传统的遗传算法,运算速度更快。经过本发明中的算法处理后的布匹瑕疵分割效果精准,分割速度快,并很好的保留了瑕疵原本的形态。Due to the adoption of the above-mentioned technical scheme, the present invention has the following advantages and positive effects compared with the prior art: the present invention combines wavelet transform and genetic algorithm, and first uses discrete wavelet transform to decompose the preprocessed image, extract The components in different dimensions of the image are obtained to obtain a lower-resolution image, which achieves the purpose of dimensionality reduction. Then, the genetic algorithm is used to process the approximate image histogram after wavelet decomposition to obtain a threshold value, and then threshold value segmentation is performed on the original image to separate the defect part from the fabric background. After wavelet decomposition, the genetic algorithm is used to make the calculation faster than the traditional genetic algorithm. After being processed by the algorithm of the present invention, the segmentation effect of the cloth blemish is accurate, the segmentation speed is fast, and the original shape of the blemish is well preserved.

附图说明Description of drawings

图1是织物瑕疵自动检测设备示意图;Fig. 1 is a schematic diagram of automatic detection equipment for fabric defects;

图2是本发明的流程图;Fig. 2 is a flow chart of the present invention;

图3是采集的织物原图;Figure 3 is the original picture of the collected fabric;

图4是经小波分解得到的子图像;Fig. 4 is the sub-image obtained through wavelet decomposition;

图5是融合后图像;Fig. 5 is the image after fusion;

图6是经阈值处理得到的检测结果图。Fig. 6 is a diagram of detection results obtained by thresholding.

具体实施方式detailed description

下面结合具体实施例,进一步阐述本发明。应理解,这些实施例仅用于说明本发明而不用于限制本发明的范围。此外应理解,在阅读了本发明讲授的内容之后,本领域技术人员可以对本发明作各种改动或修改,这些等价形式同样落于本申请所附权利要求书所限定的范围。Below in conjunction with specific embodiment, further illustrate the present invention. It should be understood that these examples are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the teachings of the present invention, those skilled in the art can make various changes or modifications to the present invention, and these equivalent forms also fall within the scope defined by the appended claims of the present application.

本发明的实施方式涉及一种基于小波变换和遗传算法的织物瑕疵检测方法,如图1所示,包括以下步骤:Embodiments of the present invention relate to a fabric defect detection method based on wavelet transform and genetic algorithm, as shown in Figure 1, comprising the following steps:

(1)对采集的带有瑕疵的图像进行预处理;(1) Preprocessing the collected images with defects;

(2)对预处理后的图像使用小波分解得到多尺度下的子图像;(2) Use wavelet decomposition on the preprocessed image to obtain multi-scale sub-images;

(3)对子图像进行融合以得到最优的疵点边缘信息;(3) Fusion the sub-images to obtain the optimal defect edge information;

(4)对子图像利用遗传算法计算出阈值,并采用所述阈值对融合后的图像进行阈值分割;(4) Utilize genetic algorithm to calculate threshold value to sub-image, and adopt described threshold value to carry out threshold value segmentation to the image after fusion;

(5)对经过阈值分割的图像进行形态学处理。(5) Perform morphological processing on the thresholded image.

具体如下:details as follows:

预处理preprocessing

将采集到的图像先进行灰度化处理,再使用直方图均值化和中值滤波使得原图像的质量得到整体改善,便于进行下一步的处理。The collected images are processed in grayscale first, and then histogram mean and median filter are used to improve the quality of the original image as a whole, which is convenient for the next step of processing.

小波分解wavelet decomposition

在织物中,绝大部分的疵点都具有一定的方向性,如断经、缺纬、双经等,一些区域类的疵点如油污、破洞等,则是在经纬两个方向上均产生了不规则纹理。对含有疵点的图像进行小波分解后,水平方向的细节子图和垂直方向的细节子图中会出现小波系数的局部极大值,在灰度上表现为灰度的奇异点。由于小波分解具有方向性,因此可利用小波分解得到的水平和垂直细节子图像表示织物水平和垂直方向上的纹理信息。小波变换还具有稀疏性,这些极大值较之分解前更为突出,更加有利于疵点的检测。In the fabric, most of the defects have a certain direction, such as broken warp, missing weft, double warp, etc. Some regional defects such as oil stains, holes, etc., are produced in both directions of warp and weft. Irregular texture. After the wavelet decomposition of the image containing defects, the local maximum value of the wavelet coefficient will appear in the detail sub-image in the horizontal direction and the detail sub-image in the vertical direction, and it will appear as a gray singular point in the gray scale. Because the wavelet decomposition has directionality, the horizontal and vertical detail sub-images obtained from the wavelet decomposition can be used to represent the texture information in the horizontal and vertical directions of the fabric. Wavelet transform also has sparsity, and these maximum values are more prominent than those before decomposition, which is more conducive to the detection of defects.

图像的小波分解是分别对图像在水平和垂直方向上进行一维离散小波变换。先分别对图像按行进行高通和低通滤波并进行下采样,得到两个输入图像一般大小的自图像,之后对其自图像按列进行高通和低通滤波并进行下采样,得到4个输入图像四分之一大小的子图像分别是Aj+1,Dj+1 H,Dj+1 V,Dj+1 D。其中,Aj+1是行和列两个方向上低通滤波的结果,代表下一尺度的概貌信号;Dj+1 H是行方向上低通滤波和列方向上高通滤波的结果,代表垂直方向上的细节信号在水平方向的概貌;Dj+1 V是行方向上高通滤波和列方向上低通滤波的结果,代表水平方向上的细节信号在垂直方向上的概貌;Dj+1 D是行和列两个方向上高通滤波的结果,代表对角方向的细节信号。The wavelet decomposition of the image is to perform one-dimensional discrete wavelet transform on the image in the horizontal and vertical directions respectively. First perform high-pass and low-pass filtering on the image by row and down-sampling to obtain two self-images of the same size as the input images, and then perform high-pass and low-pass filtering on the self-image by column and down-sampling to obtain 4 input images The sub-images of the quarter size of the image are A j+1 , D j+1 H , D j+1 V , D j+1 D . Among them, A j+1 is the result of low-pass filtering in the row and column directions, representing the overview signal of the next scale; D j+1 H is the result of low-pass filtering in the row direction and high-pass filtering in the column direction, representing the vertical The overview of the detail signal in the horizontal direction; D j+1 V is the result of high-pass filtering in the row direction and low-pass filtering in the column direction, representing the overview of the detail signal in the horizontal direction in the vertical direction; D j+1 D It is the result of high-pass filtering in the row and column directions, and represents the detail signal in the diagonal direction.

子图像融合sub-image fusion

经小波分解后的得到多尺度下的织物瑕疵边缘信息,以一定的规则对个尺度下的边缘子图像进行融合,可得到最优的疵点边缘信息。本发明中运用的是边缘聚焦方法,步骤如下:After wavelet decomposition, the edge information of fabric defects in multiple scales is obtained, and the edge sub-images in each scale are fused with certain rules to obtain the optimal edge information of defects. What used in the present invention is the edge focusing method, and the steps are as follows:

(1)从最大尺度开始,令j=J,将Ej(x,y)中模值与相角均相近的非零像素点进行链接,并且设置链长阈值,删除小于链长的短链,得到尺度j下的单像素宽的边缘图像Ej(x,y);(1) Starting from the largest scale, let j=J, link the non-zero pixels in E j (x, y) with similar modulus and phase angle, and set the chain length threshold to delete short chains smaller than the chain length , to obtain a single-pixel-wide edge image E j (x, y) at scale j;

(2)获得尺度j下的边缘图像后,对于Ej(x,y)中的每一个边缘像素点,搜索该点在尺度j-1下对应的像素点为中心的3×3邻域,将邻域内模值相角均相近的点作为边缘点添加到Ej(x,y)中去,将Ej(x,y)中模值相近、相角相近的非零像素点进行链接,并且设置链长阈值,删除小于链长的短链,从而尺度j-1下的疵点边缘图像Ej-1(x,y);(2) After obtaining the edge image at scale j, for each edge pixel in E j (x, y), search for a 3×3 neighborhood centered on the corresponding pixel at scale j-1, Add the points with similar modulus and phase angles in the neighborhood as edge points to E j (x, y), and link the non-zero pixels with similar modulus and phase angles in E j (x, y), And set the chain length threshold to delete short chains smaller than the chain length, so that the defect edge image E j-1 (x, y) under the scale j-1;

(3)令j=j-1,若j>1,则进入步骤(2),若j=1,则得到的E1(x,y)即为多尺度融合后的疵点边缘图像。(3) Let j=j-1, if j>1, go to step (2), if j=1, then the obtained E 1 (x, y) is the defect edge image after multi-scale fusion.

其中,Ej(x,y)为各个尺度j下的边缘图像,其中,j=1,2,3,...,J。Wherein, E j (x, y) is an edge image at each scale j, where j=1, 2, 3, . . . , J.

利用遗传算法进行阈值分割Threshold Segmentation Using Genetic Algorithm

简单的阈值分割很容易受到噪声、目标区域不规则的因素的影响,而分割的理想程度由阈值觉得,所以阈值的选取的研究对图像分割来说至关重要。而运用标准的遗传算法对瑕疵图像进行分割,会有收敛速度慢,计算时间长的缺点。本算法中的分割算法属于一种多级阈值方法。先利用小波变换将从不同尺度将图像分解成近似信号与细节信号,再对得到的近似信号进行二阶小波变换,分解为下一级别的近似信号和细节信号。结合小波变换的遗传算法流程如下:Simple threshold segmentation is easily affected by noise and irregularities in the target area, and the ideal degree of segmentation is determined by the threshold, so the research on the selection of threshold is very important for image segmentation. However, using the standard genetic algorithm to segment the flawed image has the disadvantages of slow convergence and long calculation time. The segmentation algorithm in this algorithm belongs to a multi-level threshold method. Firstly, the wavelet transform is used to decompose the image from different scales into approximate signal and detail signal, and then the second-order wavelet transform is performed on the obtained approximate signal to decompose it into the next level of approximate signal and detail signal. The genetic algorithm process combined with wavelet transform is as follows:

(1)经过小波变换的图像维度已经降低,对该图像进行直方图计算,得到低分辨率版本的直方图;(1) The dimensions of the image after wavelet transformation have been reduced, and the histogram calculation is performed on the image to obtain a low-resolution version of the histogram;

(2)在此低分辨率版本的直方图基础上产生初始种群;(2) Generate an initial population based on this low-resolution version of the histogram;

(3)定义适应度函数;(3) Define the fitness function;

(4)应用学习策略改进字符串的适应值;(4) Apply the learning strategy to improve the fitness value of the string;

(5)比较最优字符串和当前字符串,如果最优字符串优于当前字符串,则用最优字符串代替当前字符串。否则,进行选择、交叉和变异操作来生成下一种群,转到步骤2;(5) Compare the optimal string with the current string, and if the optimal string is better than the current string, replace the current string with the optimal string. Otherwise, perform selection, crossover and mutation operations to generate the next population, go to step 2;

(6)把得到的最佳阈值投射到原始空间得到原始图像的最佳阈值分割效果。(6) Project the obtained optimal threshold to the original space to obtain the optimal threshold segmentation effect of the original image.

形态学处理Morphological processing

对经过阈值分割的图像进行腐蚀、膨胀的形态学处理。在瑕疵的区域之间会存在空隙,通过腐蚀、膨胀等的形态学方法可出去图像中的噪声,并使得瑕疵区域变得连通。Morphological processing of erosion and dilation is performed on the thresholded image. There will be gaps between the flawed regions, and the noise in the image can be removed through morphological methods such as corrosion and expansion, and the flawed regions will become connected.

本方法可以应用于如图2所示的织物瑕疵自动检测系统中,该系统包括带检测布匹模块1,照明装置模块2,布匹传送装置模块3,拍摄装置模块4,旋转编码器模块5,图像采集装置模块6,上位机处理与现实装置模块7。照明装置模块2为织物图像的采集提供良好的光线条件,提高了织物图像的质量,有利于下一步的图像处理。布匹传送装置模块3为布匹传送装置,使得线阵相机与布匹形成匀速的相对运动,布匹传送装置模块3包括退布滚轴、送布滚轴、电机及其驱动、电机控制器。拍摄装置模块4为CCD线阵相机,在工业中用于拍摄图像。旋转编码器模块5主要功能是为相机提供主定时脉冲。图像采集装置模块6为图像采集卡,使得每个相机获得的数据被图像采集卡转换为数字图像。上位机处理与现实装置模块7为上位机处理与显示装置,将采集到的图片进行处理与分析结果输出。This method can be applied in the automatic detection system of fabric defect as shown in Figure 2, and this system comprises belt detection cloth module 1, illuminating device module 2, cloth conveying device module 3, photographing device module 4, rotary encoder module 5, image Acquisition device module 6, host computer processing and reality device module 7. The lighting device module 2 provides good light conditions for the collection of fabric images, improves the quality of the fabric images, and is beneficial to the next image processing. The cloth conveying device module 3 is a cloth conveying device, so that the linear camera and the cloth form a constant relative motion. The cloth conveying device module 3 includes a cloth withdrawing roller, a cloth feeding roller, a motor and its drive, and a motor controller. The photographing device module 4 is a CCD line scan camera, which is used for photographing images in industry. The main function of the rotary encoder module 5 is to provide the main timing pulse for the camera. The image acquisition device module 6 is an image acquisition card, so that the data obtained by each camera is converted into a digital image by the image acquisition card. The host computer processing and display device module 7 is a host computer processing and display device, which processes the collected pictures and outputs analysis results.

本发明专利数字图像处理的算法原理如下:The algorithm principle of the patent digital image processing of the present invention is as follows:

本发明先对采集的布匹瑕疵图像进行预处理,再使用离散小波变换对图像进行分解,提取出不同维度上的分量。再使用遗传算法对小波分解后的近似图像直方图进行处理,得到一个阈值,使用该阈值对图像进行阈值分割,最后得到瑕疵与背景图像分割开来的图像。The invention first preprocesses the collected cloth defect image, and then uses discrete wavelet transform to decompose the image to extract components in different dimensions. Then, the genetic algorithm is used to process the approximate image histogram after wavelet decomposition to obtain a threshold, which is used to perform threshold segmentation on the image, and finally the image separated from the blemish and the background image is obtained.

本实施例主要分为以下的步骤:This embodiment is mainly divided into the following steps:

(1)对采集的带有瑕疵的图像进行预处理:将采集到的图像先进行灰度化处理,再使用直方图均值化和中值滤波使得原图像(见图3)的质量得到整体改善,便于进行下一步的处理;(1) Preprocessing the collected images with defects: grayscale the collected images first, and then use histogram averaging and median filtering to improve the quality of the original image (see Figure 3) as a whole , to facilitate the next step of processing;

(2)使用小波分解得到多尺度下的子图像:图像的小波分解是分别对图像在水平和垂直方向上进行一维离散小波变换。先分别对图像按行进行高通和低通滤波并进行下采样,得到两个输入图像一般大小的自图像,之后对其自图像按列进行高通和低通滤波并进行下采样,得到4个输入图像四分之一大小的子图像。经小波分解得到的子图像如图4所示。(2) Use wavelet decomposition to obtain multi-scale sub-images: the wavelet decomposition of the image is to perform one-dimensional discrete wavelet transform on the image in the horizontal and vertical directions respectively. First perform high-pass and low-pass filtering on the image by row and down-sampling to obtain two self-images of the same size as the input images, and then perform high-pass and low-pass filtering on the self-image by column and down-sampling to obtain 4 input images A subimage the size of a quarter of the image. The sub-image obtained by wavelet decomposition is shown in Figure 4.

(3)对步骤(2)得到的子图像进行融合:经小波分解后的得到多尺度下的织物瑕疵边缘信息,以一定的规则对个尺度下的边缘子图像进行融合,可得到最优的疵点边缘信息。融合后得到的图像如图5所示。(3) Fusion the sub-images obtained in step (2): After wavelet decomposition, the edge information of fabric defects at multiple scales is obtained, and the edge sub-images at each scale are fused with certain rules to obtain the optimal Defect edge information. The image obtained after fusion is shown in Figure 5.

(4)根据步骤(2)得到的子图像利用遗传算法计算出阈值,并用该阈值对步骤(3)得到的融合图像进行阈值分割,经阈值处理得到的检测结果如图6所示。(4) According to the sub-image obtained in step (2), the threshold value is calculated by genetic algorithm, and the threshold value is used to perform threshold segmentation on the fusion image obtained in step (3).

(5)进行形态学处理:在瑕疵的区域之间会存在空隙,通过腐蚀、膨胀等的形态学方法可出去图像中的噪声,并使得瑕疵区域变得连通。(5) Morphological processing: There will be gaps between the defective regions, and the noise in the image can be removed through morphological methods such as corrosion and expansion, and the defective regions will become connected.

不难发现,本发明结合了小波变换和遗传算法,先用离散小波变换对预处理后的图像进行分解,提取出图像的不同维度上的分量,得到较低分辨率的图像,达到了降维的目的。再使用遗传算法对小波分解后的近似图像直方图进行处理,得到一个阈值,再对原图像进行阈值分割,将疵点部分与织物背景分隔开。先经过小波分解,在使用遗传算法,使得相比传统的遗传算法,运算速度更快。经过本发明中的算法处理后的布匹瑕疵分割效果精准,分割速度快,并很好的保留了瑕疵原本的形态。It is not difficult to find that the present invention combines wavelet transform and genetic algorithm, first decomposes the preprocessed image with discrete wavelet transform, extracts the components on different dimensions of the image, obtains a lower resolution image, and achieves dimensionality reduction the goal of. Then, the genetic algorithm is used to process the approximate image histogram after wavelet decomposition to obtain a threshold value, and then threshold value segmentation is performed on the original image to separate the defect part from the fabric background. After wavelet decomposition, the genetic algorithm is used to make the calculation faster than the traditional genetic algorithm. After being processed by the algorithm of the present invention, the segmentation effect of the cloth blemish is accurate, the segmentation speed is fast, and the original shape of the blemish is well preserved.

Claims (5)

1.一种基于小波变换和遗传算法的织物瑕疵检测方法,其特征在于,包括以下步骤:1. A fabric flaw detection method based on wavelet transform and genetic algorithm, is characterized in that, comprises the following steps: (1)对采集的带有瑕疵的图像进行预处理;(1) Preprocessing the collected images with defects; (2)对预处理后的图像使用小波分解得到多尺度下的子图像;(2) Use wavelet decomposition on the preprocessed image to obtain multi-scale sub-images; (3)对子图像进行融合以得到最优的疵点边缘信息;(3) Fusion the sub-images to obtain the optimal defect edge information; (4)对子图像利用遗传算法计算出阈值,并采用所述阈值对融合后的图像进行阈值分割;(4) Utilize genetic algorithm to calculate threshold value to sub-image, and adopt described threshold value to carry out threshold value segmentation to the image after fusion; (5)对经过阈值分割的图像进行形态学处理。(5) Perform morphological processing on the thresholded image. 2.根据权利要求1所述的基于小波变换和遗传算法的织物瑕疵检测方法,其特征在于,所述步骤(1)具体为:将采集到的带有瑕疵的图像先进行灰度化处理,再使用直方图均值化和中值滤波使得原图像的质量得到整体改善。2. the fabric flaw detection method based on wavelet transform and genetic algorithm according to claim 1, is characterized in that, described step (1) is specifically: the image with flaw that gathers is first carried out grayscale processing, Then use histogram averaging and median filtering to improve the quality of the original image as a whole. 3.根据权利要求1所述的基于小波变换和遗传算法的织物瑕疵检测方法,其特征在于,所述步骤(2)具体为:分别对图像按行进行高通和低通滤波并进行下采样,得到两个输入图像一般大小的自图像,之后对其自图像按列进行高通和低通滤波并进行下采样,得到4个输入图像四分之一大小的子图像分别是Aj+1,Dj+1 H,Dj+1 V,Dj+1 D;其中,Aj+1是行和列两个方向上低通滤波的结果,代表下一尺度的概貌信号;Dj+1 H是行方向上低通滤波和列方向上高通滤波的结果,代表垂直方向上的细节信号在水平方向的概貌;Dj+1 V是行方向上高通滤波和列方向上低通滤波的结果,代表水平方向上的细节信号在垂直方向上的概貌;Dj+1 D是行和列两个方向上高通滤波的结果,代表对角方向的细节信号。3. the fabric flaw detection method based on wavelet transform and genetic algorithm according to claim 1, is characterized in that, described step (2) is specifically: carry out high-pass and low-pass filtering and carry out down-sampling to image respectively by line, Obtain two self-images of the general size of the input image, and then perform high-pass and low-pass filtering and down-sampling on the self-image by column, and obtain four sub-images of the quarter size of the input image, which are A j+1 , D j+1 H , D j+1 V , D j+1 D ; among them, A j+1 is the result of low-pass filtering in the row and column directions, representing the profile signal of the next scale; D j+1 H is the result of low-pass filtering in the row direction and high-pass filtering in the column direction, representing the overview of the detail signal in the vertical direction in the horizontal direction; D j+1 V is the result of high-pass filtering in the row direction and low-pass filtering in the column direction, representing the horizontal The overview of the detail signal in the direction in the vertical direction; D j+1 D is the result of high-pass filtering in the row and column directions, representing the detail signal in the diagonal direction. 4.根据权利要求1所述的基于小波变换和遗传算法的织物瑕疵检测方法,其特征在于,所述步骤(3)具体包括以下子步骤:4. the fabric defect detection method based on wavelet transform and genetic algorithm according to claim 1, is characterized in that, described step (3) specifically comprises the following substeps: (31)从最大尺度开始,令尺度j为最大尺度J,将边缘图像Ej(x,y)中模值与相角均相近的非零像素点进行链接,并且设置链长阈值,删除小于链长的短链,得到尺度j下的单像素宽的边缘图像Ej(x,y);(31) Starting from the largest scale, let the scale j be the largest scale J, link the non-zero pixels in the edge image E j (x, y) with similar modulus and phase angle, and set the chain length threshold, delete less than The short chain of the chain length obtains the single-pixel wide edge image E j (x, y) at the scale j; (32)对于边缘图像Ej(x,y)中的每一个边缘像素点,搜索该点在尺度j-1下对应的像素点为中心的3×3邻域,将邻域内模值相角均相近的点作为边缘点添加到边缘图像Ej(x,y)中去,将边缘图像Ej(x,y)中模值相近、相角相近的非零像素点进行链接,并且设置链长阈值,删除小于链长的短链,从而得到了尺度j-1下的疵点边缘图像Ej-1(x,y);(32) For each edge pixel in the edge image E j (x, y), search for a 3×3 neighborhood centered on the pixel corresponding to the point at scale j-1, and calculate the phase angle of the model value in the neighborhood All similar points are added to the edge image E j (x, y) as edge points, and the non-zero pixels with similar modulus and phase angles in the edge image E j (x, y) are linked, and the chain Long threshold, delete short chains smaller than the chain length, so as to obtain the defect edge image E j-1 (x, y) under the scale j-1; (33)若尺度j>1,则返回步骤(32),若j=1,则得到的边缘图像E1(x,y)即为多尺度融合后的疵点边缘图像;(33) If the scale j>1, then return to step (32), if j=1, then the obtained edge image E 1 (x, y) is the defect edge image after multi-scale fusion; 其中,Ej(x,y)为各个尺度j下的边缘图像,其中,j=1,2,3,...,J。Wherein, E j (x, y) is an edge image at each scale j, where j=1, 2, 3, . . . , J. 5.根据权利要求1所述的基于小波变换和遗传算法的织物瑕疵检测方法,其特征在于,5. the fabric defect detection method based on wavelet transform and genetic algorithm according to claim 1, is characterized in that, 所述步骤(4)包括以下子步骤:Described step (4) comprises following substep: (41)对子图像进行直方图计算,得到低分辨率版本的直方图;(41) Perform histogram calculation on the sub-image to obtain a low-resolution version of the histogram; (42)在所述低分辨率版本的直方图基础上产生初始种群;(42) generating an initial population based on the histogram of the low-resolution version; (43)定义适应度函数;(43) Define the fitness function; (44)应用学习策略改进字符串的适应值;(44) applying the learning strategy to improve the fitness value of the character string; (45)比较最优字符串和当前字符串,如果最优字符串优于当前字符串,则用最优字符串代替当前字符串;否则,进行选择、交叉和变异操作来生成下一种群,并返回步骤(42);(45) Compare the optimal character string and the current character string, if the optimal character string is better than the current character string, replace the current character string with the optimal character string; otherwise, perform selection, crossover and mutation operations to generate the next population, And return to step (42); (46)把得到的最佳阈值投射到原始空间得到原始图像的最佳阈值分割效果。(46) Project the obtained optimal threshold to the original space to obtain the optimal threshold segmentation effect of the original image.
CN201610292018.2A 2016-05-05 2016-05-05 Fabric flaw detection method based on wavelet transformation and genetic algorithm Pending CN105931246A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610292018.2A CN105931246A (en) 2016-05-05 2016-05-05 Fabric flaw detection method based on wavelet transformation and genetic algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610292018.2A CN105931246A (en) 2016-05-05 2016-05-05 Fabric flaw detection method based on wavelet transformation and genetic algorithm

Publications (1)

Publication Number Publication Date
CN105931246A true CN105931246A (en) 2016-09-07

Family

ID=56834387

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610292018.2A Pending CN105931246A (en) 2016-05-05 2016-05-05 Fabric flaw detection method based on wavelet transformation and genetic algorithm

Country Status (1)

Country Link
CN (1) CN105931246A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107256545A (en) * 2017-05-09 2017-10-17 华侨大学 A kind of broken hole flaw detection method of large circle machine
CN108090494A (en) * 2017-12-15 2018-05-29 东华大学 Based on Gabor filter and support vector machines textile flaw recognition methods
CN108389214A (en) * 2018-03-06 2018-08-10 青岛海信医疗设备股份有限公司 The processing method and processing device of ultrasonoscopy, electronic equipment, storage medium
CN110349132A (en) * 2019-06-25 2019-10-18 武汉纺织大学 A kind of fabric defects detection method based on light-field camera extraction of depth information
CN110400306A (en) * 2019-07-29 2019-11-01 恒天嘉华非织造有限公司 Non-woven fabrics defect detection method based on morphologic filtering and convolutional neural networks
CN112330673A (en) * 2020-12-11 2021-02-05 武汉纺织大学 Woven fabric density detection method based on image processing
CN113781458A (en) * 2021-09-16 2021-12-10 厦门理工学院 A recognition method based on artificial intelligence
CN113837198A (en) * 2021-05-18 2021-12-24 中国计量大学 Improved self-adaptive threshold Canny edge detection method based on three-dimensional block matching
US11788918B2 (en) 2020-06-18 2023-10-17 Trevillyan Labs, Llc Fluid detection fabric
CN119228805A (en) * 2024-12-04 2024-12-31 诸暨市锦向针织有限公司 A knitted fabric defect detection method and system based on machine vision

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1148332A2 (en) * 2000-04-18 2001-10-24 The University of Hong Kong Method of and device for inspecting images to detect defects
CN104199823A (en) * 2014-07-14 2014-12-10 西安工程大学 Fabric defect dynamic detection method based on visual data drive
CN104268505A (en) * 2014-09-12 2015-01-07 河海大学常州校区 Automatic cloth defect point detection and recognition device and method based on machine vision

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1148332A2 (en) * 2000-04-18 2001-10-24 The University of Hong Kong Method of and device for inspecting images to detect defects
EP1148332A3 (en) * 2000-04-18 2001-11-07 The University of Hong Kong Method of and device for inspecting images to detect defects
CN104199823A (en) * 2014-07-14 2014-12-10 西安工程大学 Fabric defect dynamic detection method based on visual data drive
CN104268505A (en) * 2014-09-12 2015-01-07 河海大学常州校区 Automatic cloth defect point detection and recognition device and method based on machine vision

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
BRIAN M. SADLER等: "Analysis of Multiscale Products for Step Detection and Estimation", 《IEEE TRANSACTIONS ON INFORMATION THEORY》 *
周婷婷: "基于小波分析和遗传算法的乳腺X线图像分割", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
杨怀义: "图像分割中算法的应用研究", 《计算机仿真》 *
殷国亮等: "基于边缘检测和小波分析的布匹瑕疵检测方法", 《江南大学学报( 自然科学版)》 *
王鹤翔: "基于小波变换和SVM的织物疵点检测与分类", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107256545A (en) * 2017-05-09 2017-10-17 华侨大学 A kind of broken hole flaw detection method of large circle machine
CN108090494A (en) * 2017-12-15 2018-05-29 东华大学 Based on Gabor filter and support vector machines textile flaw recognition methods
CN108090494B (en) * 2017-12-15 2021-05-25 东华大学 Textile defect recognition method based on Gabor filter and support vector machine
CN108389214B (en) * 2018-03-06 2022-03-01 青岛海信医疗设备股份有限公司 Ultrasonic image processing method and device, electronic equipment and storage medium
CN108389214A (en) * 2018-03-06 2018-08-10 青岛海信医疗设备股份有限公司 The processing method and processing device of ultrasonoscopy, electronic equipment, storage medium
CN110349132A (en) * 2019-06-25 2019-10-18 武汉纺织大学 A kind of fabric defects detection method based on light-field camera extraction of depth information
CN110349132B (en) * 2019-06-25 2021-06-08 武汉纺织大学 Fabric flaw detection method based on light field camera depth information extraction
CN110400306A (en) * 2019-07-29 2019-11-01 恒天嘉华非织造有限公司 Non-woven fabrics defect detection method based on morphologic filtering and convolutional neural networks
US11788918B2 (en) 2020-06-18 2023-10-17 Trevillyan Labs, Llc Fluid detection fabric
US12123807B2 (en) 2020-06-18 2024-10-22 Trevillyan Labs, Llc Fluid detection fabric
CN112330673B (en) * 2020-12-11 2021-07-06 武汉纺织大学 Woven fabric density detection method based on image processing
CN112330673A (en) * 2020-12-11 2021-02-05 武汉纺织大学 Woven fabric density detection method based on image processing
CN113837198A (en) * 2021-05-18 2021-12-24 中国计量大学 Improved self-adaptive threshold Canny edge detection method based on three-dimensional block matching
CN113837198B (en) * 2021-05-18 2023-11-28 中国计量大学 An improved adaptive threshold Canny edge detection method based on three-dimensional block matching
CN113781458A (en) * 2021-09-16 2021-12-10 厦门理工学院 A recognition method based on artificial intelligence
CN119228805A (en) * 2024-12-04 2024-12-31 诸暨市锦向针织有限公司 A knitted fabric defect detection method and system based on machine vision
CN119228805B (en) * 2024-12-04 2025-07-01 成工业制衣(苏州)有限公司 A knitted fabric defect detection method and system based on machine vision

Similar Documents

Publication Publication Date Title
CN105931246A (en) Fabric flaw detection method based on wavelet transformation and genetic algorithm
CN110866924B (en) Line structured light center line extraction method and storage medium
CN109598715B (en) Material granularity online detection method based on machine vision
CN114910480B (en) Wafer surface defect detection method based on machine vision
Schmugge et al. Detection of cracks in nuclear power plant using spatial-temporal grouping of local patches
CN107123114A (en) A kind of cloth defect inspection method and device based on machine learning
CN111402226A (en) A Surface Defect Detection Method Based on Cascaded Convolutional Neural Networks
CN112215819B (en) Airport pavement crack detection method based on depth feature fusion
Deng et al. Binocular video-based 3D reconstruction and length quantification of cracks in concrete structures
CN110458807A (en) A Machine Vision Detection System for Railway Track Defects
CN107389701A (en) A kind of PCB visual defects automatic checkout system and method based on image
CN108460764A (en) The ultrasonoscopy intelligent scissor method enhanced based on automatic context and data
CN110288571B (en) High-speed rail contact net insulator abnormity detection method based on image processing
CN106198569B (en) A kind of LTPS/IGZO glass substrates broken hole rapid detection method
CN110335233B (en) Highway guardrail plate defect detection system and method based on image processing technology
CN109685766A (en) A kind of Fabric Defect detection method based on region fusion feature
CN109540925B (en) Complex ceramic tile surface defect detection method based on difference method and local variance measurement operator
CN102175700A (en) Method for detecting welding seam segmentation and defects of digital X-ray images
CN113177924A (en) Industrial production line product flaw detection method
CN103761743A (en) Solid wood floor surface defect detecting method based on image fusion and division
CN107644417B (en) Appearance defect detection method of strain gauge
CN107403124A (en) A kind of barcode detection recognition methods of view-based access control model image
CN109781737B (en) Detection method and detection system for surface defects of hose
CN108647706A (en) Object recognition classification and defect detection method based on machine vision
CN111739003B (en) Machine vision method for appearance detection

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160907

RJ01 Rejection of invention patent application after publication