Automatic measurement of traditional Chinese costume from its silhouette through Fuzzy c-means clustering method

As the precious cultural heritage of the Chinese nation, traditional costumes are in urgent need of scientific research and protection. In particular, there are scanty studies on costume silhouettes, due to the reasons of the need for cultural relic protection, and the strong subjectivity of manual measurement, which limit the accuracy of quantitative research. This paper presents an automatic measurement method for traditional Chinese costume dimensions based on fuzzy C-means clustering and silhouette feature point location. The method is consisted of six steps: (1) costume image acquisition; (2) costume image preprocessing; (3) color space transformation; (4) object clustering segmentation; (5) costume silhouette feature point location; and (6) costume measurement. First, the relative total variation model was used to obtain the environmental robustness and costume color adaptability. Second, the FCM clustering algorithm was used to implement image segmentation to extract the outer silhouette of the costume. Finally, automatic measurement of costume silhouette was achieved by locating its feature points. The experimental results demonstrated that the proposed method could effectively segment the outer silhouette of a costume image and locate the feature points of the silhouette. The measurement accuracy could meet the requirements of industrial application, thus providing the dual value of costume culture research and industrial application.


Introduction
In recent years, with the continuous awareness in preserving intangible cultural heritage, the protection and inheritance of traditional costumes have gradually become a research focus. Research on traditional costumes has mainly focused on the analysis of artistic characteristics and historical and cultural discussion, thus there are still deficiencies and gaps in the quantitative research. 1 The quantitative research of traditional Chinese costumes has mostly focused on color research, 2,3 but there are few related researches on silhouette. The silhouette is the external clothing shape and the basis of its shape, which determines the overall clothing impression. 4 Traditional Chinese costumes have a variety of silhouette structures, which can be classified by their letter image. Common silhouettes are the A-line, X-line, and H-line. Among them, A-line costumes can best represent traditional Chinese costume due to their wide robes and largesleeves. At the beginning of the 20th century, western-style fitted clothing was introduced, and under its influence, traditional costumes have gradually incorporated an X-line, which emphasizes the waist, and an H-shape, which is the same width from top to bottom. These three silhouette costumes are shown in Figure 1. And these costume image samples were all collected from the Folk Costume Museum of Jiangnan University.
Quantitative research on the silhouettes of traditional costumes is urgently needed, especially dimension measurement, which is the basis of silhouette research. However, most of the traditional costume samples are cultural relics that cannot be touched frequently due to the need for protection. In addition, because they belong to different museums or collectors, it is difficult to obtain samples. Therefore, data collection has failed to form a complete system, which has affected the scientific process of traditional costume research. Moreover, the process of traditional manual measurement is time-consuming, inaccurate, and has a high cost. Traditional Chinese costumes have a planar symmetrical structure that is suitable for two-dimensional image processing technology based on computer vision. Thus, this paper introduced it into costume dimension measurement to meet the scientific automation needs of traditional costume research. There are many A-line samples in traditional Chinese costumes, which are also the most representative silhouettes. The overall shape of an A-line costume is a triangle or trapezoid with a narrow upper and lower width, and the hem is unfolded. 5 As shown in Figure 2, the main measurement parts include the costume length, sleeve length, sleeve width, bust width, and hem width. Therefore, this paper first took an A-line costume as an example to carry out the automatic dimension measurement experiment.
In recent years, machine vision has become widely used in the field of textiles and costumes, and there have been many successful applications in in pattern, color, and fabric structure extraction. Hu et al. 6 proposed an algorithm to improve the robustness and accuracy of clothing image segmentation. The algorithm does not need any predefined clothing model, but uses the Delaunay Constraint Triangle (CDT) to evaluate the foreground (clothing) and background (non-clothing) of clothing image. In order to obtain more accurate results, Yang et al. 7 used a datadriven framework with two reasoning stages to divide the segmentation process into two processes: image co-segmentation and image model building, and finally achieved good results. In view of the problem of low segmentation accuracy caused by multiple objects and occlusion in clothing image, Zhao et al. 8 utilized a cooperative segmentation method for clothing image with multiple objects. However, the data of multiple objects is often difficult to collect, so the method of single image is very important, and the clustering algorithm is one of the classic solutions. In order to determine the main body of the yarn accurately, Li et al. 9 used threshold segmentation and morphological opening operation to process the yarn image in sequence, which has better performance. Kuo et al. 10 used genetic algorithm to distinguish the images of repetitive pattern embroidery and non-repetitive pattern embroidery, which greatly reduced the calculation of the entire image. K-means clustering method is one of the most classic clustering algorithms. Some studies adopted and improved algorithms to achieve color pattern segmentation and color extraction, and achieved good results. 11,12 Li et al. 13 used x-means clustering algorithm, which can accurately identify the color and texture of dyed fabrics, and had good robustness. Zhang et al. [14][15][16] used FCM algorithm to recognize the color pattern and color yarn layout for yarn-dyed fabrics. Pan et al. 17 realized the automatic recognition of fabric texture structure by inputting BP neural network into the cluster segmentation results.
In the field of automatic costume dimension measurement, Dong and Hu 18 used SUSAN corner detection algorithm to achieve costume feature point extraction and obtain costume dimension information. Li et al. 19 used median filtering and histogram equalization to preprocess the image, and then combines the Forstner algorithm and SIFT technology to extract feature corners and achieve costume dimension measurement. However, the effects of these two methods of extracting costume feature points through corner detection were poor when applied to costumes with relatively smooth silhouette curves and complex internal structure and texture.
Traditional costumes are highly decorative, with diverse colors and complex textures. In this paper, relative total variation image texture processing and the FCM clustering algorithm were used to intelligently extract costume silhouettes with complex textures. At the same time, by using costume structure-based positioning of costume feature points, the automatic collection of traditional A-line costume dimensions was achieved. It was hoped that the results could provide more accurate and comprehensive data support for traditional costume research and costume design, as well as facilitate the digital inheritance and preservation of traditional costumes.

Research framework
The research framework of this study is shown in Figure 3.
Step 1 was costume image acquisition, in which a costume image acquisition platform was set up and calibrated, and then traditional costume image sample s were collected with a digital camera.
Step 2 was image preprocessing, in which the internal texture and other noises in the image were filtered out through the relative total variation algorithm. In Step 3 the preprocessed image was converted from the RGB color space to the CIE Lab color space.
Step 4 was image clustering and segmentation, in which image clustering was completed through the FCM algorithm and then collected to complete costume silhouette segmentation.
Step 5 was to collect the feature points according to the characteristics of the costume silhouette. Finally, according to the definition of the main costume dimension, the number of pixels between feature points was collected and the actual dimension was obtained according to the measurement ratio.

Image acquisition
To ensure measurement accuracy, a stable image acquisition platform was built first. In this study, a FUJIFILM X-Pro2 digital camera and an XF35 mm F1.4R lens were used in combination with an overhead bracket, and the Fujifilm Camera Remote app was used to collect pictures with an iPad as a remote control. At the same time, in order to reduce the impact of shadows on the accuracy of the silhouette recognition, a ring-shaped LED light source was used above the platform with a color temperature of 5600 K. The camera lens was placed 2 m away from the acquisition platform. The shooting parameters were as follows: an f/4 aperture, 1/60s exposure time, ISO-250 ISO speed, and a focal length of 23 mm. In order to ensure the segmentation effect, it should be noted that the sample costumes cannot be located at the edge of the picture. And these samples were all collected from the Folk Costume Museum of Jiangnan University.

Image preprocessing
Costume images have an extremely complex color composition. Besides the use of fabrics of different colors in a large area, local color distribution differences may cause image segmentation errors. Such local color differences may include local color areas produced by embroidery, printing, and jacquard and sewing processes, as well as local brightness noise caused by lighting effects. Such local color differences may cause errors in image segmentation, thus, specific techniques must be used to preprocess the images. In general, techniques such as Gaussian filtering 20 and median filtering 19 can be applied to costume images for local noise removal. However, the above-mentioned technical methods may cause blurring of costume edge contours, introduce errors in subsequent costume edge contour recognition, and cause errors in the final costume dimension collection. In order to retain relatively good costume silhouette characteristics and remove local color difference distributions, this study used an image denoising algorithm based on the relative total variation model. 21 The algorithm could be effectively applied to "structure + texture" images to remove local color difference areas and retain costume edge information. 22 In this algorithm, the model objective function is expressed as follows: where: I is the input image; S is the output structure image; p is the index of the 2D image pixels;  p ( ) is the total window variation;  p ( ) is the inherent window variation; ε is the small component to prevent the divisor from being zero; and λ > 0 is the proportion of the weight item and control fidelity item to total variation.  x p ( ) and  y p ( ) are defined as: where, q is the index of all pixels in a square area centered on point p ; ∂ ∂ x y , denote the partial deviation in two directions; and g p q , is a weighting function defined according to spatial affinity, expressed as: in which the role of σ is to control the space dimension of the window.
In equation (1), the first item S I P p − ( ) 2 restricts the change between the source image and the output image to be as small as possible. The second item is relative to the total variation; in a small window area of the image, only the relative total variation value significantly smaller than the relative total variation value corresponding to the main structure window is included in the image. With this difference, it was possible to remove textures from the image while preserving the main structure of the image. The preprocessed image is shown in Figure 4(b).

Color space conversion
The original image collected by a digital camera was an RGB color space; however, the device-oriented RGB color space was not suitable for directly segmenting color images due to the highly linear correlation between its components. 2 In order to solve this problem, CIE feature model was proposed in 1976, which makes up for the shortage of RGB color space model depending on device color. It is composed of three basic colors x, y, and Z, and any color can be represented by the combination of these three basic colors. The values of the three basic colors x, y, and Z can be obtained by linear conversion of RGB.
Let r, g, and b be the three-channel components of a pixel in the RGB color space. The value ranges are (0, 255). The conversion formula is as follows: . .
. , However, there are two defects in this color space. One is that brightness information and chroma information are difficult to explain the relationship between color perception and physical stimulation. And the other is perception uniformity, which means that the digital difference between colors is not consistent with visual perception. In order to solve these two problems, experts have stipulated a kind of color space, namely CIELAB (hereinafter referred to as lab), 23 but the conversion formula is quite complex. Based on it, Connolly and Fleiss 24 studied the improvement scheme of non-linear function and improved the efficiency.
where, L*, a*, and b* are the values of the three channels of the final LAB color space, and X, Y, and Z are the calculated values after RGB is converted to XYZ. X n , Y n , and Z n are generally defaulted to 95.047, 100.0, and 108.883.
Lab is a kind of uniform color space, which can classify the color according to the shortest distance, achieve more independent and simple control of color and brightness information, and accurately express the color characteristics of the image. It is more suitable for color image segmentation than RGB color space.

FCM clustering segmentation
Clustering algorithm is one of the classical algorithms in the field of image segmentation, among which K-means, mean shift and FCM are the representative methods. K-means 25 is a simple clustering method with fast calculation speed, but the segmentation effect depends on the initial clustering center. If the initialization selection is poor, the segmentation effect cannot be guaranteed, and it is easy to fall into the local optimal value. Mean shift 26 is an iterative algorithm based on the core density theory, which finds the target position through iterative calculation, and has many application scenarios. 27 However, due to its unsupervised nature, it is very difficult for mean shift to segment an image into meaningful pictures. In addition, with the development of neural network technology, it is very popular to use neural network for image segmentation. 28 But it needs a lot of data for training, which is difficult to meet the requirements in our data set.
Based on the advantages and disadvantages of the above methods, these methods are not suitable for this research. In order to extract the costume silhouette and retain more reliable information, this paper used FCM clustering and clustering result segmentation algorithm to implement the external costume main structure extraction. The segmentation algorithm segmented the foreground and background of the image through image edge detection to achieve the extraction of the main structure of the costume in the image.
The FCM clustering algorithm is one of the most widelyused clustering algorithms. The algorithm divides pixels by iterative optimization of the cost function and divides pixels into a certain area according to the degree to which each pixel belongs to a different area. Due to the degradation of the image and the influence of external noise and other uncertain factors, it is difficult to assign pixels to a certain classifier during segmentation; however, the FCM clustering algorithm uses a fuzzy concept for the independence between classifiers. This overcomes the shortcomings of the hard classification method for assigning pixels and can reduce the impact of uncertain factors on pixel classification to some extent. 29 Suppose X = {x1, x2,. . ., xn}is the gray value or feature value of an image pixel. The image consists of c regions. The clustering center of the region is expressed as v = {v1, v2, . . ., vc}, u = {uik}cn is the membership matrix, and uik is the membership degree of xi belonging to the k-th region. The core idea of FCM is to find a suitable membership degree and cluster center, so that the variance and iteration error of the cost function within the cluster are minimized. The value of the cost function is the weighted cumulative sum of the two norm measures from the pixel to the cluster center, expressed as:  30 proposed method. The image processing research experience in the field of medical imaging has also achieved good results in this paper. The traditional FCM algorithm starts with the initialization of the clustering center, however the selection of clustering centers often depends on an individual's experience. In order to solve this problem, this study chose to initialize the membership degree matrix as the beginning of the algorithm. 31 The FCM algorithm proceeded as follows: (1) Set the number of clusters as c = 6, weight coefficient m = 2, and iteration stop threshold ε=10 -3 . (2) Initialize the membership degree matrix U 0 and set the iteration pointer t = 1. (3) Update the clustering center matrix according to equation (13).
(4) Update the membership degree matrix according to equation (14), where the iteration pointer t t = +1 , and if x v j j − ≠0 , u ij will be as shown in equation (14): ε , then the FCM algorithm is completed; otherwise, return to Step (3).
After the FCM clustering of the costume image was completed, the costume silhouette needed to be segmented from the image background. Since the contours to be collected were not distributed around the edges of the image, all the existing edges of the clustering result graph were set as the background (I s ), and the remaining categories were set as the foreground to obtain the image segmentation results. The clusters contained in the edges around the image constituted set C e , and the rest of the clusters constituted its complementary, set C i . The calculation method is shown in equation (15): where p is the index of the 2D image pixels. The example costume image clustering and segmentation results are shown in Figure 4(c) and 4(d).

Costume dimension measurement
This study took an A-line traditional costume as an example and proposed a key point positioning algorithm based on the geometric characteristics of the costume silhouette design according to the costume image edge contours obtained in the previous section. The costume silhouette dimension was automatically measured based on the positioned key points. The costume dimension measurement algorithm could be extended to other categories of costumes with the same silhouette structure.

Feature point extraction
Costumes with different silhouettes have different dimensions for measurement, and the measurement of each dimension depends on specific location points on the surface of the costume. These points were called silhouette feature points in this paper. Regardless of the making of the costume, all silhouette feature points have specific geometric characteristics depending on the shapes of the costume and the design. Taking an A-line costume as an example, its main dimension indicators include: costume length, sleeve length, sleeve hem width, bust width, and hem width. Their respective geometric characteristics are defined below:  Figure 5(a).
Based on the geometric relationship, it was assumed that the costume sample was placed vertically in the image, and there was a set (P) of costume edge contour points. The positions of all feature points were thus modeled.
(1) Points A and F were located at the top and bottom of the center of gravity line of the costume, respectively. Therefore, when the costume was placed vertically, its abscissa had the same value as the center of gravity of the costume graphic, as shown in equation (16).
(2) B1 and B2 were respectively located at the far left and upper right of the costume silhouette and represented the points on the left and right edges of the costume that were furthest from point F.
(4) C1 and C2 were the lower end points of the left and right cuffs and were the farthest from the diagonal of the sleeve; that is, the points on edge contours B1D1 and B2D2, and were the farthest points from straight lines B1D1 and B2D2.
(5) Same as above, E1 and E2 were the left and right lower end positions of the costume hem, respectively, and were the farthest from the diagonal of the unilateral hem; that is, they were on the points for edge contours D1F and D2F and were the furthest from straight lines D1F and D2F.
In the above order, the traversal method was used to traverse all the costume contour edge points to solve the model, and then the coordinates of each feature point could be obtained. The actual running results are shown in Figure  5(b), which proved that the algorithm could effectively locate the A-line costume feature points.

Dimension measurement on feature points
In order to obtain the actual dimensions of the costume, the measurement ratio k needed to first be determined. The method consisted of measuring a rectangular black cloth, in which the actual length of the cloth was l e , the automatic measured value of the cloth was l m , and k l l e m = / . Taking the A-line silhouette costume as an example, when the image resolution dpi was known, the main costume dimension indicators, such as costume length l 1 , sleeve length l 2 , sleeve hem width l 3 , bust width l 4 , and hem width l 5 could be obtained through the distance of the feature points extracted in Section 3.1 and the measurement ratio k via calculation. The calculation process is shown in Eq.

Discussion on image segmentation effect
This study used a relative total variation preprocessing algorithm to process costume images and retain the silhouette edges while smoothing the local texture. On this basis, the Lab color space combined with the FCM clustering algorithm was used to obtain the costume silhouette segmentation results. Table 1 shows the original images of several representative A-line example costumes, the relative total variation preprocessing results, the image segmentation results, and the image segmentation results without preprocessing. On the whole, the costume image segmentation results obtained from the images not preprocessed by the relative total variation model were poor, and the disadvantages were mainly due to: (1) texture changes near the edges of the costume silhouettes, which lead to the segmentation result without preprocessing being fuzzier; (2) the local texture of the costume without smoothing was recognized as the background; and (3) when the main color of the costume was close to the background, the costume target without smoothing of the local texture was less distinguishable from the background and was more difficult to segment. From this comparative experiment, it was known that the relative total variation preprocessing algorithm proposed in this paper could effectively improve the segmentation effect of costume silhouettes, which was of great significance.

Optimization of FCM clustering number C
In the FCM algorithm, parameter c refers to the number of categories of the sample to be clustered. The main drawback of using clustering to segment images is that regardless of the structure of the given image, as long as the number of clustering categories c is given, it can always segment the image. Therefore, if parameter c is not selected properly, the segmentation result may not be consistent with the real structure of the image. In this study, clustering-based image segmentation was used to extract the costume silhouette, and the dimensions of the costume were measured by the edge feature points of the silhouette. In order to ensure the accuracy of the measurement results, higher requirements were imposed on the accuracy of the silhouette extraction.
In the 50 traditional costume samples selected for this study, after the images were preprocessed with relative total variation, it was found that there were fewer than eight types of foreground and background colors. Therefore, by using two to ten categories of clustering for the sample costume, the accuracy of the nine groups of collected costume data could be compared to determine the number of optimal clustering categories (c). It was found in the experiment that when c = 2, the silhouette could not be completely extracted for most costume samples, therefore there was no value for c = 2 in further accuracy analysis. Figure 6 shows the relative error distribution of 250 parts of 50 costume samples when c ranged from 3 to 10. The costume images collected under the experimental conditions of this study had a high contrast with the background. In the case of c> 2, all costumes could be segmented to obtain a continuous silhouette edge set, as well as provide effective dimension data. The average and minimum relative error differences were small for different values of c. Due to the influence of costume color, edge shadow, and other factors, the maximum error and error distribution varied significantly under different values of c. From Figure 6, it could be seen that when c = 6, the average relative error and maximum relative error of the 250 parts in the 50 samples were the lowest and the overall error distribution was optimal; that is, when c = 6, the system's accuracy, versatility, and robustness were highest.

Accuracy of costume dimension measurement results
The image segmentation and dimension acquisition algorithm proposed in this study were implemented on the  collected image set to obtain the dimensions of each part based on the costume image acquisition for all samples.
No cases of positioning errors were found during the subjective observation and after observing the location of the labeled feature points in all samples. To allow objective data analysis, the 50 costume samples were measured; the costume length, sleeve length, bust width, hem width, and sleeve width dimensions were obtained, and the distribution of absolute and relative errors in the measurement results was analyzed. Using the average value of three manual measurements as the true value of dimension l a , and the automatic measurement result l, the absolute error ∆ = − l l a and relative error δ ∆ = × l a 100% are shown in Figure 7. According to China's GB/T 2662-2008 clothing standards, the absolute error of various clothing dimensions should be controlled within 1.5 cm. According to the following results, out of the 250 dimension results collected from the 50 experimental samples, 248 results were within the range specified by the standard, indicating a compliance rate of 99.21%. However, we found that the hem of some of the images was not clear enough, which made the key points inaccurate and caused errors beyond the limits. At the same time, the average absolute error of the five main dimensions was less than 1 cm, thus proving the effectiveness of the proposed method in this paper.

Conclusion
This paper proposed a method of costume silhouette extraction and dimension acquisition based on machine vision technology. The costume image segmentation algorithm used for silhouette extraction included technical methods based on relative total variation image preprocessing, the Lab color space, and FCM clustering. Comparative experiments proved that using the image segmentation algorithm after preprocessing of the relative total variation image could result in more accurate costume silhouette edges with higher environmental robustness and wider costume color adaptability. In addition, the proposed dimension acquisition method had accurate feature point positioning performance, was not sensitive to the outer contour curvature of the costume, could effectively locate the feature points of different styles of A-line costumes, and had high versatility. The analysis of the subjective evaluation and objective statistics found that the measurement accuracy of the proposed method could meet the requirements of industrial production standards, thus proving that the algorithm not only could be applied to the collection of traditional costume dimension data but also had application value in the costume industry. There were a number of shortcomings in the method proposed in this paper. First, although the proposed method could also be applied to the measurement of articles in museums, personal collections, and pictures for which real samples cannot be obtained, the accuracy of the measurement will be limited by the arrangements of the collected costumes and the photo shooting effects. Second, the feature point positioning algorithm used in this study only proposed a specific technical route based on an A-line costume. Although its core ideas were consistent with those of X-line, H-line and other costume silhouettes, the model should be adjusted for specific silhouettes. Future research could discuss how to unify key point positioning algorithms for different costume categories.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.