Abstract
This paper proposes a method to realize computer-aided analysis and reverse reconstruction for the weave pattern of fabric. Firstly, a double-face imaging system is designed to get the redundant image information used to correct node classification, and then the image gridding processing is realized by using the projection algorithm in the warp and weft directions. The grid node color was determined by the color clustering method. Then the attributes and classification of the grid nodes are determined by the analysis of the edge strength information. The correction of node classification is realized with the information of adjacent nodes and the color of the double surface image of the corresponding fabric region. After that, the acquired nodes were encoded with 0 and 1, and then converted into a digital matrix; the basic weave structure matrix of the fabric was derived by matrix transformations. In the meantime, two one-dimensional row and column matrices and a color mapping table are adopted to represent the warp and weft yarn color array. On the basis of the above, the digital files of the woven pattern of sample fabric are established. Finally, the model of the fabric weave pattern can be obtained by the reverse reconstruction method and the automatic recognition of the fabric weave pattern is realized. Through comparison of the original fabric sample image with the reconstructed weave pattern model, it is proved that the proposed method is effective.
Keywords
The weave pattern of woven fabric mainly consists of warp and weft yarn density, fabric structure, color, the array parameter of dyed yarn and so on. In modern textile enterprises, except for the warp and weft count, which is determined by the method of sampling, weighing and calculation, other parameters still need to rely on analysis of the special testers with the help of auxiliary equipments. Such an artificial analyzing method has certain disadvantages, such as time consumption, low efficiency and influence caused by subjective factors of testers on the testing results; that is to say, different testers may come to diverse testing results. Nowadays, textile manufacturing has a tendency to produce various kinds of textiles with small batches. The development in computers and image processing technology has offered new ways to design fabric structure and to automatically recognize the weave patterns. Such ways can not only automatically and efficiently recognize the structure parameters of the sample fabric, but also achieve the products’ reverse model building and reconstruction. It has become a new researching hotspot in textile engineering by machine vision to directly obtain surface parameters of the fabric surface.1–5 Many workable algorithms have been brought forward by studies from the researchers all over the world.6–10 From the perspective of image processing methods, one way is to judge interlacing types through the means of gray analysis, edge enhancement, thresholding, histogram equalization, wave filtering, etc. For example, Kang et al. 11 take advantage of the fabric light transmittance image to locate the yarns through gray analysis of the yarn clearance, and obtain the degree of fineness and density; then they can determine the node types by using the ratio of the long axis to the short axis of the elliptical protuberances presented by the interlacing points in reflecting light image. Another way is to calculate and analyze the image after converting the spatial domain into the frequency domain through FFT (Fast Fourier Transformation), two-dimensional (2D) spectral analysis, wavelet transformation, etc.12–14
To analyze and recognize the weave pattern of fabric, first of all we need to segment the cross-yarns. There are mainly two methods of segmentation. The one proposed by Kang et al. 11 is to distinguish the cross-yarn’s type through the geometrical shape of interlacing nodes; the other is the Fuzzy C-Means (FCM) clustering method introduced by Kou et al., 15 which classifies the interlacing nodes by analyzing the texture characteristic. However, these two methods both can only recognize the interlacing type of the fabric, and are unable to distinguish the weave patterns. In addition, the noise in the image that is likely to be caused by fabric winkling, curling and fading has brought comparative difficulty in fabric recognition and even led to incorrect recognition.16–20 What’s more, due to the fact that single-face image information merely is adopted in the traditional fabric structure analyzing method, which usually results in an inadequacy in the obtained image information, it is hard to conduct accurate analysis to the weave pattern, particularly when the fabric structure is relatively complex. The double-face image information of the fabric can contribute to an increase in the information content. The single-face image only involves half of the interweaving information between warp and weft yarns; the complete geometrical shape of the yarns cannot be observed from a single face; instead, the integrated interweave information can only be acquired from the double-face field of view.
On this basis, this paper designs a double-face imaging system that can collect images of both the front-side and back-side of the woven fabric in the detection process. This kind of collection, together with brightness characteristics and color feature of the fabric in the warp and weft directions, can help to separate cross-yarns. The classification of the interlacing type is the key to recognizing the weave pattern. Accordingly, this paper proposes a classification method of interlacing node type based on the quadrilateral boundary. At the same time, in order to guarantee the accuracy of the classification, this paper raises a correction method based on neighboring information and double-face image information. The coding mode is introduced to encode the warp and weft nodes with 0 and 1; with that, the digital matrix is build up to represent node classification. The largest independent group theory is used to decide the basic construct unit of the fabric weave pattern, and two single dimension arrays, together with a color mapping table, are established to represent the arrangement of the color of the warp and weft yarns; through the above processing, a digital file can be established that is the foundation of fabric weave pattern recognition and the reverse reconstruction model. The method proposed in this paper was proved to be efficient by comparing the original sample image to the reconstructed image. The structure of this paper is arranged as follows: the first section analyzes generally the researching content of this paper and the second section introduces the double-face imaging system; in the third section the gridding processing method of the woven fabric image is put forward; in the forth section a digital node classification method and correction method are introduced, and in the fifth section we bring forward a digital file to represent the weave pattern of the fabric surface, as well as a method of reconstruction of the weave pattern. Finally we present the final discussion and conclusion.
Image acquisition device of fabric surface
In this paper, the double-face imaging device of fabric is as shown in Figure 1. In the work process, the electric motor controlled by a computer drives cramping apparatus to whirl and locates the front and back of the fabric, and then the image of both sides of the fabric surface is captured to be preserved in the computer for processing.
The schema of the double-face imaging system: (1) charge-coupled device; (2) clamp mechanism for the testing sample; (3) sample fabric; (4) electric motor and executive mechanism.
In the double-face imaging device, the distance between the camera and the fabric sample is 300 mm. The whole imaging device is made up of four parts. (1) The first is the optical imaging system, which is controlled by the computer, is in charge of acquiring the double-face image of the target region of the fabric. The optical imaging system mainly includes the digital charge-coupled device (CCD) and optical lens. In this paper, the digital CCD is a DH-SV200FC, of which the resolution is 1628 × 1236 pixels and the optical lens is TEC-M55, whose focal length is 55 mm; the aperture is F2.8-F32C and the working distance is from 140 mm to infinity. (2) The second part is the sample fabric clamping mechanism. It contains two splints of the same structure, and in each splint there are four predefined reference points (used for locating the corresponding region between double-face images) with a geometric relationship in four angular points of the sampling window; the specific sample-cramping apparatus consists of a transparent double-face splint and a fixing skeleton. A side of splints is combined together with a hinge and the other side can open and close. The tested sample can smoothly be fitted into a proper site inside. By moving the two pairs of the locating slice in the upper side of the cramping apparatus, it can select the size of the tested region. (3) The third part is the electric motor and executive mechanism. It is used to control the cramping apparatus to swivel 180 degrees precisely and realize double-face imaging of fabric. (4) The fourth part is the system software, which is used to carry out a procedure of collecting, controlling, processing and analyzing the images; this system software is developed on the Microsoft Visual C++ 6.0 platform and can work on the operating system of Windows XP.
Using the imaging device designed in the paper, we can obtain an image of the tested sample with the size of 1628 × 1236 pixels. Figure 2 shows the partial area of the double-face image of fabric captured; the image area within the blue box is selected area for processing.
The partial double-face images of fabric: (a) the front image of the fabric; (b) the back image of the fabric. (Color online only.).
The grid processing of the woven fabric image
The key steps to automatically recognize the weave pattern of woven fabric is to realize the interlacing node segmentation in the fabric image, which is based on gridding processing in the fabric image. Aiming at a precise grid to the image, the image should be preprocessed firstly so as to suppress image noise and enhance significant image features. Through these methods, we can precisely separate the interlacing nodes and lay the foundation for the follow-up image analysis.
Image region selection and filtering
Effective image region selection is to select the specified part of image as a follow-up image for processing objects from the original image. In general, the original image we obtained was too large and contained a large amount of redundant information. It is not conducive to real-time processing of images, where we can select an effective image region from the original image to realize fabric woven pattern analysis quickly. Of course, if the image structure is relatively complicated, a larger image area selection is allowed so that it can include more interlacing nodes and increase redundant information. For example, the image region within the blue box, shown in Figure 2, is selected for processing. The image preprocessing operation is required to improve image quality. In this paper, several steps on the sample fabric image are carried out, which include (a) grayscale transformation, (b) image filtering, (c) contrast enhancement, etc. The image noises are unavoidable due to the impact of the imaging environment and conditions. Hence, it is necessary for the image to be filtered after grayscale transformation. Traditional average filtering and median filtering will make the images become blurred and lose the image detail when they have got rid of noise. In this paper, the spatial filter has been used to remove image noise. We combine average filtering with the median filtering for the image of woven fabric. Firstly, an improved algorithm of average filtering has been used to wipe image noise off. The average filter can be represented by the following equation:
Considering the precision of the projection algorithm, the kernel of average filter used in this paper is
Since the common neighbor average filtering will make the image illegible, the improved average filtering algorithm has changed the pixel disposal method, in which the pixel will be replaced by the average value only if the difference between the value of the pixel and the average value of the neighbor pixel is more than a threshold that we have set up before. Otherwise, the value of the pixel will not be changed. The advantage of the algorithm is that the image will not be illegible but the noises of high intensity can be wiped off. Through the experiment, the threshold value of 30 can be used to better retain the image details.
Similarly, median filtering has selected the middle pixel values after sorting in the filter window:
In Equation (3), the size of the window is 5 × 5, and N is 25. In fact, the selected pixel is not necessarily linked with the operated pixels. Therefore, if an object in the image is too small, after sorting, it may be that there are no pixels in the middle of the filter window and the object will be filtered out or even disappear after filtering. So we set a threshold value before filter operation. Only when the difference between the value of operated pixel and the median value of neighborhood pixels is greater than the threshold value dose the operated pixel have been replaced by the pixel with the median value, or the original pixel value is retained. With this method, if there is a noise pixel point, its pixel values will have a larger difference, and it can be got rid of. If the pixel is not a noise point, the difference between the median value of the neighborhood and the operated pixel value will not be great and the original pixel value can be retained as long as the appropriate threshold is set before. Through experiments, it is found that the threshold value between 20 and 30 is preferable to retain the image details while removing noise. Figure 3 shows the image processing results.
The results of image preprocessing: (a) the original image; (b) the converted gray image; (c) the image after filter operation; (d) the enhanced image.
Automatic fabric image gridding
The automatic gridding of fabric images can be achieved by using the brightness characteristic information of the image. When constructing the gridding model, all the yarns are regarded as a straight stripe in the vertical and horizontal directions. However, the shape and location assigned to the grids are merely approximations.
The brightness distribution of fabric image has an obvious gradient change. The brightness gradient arranged in descending order is: the axial line of yarns, the marginal zone of yarns and the transition region between yarns; what is more, there is a brightness mutation in the transition region, so the brightness valley value can be found by using the projection algorithm in the vertical and horizontal directions. With this method, the yarns can be detected and the interlacing node can be finally segmented.
Assuming the brightness of any pixel point is G(i,j). The gray value of the fabric image can be mapped into two independent one-dimensional waves that can be described by following equations:
Taking Figure 3(d) for example, the gray projection result of the converted image is shown in Figure 4. The valley points of the curve in Figure 4 correspond to the weft gap position in the fabric image, and the peak points represent the axes of the yarn. As long as the valley points of the curve in Figure 4 are figured out, it will be possible to locate the weft gaps and realize preliminary segmentation of the weft yarn.
The gray fabric image and projection curve.
The same as for the weft yarn, the warp yarn of an ideal fabric should be sited in the vertical direction. In the gray projection method, an accumulation of the pixel points arraying in a row can allow one to locate the weft. In an ideal smooth curve, to locate the valley point one only needs to detect two adjacent points of the projection curve. That is to say, if a point G[i] in the projection curve can meet the condition G[i–1] <G[i] <G[i + 1], then G[i] is the valley point. However, from Figure 4 we note that the valley points in the curve can be divided into two categories: one can be called the truth value, namely the minimum value in actual representation of yarn clearance, while the other is called the partial minimum value, which comes from the fact that the brightness of the pixel points in a fabric image does not completely follow a descending distribution. In order to filter these points with local minimum value, a filter, namely Filter=[0,0,1,0,0], is involved in the paper, which can realize only when the pixel point is the minimum value among the five adjacent points can be considered as the position point of yarn gaps.
After filtering the partial minimum value point, the curve valley points can represent the exact position of yarn gaps. If we accurately locate these gaps points and then associate them with the fabric image, the fabric image gridding can be achieved. Figure 5 shows the grid results.
Fabric gridding processing result.
The method of digital classification
Preliminary classification of the nodes
The node type and number
In Table 1, node 0 and the node 4 have the same boundaries. Using the boundary information it is difficult to distinguish them, but during the next correction steps we can determine which node type they are by using their color information.
After the initial nodes model is obtained, we can adjust the node image through the analysis of the adjacent gray information of the four sides of each node. A threshold value can be set for the edge pixels. If the edge gray value is lower than the threshold value, then the edge can retained and recorded as a closed state 1; if the node edge grayscale value is higher than the threshold value, then the edge will be removed and recorded as open state 0.
Impossible-existing types of neighboring nodes
The eight pre-classification subtypes are reconverted to warp and weft node types by Equation (3) and the results can be saved by a matrix:
Thematrix representation of the node type.

Correction of node types
In the process of recognition, owing to the rough surface of the sample fabric or the complexity of the fabric image texture, mistakes are inevitable in yarn segmentation, which influence accurate classification of the node types in the fabric. Meanwhile, since the original image conversion to a gray image may lose information and lead to insufficient information of the gap region between nodes, these will also affect the classification result. However, for artificial recognition, the testers can carry out correct judgment according to their experience. In this paper, in order to assure the accuracy of the node classification, three correction methods are proposed to correct and regulate the matrix, which represents the node types.
The adjacent node information correction
In node classification, the node type is defined by boundary intensity, and the four edge intensity information types of the node are relevant to the boundary intensity of the neighboring nodes. Whether the node type exists or not can be judged according to the already-known neighboring information of the node type. Table 2 lists all impossible types of adjacent nodes. For instance, if a node type is a close weft interlacing of type 0, according to the boundary intensity, its left and right neighboring nodes in the weft direction (left and right directions) cannot be any one of the four kinds of weft node types, and its upper neighboring node and lower neighboring node (warp direction) would not exist as types 6, 7 and 5, 7, respectively. Undoubtedly this conclusion can be applied to verify the interlacing type that has already been determined.
The dual-side image information correction
In the paper, the color clustering method is used to determine the color of the pre-classification nodes. In the process, how to get the feature color set of node is key. To get feature colors includes two principles, namely the maximal frequency principle and the compatibility principle. The former guarantees that the N feature colors of the color sets can represent the main color component in the target image area, and the latter requires that the feature colors have a relatively uniform distribution in color space. We adopt the compatible sphere space color model, in which each feature color occupies one sphere space of radius R; the image color within this space can all be merged together into the feature color. The interval between each feature color should be greater than R. Obviously, the larger the compatible range is, that is, the greater R is, the fewer the node feature colors there are. For the different textiles, we can adopt an experimental method to select the R value and determine the set of characteristic colors according to the algorithm. Through the experiment, we use k (k = 16) colors as the color feature sets of each node. To determine the node color feature set we can use following steps:
draw statistics of histogram P(xn) for all the color xn of the node image (n ∈ [1, 2, … , N], where N is the number of colors of the node image); array P(xn) with descending order to get the color sequence the processing of colors starts with the color which has the maximum frequency. Take as the center and merge compatible body colors; for the residual colors, still began with the color with the maximum frequency to merge its compatibility of color body; Repeated iteration of the above merging process, until completion of N colors. after the above process, the color set that contains k feature colors can be obtained.
The color of the node can be determined by repeating the previous steps for node k feature colors, until the k feature colors of the node are merged into a color.
For some nodes that have the same color, their colors obtained with the above method sometimes have subtle differences, so through the adjacent node similarity calculation, we can determine whether their colors can be merged into one color.
If the color of the node image represents the feature colors, the color of the single node region can be described with the single feature vector:
In the formula, S(xi) is the pixel numbers of the ith feature color of a feature set in this image region, and Cf is the vector reflecting differences between them. In the paper, we use the two vector angles in the vector space to reflect the relationship of the similarity degree. So here we can define a texture similarity:
The larger the
According to the fabric color characteristics, all nodes of the image are processed with the above method. Through obtaining the color feature set of the node, the color of the node can be decided upon. And whether the colors of adjacent nodes can be merged is determined by calculating the similarity
The fabric color pattern is made up of warp and weft yarns with different colors. The node color of fabric can be used to correct the errors in node classification. Of course, this method only applies to the nodes interlaced by the yarns of different colors. If the node’s upper-side color can match that of the weft yarn, this node is a weft node, and vice versa. If the node color gained by pre-classification is contradictory with that directly extracted from the image, the node classification results need to be corrected.
The color information of the dyed yarn can be used to regulate the properties of warp and weft nodes. The rules are as follows:
if the node’s color is identical to the corresponding warp yarn, yet different from the weft, this node is defined as a warp interlacing node; if the node’s color is identical to the corresponding weft yarn, yet different with the weft, this node is defined as a weft interlacing node; if the node’s color is identical to the color of both corresponding warp and weft yarns, its properties cannot be identified and then the node will be looked at as an undetermined interlacing node, which means the color information correction method is invalid and cannot be used for judging and correcting the node interlaced by the same color yarn.
The basic structure image of fabric
Through multilevel correction, the accurate interlacing type image made by different type nodes can be obtained. In fact, the fabric is made up by a basic structure unit repeatedly arrayed one by one, which enables the fabric image to display certain texture features. Each of the basic structure units in the fabric image has the same structure. The key of recognition of a fabric weave pattern is to acquire the basic structure unit.
In this paper, the basic structure unit of fabric is extracted by using the matrix transform method. Firstly, the interlacing type image has been encoded with 0 and 1, in which the “0” represents the warp interlacing node and the “1”represents the weft interlacing node. By this method, the interlacing type image is converted to a digital matrix, the elements of which are composed of the “0” and “1”. Secondly, we calculate the largest independent group of row and column vectors of the matrix. The number of the maximal independent set of the row vectors in the matrix is the number of weft cycles, and then the number of the maximal independent set of the column vectors in the matrix is the number of warp cycles. Figure 7 shows the algorithm to acquire the fabric basic structure unit.
The method to obtain the basic structure unit.
Digitization and classification experiment
Digital file representation of the fabric weave pattern
In the study, after the basic structure unit and yarn color information of the fabric are extracted, the parameter information of the fabric can be formed into a digital file used to represent the weave pattern of the fabric and realize reverse reconstruction.
This digital file involves two parts. (1) The first is the woven pattern structure, which is made up of the basic structure unit repeatedly arrayed one by one in the interlacing image. Matrix A can be use to represent the basic structure unit, which consists of 0 and 1, where 0 represents the weft node and 1 represents the warp node. (2) The second part is two single-dimension matrices and a color mapping table that lists all colors and their corresponding coding of the fabric sample. The color mapping table is similar to the bitmap's palette.
If the total number of colors of the fabric sample is N, the different colors can be encoded as 0, 1, 2 , … , N–1 and stored in a coding table. Through the color coded value in the color mapping table, the actual color can be found.
Two one-dimension matrices can be used to represent the yarn color of the tested sample in the warp and weft directions in which the element is the code value of the colors. For example, the weave pattern shown in Figure 5 has a total of three colors and can construct the mapping table shown in Figure 8.
The color and color mapping table.
The color array of the yarn can be easily and clearly shown by two one-dimensional matrices:
Reverse reconstruction of the fabric weave pattern
Using the digital files composed of matrices A, B, C and the color mapping table, we can achieve the reconstruction of the fabric weave patterns. The reconstruction methods are as follows.
Firstly, matrix A, which represents the basic structure cycle unit, is expanded along the warp and weft directions, and makes the expanded matrix meet the pre-set size requirement. Then the matrix elements 0 and 1 are converted to a black and white interlacing image, and every node should be set to the same length and width to form a standard interlacing image.
Secondly, in the warp (vertical) direction, the directly neighboring warp nodes are merged into one interlacing node; this is the same in the warp (horizontal) direction.
Finally, according to matrices B and C, the color is filled at each node. In the process of color filling there are two necessary conditions that should be met simultaneously: when the handling node is a warp tissue node, its color value should be in correspondence with the warp color, and when the handling node is a weft node is should also be in correspondence with the weft color.
So far, we have completed the mathematical modeling of fabric samples; the model contains the complete original fabric information, such as the accurate interlacing structure and color information of the original fabric. At the same time, based on the actual need, we can also carry out an expansion on the model to achieve a simulated diagram of the fabric weave style at a larger scale so as to reach a deeper understanding of the fabric pattern. Figure 9 shows the reconstruction process.
Structure and fabric yarn color information.
Experimental details
According to the digital processing method mentioned above, we have developed a set of fabric image processing software; Figure 10 shows the software interface. In the software, the main functions include image collecting control, image preprocessing, parameter extraction, mathematical modeling and so on. Particularly through the reverse mathematics modeling function, we can realize digital simulation of the weave pattern of the fabric based on the original acquisition of the fabric image. The simulated fabric weave pattern also can prove the effectiveness of the method proposed in the paper by the comparison between the original fabric image and the simulated fabric weave pattern. In Figure 11, many kinds of fabric samples were used in the experiment to prove the validity of the method proposed.
The software interface. The real fabric images and the reverse mathematics modeling images based on the digital file.

Figure 11(a) and (c) show the images of the woven fabric from different magnifications; the basic structures of knitting and the color matrices can be correctly extracted with the proposed method in this paper. Figure 11(b) and (d) show the corresponding reconstruction images, respectively. In Figure 11(e), its feature is that the left half of the image is made by the warp and weft yarns with the same color and the right half of the image is made by the warp and weft yarns with a different color. From the reconstructed image shown in Figure 11(f) it can be seen that for the fabric made from the warp and weft yarns with the same color, it is difficult to distinguish the warp and weft node types by the method proposed in this paper. To distinguish this kind of node we need the shape information of nodes and the global image information; this means the algorithm proposed in this paper need to be further improved.
Conclusion
The method proposed in this paper improves the traditional recognition method. It enables us to obtain a more accurate fabric weave pattern. In this paper we realize automatic recognition and digital representation of the fabric weave pattern by using the double-sided image information of the fabric sample, the interlacing node separation with the gray projection algorithm, color information extraction and the derivation of the basic structure unit. The multilevel correction method is used in this paper to ensure the correctness of the digital representation of node classification. The fabric weave pattern reverse reconstruction modeling is realized based on the digital file. Many models of the weaving pattern are established that prove the effectiveness of the proposed method. However, this tolerant ability is not unlimited to recognize the fabric patterns correctly. There are two main factors leading to recognition errors. The first reason is the quality of the image. In the imaging process, if light intensity is uneven or the fabric positioning is not accurate, it easily leads to image quality degradation, which results in fabric node segmentation errors and the reduction of the recognition rate. Another factor is the complexity of the structure of the fabric itself, which will also affect the recognition accuracy. The algorithm proposed in this paper can accurately handle some organizational structure with high regularity, such as plain, twill and satin weave, as well as fabric with strong texture changing regularity. However, for those fabrics with seriously declining yarns or a complex combination weave, it is necessary to improve the algorithm’s robustness in order to achieve the identification of structural parameters of complex structural or non-obvious regularity fabric. Particularly for the fabrics that contain a large curve or overlap tissue, it is very difficult to realize the accurate positioning of the yarn by using the image processing method and this easily leads to classification errors. These problems will require further study.
Footnotes
Funding
This work was supported by the National Natural Science Foundation of China (Grant Nos. 11174048).
