# Research on the Design of Zhuang Brocade Patterns Based on Automatic Pattern Generation
## 2 Related Literature and Work
### Pattern Extraction Process and Results
#### 3.3.1 Image Smoothing  
In order to reduce the interference of the textile's own tissue texture on the processing of pattern information, the Relative Total Variation (RTV) modeling algorithm is applied for the purpose of extracting texture smoothing. Texture smoothing aims to smooth the texture in the image while preserving salient structures [28]. The Relative Total Variation formula at any point p in the image is shown in (1):  
\[\sum_{p}(\frac{\Phi_{x}(p)}{\Psi_{x}(p)+\epsilon}+\frac{\Phi_{y}(p)}{\Psi_{y}(p )+\epsilon}) \tag{1}\]  
where \(\epsilon\) is a fixed constant to prevent division by zero errors, \(\epsilon>0\). The window full and intrinsic variants in the \(x\) and \(y\) directions for any point p in the image are:  
\[D_{x}\big{(}f_{p}\big{)}=\sum_{q\in R(p)}h_{p,q}\cdot\Big{|}\big{(}\partial_{x }f\big{)}_{q}\Big{|} \tag{2}\]  
\[D_{y}\big{(}f_{p}\big{)}=\sum_{q\in R(p)}h_{p,q}\cdot\Big{|}\big{(}\partial_{y }f\big{)}_{q}\Big{|} \tag{3}\]  
Figure 8: Flowchart showing color feature extraction of Zhuang brocade. \[L_{x}(f_{p}) =\left|\sum_{q\in R(p)}h_{p,q}\cdot(\partial_{x}f)_{q}\right| \tag{4}\] \[L_{y}(f_{p}) =\left|\sum_{q\in R(p)}h_{p,q}\cdot\left(\partial_{y}f\right)_{q}\right| \tag{5}\]  
where \(R(p)\) is a rectangular region centered at \(p\), \(q\) is any point in the variational region \(R(p)\), \(x\) and \(y\) are the partial differentials of the pixel point \(q\) in the \(x\) and \(y\) directions, respectively, and \(h_{p,q}\) are the weight functions defined according to the spatial,  
\[h_{p,q}\propto\frac{exp\left(-\left(\left(x_{p}-x_{q}\right)^{2}+\left(y_{p} -y_{q}\right)^{2}\right)\right)}{2\sigma^{2}} \tag{6}\]  
where \(x_{p}\) and \(y_{p}\) denote the horizontal and vertical coordinates of point \(p\), respectively, and \(\sigma\) controls the window spatial scale in Formula (6). The RTV algorithm is modeled as:  
\[arg\underset{f}{min}\underset{p}{\sum}\left[\left(f_{p}-S_{p}\right)^{2}+ \lambda\cdot RTV(f_{p})\right] \tag{7}\]  
where \(S\) denotes the input Zhuang brocade pattern, \(f\) denotes the image after the extracted structure, and \(\lambda\) is a fixed regularization parameter, representing the smoothing degree coefficient in Formula (7). From the above model, it is evident that the degree of smoothing of the image by the RTV algorithm mainly depends on two parameters including the smoothing degree coefficient \(\lambda\), and the spatial scaling parameter \(\sigma\). The smoothing degree coefficient generally takes a value between 0.005 and 0.03. Adjusting \(\lambda\) alone may not effectively separate texture and noise; only increasing \(\lambda\) may cause image blurring and keep the unwanted texture. Therefore, \(\lambda\) needs to be adjusted simultaneously with the spatial scale parameter \(\sigma\). \(\sigma\) generally ranges from 0 to 6 and mainly regulates the spatial scale of the window, which depends on the size of noise or blotches in the image. Increasing \(\sigma\) can effectively remove noise interference and image blotches [21]. We take A03 - Wansheng pattern from the pattern extraction dataset shown in Figure 3 as an example and adjust \(\lambda\) and \(\sigma\) within the above value ranges to smooth the Zhuang brocade pattern. The results show that the algorithm exhibits different levels of smoothness after various numbers of iterations, with convergence typically reached within four iterations. The influence of the values of \(\sigma\) and \(\lambda\) on the image segmentation effect is demonstrated in Figure 9. In Figure 9a-d, for the plant pattern with less obvious texture, the smoothing effect is more obvious when \(\sigma\) increases to 2-3. However, some details of the pattern will be lost when \(\sigma\) = 3. Therefore, \(\sigma\) is selected as 2 for the printed fabric smoothing. Meanwhile, in Figure 9e-h, it can be seen that as \(\lambda\) increases, the details of the fabric pattern become smoother.