Fully Automatic Weave Identiﬁcation in Woven Fabrics Using Digital Image Processing

: Fabric is an important part and parcel of our lives. In addition to fabric color and texture, fabric weave also determines the physical appearance and physical properties of the fabric. At times, it is necessary to determine the weave type of the fabric, for example, at sales outlets, or at customs for tax duty computations. Furthermore, the end-user may be required to conﬁrm the fabric weave type. Conventionally, a manual invasive technique is used to determine the weave type of the fabric, which also requires extensive knowledge of the fabric weaving process. Therefore, in this study, we present an image-processing-based, non-invasive, low-cost fabric weave identiﬁcation scheme. The experimental results are very encouraging results and show a 90% accuracy in detecting fabric weave type in real-time.


Introduction
Fabric is not only a basic human necessity, but it is also reflection of human civilization and its culture. It has been a key representative of the complexity of human civilization from the past to the present. There are very inspiring and versatile kinds of attractive textiles, such as carpets of the Middle East, Chinese silk, and the tapestries of Western Europe. The method that has not changed since ancient times is the fabric weaving process. It is always weaved with the help of two threads: warp and weft. However, the difference is that with the advancement in industrial processes and the emergence of IT technology, textile manufacturing processes have also become highly automated. In the case of Pakistan, the textile sector is considered to be the backbone of the economy as it contributes to more than 60% of total exports (around USD 12.5 billion of GDP between 2011 and 2012). Around 700 textile processing units are currently operating in Pakistan, which carry out various textile processes, ranging from de-sizing and bleaching to dyeing and finishing [1,2]. However, the detection/inspection of a fabric for its weave type and defect analysis conventionally requires a manual process and an expert person with a magnifying glass.
The weave pattern of woven fabric plays a very vital role in its characterization, such as its feel and physical appearance. Thus, in the textile industry, a weave pattern analysis is the most important factor for woven fabrics as it plays a significant role in design/redesign of the fabrics [3]. The weave pattern is actually dependent on the variable crossings of the weft and warp threads, resulting in a periodic manner determine the type of fabric [4]. For example, a simple alternate crossing is easier to weave and results in a plain weave. However, a crossing of wefts over two warps results in a twill weave. These variable crossing mechanisms result in over ten different weave types of fabrics. Thus, the recognition of these fabrics is not an easy task and requires a manual and visual-based inspection process using a magnifying glass or even an invasive step in cases where the weave pattern is very complicated. Many machine-learning-based weave identification techniques have also been proposed in the literature. These approaches are based on classical machine learning algorithms, such as the support vector machine (SVM), that are computationally expensive and require the extensive training of a large image dataset before being able to detect a fabric weave.
The most cumbersome requirement of the manual inspection process is that the person should have sufficient knowledge and training about weave patterns and weaving processes. In an industrial manufacturing process, this approach may require extensive labor and a time-consuming process. It may also suffer from human factors, such as mental stress, physical fatigue, tiredness, dizziness, etc., which will definitely impact the accuracy of the fabric identification results. Therefore, it is necessary to have an automatic inspection system for the quick and accurate recognition of woven patterns of the fabric in real-time to produce higher quality products in line with a customer's requirements. With the advancements in the industrial technology, more and more recognition and classification technologies are emerging based on computer vision techniques and are being frequently used in the industrial and textile production industry [5].
The aim of the present study is to develop a simple and low-cost fabric weave identification system for three basic weave types: plain, satin, and twill. The identification and classification of woven fabrics have numerous applications, such as calculating the duty of the imported fabric in customs. With the advances in computer technology, new, automatic and efficient ways can be used for problem-solving with less human intervention. In today's textile industry, fabric classification is manually carried out, which requires extensive human labor, time, and considerable effort. The novelty of this project is that it will provide a non-destructive method for fabric classification different from conventional techniques. The developed handheld hardware will also be useful for cloth merchants.

Literature Review
Many studies have focused on image processing techniques for fabric weave identification and characterization. For example, the study in [4] focused on the identification of weave patterns using optical tomography. However, this setup is quite costly and requires a special arrangement. Moreover, the proposed technique was tested on very few samples. The impact of the print on the fabric was also ignored. Another study [5] demonstrated a reverse engineering method for the 3D textile model development of woven fabrics. These authors presented four novel algorithms to extract volumetric fabric models using a single image as an input with spatial domain and frequency domain processing steps. These authors claim to be able to compute a model in up a few minutes from the taken images using a DSLR camera.
The FFT-based weave identification method is presented in [6]. The authors claim that their proposed method is able to identify weave type, irrespective of the image rotations, material type, the density of the yarns and weaves, without requiring any previous knowledge about the fabric. However, a basic requirement of these image processing techniques is that the woven fabric samples contain protruding fibers on the surface, which should be removed by burning, clipping, or brushing for appropriate processing [7].
Many studies have also used image processing for the identification of defects such as a fabric pill assessment using machine learning techniques; ANN and SVM are shown in [8]. Another similar study is presented in [9]. However, the detection of warps and wefts is a common challenge. To solve this problem, the skews of warps and wefts were detected in the experiment, and then the fabric density was automatically measured. The Hough transform that was first proposed by Hough in 1962 [10], can automatically detect lines in an image without requiring any special knowledge about the image [10]. A more challenging task is to detect the interstices among yarns. It was shown in the study of [11] that yarn crossing points can be identified by applying a k-means clustering method to the pre-processed gray scale data of the image by making two data clusters for the yarn crossing point and looking for the local minima of the horizontal and vertical integral projections.
In many studies, deep learning techniques have also been reported as an accurate method of automatic fabric identification and classification. The ResNet-50 pre-trained CNN architecture was used to classify the woven fabric images into three classes. The numbers of training and testing images used for the woven fabric dataset were 11,328 and 2832, respectively. Like other machine learning studies, these authors used 80% of the images for training, and the remaining 20% were used for validation purposes to evaluate the trained model performance [12]. However, the drawback of machine-learning-based techniques is the extensive requirement of computing resources.
Therefore, this study focuses on a simple machine learning technique for weave identification. This study is inspired from earlier experiments in [13] that used the contour detection method for the identification of the contours of weft and warp yarns and computed the area of these weft and warp yarns. From this area information, these authors detected the defects in the weave. However, this study has two limitations: firstly, it has a very inaccurate alignment of the weft and warp threads, and secondly, it requires a high resolution camera. Thus, in this study we propose a different technique that does not suffer from these limitations. The proposed scheme can also be efficiently used for the identification of both defects and weave types.

Experimental Setup and Work
The experimental setup comprised a mini portable digital microscope with an optical zoom of up to 1600× and an 8-megapixel camera. A testbed was prepared with a transparent acrylic sheet with a white and illuminated background, so that the light passing from the spacing between the warp and weft threads was visible in the camera. The testbed setup is shown in Figure 1. challenging task is to detect the interstices among yarns. It was shown in the study of [11] that yarn crossing points can be identified by applying a k-means clustering method to the pre-processed gray scale data of the image by making two data clusters for the yarn crossing point and looking for the local minima of the horizontal and vertical integral projections. In many studies, deep learning techniques have also been reported as an accurate method of automatic fabric identification and classification. The ResNet-50 pre-trained CNN architecture was used to classify the woven fabric images into three classes. The numbers of training and testing images used for the woven fabric dataset were 11,328 and 2832, respectively. Like other machine learning studies, these authors used 80% of the images for training, and the remaining 20% were used for validation purposes to evaluate the trained model performance [12]. However, the drawback of machine-learning-based techniques is the extensive requirement of computing resources.
Therefore, this study focuses on a simple machine learning technique for weave identification. This study is inspired from earlier experiments in [13] that used the contour detection method for the identification of the contours of weft and warp yarns and computed the area of these weft and warp yarns. From this area information, these authors detected the defects in the weave. However, this study has two limitations: firstly, it has a very inaccurate alignment of the weft and warp threads, and secondly, it requires a high resolution camera. Thus, in this study we propose a different technique that does not suffer from these limitations. The proposed scheme can also be efficiently used for the identification of both defects and weave types.

Experimental Setup and Work
The experimental setup comprised a mini portable digital microscope with an optical zoom of up to 1600× and an 8-megapixel camera. A testbed was prepared with a transparent acrylic sheet with a white and illuminated background, so that the light passing from the spacing between the warp and weft threads was visible in the camera. The testbed setup is shown in Figure 1.  A mixed sample of different weave types was used for this study, as shown in Figure 1. During the analysis, the weft and warp directions were manually aligned before taking the snapshot. The complete steps of the proposed scheme for image acquisition, preprocessing and analysis of weave type identification are shown in Figure 2.
Eng. Proc. 2022, 20, 1 4 of 6 A mixed sample of different weave types was used for this study, as shown in Figure  1. During the analysis, the weft and warp directions were manually aligned before taking the snapshot. The complete steps of the proposed scheme for image acquisition, preprocessing and analysis of weave type identification are shown in Figure 2.

Results and Discussion
The results of binary images of the plain, twill, and satin weaves after the thresholding process are shown in Figure 3. These patterns are quite similar to the known patterns of these weave types. The computation of contours for each fabric sample is shown in Figure 4. The thresholds for plain, satin, and twill were set to 450 and 200 through repeated experimentations. If the contours count was less than 200, the image was identified

Results and Discussion
The results of binary images of the plain, twill, and satin weaves after the thresholding process are shown in Figure 3. These patterns are quite similar to the known patterns of these weave types. The computation of contours for each fabric sample is shown in Figure 4. The thresholds for plain, satin, and twill were set to 450 and 200 through repeated experimentations. If the contours count was less than 200, the image was identified as a twill weave; when between 200 and 450, it was identified as a satin weave; and when above 450, it was identified as a plain weave. Except for sample number 6, all samples were correctly identified. These results show that the proposed approach and its accuracy can be enhanced in future work by improving the contour detection scheme via computing the area of the contour. However, this will require the development of an accurate contour detection scheme in varying lighting conditions. Eng. Proc. 2022, 20, 1 5 of 6 as a twill weave; when between 200 and 450, it was identified as a satin weave; and when above 450, it was identified as a plain weave. Except for sample number 6, all samples were correctly identified. These results show that the proposed approach and its accuracy can be enhanced in future work by improving the contour detection scheme via computing the area of the contour. However, this will require the development of an accurate contour detection scheme in varying lighting conditions.   Eng. Proc. 2022, 20, 1 5 of 6 as a twill weave; when between 200 and 450, it was identified as a satin weave; and when above 450, it was identified as a plain weave. Except for sample number 6, all samples were correctly identified. These results show that the proposed approach and its accuracy can be enhanced in future work by improving the contour detection scheme via computing the area of the contour. However, this will require the development of an accurate contour detection scheme in varying lighting conditions.
(a) (b) (c) (d)   Funding: This research work was conducted with locally available resources at NED Univerity and Technology and no external funding was received.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.