This study organizes key features and extracts and organizes pattern features. When
implementing pattern feature extraction and pattern design on the ground of relative
coordinates and region content replacement technology, corresponding algorithm design
and optimization need to be combined with specific application scenarios and requirements.
This is to achieve the best pattern processing effect.
3.1. Feature Extraction Methods and Image Segmentation of Zhuang Brocade Patterns
It systematically collects and classifies representative patterns of Zhuang brocade,
using computer image recognition and extraction methods. This can achieve fast and
accurate extraction of Zhuang brocade patterns on the ground of their features, laying
a preliminary research foundation for subsequent automatic generation and application
of patterns. The pattern feature extraction process is shown in Fig. 1.
Fig. 1. Zhuang brocade feature extraction process.
As shown in Fig. 1, when extracting pattern features, the first step is to clarify the target object
of pattern feature extraction, which usually involves systematic collection and classification
of Zhuang brocade patterns to ensure the comprehensiveness and pertinence of the research.
The steps of constructing extraction algorithms involve designing and developing algorithms
that can accurately identify and quantify pattern features, including but not limited
to color, texture, and organizational structure recognition. After the algorithm construction
is completed, experiments are conducted to verify the effectiveness of the algorithm.
The extraction algorithm will analyze the main colors and their distribution in the
Zhuang brocade pattern, quantify the color space, and provide a color basis for subsequent
design. Pattern feature extraction focuses on identifying and reproducing specific
graphic elements of Zhuang brocade patterns. Organizational structure feature extraction
focuses on the layout and combination of patterns, analyzing how patterns are organized
and arranged in space. Through the collaborative work of three branches, comprehensively
extract the key features of Zhuang brocade patterns. In the process of feature extraction,
a dataset containing color, pattern, and organizational structure features will be
gradually established as the basis for algorithm development and optimization. The
color extraction process is shown in Fig. 2.
Fig. 2. Color feature extraction process for Zhuang brocade.
In Fig. 2, during the color extraction process, samples of any color were selected as examples,
and the K-means algorithm was utilized for displaying the hexadecimal encoding and
proportion of the main colors in the Zhuang brocade image in an intuitive pie chart.
Using the K-means method to binarize the selected image, the main color tone is encoded
in hexadecimal and matched with the color closest to the query result in the color
dictionary to generate a scale map. This study uses the relative total variance model
and Grab cut interactive image segmentation technology to address the impact of sample
image blurring and complex textures on the extraction results in traditional pattern
extraction. The color extraction process of the pattern is shown in Fig. 3.
Fig. 3. Zhuang brocade color extraction process.
To reduce the impact of the texture of the fabric on pattern information processing,
a relative total variation model is utilized for achieving smooth extraction of fabric
texture. The relative total variation formula for any point in image smoothing processing
is shown in formula (1).
In formula (1), $\varepsilon$ is a fixed constant with a value greater than 0, the function is to
ensure that the values are always meaningful and to avoid calculation errors; $\Phi(\cdot)$
represents the contribution weight function; $\Psi(\cdot)$ representing texture feature
functions; $p$ represents the point of analysis. Its function is for ensuring that
the value is always meaningful to avoid calculation errors. The creation of even total
and intrinsic variations in the $x$ and $y$ directions at any point $p$ in the graph
is shown in formula (2).
In formula (2), $R(p)$ is the region centered on $p$, and $q$ is any point in the variational region
$R(p)$. $x$, $y$ is the partial differential of pixel $q$ in the $x$ and $y$ directions,
and $h_{p,q}$ is the weight function defined in space. Its expression is shown in
formula (3).
In formula (3), $p_x$ and $p_y$ respectively represent the horizontal and vertical coordinates of
point $p$, while $\sigma$ controls the spatial scale of the window. The RTV algorithm
model is shown in formula (4).
In formula (4), $S$ represents the input Zhuang brocade pattern, $f$ represents the extracted structure
of the image, and $\lambda$ is a fixed regularization parameter, that is, the smoothness
coefficient. The above model indicates that the degree of image smoothing processed
by the relative total variation algorithm mainly depends on two parameters: the smoothness
coefficient $\lambda$ and the spatial scale parameter $\sigma$. The algorithm used
in image segmentation processing is the GrabCut algorithm, which requires users to
manually label the areas to be segmented with rectangles. The connection between Zhuang
brocade patterns and patterns, as well as between patterns and tissues, is not high.
The GrabCut algorithm is used for selective local segmentation of Zhuang brocade patterns.
Its operation first defines a rectangle $T$ containing the target in the image, with
the outer region of the rectangle as the background region $T_B$ and the inner region
of the rectangle as the foreground region $T_F \neq \emptyset$ and $T_U = T_B$; When
the initialization label $a_n = 0$ of a pixel point $n$ in $T_B$ is considered as
a background pixel, and when the initialization label $a_n = 1$ of a pixel $n$ in
$T_U$ is considered as a possible target pixel; It uses the K-means clustering algorithm
to cluster the foreground region $T_F$ and background region $T_B$ into $K$ classes,
obtaining $K$ Gaussian mixture models (GMM); Using a Gaussian mixture model to model
the background and foreground, two GMM parameters $\theta$ and DE with initial values
$(\pi, \mu, \sigma)$ are obtained, where $\pi$ is the weight, $\mu$ is the mean vector,
and $\sigma$ is the covariance matrix. The GMM component of each pixel in foreground
$T_U$ is the RGB value of the target pixel $n$, and the $k_n$-th Gaussian component
of pixel $n$, as shown in formula (5).
It trains and learns GMM parameters for the given image data Z.
The segmentation is performed using the maximum minimum retention algorithm to obtain
the minimum energy as shown in formula (7).
It optimizes the GMM model and segmentation results until the energy $E$ reaches a
convergence state, thereby outputting high-quality images [18,
19]. After image preprocessing and segmentation, to objectively evaluate the accuracy
of pattern segmentation, it is necessary to calculate the pixel accuracy $PA$, as
shown in formula (8).
In formula (8), $p_{ij}$ serves as the total pixels with real pixel category $i$ predicted as category
$j$, and $p_{ii}$ serves as the total pixels with real pixel category $i$ predicted
as category $i$. Image binarization is a fundamental technique in image processing
that preserves sufficient feature information. It is mainly on the ground of the grayscale
characteristics of the image, dividing it into two parts: background and foreground,
in order to achieve more precise image processing results. The main core idea is to
find the maximum grayscale level $k$, and then divide the image into black and white
colors that are greater than the threshold and less than the threshold. The specific
algorithm principle is to treat grayscale image $F$ as a $M \times N$ matrix, where
the pixel value is $(0, 255)$. The probability of a pixel having a grayscale of $i$
is shown in formula (9).
Among them, the value of $\sum_{i=0}^{255} p_i$ is shown in formula (10).
The segmentation threshold for foreground and background is denoted as $k$, and the
image is divided into $C_A$ and $C_B$ on the ground of the threshold. The calculation
method for the global mean $m_G$ of the image is shown in formula (11).
In formula (11), $p_A$ and $p_B$ are the classification probabilities of images $C_A$ and $C_B$,
with grayscale means $m_A$ and $m_B$, respectively. The cumulative mean of grayscale
level $K$ is $m$, and the expression of variance is shown in formula (12).
It brings formula (11) into formula (12), as shown in formula (13).
It deforms formula (13) as shown in formula (14).
After obtaining the maximum threshold, the image is segmented by binarization, as
shown in formula (15).
3.2. Zhuang Brocade Pattern Design Algorithm on the Ground of Relative Coordinates
and Regional Content Replacement
This study investigates the Zhuang brocade pattern design algorithm on the ground
of graphic feature elements. It takes the Zhuang brocade pattern as the research object,
establishes a Zhuang brocade pattern design method and process on the ground of relative
coordinates and regional content replacement by encoding feature materials. This can
achieve the exchange of pattern and organizational form target area content. It matches
the color scheme of Zhuang brocade, generates multiple types of Zhuang brocade, and
evaluates their style similarity. The research process of pattern design is shown
in Fig. 4.
Fig. 4. Zhuang brocade pattern design process.
As shown in Fig. 4, the pattern encoding process is a key step in achieving automatic generation and
customized design of Zhuang brocade patterns. The process is mainly divided into three
independent sub processes, including color sample coding, pattern sample coding, and
tissue sample coding. Color sample coding focuses on the colors and their proportions
used in Zhuang brocade patterns. Establish a color sample library by quantifying and
classifying colors. The library will contain the main colors and their corresponding
hexadecimal values and proportions that appear in the Zhuang brocade pattern, providing
reference for the color matching of the pattern. Pattern sample coding is the analysis
and coding of specific graphic elements in Zhuang brocade patterns. Including extracting
features such as shape, lines, and texture of patterns, and converting them into editable
and reconfigurable data formats. Organizing sample coding involves the spatial arrangement
and organizational structure of patterns. During the process, it is necessary to analyze
how patterns are laid out in Zhuang brocade, including organizational forms such as
repetition, symmetry, and rhythm, and encode them into data structures that can be
processed by algorithms. The algorithm framework for replacing relative coordinates
and regional content is shown in Fig. 5.
In Fig. 5, it can be seen that the Zhuang brocade pattern reconstruction algorithm generates
corresponding mapping files by binary encoding each element. On this basis, the received
pattern genes are decoded to obtain the corresponding pattern elements, and their
localization is performed. This can make it consistent with the center coordinates
of the pattern to be reconstructed, and use the position displacement method specified
in the image to obtain the reconstructed pattern, and color it to obtain the final
effect. In the algorithm framework, its running steps include: generating element
encoding mapping files; Decoding; Pattern reconstruction and pattern coloring. Pattern
reconstruction mainly involves reorganizing the extracted pattern patterns and organizational
forms, using various combination methods to generate a novel Zhuang brocade pattern
in batches [20]. The center point (CP) of the pattern is aligned with the CP of the organizational
form to be embedded, thus completing the recombination of the pattern and organizational
form. The process of pattern position matching is shown in Fig. 6.
Fig. 5. Algorithm framework for replacing regional content on the ground of relative
coordinates.
Fig. 6 shows that in Fig. 6(a), when the pasted area does not exist or the coordinates are (0,0), it indicates that
the top left corner (TLC) of the pattern coincides with the TLC of the prohibited
image, and the pattern is pasted to the TLC of the organizational form; In Fig. 6(b), if the coordinates of the CPs of the organizational pattern area and the pasted
area exist, then when the pasted area is the same as it, the upper left corner of
the pattern is located at the CP of the pasted area, and the pattern and organizational
attributes overlap; In Fig. 6(c), if the pattern image wants to be offset upwards, the CP of the pattern image will
coincide with the CP of the pasted area. When using research methods for Zhuang brocade
pattern design in practical scenarios, in the initial stage of technical operation,
requirement analysis is first conducted to clarify design goals and expected effects.
Using computer image recognition technology to extract features from Zhuang brocade
patterns. Identification and classification of colors, patterns, and organizational
structures. Encode the extracted features to form color sample encoding, pattern sample
encoding, and tissue sample encoding. Develop pattern design algorithms based on encoded
data, including the development and optimization of algorithms for pattern recombination,
color matching, and style similarity evaluation. And through computer programs, multiple
design schemes are automatically output to achieve the automatic generation of Zhuang
brocade patterns. The automatically generated patterns are evaluated, including style
similarity, color coordination, and pattern innovation. Select the solution that best
meets the design objectives for further refinement and improvement. After user customization
and final adjustment by the designer, the output of the Zhuang brocade pattern meets
the requirements of modern packaging design.
Fig. 6. Pattern position matching process.