Photometric Stereo Method Used for Woven Fabric Density Measurement Based on 3D Surface Structure Endang Juliastuti 1,*. Irwan Setiawan2. Vebi Nadhira1 & Deddy Kurniadi1 Instrumentation and Control Research Group. Faculty of Industrial Technology. Institut Teknologi Bandung. Jalan Ganesa No. Bandung 40132. Indonesia Engineering Physics Doctoral Program. Faculty of Industrial Technology. Institut Teknologi Bandung. Jalan Ganesa No. Bandung 40132. Indonesia *Corresponding author: yuliast@tf. Abstract The measurement of the density of woven fabrics based on the vision method has been widely developed. This study used a photometric stereo method to measure the warp and weft density of woven fabrics based on the 3D surface structure. Six 2D images of the fabric were recorded, each with a different lighting direction. The six images were then reconstructed using the unbiased photometric stereo algorithm to produce the three-dimensional surface structure. The reconstructed image was used to detect and correct the skew angle with the Hough transform. For each image, a depth profile was made toward the x-axis to get the weft curve and towards the y-axis to get the warped curve. The two depth curves were filtered using a locally weighted smoothing (LOESS) filter. This study successfully measured the density of woven fabric with an average error for warp and weft of 0. 64% and 0. 45%, respectively. Keywords: density measurement. Hough transform. photometric stereo. warp density. weft density. woven fabric. Introduction In recent years, stricter requirements for textile quality control have emerged, with measurement and detection procedures employing non-destructive testing methods to minimize costs and eliminate raw material waste in the textile industry . Before mass manufacturing in the textile industry, the fiber type . and structural properties of the fabrics are studied. Density is an important factor for quality control in woven fabric manufacture . The current approach for assessing fabric density is to count the amount of warp and weft yarns in measurement units using a special magnifying lens. This methodAos measuring findings depend largely on the examinerAos mental and physical state. therefore, it requires an effort to obtain rapid and precise results . Hence, an accurate and reliable automatic approach to measure fabric density would be preferable. One approach to the challenge of woven fabric density measurement is to take advantage of the recent improvements in image processing algorithms. Based on fabric image processing, the employed approaches can be separated into frequency domain and spatial domain analyses . The Fast Fourier Transform (FFT) is used in frequency domain analysis . Ae. The FFT method can identify the warp and weft by locating the highest of the regularly repeating intensity values in a spectrum. Unfortunately, the fabricAos weave and color patterns frequently distract from the attained highest values. The Discrete Wavelet Transform (DWT) is another frequency domain approach commonly used to extract information about warp and weft density . The DWT can decompose the image of a fabric into low and high frequencies and then reconstruct the horizontal and vertical portions to gain information about the warp and weft. The reconstructed image can indicate whether or not the yarns are suitable, but it is not sufficiently segmented, so the results are inaccurate. The frequency domain approach can reliably determine the density of solid-colored fabrics but not of those that are Copyright A2023 Published by IRCS - ITB ISSN: 2337-5779 Eng. Technol. Sci. Vol. No. 6, 2023, 659-668 DOI: 10. 5614/j. Research Paper Journal of Engineering and Technological Sciences Endang Juliastuti et al. The grey-level co-occurrence matrix (GLCM) . , the quadratic local extremum . , and the Hough transform . are utilized in spatial domain analysis. These approaches determine fabric density by locating warps and wefts in the spatial domain. The optimal way to locate yarns is using separate images of the warps and wefts. Lastly, the density of the warps and wefts can be calculated using a grey-line profile . or an image projection . These methods are useful for assessing solid-color materials as well. Although some systems can handle yarn-dyed textiles . , complex pattern fabrics . , and high-tightness woven fabrics (HTWF) . , they are all specialized for a single fabric type. Different fabric types require that their operationsAo parameters are varied, which limits the generalization and diversity adaptability. Deep learning algorithms are increasingly used in the textile industry . , for example to classify colors or textures and find defects . Meng et al. is one of the recent publications on measuring fabric density using a deep learning algorithm. They proposed a multi-scale convolution neural network to distinguish the warps and wefts of a cloth. Grey projection and skew angle detection can then be used to measure the density of the fabric. The method that was applied has a solid track record for evaluating fabric density, although product flexibility and computation time are constraints. The first study used two-dimensional . D) images, which are impacted by numerous factors . In addition, it is difficult to directly use this method when employing 2D images to identify the density of yarn-dyed fabrics, since photographs sometimes require additional treatment for accurate density estimation . If the characteristics of multicolored fabrics are retrieved straight from a grayscale image, considerable variations will arise . The periodic interweaving of the warp and weft yarns forms a 3D fabric structure. It is expected that the 3D technique can assist in resolving issues associated with estimating the characteristics of woven fabrics . the 3D configuration of the fabricAos surface can be determined, it is straightforward to recognize the woven pattern and yarn density from 3D surface photos . Xiang et al. obtained 3D images using machine vision . Two techniques have been devised to determine the surface depth of an item. One method obtains surface depth information through a specific device employing a laser depth sensor . or a 3D camera . However, these devices are costly, the data processing is highly complex, the amount of data obtained is substantial, and the processing time is lengthy. The other option is multi-directional lighting technology, which employs several 2D photographs of the object captured with distinct light sources in each shot. The generated images are then reassembled to create a three-dimensional image. This method employs photometric stereo, a popular technique for detecting surface lighting and object gradients . This method can determine the 3D surface structure as a function of depth. Several studies . concentrated on surface recognition techniques based on multi-directional lighting to recognize solid or distorted surface textures, emphasizing the development of their algorithms. This study attempted to measure the density of woven materials using a 3D surface structure and photometric In the proposed method, the photometric stereo algorithm is used for image reconstruction to obtain the 3D surface structure of woven fabrics. The Hough transform is used to determine the skew angle of the reconstructed image. Using a locally weighted smoothing (LOESS) filter, the depth profile of the image in the x and y directions is refined to identify the warp and weft density of the woven material. The test findings from this study were compared to a manual test as well as calculations. Methods Image Acquisition System with Lighting Direction Variation In the proposed method, an image acquisition system is used to obtain images of woven fabrics with variation of the direction of lighting. Images of the set-up are shown in Figure 1. Figure 1. shows the light source system, consisting of six light sources in the form of cree type LEDs . ight emitting diode. with a power of 1 watt and the tilt angle () between the LEDs at 60A . The light sources are set to illuminate alternately with an intensity of around 18 cd. At the same time, the slant angle () is chosen around 55A . , as shown in Figure 1. The Photometric Stereo Method Used for Woven Fabric Density Measurement DOI: 10. 5614/j. recording is done with a digital camera (Sony IMX. and a C-mount macro lens with 8x to 100x magnification. The camera output is a color image with a size of 1280 x 720 pixels. Six images are produced for each woven fabric with different lighting directions, as shown in Figure 2. Figure 1 Image acquisition system for woven fabric samples with variation of lighting direction: . light source view, and . side view of the image recording device. Photometric Stereo Algorithm The classic photometric stereo method produces 3D surfaces in the reconstruction process, assuming that the woven fabric surface is Lambertian. Each pixelAos intensity for each lighting direction can be expressed as: I . , . = As. , . LE . NE. , . I . , . is the intensity value and As. , . is the albedo of the pixels . , . of the k . = 1. A ,. image with the vector normal to the surface NE. , . The image is obtained when the surface is illuminated with an LED in the LE direction. Eq. becomes Eq. as follows: , . = As. , . NE. , . , . = I . , . and L = LE . If the lighting vectors are not co-planar, then the lighting matrix L is nonsingular and can be inverted so that the equation becomes: , . = L . , . Eq. is an optimization process for solutions in the form A Oo X = b and produces vectors M. , . = . , . ], n = 1. A ,3. From these vectors, the surface gradient can be extracted as following Eq. , . = Oem . , . /m . , . and q . , . = Oem . , . /m . , . The surface albedo is expressed as in Eq. As. , . = m . , . , . , . The photometric stereo technique established by Gorpas et al. does not consider the light sourceAos and the objectAos colors. It is important to adjust the photometric stereo method to reconstruct the surfaces of different types of woven fabric . arn-dyed, solid-colored, and high-density fabric. The photometric stereo algorithm employed in this investigation is the unbiased photometric stereo algorithm . A non-biased method requires interaction between the color of light and the object. This study used an algorithm for white light and colored Endang Juliastuti et al. Figure 2 Six woven fabric images were recorded with different light sources. Skew Detection Due to the fabricAos location and skewed warp and weft in some textiles, yarn skewing in fabric imaging is The Hough transform is the standard technique for detecting the skew of woven materials. The goal of skew detection is to discern the direction of the warp and weft yarns in an image, because if the direction information of the warp and weft yarns can be preserved, the reliability of skew detection can be enhanced. All pixels with their x and y coordinates . in the image are converted to polar coordinates . , ) as follows: s = x Oo cos y Oo sin In this work, the surface texture of the recreated woven fabric reveals the depth difference between the yarn floats and the interstices. therefore, no filtering is required. Adopting edge detection with the Canny operator is sufficient to simplify the Hough detection procedure and improve the accuracy of the skew detection results. Figure 3. depicts the Hough transform. Figure 3. shows the results of edge identification of fabric samples using the Canny operator, with the input fabric image reassembled using the unbiased stereo photometric Figure 3. shows the results of skew detection using the Hough transform simultaneously. Input image of unbiased photometric stereo Canny operator edge detection Hough detection . Figure 3 Skew detection by combining edge detection and the Hough transform approach: . flowchart, . result using the Canny operator for a sample fabric, and . results using the Hough transform on . Three-dimensional Surface Depth Profile and Density Calculations The fabricAos surface is viewed as a three-dimensional structure. The grayscale value is proportional to the variation of the yarn float and its interstices in terms of depth. The yarnAos center and interstices typically have the highest and lowest grayscale values. Thus, a depth profile of the fabricAos 3D surface structure can be The highest part of the curve indicates the positions of the yarns, while the lowest part indicates the positions of the spaces between the yarns. Counting the highest and lowest points on the curve will reveal the yarnAos density. In practice, the projection curve has numerous local highest points. This will decrease the accuracy of the density calculations. The projection curve is smoothed using local weighted polynomial regression to reduce interference. (LOESS) . Photometric Stereo Method Used for Woven Fabric Density Measurement DOI: 10. 5614/j. At every point in the data range, the LOESS approach matches low-order polynomials to a subset of data, giving more weight to points closer to the estimated point and less weight to distant places. The density calculations are affected by the width of the local smoothing or the number of data points in the subset during the LOESS In prior research. LOESS was utilized with a set smoothing width . For materials of varying densities, it is also required to alter the smoothing rangeAos width manually. A method for dynamically calculating the local smoothing width must be developed to increase the algorithmAos adaptability. The pixel distance between two adjacent yarns, p, can be obtained by calculating the average distance between those yarns in the projection smoothed with LOESS. The density of the fabric can be obtained using the following Eqs. & . where d is the weft density . hds/inc. , d is the warp density . hds/inc. PPI is the spatial resolution . ixels/inc. , and p is the pixel distance between two adjacent yarns . Figure 4 shows the method used to calculate fabric density adopted in this study with the dynamic smoothing width coefficient based on the type of woven fabric density. Start Surface profile along the warp and weft directions Detect the number of highest points in the surface profile curve Determination of the smoothing width range and smoothing of the projection curve with LOESS Calculate the pixel distance between two adjacent yarns . and the number of highest points in the smoothed Calculate the warp and weft yarns densities Stop Figure 4 Flowchart to obtain 3D surface depth and fabric density using LOESS. Experimental Results and Discussion Evaluation of the Quality of the Reconstructed Image The gap between the target and the light source, h, and the angle between the light source directly impact the image quality. The outcomes of the woven fabric surface reconstruction were further examined. In this investigation, the best h distance was determined to be 10 cm, while the angle size was approximately 55 degrees . Figure 5 shows the single images, the reconstructed images, and the depth profile patterns for the warp and weft of the seven samples for a plain-woven pattern with a single color and a patterned material with more than one color. Figure 6 shows the same as Figure 5 for the twill and satin weave patterns of three samples Each sample is 1280 x 720 pixels. Endang Juliastuti et al. Woven Pattern Sample Surface profile Warp Weft Plain Figure 5 Two and three-dimensional images for plain woven fabric samples. Woven Pattern Sample Surface profile Warp Weft Twill Satin Figure 6 Two and three-dimensional images for twill and satin woven fabric samples. Photometric Stereo Method Used for Woven Fabric Density Measurement DOI: 10. 5614/j. Measurement and Comparison of Fabric Density Sample . in Figure 5 is an example of a depth profile showing the surface profile curve along the direction of the warp yarns. The same profile is shown in Figure 7. The surface profile curve along the weft yarn direction is depicted in Figure 7. Some of the local highest points seen within the curves, marked by red circles, will interfere with the accuracy of determining the density of the fabric. The LOESS method is used on the curve to eliminate these interferences. Figures 7. show the surface profile after using the LOESS filter . Figure 7 Surface profiles and results of warp and weft recognition: . surface profile curve of the warp, . surface profile curve of the weft, . surface profile smoothed with LOESS of the warp, and . surface profile smoothed with LOESS of the weft. The coefficient of the local smoothing width affects the accuracy of determining the density of the fabric. For the density of fabrics in the less dense category, the span value of the LOESS algorithm is 0. 07, medium density 04, and high density is 0. Yarn density measurements were carried out on thirteen samples, three times for each sample. the specifications are shown in Table 1. The results of manual density measurements . are as shown in the table, compared with those calculated using the developed method . The calculation error . was determined as follows: e = . Oe xA|/x y 100% . This study successfully measured the density of woven fabric with an average error for warp and weft of 0. 45%, respectively. These results indicate that the method proposed in this study is effective for assessing the density of woven fabric with various weave patterns and densities. Based on the graph, there is a positive relationship between the manual and the automatic measurement results of the warp and weft densities in Figure 8, indicating a small average deviation of the warp and weft density measurements. Image acquisition methods and photometric stereo-reconstruction techniques have varying degrees of influence on image quality. Endang Juliastuti et al. Table 1 Measurement results of warp and weft densities. Fabric Manual measurement . hds/inc. Warp Weft Automatic measurement . hds/inc. Warp Weft Error (%) Warp Weft Figure 8 Relationship between manual and automatic measurement results of warp and weft densities. Table 2 shows some fabric density measurement methods. Automated methods achieve high accuracy and efficiency, but they are only suitable for certain types of fabrics. The average deviation of the fuzzy C-means approach and the color gradient image approach given by Pan et al. was around 0. The average deviation between the image fusion approach based on two-sided pictures and the FFT method proposed by Zhang et al. was approximately 0. Despite the great detection resolution of these techniques, they are nevertheless limited by the structure and the amount of certain fabric colors. Other than stated above, the image fusion method with multi-directional lighting developed by Xiang et al. had an average deviation of 0. This method is limited to yarn-dyed fabrics with a specific weave pattern and yarn density. The color and structure-independent multi-scale convolutional neural network proposed by Meng et al. had an average deviation of 1. Still, with a relatively long computation time, less than 10 seconds was required for each Table 2 Performance comparison against baseline approaches. Authors Method Fabric types Pan et al. Zhang et al. Xiang et al. FFT Sub-image projection Multi-directional illumination image Multi-scale convolutional neural Photometric stereo Solid color and HTWF Complex pattern Yarn-dyed Average deviation (%) Uniform density Yarn-dyed, solid color & HTWF Meng et al. This work Photometric Stereo Method Used for Woven Fabric Density Measurement DOI: 10. 5614/j. Compared to other automatic methods, the warp and weft density measurement mechanism developed in this paper requires fewer steps and achieves a computing time of fewer than 5 seconds for each measurement. The method also considers the 3D surface characteristic of the fabric to limit the impact of color and structure characteristics on the detection results. This method differs significantly from previous studies, which focused on fusion images with multi-directional lighting and multi-scale convolutional neural networks. Further work will be carried out to improve the resolution of the 3D fabric surface reconstruction results and reduce the computation time so that the algorithm will be utterly independent of color and structure. Conclusion In this paper, we proposed a woven fabric density measurement method based on the 3D surface structure using photometric stereo. This method can accurately locate warp and weft yarns to measure the density of the woven fabric. The experimental results showed that: . the proposed method achieves high accuracy compared to other automatic methods. the proposed method shows good robustness over different types of weave patterns and fabric densities. the proposed method can efficiently measure the density of woven fabrics. Although the fabric density measurement has high accuracy, the proposed method has some limitations when dealing with high-tightness woven fabrics. In the future, we will continue to further improve the performance of the proposed method and develop the image acquisition system used for the optimization of the number of stereo photometric images to handle high-tightness woven fabrics. In addition, we will generalize the automatic measurement of fabric density and identify more woven fabric parameters. References