This section presents the experimental results of our proposed texture removal method. We collected 316 real knitted pattern photographs as the test set, covering six typical knitting processes: plain knitted fabrics, intarsia jacquard fabrics, float jacquard fabrics, double-faced fabrics, terry fabrics, and others, with approximately 50 samples for each process. All images were captured using a digital camera under natural lighting conditions, with resolutions ranging from 1000 × 1000 to 3000 × 3000 pixels, realistically reflecting the various shooting conditions and fabric states encountered in practical applications.
To establish objective evaluation criteria, we invited three professional textile designers with more than five years of experience to manually process these 316 original fabric images using Adobe Photoshop, with the workload distributed approximately equally among them (approximately 105 images per designer). The manual processing procedure included the following: (1) removing texture noise from the fabric surface using the healing brush tool and clone stamp tool; (2) precisely delineating pattern edges using the pen tool and magic wand tool; and (3) simplifying the patterns into 3–8 primary colors using color reduction techniques. The manual processing of each image required an average of approximately 15–30 min. To ensure annotation quality, each processed image was subsequently reviewed and confirmed by the remaining two designers. Any case where a meaningful discrepancy was identified—such as a difference in the number of color regions or inconsistent edge treatment—was returned to the original designer for revision until a consensus was reached, resulting in a single final reference per image reflecting the collective judgment of all three designers. The resulting posterized patterns serve as the ground truth for each image, representing the ideal knitted pattern extraction result.
For each image, we independently searched for its optimal bilateral filtering parameters using Bayesian optimization to validate the universality of the method. All algorithms were implemented in Python 3.9 and executed on a computer equipped with an Intel Core i7-8550U processor, 8 GB of RAM, and the Windows 10 operating system.
4.1. Bayesian Optimization Results
To optimize the bilateral filtering parameters for achieving optimal image processing results, we employed the Bayesian optimization method. During the optimization process, we configured the optimizer to use 5 initial random points and perform 50 iterations, with the random seed set to 42 to ensure reproducibility of the results.
Table 3 presents the optimized parameter results for 10 different fabric images. To validate the method’s adaptability to different knitting processes, we selected samples from five typical knitting processes for display: Images I and II are plain knitted fabrics, Images III and IV are intarsia jacquard fabrics, Images V and VI are float jacquard fabrics, Images VII and VIII are double-faced fabrics, and Images IX and X are terry fabrics. As can be observed from the table, the optimal parameter combinations for different knitting processes exhibit significant variations, validating that the Bayesian optimization method can automatically adjust parameter configurations according to the texture characteristics of different knitting processes, achieving adaptive optimization.
Figure 3 presents the optimization convergence curves. Since Bayesian optimization is performed independently for different fabric samples, each sample forms a unique convergence trajectory. Therefore,
Figure 3 displays three typical convergence curves corresponding to images from three different knitting processes. As the number of iterations increases, the objective function value shows a clear upward trend and stabilizes after a certain number of iterations, demonstrating good convergence performance of the optimization process and indicating that the algorithm successfully found the global optimal solution in the parameter space. Compared with traditional grid search or random search methods, Bayesian optimization can identify superior parameter combinations with fewer function evaluations, significantly improving optimization efficiency.
Figure 4 illustrates the variation trajectories of the three key parameters of bilateral filtering during each iteration of the Bayesian optimization process. From the parameter evolution curves, it can be observed that the neighborhood diameter d exhibits relatively large fluctuations in the early stages of optimization and gradually converges to the optimal range as iterations proceed, indicating that the algorithm progressively determines the best neighborhood size suitable for knitted fabric texture processing during the exploration process. The
σcolor demonstrates a relatively stable trend during the optimization process, with most iteration results concentrated within a reasonable value range, reflecting the sensitivity requirements of knitted pattern extraction for color similarity judgment. In contrast, the
σspace exhibits a larger variation range and exploratory behavior, showing a broader distribution across different iterations. This variation pattern reflects the intelligent search characteristics of the Bayesian optimization algorithm when balancing exploration and exploitation strategies. Analysis of the parameter evolution process reveals that the algorithm can effectively conduct global search in high-dimensional parameter spaces, avoiding the tendency of traditional optimization methods to become trapped in local optima. Ultimately, personalized optimal parameter configurations are found for different fabric characteristics, further validating the applicability and effectiveness of the Bayesian optimization method in automatic knitted pattern extraction.
4.2. Comparison with Other Algorithms
To validate the effectiveness of the proposed method, we conducted comparative experiments with various classical denoising algorithms,0 as well as advanced structure extraction algorithms, including median filtering, non-local means filtering, wavelet denoising, traditional bilateral filtering, mean filtering, Gaussian filtering, RTV, and PTF.
It should be noted that there is a fundamental difference in parameter settings between the proposed method and the comparison algorithms. This study automatically searches for the optimal parameter combination for each input image through Bayesian optimization, whereas the comparison algorithms employ their respective default parameter settings widely used in the image processing field or “universal parameters” adjusted through small-scale sample experiments. Specifically, median filtering, non-local means filtering, wavelet denoising, traditional bilateral filtering, mean filtering, and Gaussian filtering adopt their respective default parameters; RTV is configured with λ = 0.02 and σ = 3 according to the recommendations in the original literature; and PTF is set with σs = 5 and σr = 0.07. The rationale for this comparison approach is as follows: (1) default parameters represent the typical performance of each algorithm in general application scenarios; (2) most of these traditional algorithms do not support adaptive parameter adjustment mechanisms similar to Bayesian optimization; (3) although RTV and PTF are advanced methods, their parameter settings require manual adjustment based on image characteristics and cannot achieve adaptive parameter selection; and (4) the advantage of the proposed method lies precisely in its ability to automatically optimize for specific fabric types rather than relying on fixed parameters. The processing results of all comparison algorithms are uniformly subjected to K-means clustering for color quantization to ensure fairness in the post-processing stage. The clustering number parameter remains consistent across all algorithms and is manually selected.
For each image, the number of clusters K for K-means color quantization was determined through a systematic visual inspection procedure. Since K = 1 yields a single flat color representation that retains no design information, the procedure begins from K = 2. K was incrementally increased until no perceptually significant color was absent from the quantized output. The final K value was selected as the smallest value beyond which further increments produced only spurious color fringe artifacts along existing pattern edges—caused by the gradual color transition zones at yarn boundaries—rather than introducing additional perceptually meaningful design colors. As illustrated in
Figure 5, which presents the original image alongside K-means quantization results for K = 2 through K = 6, the output progressively recovers design-relevant colors as K increases. K = 4 yields a visually complete color representation faithful to the original design, while K = 5 and K = 6 introduce only narrow artifact color bands along pattern boundaries without contributing new design-relevant color regions, confirming K = 4 as the appropriate selection for this image. This selection was cross-referenced against the corresponding manually processed ground truth image, in which the number of distinct colors reflects the judgment of experienced textile designers.
To validate the universality of the proposed algorithm, we selected knitted patterns with six different knitting processes for testing. The six fabric images displayed in
Table 4 represent typical knitting processes in the textile field: the first is a plain knitted fabric, which is the most basic knitting structure; the second is an intarsia jacquard fabric with additional decorative yarns on the surface, featuring complex surface textures; the third is an intarsia jacquard fabric with different color regions exhibiting textures of varying densities; the fourth is a float jacquard fabric, characterized by relatively long floats on the reverse side; the fifth is a double-faced fabric with greater thickness, where patterns on both the front and reverse sides can be used; and the sixth is a terry fabric with a distinct loop structure on the surface. These fabrics with different knitting processes exhibit significant variations in texture complexity, surface luster, and three-dimensional relief, enabling comprehensive assessment of the algorithm’s adaptability and stability when processing different types of knitted fabrics.
Table 4 presents the processing effects of various filtering algorithms on the same fabric images.
Table 4a shows actual photographs of real knitted patterns, where all four photographs exhibit obvious knitted textures, with different shooting angles, uneven illumination, and irregular textures. From a visual perspective, as shown in
Table 4b, although median filtering can remove some texture noise, it also causes noticeable blocky artifacts at edges. As shown in
Table 4c, non-local means filtering performs well in preserving edges but does not sufficiently process complex fabric textures, leaving considerable texture residues. As shown in
Table 4d, wavelet denoising can effectively remove high-frequency noise, but its effect is limited when processing the irregular textures characteristic of fabrics, and pattern edges exhibit slight blurring. As shown in
Table 4e, when traditional bilateral filtering uses default parameters, although it can balance texture removal and edge preservation to some extent, the effect is not ideal, with problems of texture residues and edge blurring. As shown in
Table 4f,g, mean filtering and Gaussian filtering, as linear filtering methods, severely damage the edge information of patterns while removing textures, resulting in blurred pattern contours. As shown in
Table 4h, the RTV method performs excellently in texture smoothing of plain knitted fabrics but exhibits edge blurring caused by over-smoothing on samples with strong three-dimensional textures such as terry fabrics, because its fixed parameters cannot simultaneously adapt to the uniform textures of plain knitted fabrics and the strong undulations of terry fabrics. As shown in
Table 4i, PTF achieves good texture-structure separation through multi-scale decomposition but exhibits edge loss on intarsia jacquard fabric samples, indicating that fixed pyramid levels and smoothing strength cannot cope with fabric density variations caused by different knitting processes. In contrast, as shown in
Table 4j, the Bayesian-optimized bilateral filtering method proposed in this paper can effectively remove fabric texture noise while maintaining good pattern edge clarity and structural integrity. The optimized parameters enable the bilateral filter to better adapt to the characteristics of knitted fabrics, achieving an optimal balance between texture removal and edge preservation.
It should be noted that the texture removal and edge preservation evaluation metrics constructed in this paper are mainly used to guide the Bayesian optimization process to find filtering parameters most suitable for knitted fabric characteristics. When making horizontal comparisons with other algorithms, we adopt objective standard evaluation metrics: mean square error (MSE), peak signal-to-noise ratio (PSNR), and SSIM, using manually processed reference patterns as the evaluation baseline.
MSE measures the pixel difference between the filtered image and the reference image, calculated as
where
I(
i,
j) is the pixel value at position (
i,
j) in the image processed by each filtering algorithm,
K(
i,
j) is the pixel value at the corresponding position in the standard knitted pattern extracted through manual processing, and
M and
N are the width and height of the image, respectively. The smaller the MSE value, the closer the filtered image is to the high-quality manually processed result, indicating better algorithm performance.
PSNR is calculated based on MSE and reflects the signal-to-noise ratio level of the image, with the formula
where
MAXI is the maximum possible pixel value of the image (255 for 8-bit images). The larger the PSNR value, the better the image quality.
As defined in Equation (16), SSIM evaluates image similarity from three dimensions: luminance, contrast, and structure. The closer the SSIM value is to 1, the higher the structural similarity between the two images, indicating better algorithm performance. The closer the SSIM value is to 1, the higher the structural similarity between the two images, indicating better algorithm performance.
We conducted a comprehensive quantitative evaluation of various filtering algorithms using the 316 collected real knitted patterns as test samples. As can be seen from the results in
Table 5, the proposed method achieves the lowest MSE value (227.56), indicating the smallest pixel difference between its output and the manually processed reference patterns; the highest PSNR value (26.92 dB), indicating that the image quality is closest to the manual standard; and the highest SSIM value (0.83), indicating the best structural similarity. Among traditional filtering methods, mean filtering and median filtering perform relatively well but still exhibit noticeable texture residues or edge loss. RTV and PTF, as advanced structure extraction algorithms, outperform traditional filtering methods in overall performance (SSIM of 0.76 and 0.77, respectively) but are significantly inferior to the proposed method. More importantly, by analyzing the performance fluctuations of each method across six different knitting processes, the standard deviation of each method is significantly larger than that of the proposed method, indicating that fixed-parameter methods yield unsatisfactory results when facing diverse knitting processes. In terms of computational efficiency, RTV requires approximately 24 s per image on average due to the need for iterative solution of optimization problems, PTF’s multi-scale decomposition process requires approximately 36 s on average, while the total processing time of the proposed method including the Bayesian optimization process is only 21 s. Although the proposed method performs approximately 55 filtering parameter evaluations on each image, due to the high efficiency of bilateral filtering itself and the fast convergence characteristics of Bayesian optimization, the overall computational overhead is still significantly lower than the RTV method, which requires hundreds of iterations. These three metrics validate from different perspectives that the proposed method achieves the closest quality to manual processing in automatic knitted pattern extraction. It is worth noting that even the best-performing algorithm achieves an SSIM value of only 0.83, which still has a gap from the ideal value of 1.0. This reflects the inherent difficulty of the automatic knitted pattern extraction task—automatic algorithms struggle to fully replicate the meticulous judgment and precise operations involved in manual processing. Nevertheless, the proposed method significantly outperforms other traditional denoising algorithms, providing an efficient and practical solution for the automated extraction of knitted patterns.
It is worth noting that standard bilateral filtering with default parameters is included as an explicit baseline in
Table 5 (SSIM = 0.66, PSNR = 23.83 dB). This provides a natural controlled comparison between the untuned and tuned versions of the same base algorithm, allowing readers to attribute performance differences more clearly. Furthermore, applying such per-image automated tuning to the other evaluated baseline methods is not practically feasible in our real-world, no-reference scenario, as they lack the domain-specific, texture-aware objective function that our pipeline introduces.
4.3. Ablation Study
The following ablation study isolates the contribution of the Bayesian tuning strategy by comparing it against grid search and random search under controlled evaluation budgets.
In the experimental setup, grid search was conducted in the following parameter space: d with values of 5, 9, 15, 21; σcolor with values of 50, 100, 150, 200, 250; and σspace with values of 50, 100, 150, 200, 250, totaling 100 parameter combinations, i.e., 100 evaluations. Random search randomly sampled 50 times within the same parameter range. Bayesian optimization used 5 initial points and 50 iterations.
Table 6 shows the performance comparison of the three methods under the same evaluation budget. From the results, it can be seen that Bayesian optimization achieved performance comparable to 100 evaluations of grid search after 50 evaluations, with shorter computation time, demonstrating its advantage in search efficiency. Compared with random search, Bayesian optimization models the parameter space through a Gaussian process model, enabling more intelligent selection of the next evaluation point, avoiding the blindness of random search, and achieving higher comprehensive scores under comparable computation time. These results confirm that the gains of the proposed method arise from the combination of the intelligent search strategy and the knitting-texture-aware objective function, rather than from tuning budget alone.
4.4. Parameter Sensitivity Analysis
To justify the critical design choices in the proposed objective function, we conducted sensitivity analyses on the primary weighting parameters: the large-scale weights wtex and wedg, as well as the texture removal sub-weights w1, w2, and w3 and edge preservation sub-weights w4 and w5. All analyses were performed on a representative subset of 60 images drawn from the full dataset of 316 images, with 10 images selected from each of the 6 typical knitting process categories to ensure process diversity. All analyses use the mean SSIM and PSNR against ground truth as the external evaluation criterion, ensuring that the assessment is independent of the objective function configuration under test.
Table 7 reports the final extraction quality under nine configurations of
wtex ranging from 0.1 to 0.9, with
wedg = 1 −
wtex fixed accordingly. The results demonstrate a clear unimodal trend: SSIM and PSNR increase steadily as
wtex increases from 0.1 to 0.8, and then decline at
wtex. The current setting of
wtex achieves the highest mean SSIM of 0.8792 and mean PSNR of 28.76 dB, confirming that it represents a genuine optimum rather than an arbitrary boundary value. This finding is consistent with the domain motivation: in knitted pattern extraction, texture suppression is the primary bottleneck, and assigning excessive weight to edge preservation (low
wtex) substantially degrades extraction quality, while over-suppressing edge information (
wtex = 0.9) also incurs a measurable performance penalty.
Table 8 reports the final extraction quality under representative configurations of the texture removal sub-weights (
w1,
w2,
w3) and edge preservation sub-weights (
w4,
w5), with the large-scale weights fixed at their optimal values. Two key observations emerge. First, any configuration that employs all sub-metrics simultaneously yields virtually identical SSIM and PSNR regardless of the specific weight values (SSIM variation < 0.001), indicating that the objective function resides within a broad robust plateau with respect to sub-weight choices. Second, reducing either sub-metric group to a single metric results in substantial performance degradation, with SSIM drops of 0.10–0.29 for the texture removal sub-weights and approximately 0.10 for the edge preservation sub-weights. These findings confirm that the multi-metric design is essential for capturing the complementary aspects of texture suppression in knitted fabric images, while the specific sub-weight values are not critical and the current settings represent one of many equally effective configurations within the robust plateau.