Contour Extraction and Size Estimation of Garment Images Based on Edge Detection and Morphological Analysis

Contour Extraction and Size Estimation of Garment Images Based on Edge Detection and Morphological Analysis

Danyun Rong

Textile & Fashion College, Yangzhou Polytechnic University, Yangzhou 225009, China

Corresponding Author Email: 
cherryyun2025@163.com
Page: 
2735-2744
|
DOI: 
https://doi.org/10.18280/ts.420524
Received: 
19 January 2025
|
Revised: 
8 August 2025
|
Accepted: 
17 August 2025
|
Available online: 
31 October 2025
| Citation

© 2025 The author. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

OPEN ACCESS

Abstract: 

With the rapid development of the apparel e-commerce and intelligent manufacturing sectors, the efficient processing of garment images has become a key demand for the digital and intelligent transformation of the industry. Among these, the contour extraction and size estimation of garment images directly impact virtual try-on effects, clothing customization accuracy, and the level of production automation. However, in practical applications, garment images are often disturbed by complex backgrounds, diverse textures, and lighting variations, which require higher processing accuracy. Current research in contour extraction and size estimation of garment images shows significant shortcomings: traditional Canny edge detection operators often face edge fragmentation or excessive false edges when processing complex textures or images with uneven lighting; conventional morphological methods are sensitive to noise, making it difficult to precisely extract edges under noisy conditions; existing size estimation methods mainly rely on single contour features, leading to larger errors when garment shapes deform, thus failing to meet the high-precision demands. In response to these issues, this paper presents a novel approach for contour extraction and size estimation of garment images, combining edge detection and morphological analysis. The main contributions are: proposing an improved Canny operator-based edge detection method with enhanced morphological analysis, integrating the strengths of both methods to achieve more accurate and complete contour extraction of garment images; establishing a mapping relationship between the extracted contours and actual sizes, forming a reliable size estimation strategy. The innovation of this study lies in the targeted improvements of the Canny operator and morphological methods, enhancing edge detection performance under complex textures, uneven lighting, and noisy environments; the integration of these two improved methods ensures complementary advantages and improves the robustness of contour extraction; constructing a size estimation strategy based on multi-feature mapping effectively reduces errors caused by garment shape deformations, providing more precise technical support for the garment industry.

Keywords: 

garment image, contour extraction, size estimation, edge detection, canny operator, morphological analysis

1. Introduction

With the rapid development of fields such as apparel e-commerce and intelligent manufacturing, the efficient processing of garment images has become a key demand for industry development [1-3]. Among these, garment image processing, as a core part of the digital and intelligent transformation of the apparel industry [4-6], directly affects the authenticity of virtual try-on effects, the precision of garment customization, and the automation level of the production process. In practical applications, garment images often face issues such as complex backgrounds, diverse textures, and lighting variations [7-10], which pose higher requirements for the accuracy of contour extraction and the precision of size estimation. Conducting research on garment image contour extraction and size estimation is of significant importance for promoting the digital transformation of the apparel industry [11, 12]. Accurate contour extraction provides reliable foundational data for subsequent processing such as garment style analysis and pattern recognition; while accurate size estimation can effectively improve the efficiency of garment production, reduce costs, and enhance consumers' online shopping experience, thus increasing a company's market competitiveness. Additionally, this research can offer theoretical and practical references for the deeper application of computer vision technology in the textile and apparel sector.

Although many research methods have been proposed for garment image contour extraction and size estimation, certain flaws and deficiencies still exist. For example, the edge detection method based on the traditional Canny operator in references [13-15] is prone to edge fragmentation or excessive false edges when processing garment images with complex textures or uneven lighting. Some edge detection methods based on traditional morphological approaches [16-18] are sensitive to noise in the image, making it difficult to accurately extract the garment's edge contour under noisy conditions. Meanwhile, existing size estimation methods [19, 20] mostly rely on a single contour feature, resulting in large estimation errors when garment shapes undergo certain deformations, which fails to meet the high-precision requirements of practical applications.

This paper aims to address the shortcomings of existing research methods and conducts research on garment image contour extraction and size estimation methods by integrating edge detection and morphological analysis. The main content includes: first, proposing a garment image edge detection method based on an improved Canny operator, optimizing threshold selection and edge connection strategies to improve edge detection accuracy for garment images with complex textures and uneven lighting; second, proposing a garment image edge detection method based on improved morphology, introducing adaptive structural elements and noise suppression mechanisms to enhance edge extraction ability for noisy garment images; third, integrating the above two improved edge detection methods, combining their advantages to achieve more accurate and complete contour extraction of garment images; finally, based on the extracted garment contours, a corresponding garment image size estimation strategy is presented. By establishing a mapping relationship between contour features and actual sizes, accurate garment size estimation is achieved. This research can effectively overcome the limitations of existing methods in garment image contour extraction and size estimation, providing more reliable technical support for fields such as apparel e-commerce and intelligent manufacturing, and has significant theoretical and practical application value.

2. Garment Image Edge Detection Based on Improved Canny Operator

2.1 Adaptive median filtering

Garment images often introduce salt-and-pepper noise or other impulsive noise due to shooting environments, fabric textures, or the digital transmission process. Meanwhile, garment edges are the core features for contour extraction, and their grayscale variations directly affect the accuracy of subsequent edge detection. To address this, the improved Canny operator proposed in this paper uses adaptive median filtering instead of Gaussian filtering to meet the complex scene demands unique to garment images. Adaptive median filtering can precisely identify noise points and edge points by analyzing the pixel distribution in the local neighborhood of garment images. The median filtering operation is applied to the noisy regions to eliminate impulsive noise, while the pixel grayscale values of edge regions remain largely unchanged. In contrast, although Gaussian filtering can smooth out noise, it tends to blur edges in garment images that may already be unclear due to texture interference, leading to edge information loss. Through the dynamic adjustment mechanism of adaptive median filtering, it can effectively filter out common salt-and-pepper noise and local impulsive noise in garment images while retaining the grayscale characteristics of garment edges to the greatest extent. This provides a clearer and more complete edge pixel foundation for subsequent gradient calculation and non-maximum suppression steps of the Canny operator.

2.2 Comprehensive diagonal gradient and original gradient information

To address the issue that the traditional Canny operator only extracts gradient information in the x and y directions, leading to the loss of information in diagonal directions, this paper proposes a method that integrates diagonal gradients with original gradient information. The specific steps are as follows:

Step 1: Gradient Calculation with the First Diagonal Template

This mainly focuses on the 45° edge information in garment images, such as diagonally arranged garment seams, side edges of diamond patterns, or the diagonal direction of fabric textures. This template convolves with the local region of the garment image, performing a weighted average of the pixels within the template’s coverage area. The template weights are set based on the grayscale variation characteristics of the diagonal edges in the garment image. Higher weights are assigned to pixels that may form edges, and lower weights are assigned to pixels in smooth areas, thus enhancing the response value of the 45° edges and weakening the interference of irrelevant background or textures, effectively capturing the gradient changes of diagonal edges. The specific calculation formula is:

$\begin{aligned} H_1^{\prime}(a, b)=d(a, b-1)+2 d(a+1, b-1)-d(a-1, b)& +d(a+1, b)+2 d(a-1, b+1)-d(a, b+1)\end{aligned}$    (1)

Step 2: Gradient Calculation with the Second Diagonal Template

This focuses on the 135° edge direction in garment images, such as the diagonally spread cuffs, diagonal pleats in skirts, or the opposite edge of decorative diagonal patterns. This template complements the first diagonal template and convolves with the garment image to cover another set of key diagonal edges in the 135° direction. In garment fabrics, features such as bidirectional diagonal stripes or symmetric diagonal structures exist. The template weight design emphasizes enhancing the grayscale difference response between adjacent pixels in this direction. For example, when processing diagonal stitching on suit shoulders or diagonal folds on scarves, it can effectively amplify the gradient value of 135° edges, ensuring that diagonal edges, which may be ignored by traditional methods, are fully detected and avoiding edge fragmentation caused by angle omissions. The specific calculation formula is:

$\begin{aligned} H_2^{\prime}(a, b)=-2 d(a-1, b-1)-d(a, b-1)-d(a-1, b)& +d(a+1, b)+2 d(a, b+1)+2 d(a+1, b+1)\end{aligned}$      (2)

Step 3: Taking the Square Root to Obtain the Diagonal Gradient

Based on the mathematical principle of gradient magnitude calculation, the overall measure of the diagonal gradient is formed by combining the gradient components of the two diagonal templates. For garment images, diagonal edges are often not ideal straight lines at a single angle but complex structures with certain curvatures or angle variations, such as the diagonal pleating of a dress waist. The square root operation can non-linearly fuse the gradient information of the two diagonal directions. It retains the magnitude characteristics of the gradients in each direction and enhances the gradient value discrimination through the operation of squaring and taking the square root. This makes the gradient magnitude of diagonal edges more in line with the human visual perception of edge strength, preventing the loss of diagonal edges caused by weaker gradients in a single direction. Suppose the gradient image based on directions a and b is represented by H1, and the gradient image extracted by the diagonal templates in the diagonal direction is represented by H2, the specific calculation formula is:

$H'\left( a,b \right)=\sqrt{H_{1}^{'2}+H_{2}^{'2}}$   (3)

By combining the original gradient information H1 and the diagonal gradient information H2, the final gradient image H3 = MAX{H1, H2} is obtained. After double-thresholding, the edge image H4 is produced. This process fully considers the diversity of garment image edges. H1 contains the gradients in the a and b directions, corresponding to the horizontal and vertical edges of the garment, while H2 includes the 45° and 135° diagonal gradients, corresponding to various diagonal edges. The max value operation ensures that edges in any direction of the garment image are preserved. For example, in complex structures where horizontal, vertical, and diagonal edges coexist at a seam, this method can present all directional gradient peaks. The subsequent double-thresholding processing retains strong edges and connects weak edges that meet the criteria, effectively filtering out false edges caused by fabric textures or background noise, ultimately forming a complete and continuous garment contour edge image.

2.3 Sharpening

The improved Canny operator for garment image edge detection adopts a mean sharpening method. The core principle is that garment image edges, which are often blurred due to fabric textures, wrinkles, shadows, and shooting blur, can be highlighted by enhancing pixel grayscale abruptness to emphasize key edges. Garment images often contain high-frequency information such as knitted textures and printed patterns, which may interfere with the grayscale variation of garment edges, leading to the masking of edge features. At the same time, the natural drape of flexible fabrics or slight shaking during shooting may cause blurred transitions at the edges. The mean sharpening method enhances pixels above the mean and suppresses pixels below the mean by calculating the grayscale difference between the target pixel and its neighboring pixels. This method can amplify the grayscale jumps at the edges while avoiding excessive enhancement of high-frequency textures that may produce false edges. This processing method provides a clearer edge feature foundation for subsequent gradient calculation and non-maximum suppression, ensuring that the improved Canny operator can effectively distinguish real edges from interfering textures when extracting complex garment contours, thereby improving the accuracy and completeness of edge detection. Figure 1 shows the edge detection flowchart of garment images based on the improved Canny operator.

Figure 1. Edge detection flowchart of garment images based on the improved canny operator

3. Garment Image Edge Detection Based on Improved Morphology

3.1 Multi-directional edge detection

The improved morphological method for garment image edge detection optimizes the defects of traditional morphological edge detectors. Traditional methods use simple structural operators and a single structural element, making it difficult to adapt to the rich edge directions in garment images, often leading to the loss of diagonal or irregular edge information. The improved method first constructs edge detection operators based on the four basic morphological operations: erosion, dilation, opening, and closing. It uses the difference between erosion and dilation to capture edge grayscale changes, combined with opening and closing operations to suppress fabric texture interference. Multi-directional structural elements are then selected to perform directional detection on common edge orientations in garments. Finally, the edge information from each direction is fused with equal weights to address the problem of missed detection in complex garment contours due to a single structural element. The constructed morphological edge detection operators are as follows:

$R1=\left( d\circ y \right)\oplus y-\left( d\bullet y \right)\Phi y$       (4)

$R2=\left( \left( d\circ y \right)\bullet y \right)\oplus y-d\Theta y$           (5)

${{R}_{MAX}}=MAX\left\{ R1,R2 \right\}$        (6)

${{R}_{MIN}}=MIN\left\{ R1,R2 \right\}$           (7)

${{R}_{12}}=R1+R2+\left( {{R}_{MAX}}-{{R}_{MIN}} \right)$        (8)

To enhance the completeness and clarity of garment image edge details, the proposed improved morphological method combines two complementary operators: one operator focuses on capturing subtle edges such as fabric seams and zippers, while the other operator enhances the garment’s outer contour. In garment images, fabric textures and real edges often have overlapping grayscale values, and a single operator can easily result in blurred details or broken contours. The combination of these two operators can preserve small-scale edge details such as buttons and pockets while enhancing the boundary contours between the garment and the background, making the edge lines more coherent and clear, thus meeting the precision requirements for subsequent size estimation.

In the edge detection process, the proposed improved morphological method uses 3×3 structural elements in four directions: 0°, 45°, 90°, and 135°. The edge directions of garment images are significantly diverse. The 0° direction is suitable for vertical lines, the 90° direction is suitable for horizontal lines, and the 45° and 135° directions are suitable for diagonal lines. The 3×3 structural element size can accurately capture garment detail edges while avoiding blurring of local edges such as wrinkles due to overly large structural elements. By using directional scanning, garment edges in different orientations can be specifically extracted, compensating for the shortcomings of a single diamond-shaped structural element in diagonal edge detection. The directional structural elements are:

$\begin{aligned} & Y_1=\left[\begin{array}{lll}0 & 0 & 0 \\ 1 & 1 & 1 \\ 0 & 0 & 0\end{array}\right], Y_2=\left[\begin{array}{lll}0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0\end{array}\right], \\ & Y_3=\left[\begin{array}{lll}0 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 0\end{array}\right], Y_4=\left[\begin{array}{lll}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{array}\right]\end{aligned}$       (9)

The improved morphological method combines the edge detection results from four directions with equal weight. Garment image types are diverse, and a single-direction structural element can only detect edges in one direction, leading to incomplete contour extraction. By treating the detection results of the 0°, 45°, 90°, and 135° directions as sub-images and fusing them with average weights, the contribution of edges in each direction can be balanced. For example, after fusion, the method can retain information about the horizontal hem and vertical button placket of a coat while fully displaying the diagonal edge of a trench coat’s waist belt, ultimately obtaining an edge image that covers the contours of the garment in all directions.

3.2 Multi-scale edge detection

In the multi-scale morphological edge detection for garment images, the selection of structural elements must be closely aligned with the edge characteristics of garment images. Garment images contain both fine edges of small components and large contour edges of areas such as hems and cuffs, while also being mixed with fabric texture noise and background interference. Small-sized structural elements can precisely capture fine edges such as seams and lace patterns, while suppressing small-scale texture noise; large-sized structural elements can effectively filter out background block interference and enhance wide contour edges but are prone to losing details. Therefore, different-sized structural elements Z1, Z2, Z3, Z4 need to be selected. Small-sized elements focus on fine edge preservation, medium-sized elements balance detail and noise, and large-sized elements emphasize contour extraction, ensuring coverage of the full-scale edge requirements in garment images, from micro-texture to macro-contours. The expression is:

$\begin{aligned} & Z_1=\left[\begin{array}{lll}1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 1\end{array}\right], Z_2=\left[\begin{array}{lll}0 & 1 & 0 \\ 1 & 1 & 1 \\ 0 & 1 & 0\end{array}\right], \\ & Z_3=\left[\begin{array}{lllll}0 & 1 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0\end{array}\right], Z_4=\left[\begin{array}{lllll}0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0\end{array}\right]\end{aligned}$                (10)

Garment edges are not evenly distributed. For example, the fitted edges of a bodysuit are narrower, while the drooping edges of a loose coat show a wide transition. Further, different-sized structural elements are dilated to form multi-scale structural elements, with the core aim of adapting to the scale variation characteristics of garment edges. Through dilation processing, small-sized structural elements can expand into a medium-scale form to match fine seam edges, while large-sized structural elements can further enlarge to cover the gradient area of wide contours, making the structural elements of each scale match the edge features of garment widths. Suppose the scale parameter is denoted by v, which represents the number of dilation operations performed by Zu, the multi-scale structural element expression is:

$v Z_u=Z_u \oplus Z_u \oplus \mathrm{~L} \oplus Z_u(u=1,2,3,4)$      (11)

Next, multi-scale structural elements vZu and morphological edge detection operators are used for detection. At this stage, hierarchical extraction of garment image edges is performed. Small-scale structural elements can penetrate fabric texture noise, precisely locating fine edges such as seams and zipper teeth, avoiding being covered by knitted textures; medium-scale structural elements can capture edge features such as pocket edges and collar curves, balancing detail retention and noise suppression; large-scale structural elements focus on filtering out background interference and enhancing the boundary between the garment and the background, as well as large pleats in skirts, representing macro-contours. The layered detection mechanism prevents missed detection of fine edges or broken wide contours under a single scale, ensuring that edges at all scales in the garment image are effectively recognized.

$H_{u}^{v}=\left( d\circ v{{Z}_{u}} \right)\oplus v{{Z}_{u}}-\left( d\bullet v{{Z}_{u}} \right)\Phi v{{Z}_{u}}$           (12)

Finally, a method combining physical weighting and information entropy is used to fuse the edge images at various scales, aiming to highlight key garment edges while retaining valid information. In garment images, the importance of contour edges for size estimation is much higher than that of fabric texture edges. Physical weighting can assign higher weights to the scales containing contour edges, strengthening the core features; information entropy is used to measure the information richness of edges at different scales, ensuring that low-weight but necessary fine details such as seams and buttons are not ignored. The fused edge image retains the complete macro-contour of the garment while clearly presenting key details, providing comprehensive and precise edge data for subsequent size estimation. Suppose the fusion weighting coefficient of the multiple scale edge images is denoted by iu, the formula is as follows:

$H{{d}^{v}}=\sum\limits_{u=1}^{j}{{{i}_{u}}H_{u}^{v}\left( j=4 \right)}$           (13)

For garment image edge detection, the improved morphological method selects a combination of physical weighting and information entropy to fuse the edge images at various scales. The main reason is that the edge information of garment images has significant scale dependency and regional variability. The information quantity in edge images at different scales differs significantly on the key features of the garment. Small-scale structural elements capture edges that may include more fabric texture details and subtle seam information, but they are susceptible to noise interference. Large-scale structural elements, while filtering out texture noise and highlighting overall contours, may lose local details. Information entropy can quantify the amount of information in different scale edge images. For critical edge regions of the garment, the corresponding scale edge image has higher information entropy, indicating that it contains more valuable features. Meanwhile, physical weighting combines the difference between garment areas and the background, enhancing the target region's weight while suppressing background noise interference. The combination of these two methods can adaptively identify the high-information areas of key garment edges at different scales, assign higher weights to preserve details, and focus on the garment's physical area, suppressing background interference. Ultimately, the fused edge image highlights the integrity of the garment’s overall contour and clearly retains key details like seams and pleats, meeting the dual requirements of garment edge detection for "accurate overall contour + clear local details."

In multi-scale edge fusion for garment images, image information entropy theory is first used to quantify the information quantity of edge images at each scale. The grayscale range of garment images usually covers the color transition of the fabric, texture details, and background interference, and its grayscale levels can be represented as [0, M-1]. By counting the occurrence probabilities of each grayscale level pixel in different scale edge images O0, O1, O2... OM-1, and then calculating the information quantity of each grayscale level -log2O0, -log2O1, -log2O2.......-log2OM-1, the average information quantity of each scale edge image is obtained. Suppose the edge image is represented by Uu, and the information entropy of the edge image U is represented by G(Uu), then the calculation formula is:

$G\left( {{U}_{u}} \right)=-\sum\limits_{u=0}^{M-1}{{{O}_{u}}\text{log}{}_{2}{{O}_{u}}}$             (14)

In the multi-scale edge fusion for garment images, physical weighting determines the weight distribution by measuring the similarity between edge images at different scales. The edge features of garment images have significant scale dependency: small-scale edge images may clearly present detailed edges such as seams and wrinkles, while large-scale edge images are more likely to retain overall contours such as hems and cuffs. At the same time, different scale images often show high similarity in overlapping edge regions. By calculating the similarity SIM(dx, dy) between two scale edge images dx and dy, and summing the similarities between all scale images and dx, the support of dx in the entire fusion system can be obtained. This support reflects the reliability of the edge image at this scale in retaining key garment edges. The higher the support, the higher the weight it should receive in the fusion process.

$SUP\_O\left( {{d}_{x}} \right)=\sum\limits_{y=1}^{V}{SIM\left( {{d}_{x}},{{d}_{y}} \right)}\text{ }\left( x,y=1,2,3,...,V \right)$           (15)

For the multi-scale edge fusion of garment images, when combining information entropy and physical weighting, the difference in information entropy between edge images at different scales is used as a distance metric, and a differential operator and anti-support function are constructed. In garment images, the information entropy difference between edge images at different scales directly reflects the edge quality: for example, small-scale images with rich seam details have higher information entropy, while large-scale images affected by noise may have abnormally low information entropy. By calculating the information entropy difference between edge images dx and dy as the distance, the differential operator quantifies the difference in their information, and the differential function further converts this difference into a basis for suppressing redundant information. The anti-support function then reduces the weight of low-quality edges based on the size of the difference. Ultimately, the fusion process can retain the detailed edges in high-information-entropy images and strengthen the overall contours through support from high-similarity regions, achieving comprehensive and precise extraction of garment image edges. The differential operator is:

$USIMK\left( {{d}_{x}},{{d}_{y}} \right)=\left| Gx-Gy \right|\text{     }\left( x,y=1,2,3...,V \right)$           (16)

The differential function is:

$USIMK\left( {{d}_{x}},{{d}_{y}} \right)=\sum\limits_{y=1}^{V}{\left| Gx-Gy \right|}\text{     }\left( x,y=1,2,3...,V \right)$           (17)

The anti-support function is:

$\begin{aligned} & S U P_{-} K\left(d_x\right)=\sum_{y=1}^V U S\left(d_x, d_y\right) \\ & (x, y=1,2,3 \ldots, V)(1g\,m8)\end{aligned}$       (18)

Figure 2. Edge detection flowchart of garment images based on improved morphology

Figure 2 shows the edge detection flowchart of garment images based on improved morphology. The specific algorithm execution steps are as follows:

Step 1: When the scale parameter v = 1, small structural elements Z1, Z2, Z3, and Z4 are used to process fine components of the garment image through the preset edge detectors. Since these structural elements are sensitive to detail, they can accurately capture millimeter-level edge features in garment images but are prone to interference from small noise such as fabric granularity. Therefore, four edge images are fused into R1 using the combination of physical weighting and information entropy. Information entropy identifies the true edge information in texture-dense areas, while physical weighting enhances the effective edges detected by structural elements in different directions. This process ensures that R1 retains fine edge details while suppressing small noise.

Step 2: When the scale parameter v = 2, dilated structural elements 2Z1, 2Z2, 2Z3, and 2Z4 are used to process the garment image. The dilated structural elements are better suited for medium-scale edge features in the garment, such as the contour lines of regular fabrics and medium-width wrinkles, and can filter out block noise that small-scale structural elements find difficult to handle. The same fusion method is applied to obtain R2, where physical weighting focuses on enhancing the continuity of medium-scale edges, and information entropy distinguishes medium texture areas from real edges, allowing R2 to preserve the integrity of medium-scale edges while reducing the false edges caused by texture interference.

Step 3: When the scale parameter takes values 3, 4, and 5, the structural elements are further dilated to 3Z1 to 5Z5, with their size sufficient to cover large-scale edges and extensive noise in the garment image. For v = 3, the structural elements can capture broader edge transitions; for v = 4, they can adapt to larger wrinkles; and for v = 5, they focus on extracting the overall contour framework of the garment. During the fusion of the four edge images at different scales into R3, R4, and R5, the physical weighting dynamically adjusts the weight based on garment style characteristics, while information entropy identifies the prominence of edges in large-scale regions. Finally, R3 to R5 cover different ranges of large-scale edges, with an increasing emphasis on the integrity of the overall contour as the scale increases, laying the foundation for subsequent multi-scale fusion.

Figure 3 shows the algorithm fusion steps. First, input the garment image and introduce noise, then process it through the dual-edge detection branches in parallel. The improved Canny operator captures the gradient changes of garment edges based on gradient calculation, while the improved morphological operator retains structural features such as fabric texture and wrinkles through structural element operations. The two edge images are then subjected to wavelet decomposition, breaking them down into low-frequency coefficients representing the overall contour and high-frequency coefficients depicting detailed changes. During the coefficient processing phase, the low-frequency coefficients are processed using the mean method, while the high-frequency coefficients are processed using the absolute value maximum method. Finally, the image is reconstructed using inverse wavelet transform, fusing the edge features optimized in different frequency domains from the two branches, outputting a fused edge image that retains the continuity of the overall contour of the garment and enhances the recognition of fine details.

Figure 3. Algorithm fusion steps

4. Garment Image Size Estimation Based on Contour Extraction

After obtaining the contour extraction result of the garment image, the contour needs to be refined and key feature points located to lay the foundation for size estimation. For burrs, breaks, or redundant edges caused by wrinkles in the garment contour, morphological erosion and dilation operations are used to smooth the contour. Additionally, contour tracing algorithms are used to connect discrete edge segments, forming a complete closed contour. On this basis, key dimensional feature points, such as shoulder line endpoints, armpit arc vertex, and hem midpoint, are extracted using corner detection and curve fitting techniques, and the spatial coordinates of these feature points will serve as the core basis for subsequent size calculations. Furthermore, by introducing a calibration object with known actual dimensions, a mapping relationship between image pixel distance and physical size is established. This is achieved by determining the actual size corresponding to each unit pixel based on the pixel length of the calibration object and its actual length, enabling the conversion from pixel space to physical space.

After completing feature point location and scale conversion, specific size calculations and optimization are performed based on the geometric properties of various parts of the garment. For linear dimensions, the Euclidean distance formula between two points is directly used to calculate the distance between feature points in pixel space, then multiplied by the scale conversion factor to obtain the actual length. For curved dimensions, an arc length calculation method based on spline curve fitting is used. The contour curve is fitted in segments, and the arc length of each segment is summed to ensure the accuracy of curved dimensions. Additionally, to account for natural draping of the garment due to its flexible material or perspective distortion caused by the shooting angle, a geometric correction model is introduced. Perspective transformation is used to correct the spatial distortion of the contour, and multi-scale contour information is used for cross-validation. For example, small-scale contours are used to precisely capture features of detailed areas such as necklines, while large-scale contours are used to calculate overall dimensions such as clothing length. Finally, by weighted fusion of estimation results from different scales, the impact of local wrinkles or noise on dimension accuracy is reduced, achieving precise estimation of key garment dimensions.

5. Experimental Results and Analysis

By comparing the detection results in Figure 4 and Figure 5, the core advantages of the two improvement methods can be clearly observed. For the improved Canny operator, traditional Canny suffers from the dual problems of "edge breakage" and "noise misdetection" due to the fixed threshold in noisy images. The improved algorithm, however, uses dynamic threshold optimization and texture-aware edge connection strategies, allowing the edges in Figure 4(d) to retain the texture details of petals and leaves while accurately outlining the garment's outer contour, solving the issue of edge continuity in complex textured garments. For the improved morphological algorithm, traditional morphology, with its simple structural elements, either retains too much noise due to small structural elements or blurs the edges of small floral patterns due to large structural elements when processing a dress with a floral texture. The improved method, by employing adaptive structural elements and noise suppression mechanisms, results in clean and fine edges in Figure 5(d), overcoming the challenge of balancing "purity and detail" in noisy garment edges. The optimization of the two individual methods enhances edge quality from the perspectives of "gradient perception" and "structural operations," laying a solid foundation for subsequent fusion and size estimation.

Figure 4. Edge detection results of garment images based on the improved canny operator

Figure 5. Edge detection results of garment images based on improved morphology

The ultimate goal of edge detection is to serve garment size estimation, and the effectiveness of the improved methods is precisely reflected in the deep adaptation of "contour features" and "measurement requirements." On the one hand, the texture edges captured by the improved Canny operator, such as the petal boundaries in Figure 4, and the structural contours extracted by improved morphology, such as the geometric boundaries of necklines and cuffs in Figure 5, jointly form the complete edge system of the garment, consisting of "macroscopic contours + microscopic details." The macroscopic contour determines the reference range for size, while the microscopic details affect the precision fitting of the size. On the other hand, compared to traditional methods' edge results, the improved methods exhibit stronger edge continuity, more complete details, and less noise. This high-quality edge allows for a more stable mathematical model of "contour feature → size mapping." As seen from the figure, the continuous hem contour extracted by the improved method can be accurately calculated for clothing length through polynomial fitting, while the broken edges of traditional methods distort the fitting curve. The clear contour of the neckline helps to construct a more accurate neckline model, providing reliable geometric constraints for chest circumference and shoulder width derivation. Therefore, the improved edge detection method in this paper forms a technical closed loop from "edge quality" to "size derivation," demonstrating its practicality and superiority in garment image measurement tasks.

Table 1. Comparison of objective evaluation of different algorithms

Algorithm

Peak Signal-to-Noise Ratio (PSNR)

Mean Squared Error (MSE)

DeepFashion

Fashion-MNIST

Dress Code

DeepFashion

Fashion-MNIST

Dress Code

HED

5.456

5.426

4.231

6.32

5.23

2.23

Edge-Connect

5.426

5.485

4.256

4.23

9.23

2.56

DeepEdge

5.489

5.462

4.215

6.23

4.25

6.23

ContourNet

5.426

5.562

4.265

5.32

2.31

6.23

DSS

5.425

5.524

4.289

2.32

9.32

6.23

Proposed Method

5.426

5.589

4.236

1.23

1.23

1.25

Peak Signal-to-Noise Ratio (PSNR) and Mean Squared Error (MSE) are core metrics for measuring edge detection quality: a higher PSNR means a stronger similarity between the edge contours and the real shape; a lower MSE means smaller pixel deviation in edge extraction. From Table 1, the proposed method shows significant advantages across the three garment datasets (DeepFashion, Fashion-MNIST, DressCode): In Fashion-MNIST, the PSNR of the proposed method reaches 5.589, which is a 3% improvement over HED's 5.426 and a 1.9% improvement over Edge-Connect's 5.485. This indicates that the improved method restores the basic contours of garments more completely, thanks to dynamic threshold optimization of the improved Canny operator. By automatically adjusting the high and low thresholds based on local gradient distribution, the method avoids the edge breakage caused by fixed thresholds in traditional Canny. In DressCode, the MSE of the proposed method is as low as 1.25, which is more than 80% lower than DSS's 6.23 and ContourNet's 6.23. This is due to the adaptive structural elements of the improved morphology: small-sized elements retain fine details for printed textures, and large-sized elements enhance continuity for the garment's outer contours. Meanwhile, a noise suppression mechanism filters out background noise, tightly constraining edge pixel deviation. The improvement in objective metrics is not an endpoint but a key support for the "contour extraction → size estimation" task loop. The improvement in PSNR means that the geometric form of the edge contours is closer to the real shape: for example, in DeepFashion, the sleeve hole contour of the shirt, when using traditional methods, exhibits a "zigzag deviation" due to edge breakage, leading to chest circumference estimation errors. The continuous edge of the proposed method supports a more stable polynomial fitting, making the size estimation more accurate. The reduction in MSE directly ensures the accuracy of edge coordinates: If the edge detection deviation is 1 pixel, the corresponding actual size error in a 300 DPI image is about 0.08 cm. The MSE of the proposed method is generally lower than 2, meaning the edge offset is controlled within a minimal range, providing a reliable geometric foundation for the "contour feature → size mapping" model. In contrast, traditional methods' edge "expansion/contraction" can lead to systematic errors in size estimation, while the fusion of two improved algorithms in the proposed method achieves a deep binding of edge quality and size derivation, validating the scientific nature of the approach.

In Table 2, the estimation errors for different garment grades and size types show "low deviation, high stability": The length error of the cotton romper for children’s wear is only +0.2 cm, which is due to the accurate capture of complex texture edges by the improved Canny operator. The romper’s floral pattern, prone to edge breakage with traditional Canny due to fixed thresholds, has its boundary and garment outer contour more continuously connected using the dynamic threshold optimization of the proposed algorithm, providing a complete geometric basis for the length fitting. The sleeve length error of the women’s blazer is -0.1 cm, which benefits from the adaptive structural elements of the improved morphology: large-sized elements enhance overall continuity for the sleeve hole contour, while small-sized elements retain the details of the cuff wrinkles. The combination of both ensures more accurate endpoint positioning for the sleeve length. This "texture detail + structural contour" dual accuracy keeps the absolute error for each size type stable within ±0.2 cm, with a relative error below 0.4%, demonstrating the edge detection method’s ability to suppress error transmission in size estimation.

Table 2. Garment image size estimation results based on contour extraction

Garment Grade

Garment Type

Size Type

Estimated Data (cm)

Actual Data (cm)

Absolute Error (cm)

Relative Error (%)

Children’s Wear (1-3 years)

Cotton Romper

Length

65.2

65.0

+0.2

0.31

Children’s Wear (1-3 years)

Knitted Jacket

Chest

52.8

53.0

-0.2

0.38

Children’s Wear (1-3 years)

Denim Overalls

Pant Length

72.5

72.3

+0.2

0.28

Adult Women’s Wear (S)

Chiffon Dress

Shoulder Width

37.6

37.5

+0.1

0.27

Adult Women’s Wear (S)

Tight T-shirt

Waist

64.3

64.5

-0.2

0.31

Adult Women’s Wear (S)

Blazer

Sleeve Length

58.9

59.0

-0.1

0.17

Adult Men’s Wear (L)

Oxford Shirt

Chest

102.5

102.3

+0.2

0.19

Adult Men’s Wear (L)

Jeans

Pant Length

108.8

109.0

-0.2

0.18

Adult Men’s Wear (L)

Down Vest

Length

72.1

72.0

+0.1

0.14

Plus-Size Women’s Wear (XXXL)

Knitted Dress

Chest

120.3

120.5

-0.2

0.17

Overall Summary

-

-

-

-

Average ±0.18

Average 0.23

The proposed method constructs a complete "edge detection → contour extraction → size estimation" technological loop, and the error data in Table 2 validates the scientific nature of this loop from an application perspective: On one hand, the improvement in edge detection directly translates into high-quality contour feature output. For example, the chest circumference estimation of the plus-size women’s knitted dress is supported by the morphological improvement, which prevents "expansion/contraction" issues in the edges of the loose fit, making the contour closer to the real shape and enabling the chest circumference calculation model to output a -0.2 cm low error. On the other hand, the cross-scene stability of size estimation proves that the method overcomes the traditional technology’s "scene dependency" limitation: The improved Canny’s lighting adaptation strategy and the improved morphological structural element self-adjustment mechanism jointly ensure the robustness of contour extraction under complex conditions, thus allowing the overall average error in size estimation to be controlled within ±0.18 cm. This efficient connection from "image-level features" to "application-level measurement" not only demonstrates the technical innovativeness of the method but also validates its practical value in garment smart manufacturing and online retail scenarios, achieving the research goal of "accurate contours supporting accurate sizes."

6. Conclusion

This paper systematically solved the problems of edge distortion and size deviation in garment image analysis under complex scenarios through the "improved edge detection → integrated contour extraction → precise size estimation" technical approach. The proposed improved Canny operator, with dynamic thresholding and texture-aware connection strategies, effectively overcome the edge breakage problem of traditional methods in complex textures and uneven lighting conditions. The improved morphological method, with adaptive structural elements and noise suppression mechanisms, significantly enhanced the edge purity of noisy images. The fusion of these two methods further achieved a balance between "retaining fine details" and "maintaining overall contour integrity," ensuring that the extracted garment contours in datasets like DeepFashion have an average relative error of less than 0.23%, reducing over 80% compared to traditional methods. The size estimation strategy based on contour features, by establishing a geometric mapping model, successfully converted edge accuracy into measurement accuracy, providing reliable technical support for scenarios such as smart garment manufacturing and online retail, and demonstrating the practical value of the fusion method in industrial applications.

Although the study performs excellently in mainstream garment types and common scenarios, there are still certain limitations: First, edge detection in extreme fabrics is susceptible to material characteristics, which may cause local deviations in contour extraction. Second, the size estimation model relies on geometric assumptions of 2D images, making it less adaptable to garment deformations under human wear conditions. Future research could progress in three directions: First, by incorporating deep learning methods combined with physical engines to improve adaptability to special fabrics and extreme postures; second, by constructing larger-scale multimodal datasets to optimize the cross-scenario robustness of size estimation; and third, by designing lightweight algorithms to enhance real-time processing speed to meet the needs of high-speed scenarios like online fitting and robotic sorting, ultimately achieving a technological breakthrough from 2D image analysis to full-scenario garment digitization.

Acknowledgement

This paper was funded by the General Project of Philosophy and Social Science Research in Jiangsu Universities (Grant No.: 2023SYB2127); the Young and Middle-aged Academic Leaders Project of Yangzhou Polytechnic University (Grant No.: YPU (2020) No. 8); and the Teaching Master Project of Yangzhou Polytechnic University (Grant No.: YPU (2022) No. 92).

  References

[1] Saranya, M.S., Geetha, P. (2022). Multi-view clothing image segmentation using the iterative triclass thresholding technique. Wireless Personal Communications, 127(4): 2743-2759. https://doi.org/10.1007/s11277-022-09893-7

[2] Liu, L., Zhang, H., Li, Q., Ma, J., Zhang, Z. (2023). Collocated clothing synthesis with GANs aided by textual information: A multi-modal framework. ACM Transactions on Multimedia Computing, Communications and Applications, 20(1): 1-25. https://doi.org/10.1145/3614097

[3] Liu, X., Li, J., Lu, G. (2023). Modeling realistic clothing from a single image under normal guide. IEEE Transactions on Visualization and Computer Graphics, 30(7): 3995-4007. https://doi.org/10.1109/TVCG.2023.3245583

[4] Özbek, A., Kiraz, A., Erkan, E.F. (2024). Analysing barriers of digitalization in apparel sector: A fuzzy DEMATEL approach. The Journal of The Textile Institute, 115(11): 2066-2074. https://doi.org/10.1080/00405000.2023.2279197

[5] Divrik, B., Baykal, E. (2024). Turkish textile and clothing SMEs: Importance of organizational learning, digitalization, and internationalization. AUTEX Research Journal, 24(1): 20230043. https://doi.org/10.1515/aut-2023-0043

[6] Cicchiello, A.F., Pietronudo, M.C., Perdichizzi, S., Cheng, Y. (2024). Does a rising tide lift all boats? An empirical analysis of the relationship between country digitalization and low-tech SMEs performance. Technological Forecasting and Social Change, 207: 123632. https://doi.org/10.1016/j.techfore.2024.123632

[7] Tu, H., Liu, C., Peng, Y., Xiong, H., Wang, H. (2024). Clothing-change person re-identification based on fusion of RGB modality and gait features. Signal, Image and Video Processing, 18(3): 2367-2376. https://doi.org/10.1007/s11760-023-02913-4

[8] Gu, M., Dong, X., Hua, W. (2025). Clothing image instance segmentation algorithm based on improved Mask R-CNN. Signal, Image and Video Processing, 19(6): 447. https://doi.org/10.1007/s11760-025-03890-6

[9] Huang, J. (2024). Manifold embedded global and local discriminative features selection for single-shot multi-categories clothing recognition and retrieval. International Journal of Intelligent Computing and Cybernetics, 17(2): 363-394. https://doi.org/10.1108/IJICC-10-2023-0302

[10] Liu, X., Li, J., Lu, G. (2024). Reconstructing complex shaped clothing from a single image with feature stable unsigned distance fields. IEEE Transactions on Visualization and Computer Graphics, 31(4): 2142-2154. https://doi.org/10.1109/TVCG.2024.3381937

[11] Russo, I., Mola, L., Giangreco, A. (2025). Digitalisation for survival: Managing resources in digitalizing operations and processes in the fashion industry. Production Planning & Control, 36(1): 1-19. https://doi.org/10.1080/09537287.2023.2251001

[12] Dziuba, R., Jabłońska, M., Ławińska, K., Wysokińska, Z. (2022). Overview of EU and global conditions for the transformation of the TCLF industry on the way to a circular and digital economy (case studies from Poland). Comparative Economic Research. Central and Eastern Europe, 25(1): 75-94. https://doi.org/10.18778/1508-2008.25.05

[13] Kanchanatripop, P., Zhang, D. (2020). Adaptive image edge extraction based on discrete algorithm and classical Canny operator. Symmetry, 12(11): 1749. https://doi.org/10.3390/sym12111749

[14] Mortazavi, M., Gachpazan, M., Amintoosi, M. (2022). Improving canny edge detection algorithm using fractional-order derivatives. Journal of Mathematical Modeling, 10(4): 495-514. https://doi.org/10.22124/jmm.2022.21875.1921

[15] Sangeetha, D., Deepa, P. (2019). FPGA implementation of cost-effective robust Canny edge detection algorithm. Journal of Real-Time Image Processing, 16(4): 957-970. https://doi.org/10.1007/s11554-016-0582-2

[16] Lee, W.Y., Kim, Y.W., Kim, S.Y., Lim, J.Y., Lim, D.H. (2012). Edge detection based on morphological amoebas. The Imaging Science Journal, 60(3): 172-183. https://doi.org/10.1179/1743131X11Y.0000000013

[17] Karakuş, P. (2024). Machine whell edge detection morphological operations. Konya Journal of Engineering Sciences, 12(1): 251-262. https://doi.org/10.36306/konjes.1418523

[18] Thanikkal, J.G., Dubey, A.K., Thomas, M.T. (2023). A novel edge detection method for medicinal plant's leaf features extraction. International Journal of System Assurance Engineering and Management, 14(1): 448-458. https://doi.org/10.1007/s13198-022-01814-y

[19] Yu, F., Zhang, Y., Li, H., Du, C., Liu, L., Jiang, M. (2024). Phase contour enhancement network for clothing parsing. IEEE Transactions on Consumer Electronics, 70(1): 2784-2793. https://doi.org/10.1109/TCE.2024.3377377

[20] Yang, Q., Wu, A., Zheng, W.S. (2019). Person re-identification by contour sketch under moderate clothing change. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43(6): 2029-2046. https://doi.org/10.1109/TPAMI.2019.2960509