A method for digital analysis and inheritance of a traditional embroidery technique
Patent Information
- Application Number
- CN202511579837.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2045-10-31
AI Technical Summary
例如,在一幅广绣花卉图案中,若起针点位于花瓣的明亮中心区域,线头需要额外延伸至花瓣边缘的阴影部分或叶片的纹理密集区,导致机械臂执行路径变得复杂,效率降低,同时可能因引线过多影响刺绣作品的精细度
本发明公开了一种广绣传统技艺数字化解析与传承方法,解决了传统手工刺绣中起针位置选择依赖经验且藏线效果难以量化评估的核心问题。该方法通过分析输入图案的亮暗区域分布和色彩过渡特征,结合广绣传统起针技法中暗部优先起针的传承知识,智能识别符合藏线技法要求的可藏线头位置,并通过评估引线路径长度、针脚密度分布、纹理清晰度影响程度等多维度指标,自动确定最优起针点和完整针法路径。本发明创新性地将传统广绣的起针藏线技艺进行数字化解析和量化建模,实现了从图案分析到针法路径生成的全流程自动化处理,既保持了传统技艺的精髓又提升了刺绣效率和质量稳定性,为广绣等传统手工艺的数字化传承和产业化发展提供了重要技术支撑。
Smart Images

Figure CN121458788B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology, and in particular to a method for the digital analysis and inheritance of traditional Cantonese embroidery techniques. Background Technology
[0002] As an important branch of traditional Chinese embroidery art, Cantonese embroidery carries profound cultural value with its exquisite patterns and unique techniques. Combining Cantonese embroidery techniques with modern robotic arm embroidery systems can improve production efficiency and promote the modernization of traditional crafts. However, in practical applications, how to ensure that the robotic arm adheres to the requirements of traditional techniques while maintaining execution efficiency has become an urgent problem to be solved in the digital inheritance of Cantonese embroidery. Existing digital methods for Cantonese embroidery mainly focus on optimizing the path of the robotic arm, usually using the geometric center of the pattern as the starting point, and reducing the movement distance of the robotic arm and improving embroidery efficiency by selecting the shortest path. This approach seems reasonable, but it ignores the core requirement of Cantonese embroidery, "hiding the needle invisibly," that is, the thread end must be hidden in the dark part of the pattern or in a densely textured area to ensure the beauty of the work and the integrity of the traditional craftsmanship. Simply pursuing the shortest path fails to meet the aesthetic requirements of traditional techniques and limits the practical application effect of digital Cantonese embroidery. In Cantonese embroidery, the choice of the starting point directly affects the hiding effect of the thread end, and the hiding position of the thread end is closely related to the light and dark distribution and texture density of the pattern. Choosing a starting point close to the center of the pattern theoretically shortens the robotic arm's movement path. However, since the central area is usually the bright or smooth part of the pattern, the thread ends cannot be effectively hidden. An additional guide thread path must be used to direct the thread ends to the darker or more textured areas. This not only increases the path length but may also compromise the overall aesthetic appeal of the pattern. For example, in a Cantonese embroidery floral pattern, if the starting point is located in the bright center of the petals, the thread ends need to extend to the shadowed edges of the petals or the textured areas of the leaves, making the robotic arm's execution path more complex and reducing efficiency. Furthermore, excessive guide thread may affect the fineness of the embroidery. Summary of the Invention
[0003] This invention provides a method for the digital analysis and inheritance of traditional Cantonese embroidery techniques, mainly including: Based on the input pattern image, determine the line direction, boundary shape, position coordinates within the pattern area, and color transition areas of the embroidery pattern, and determine the outline of the dark area edge. Identify the stitch density based on the ratio of light to dark area areas, distinguishing between dense and sparse stitch areas. Compare the overlap between the dark area edge outline and the dense stitch area to obtain a list of concealable thread positions that meet the requirements of the Cantonese embroidery concealed thread technique. Analyze the starting positions of the concealable thread positions within the dark area distribution, and extend along the dark area edge outline towards the pattern's starting point to identify the guide lines. In the embroidery pattern preparation area, a candidate list of starting positions is generated; the stitch direction from each starting position in the candidate list to the starting point of the pattern is evaluated, and the total stitch length of the sewing pattern is sorted; based on the sorting of the total stitch length of the sewing pattern, the degree of conformity between each starting position and the hidden stitch technique is evaluated, and the starting point of the sewing pattern is determined; based on the starting point of the sewing pattern, an embroidery stitch path is generated, and the embroidery stitch path is optimized to obtain an optimized stitch path; the optimized stitch path is fed back to the digital embroidery system, the association record between the starting position and the stitch path is recorded, and the technique gaps in the heritage knowledge base are identified and stored.
[0004] Furthermore, the step of determining the line direction, boundary shape, position coordinates within the pattern area, and color transition area of the embroidery pattern based on the input pattern image, and determining the outline of the dark area edges, includes: Edge detection is performed on the pattern image to obtain a set of contour points. The tangent angle is calculated based on the coordinate difference between adjacent points in the set of contour points to determine the distribution of smooth and transition regions, and a spatial topology containing contour line segments is constructed. The pixel color values of the closed regions within the spatial topology are grouped, the color difference between adjacent color block boundaries is calculated, color transition boundaries are marked, and pixels with brightness values higher than the median constitute bright regions, while those lower than the median constitute dark regions. Based on the dark regions and color transition boundaries, the geometric center points and boundary point sets of connected domains within the dark regions are extracted to generate dark edge bands. Line segments that conform to the hidden needle path criterion are selected to generate dark edge contour lines.
[0005] Furthermore, the method of identifying the density of embroidery stitches based on the ratio between the area of light-colored areas and the area of dark-colored areas, distinguishing between densely stitched and sparsely stitched areas, and comparing the overlap between the edge outline of the dark area and the densely stitched area, yields a list of locations where thread ends can be hidden that meet the requirements of the Cantonese embroidery hidden thread technique, including: Determine the actual stitch density value; divide the pattern area into grids, calculate the ratio of the stitch density value in each grid to the actual stitch density value, and mark dense stitch areas and sparse stitch areas; extract the overlapping line segments of the outer boundary line of the dense stitch area and the outline of the dark area, and generate a list of positions where thread ends can be hidden that meet the requirements of the thread hiding technique.
[0006] Furthermore, the analysis identifies the starting positions of the needle in the dark area within the list of hidden thread positions, extending along the outline of the dark area towards the starting point of the pattern, to identify the thread path area and generate a candidate list of starting positions, including: Extract the distance from each position point to the geometric center of the pattern from the list of possible hidden thread ends, filter candidate points close to the center, determine whether the candidate points are located in the dark area, and mark the starting position that meets the dark area priority principle; search for a continuous path along the edge contour of the dark area from the starting position, record the coordinates of the path pixels, and generate the lead thread path area; expand the sampling of the pixels in the lead thread path area to generate a candidate list of starting positions.
[0007] Furthermore, the evaluation of the stitch direction from each starting position in the candidate list to the starting point of the pattern, and the sorting of the total stitch length of the sewn pattern, includes: Based on the stitch direction from each starting position in the candidate list to the starting point of the pattern, the sewing process is simulated, the pattern area is traversed, the pixel coordinate sequence and cumulative path length are recorded, and the total stitch length of the sewing pattern is generated; the color transition points in the pixel coordinate sequence are identified, the angle between the texture direction and the stitch direction at the color transition point is calculated, and the weight of the hiding effect is determined; the total stitch length is adjusted according to the hiding effect weight, and the optimized starting position sequence is generated.
[0008] Furthermore, after generating the list of candidate starting positions, it includes: Traverse the lead-line paths of each position in the candidate list of starting positions, count the number of densely textured areas traversed by the lead-line paths and the number of times the dark edges are turned back; calculate the number of additional pinholes based on the number of turns and assess the degree of damage to texture clarity; calculate the thread end accumulation thickness based on the number of turns and the embroidery thread diameter and assess the impact on surface smoothness; set control parameters based on the degree of damage and the impact on smoothness, eliminate positions that exceed the control parameters, and generate an optimized starting position sequence.
[0009] Furthermore, the process of evaluating the conformity of each starting position with the hidden stitch technique based on the total stitch length of the sewing pattern, and determining the starting point of the sewing pattern, includes: Calculate the median total stitch length and the median lead-in path length; after eliminating positions in the candidate list of starting positions where both the total stitch length and the lead-in path length exceed the median value, select the position with the minimum total stitch length to generate the starting point of the sewing pattern.
[0010] Furthermore, the step of generating an embroidery stitch path based on the starting point of the sewing pattern, and optimizing the embroidery stitch path to obtain an optimized stitch path, includes: Traverse the pattern area from the starting point, count the stitch density value, mark the density transition area, and detect the straight needle compatibility; for the incompatible area, select the binding needle or the sprinkling needle according to the texture characteristics, and update the needle path; identify the dark area in the needle path, optimize the direction angle of the thread end according to the hidden position of the thread end in the dark area, and generate the optimized needle path.
[0011] Furthermore, the optimized stitch path is fed back to the digital embroidery system, recording the association between the starting position and the stitch path, identifying and storing technique gaps in the inherited knowledge base, including: The needlework paths are stored in the digital embroidery system, recording the mapping relationship between the starting position and the needlework path, and recording the lead thread path, needlework type sequence, and hidden thread position coordinates corresponding to each starting point, forming a structured association record; the association record is compared with the heritage knowledge base to identify unrecorded technique parameters and store them in the heritage knowledge base.
[0012] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: This invention discloses a method for the digital analysis and inheritance of traditional Cantonese embroidery techniques, solving the core problems of relying on experience for the selection of the starting stitch position and the difficulty in quantifying and evaluating the effect of concealing the thread in traditional hand embroidery. This method analyzes the distribution of light and dark areas and color transition characteristics of the input pattern, combining the inherited knowledge of prioritizing starting stitches in dark areas in traditional Cantonese embroidery techniques. It intelligently identifies suitable positions for concealing thread ends that meet the requirements of the concealing thread technique, and automatically determines the optimal starting point and complete stitch path by evaluating multiple dimensions such as the length of the lead thread path, the distribution of stitch density, and the degree of influence on texture clarity. This invention innovatively performs digital analysis and quantitative modeling of the traditional Cantonese embroidery's starting and concealing thread techniques, achieving fully automated processing from pattern analysis to stitch path generation. It preserves the essence of traditional techniques while improving embroidery efficiency and quality stability, providing important technical support for the digital inheritance and industrial development of traditional handicrafts such as Cantonese embroidery. Attached Figure Description
[0013] Figure 1 This is a flowchart of a method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to the present invention.
[0014] Figure 2 This is another schematic diagram of a method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0016] like Figure 1-2This embodiment of a method for the digital analysis and inheritance of traditional Cantonese embroidery techniques may specifically include: Step S101: Determine the line direction, boundary shape, position coordinates, and color transition area of the embroidery pattern within the pattern area based on the input pattern image, and determine the outline of the dark edge.
[0017] The system extracts the rule sets for starting and hiding stitch techniques of Cantonese embroidery from the heritage knowledge base. It obtains starting point location data and hiding stitch path data recorded by embroiderers throughout history in floral, bird / animal, and landscape patterns. The system matches the input pattern with the pattern category identifiers in the rule sets to identify the current pattern's category. Based on the matching results, it retrieves the corresponding category's dark-area priority starting stitch criterion and edge hiding stitch path criterion. Canny edge detection is performed on the input pattern image to obtain a pattern contour point set. The tangent angle of each contour segment is calculated using the coordinate difference between adjacent points in the contour point set. The distribution of smooth and transitional regions is determined based on the rate of change of the tangent angle. Points with an angle change rate greater than 45 degrees are selected as boundary shape feature points. A spatial topology containing contour segments and closed regions is constructed using the coordinates of these feature points. Based on the RGB values of pixels in each enclosed region within the spatial topology, K-means clustering is used for color grouping. The color difference within a 10-pixel range on both sides of the boundary of adjacent color blocks is calculated. If the difference is greater than 30, it is marked as a color transition boundary. The brightness values of pixels within each color block are counted. The set of pixels with brightness values higher than the overall median brightness constitutes a bright region, and the set of pixels with brightness values lower than the median brightness constitutes a dark region. Based on the dark regions and color transition boundaries, the geometric center points and boundary point sets of each connected component within the dark region are extracted. A dilation operation is used to obtain the region after expanding the dark region by 3 pixels, and then an erosion operation is used to shrink it back by 2 pixels to obtain the dark edge band. Douglas-Puck polygon fitting is performed on the point set within the dark edge band. According to the dark region priority starting point criterion and the edge hidden needle path criterion, line segments in the dark edge band that meet the hidden needle requirements are selected to obtain the dark edge contour line.
[0018] For example, in one implementation, when extracting Cantonese embroidery technique rules from a heritage knowledge base, the system first reads a database of starting stitch positions recorded by embroiderers throughout history. This database is indexed according to three major pattern categories: floral, bird and animal, and landscape. The starting stitch rules for floral patterns typically require starting from the shadowed edge of the petals, avoiding the bright area of the flower center; for bird and animal patterns, the priority is given to the dark texture boundary of feathers or hair; and for landscape patterns, the starting stitch often begins from the shadowed crevices of rocks or the dark areas of water ripples. Cosine similarity is calculated between the pattern feature vector and the category features in the rule set. When the similarity exceeds 0.75, the pattern is classified as belonging to that category. The system then retrieves the corresponding dark-area priority starting stitch criterion, which includes the minimum distance threshold between the starting point and the dark area, the thread end concealment depth requirement, and the curvature constraint parameters of the lead thread path.
[0019] Specifically, the Canny edge detection process uses a 5×5 Gaussian filter to smooth the input pattern, eliminating image noise before calculating the gradient magnitude and direction. Strong and weak edges are extracted using a dual-threshold method, with the strong edge threshold set to the 70th percentile of the gradient magnitude and the weak edge threshold set to the 30th percentile. The extracted contour point set is sorted according to 8-neighborhood connectivity, forming an ordered contour chain. For each point Pi in the contour chain, the tangent direction is obtained by calculating the angle between the vectors from Pi-1 to Pi+1. When the cumulative change in the tangent angle of five adjacent points exceeds 45 degrees, the point is marked as a turning point. These feature points divide the pattern contour into multiple line segments, and each line segment and the region it encloses together constitute the basic unit of the spatial topology. In the color clustering stage, the initial number of cluster centers K in the K-means algorithm is determined by the number of peak values in the color histogram of the region inside the contour, typically between 3 and 8. During the algorithm iteration, each pixel is classified according to its RGB value and the Euclidean distance to each cluster center. The iteration terminates when the distance the cluster center moves is less than 0.01 or the number of iterations reaches 100. The color difference is calculated using the CIELab color space. First, the RGB values are converted to Lab values. Then, the average Lab value of 10 pixels on each side of the boundary of adjacent color blocks is calculated. The color difference is calculated using the DeltaE formula. When DeltaE is greater than 30, it is considered a significant color transition boundary.
[0020] For example, when processing a peony embroidery pattern, the brightness value of the pink area at the center of the petals is 180, while the brightness value of the dark red area at the edge of the petals is 95, and the overall median brightness is 120. The system marks all pixels with brightness values below 120 as dark areas. These areas are mainly distributed in the folds of the petals, the shadows of overlapping petals, and the dark side of the leaves. Through connected component analysis, three main dark connected components are identified, corresponding to the shadow of the left petal, the folds of the right petal, and the dark side of the bottom leaves, respectively.
[0021] It should be noted that the dilation operation in the morphological operations uses a 3×3 structuring element to expand each boundary point of the dark area outward by 3 pixels. This ensures that the edge band contains enough buffer area for hiding the line ends. The subsequent erosion operation uses a slightly smaller structuring element to shrink back by 2 pixels, retaining the edge band width of 1 pixel outward expansion. This avoids the edge band being too wide and affecting the pattern's aesthetics, while also ensuring sufficient space to hide the lines.
[0022] Preferably, the Douglas-Peucker algorithm sets the tolerance parameter to 2 pixels when fitting the contour of dark edges. This parameter determines the degree of fit between the fitted polygon and the original contour. The algorithm first connects the start and end points of the contour to form a baseline, finds the point farthest from the baseline, and if the distance from this point to the baseline is greater than the tolerance, then this point is added to the polygon as a new vertex, and the two sub-segments are processed recursively. The number of vertices in the fitted polygon is usually one-tenth of the number of points in the original contour, which greatly simplifies the subsequent path planning calculation.
[0023] In one embodiment, when processing embroidery patterns with complex textures, the system also evaluates the texture density within the dark edge band. By calculating the gray-level co-occurrence matrix within a 5×5 window, two texture features—contrast and entropy—are extracted. Regions with a contrast greater than 50 and an entropy greater than 3.5 are identified as texture-dense areas. The intersection of these texture-dense areas and the dark edges becomes a preferred location for concealing threads, as the dense texture better masks thread ends.
[0024] Understandably, the edge-hidden needle path rule stipulates that the lead-in path from the starting point of the needle to the main body of the pattern must travel along the edge of the dark area, and the radius of curvature of the path must be no less than 5 pixels to avoid sharp turns that would cause the needle to be exposed. The system uses the A* path search algorithm to find the shortest path that satisfies the curvature constraint within the edge band of the dark area. The cost function of the path comprehensively considers the path length, the depth of the dark area traversed, and the consistency with the texture direction.
[0025] Step S102: Identify the density of embroidery stitches based on the ratio between the area of the light-colored area and the area of the dark-colored area, distinguish between densely stitched areas and sparsely stitched areas, compare the overlap between the dark edge outline and the densely stitched area, and obtain a list of positions where thread ends can be hidden that meet the requirements of the Cantonese embroidery hidden thread technique.
[0026] The ratio of the area of the light-colored region to the area of the dark-colored region is calculated. If the ratio is greater than a first preset threshold, it is determined to be a light-toned pattern; if it is less than a second preset threshold, it is determined to be a dark-toned pattern; and if it is in between, it is a mid-tone pattern. A basic pin density coefficient is determined based on the pattern tonality. The coefficient for light-toned patterns is higher than that for mid-tone patterns, and the coefficient for dark-toned patterns is lower than that for mid-tone patterns. The actual pin density value is obtained by multiplying the basic pin density coefficient by the length of the outline within a unit area. The pattern area is divided into grids based on the actual pin density value. The ratio of the pin density value within each grid to the actual pin density value is calculated. Grids with a ratio exceeding a preset upper limit are marked as dense pin regions, and those with a ratio below a preset lower limit are marked as sparse pin regions. The outer boundary line of the dense pin region and the edge outline of the dark area are extracted, and the distance between them is calculated point by point to obtain a set of line segments whose distance between the two lines is less than a preset pixel width. For each line segment in the line segment set, a concealment suitability assessment is performed. The gray-level gradient direction of the adjacent pixels at the location of the line segment is detected as the texture direction. The angle between the texture direction and the preset direction of the line end is calculated. Line segments with an angle less than a preset angle threshold are added to the list of concealable line end locations. At the same time, the distance value from each location to the center of the dark area and the stitch density value of the surrounding grid are recorded to obtain a list of concealable line end locations that meet the requirements of the Cantonese embroidery concealment technique.
[0027] For example, in one implementation, the relationship between the light / dark ratio and stitch density is determined through pattern tonality classification. When the ratio of the area of light-colored areas to the area of dark-colored areas exceeds 3.5, the pattern is classified as a light-toned pattern. This type of pattern typically appears in embroidery depicting bright petals of flowers or white bird feathers, requiring a higher stitch density to achieve a delicate sheen. Accordingly, the base stitch density coefficient is set to 1.3 times the standard value. Dark-toned patterns have a ratio below 0.4, often seen in depicting shadows on rocks or dark leaves; the stitches can be relatively sparse, and the coefficient is reduced to 0.7 times the standard value.
[0028] Specifically, the actual stitch density value is obtained by multiplying the base stitch density coefficient by the outline length per unit area. The outline length per unit area is calculated by dividing the pattern area into 10×10 pixel cells, counting the number of outline pixels in each cell, and then multiplying by the pixel spacing. In the folded area of the peony petals, the outline is densely distributed, with an outline length of up to 15 pixels per unit area. Multiplying this by a 1.3x coefficient for the highlight pattern yields a stitch density of approximately 20 stitches per square centimeter required for this area.
[0029] It should be noted that the mesh division adopts an adaptive mesh size, dynamically adjusted according to the actual stitch density. High-density areas use a fine 5×5 pixel mesh, while low-density areas use a coarse 15×15 pixel mesh. Within each mesh, the local stitch density is calculated by statistically analyzing the number of pre-set stitch template matches. When the ratio of local density to overall density exceeds 1.5, it is marked as a dense area; when it is below 0.5, it is marked as a sparse area. During the thread concealment suitability evaluation, the texture direction is determined by calculating the principal direction of the pixel grayscale gradient within a 3×3 window. The Sobel operator is used to calculate the gradient components in the horizontal and vertical directions, and the gradient direction angle is obtained through the arctangent function. The preset direction of the thread end is set according to the traditional Cantonese embroidery technique to be consistent with the tangent direction of the outline line. When the angle between the two is less than 30 degrees, the position is considered suitable for thread concealment and is recorded in the list of suitable thread end positions.
[0030] For example, when processing the vein texture area, the texture is distributed radially, forming multiple intersections with the dark edge outline. The included angle at these intersections is usually between 15 and 25 degrees, which is an ideal position for hiding the vein.
[0031] Step S103: Based on the traditional knowledge of prioritizing starting stitches in the dark area in Cantonese embroidery, analyze the starting positions in the dark area distribution of the list of positions where thread ends can be hidden. Extend from the starting position along the outline of the dark area towards the starting point of the first pattern to identify the thread guide path area that can be used to hide the thread ends, expand the candidate starting points of the thread guide path area, and determine the candidate list of starting positions.
[0032] Extract the Euclidean distance from each location point to the geometric center of the pattern from the list of possible hidden thread ends. Filter points with a distance less than half the radius of the pattern's circumcircle as candidate points closer to the center. Perform spatial overlap judgment on these candidate points and the dark area. If a candidate point is located inside or on the boundary of the dark area, it is marked as a starting position conforming to the dark area priority principle. Starting from the starting position, search for a continuous path along the dark edge contour towards the starting boundary point of the main embroidery area of the pattern. Record the coordinates and grayscale value of each pixel on the path by tracing the connectivity of adjacent pixels. Stop the search when the path reaches the starting boundary point or the dark edge breaks. The set of continuous path pixels constitutes the lead thread path area. For each pixel in the lead thread path area, expand outwards to adjacent pixels, with an expansion distance twice the standard embroidery thread diameter. Sample new candidate points at preset intervals within the expanded area. Calculate the vertical distance from each candidate point to the center line of the original lead thread path. Check whether there is a continuous dark pixel path from the candidate point to the starting boundary point. Candidate points with a distance less than a threshold and a continuous path are added to the starting position candidate list.
[0033] For example, in one implementation, when selecting a starting position near the center from a list of possible concealable thread ends, the Euclidean distance from each position to the geometric center of the pattern is first calculated. For a circular floral pattern with a diameter of 80 mm, the geometric center is located at the origin, and the circumcircle radius is 40 mm. When a possible concealable thread end position is less than 20 mm from the center, the position is considered close to the central area. Subsequently, by overlaying a mask image of the dark area, it is determined whether the candidate points fall within the dark area. Only points that simultaneously meet both the distance condition and the dark area condition are marked as starting positions conforming to traditional techniques.
[0034] Specifically, the search process for the guide thread path begins at the starting point and traces pixel by pixel along the contour line of the dark area's edge. During tracing, the system checks the eight neighboring pixels of the current pixel and selects the next pixel that belongs to both the dark edge and can continue the path direction. Each tracked pixel records its coordinates and corresponding grayscale value, which is used to subsequently determine the hiding effect of that path point. When the tracing path reaches the starting boundary point of the embroidered area of the main pattern, it indicates that a complete guide thread path has been found; if a break in the dark edge is encountered, the search terminates at the break point.
[0035] It should be noted that the expansion of the lead path region employs the principle of morphological dilation, but it is not a simple binary image dilation. For each pixel on the path, it is expanded by two pixels in each of the four directions (up, down, left, and right). This width corresponds to twice the diameter of a standard embroidery thread (size 6), approximately 0.8 mm. After expansion, a strip-shaped region is formed, and a new candidate point is sampled every 5 pixels within this region.
[0036] Preferably, the selection of candidate points requires meeting two conditions simultaneously: first, the vertical distance to the center line of the original lead path does not exceed a preset threshold, typically 3 pixels; second, there must be a continuous dark pixel path from the candidate point to the starting boundary point. Path continuity is detected using a depth-first search algorithm; a path is considered continuous only if the search can reach the target point within the dark region. Candidate points that meet both conditions are added to the list of candidate needle starting positions.
[0037] Step S104: Evaluate the stitching direction from each candidate starting position in the candidate starting position list to the starting point of the pattern, identify the stitching length from the dark edge outline of different starting positions to the first starting point of the pattern, the total stitching length from the start to the end of the sewing pattern, and sort the total stitching length.
[0038] For each position in the candidate list of starting positions, calculate the vector angle from the starting point of the pattern boundary. Obtain the angle deviation value between this vector and the preset standard stitch direction. When the deviation value is less than a first preset threshold, mark the direction feature value of the starting position as positive; when it is greater than the threshold, mark it as negative. Construct lead-line path segments using sampling points on the dark edge contour line. Accumulate the lengths of each segment to obtain the total length of the lead-line path. Simulate the sewing process starting from the end point of the lead-line path. Traverse all areas to be sewn according to the pattern contour order, recording the pixel coordinate sequence and cumulative path length. When the traversal of all pattern areas is completed and the area returns to the vicinity of the end point of the lead-line path, obtain the total stitch length of the sewn pattern. Adjust the total length of the lead-line path according to the direction feature value and add it to the total stitch length to obtain the complete stitch length value. The color value difference between two adjacent points in the pixel coordinate sequence is identified. If the difference exceeds a preset color difference threshold, it is marked as a color transition point. The local texture direction and stitch direction at the color transition point are extracted, and the angle between them is calculated. If the angle is less than a second preset threshold and the transition point is located in a dark area, it is assigned a high hiding effect weight; otherwise, it is assigned a low hiding effect weight. The complete stitch length value of each stitch starting position is weighted and adjusted according to the hiding effect weight. The stitch length of high-weight positions is multiplied by a priority coefficient less than 1, and the stitch length of low-weight positions is multiplied by a penalty coefficient greater than 1. The candidate list of stitch starting positions is sorted from smallest to largest according to the adjusted stitch length value to obtain the optimized stitch starting position sequence.
[0039] For example, in one implementation, the vector angle calculation from the starting point of the stitch to the starting point of the pattern boundary is based on the traditional Cantonese embroidery principle of "following the pattern." The starting point of the pattern boundary is usually chosen at the leftmost or topmost end of the pattern outline, which is a conventional starting position in the Cantonese embroidery tradition. A vector is drawn from the starting point to this starting point, and the angle between the vector and the horizontal axis is calculated as the actual direction angle. The standard stitch direction is set at a 45-degree angle for floral patterns, a 30-degree angle for bird and animal patterns, and dynamically adjusted according to the mountain's direction in landscape patterns. When the deviation of the actual direction angle from the standard direction is less than 15 degrees, the direction characteristic value is marked as +1, indicating that it follows the traditional direction; when the deviation is between 15 and 45 degrees, it is marked as 0, indicating a neutral direction; when it exceeds 45 degrees, it is marked as -1, indicating reverse stitching.
[0040] Specifically, the construction of the lead-line path involves the discretization of the dark edge contour line. A point is sampled every 5 pixels along the dark edge contour line, forming straight line segments between adjacent sampling points. The length of these segments is calculated using the Euclidean distance formula between the two points. In a peony embroidery pattern, the lead-line path from the starting point of the needle in the petal's shadow to the starting point of the petal's edge may contain 8 to 12 broken line segments, each with a length between 3 and 8 pixels. The total length of the lead-line path after accumulation is typically in the range of 50 to 80 pixels. This length value also needs to be adjusted according to the direction feature value. The path length for positive feature values remains unchanged, the path length for zero-value feature values is multiplied by an adjustment factor of 1.1, and the path length for negative feature values is multiplied by an adjustment factor of 1.3, reflecting the advantage of forward-direction stitching in traditional techniques.
[0041] It should be noted that the simulation of the sewing process follows the "following the edge" rule of Cantonese embroidery, that is, embroidering each area sequentially along the outline of the pattern in a clockwise or counterclockwise direction. The simulation begins from the end of the lead thread path, which is the position of the first stitch in the actual embroidery. Following the preset outline traversal order, the coordinates of each pixel to be sewn are recorded, forming an ordered coordinate sequence. During the traversal, the distance between two adjacent pixels is accumulated to form the path length. After traversing all pattern areas, the last sewing point usually returns to within 10 pixels of the end of the lead thread path; the accumulated path length at this point is the total sewing thread length. For a medium-complexity petal pattern containing 500 sewing points, the total sewing thread length can reach 800 to 1200 pixels.
[0042] Preferably, color transition points are identified by calculating the color space distance between adjacent pixels. In the coordinate sequence, the RGB value of each pixel is extracted, converted to the HSV color space, and the hue difference between adjacent points is calculated. A color transition point is identified when the hue difference exceeds 30 degrees or the saturation difference exceeds 0.3. These transition points correspond to thread changing positions in Cantonese embroidery and are key nodes where thread ends are easily exposed.
[0043] For example, texture features within a 5×5 window centered on the color transition point are extracted. The dominant texture direction is determined by calculating the gradient direction histogram of pixel grayscale within the window. Simultaneously, the stitch direction is determined by the direction of the line connecting the three pixels before and after the transition point. The angle between the two directions reflects the degree of coordination between the stitch and the texture. When the angle is less than 20 degrees, it indicates that the stitch follows the texture, which is beneficial for hiding the thread ends. In this case, if the transition point is located in a dark area, a weight value of 2.0 is assigned; if the transition point is in a bright area, the weight is reduced to 1.5. When the angle is between 20 and 60 degrees, the weights are adjusted to 1.2 and 0.8 respectively. When the angle exceeds 60 degrees, it indicates that the stitch contradicts the texture, and even in a dark area, the weight is only 0.5.
[0044] Understandably, the weighting coefficients are set according to the basic principle of Cantonese embroidery: "hiding the thread in the shadows and following the grain." A high-weight position means that the starting point can better hide the thread end, so it should be given priority in the sorting. By multiplying the complete stitch length by a priority coefficient between 0.7 and 0.9, these positions receive a higher ranking in the sorting.
[0045] For example, when processing a red peony embroidery pattern, five potential starting positions were identified. The first position is located in the shadow at the lower left corner of the petal, with a lead-line path length of 60 pixels and a total sewing length of 900 pixels. It has three color transition points, all in the dark area with an angle less than 20 degrees. The weighted length is (total sewing length + lead-line path length) × overall weight, in pixels. The second position is on the right edge of the petal. Although the lead-line path is only 40 pixels, it has two transition points in the bright area with an angle exceeding 45 degrees. The weighted length is (total sewing length + lead-line path length) × overall weight, in pixels. Overall weight = 1.0 × (1 + α) Highlight penalty +β Angle penalties are pre-set: α = 0.15, β = 0.1. For the first position, all three transition points are in the dark area with a light area penalty of 0; for the second position, both transition points are in the bright area with a light area penalty of 2; for the first position, the angle penalty is 0 if the angle is less than 20 degrees (smooth transition); and for the second position, the angle penalty is 1 if the angle exceeds 45 degrees (sharp turn). This weighted sorting mechanism selects the first position as the starting point, achieving a balance between traditional technique requirements and path efficiency. Furthermore, the sorted starting position sequence provides a clear priority selection scheme for the robotic arm's path planning, ensuring optimized embroidery efficiency while meeting the requirements of traditional Cantonese embroidery techniques.
[0046] Obtain the lead wire path from each candidate position to the dark area from the list of candidate starting positions. Analyze the number of additional pinholes generated in the textured dense area and the thickness of the lead wire accumulation in the dark area after the number of lead wire folds increases. Evaluate the degree of damage of the number of additional pinholes to the clarity of the local pattern edge texture. Evaluate the degree of influence of the lead wire accumulation thickness on the surface smoothness of the local pattern texture. Determine the upper limit of the number of lead wires passing through the textured dense area and the allowable range of the number of lead wire folds.
[0047] The lead path is iterated through the candidate list of starting positions, identifying the texture region type of each pixel traversed by the path. The grayscale variance within the window surrounding each pixel is calculated as the texture density index. When the texture density index of multiple consecutive pixels exceeds a preset threshold, it is marked as a dense texture region. The total number of dense texture regions traversed by the lead path is counted, and the direction change of the lead path is tracked. When the path direction changes continuously beyond a preset angle threshold and the position is at the edge of a dark area, it is recorded as a reversal. The number of reversals is accumulated. Based on the number of reversals, the additional pinholes generated at each reversal point are calculated. Each reversal generates multiple additional pinholes in dense texture regions and fewer additional pinholes in non-dense regions. The ratio of the number of additional pinholes to the original texture line density of the region is calculated. If the ratio exceeds a first preset threshold, it is determined to have caused serious damage to texture clarity; if it is between the first and second preset thresholds, it is considered moderate damage; and if it is less than the second preset threshold, it is considered slight damage. The build-up thickness is calculated using the number of back-and-forth turns and the standard embroidery thread diameter. The local build-up height is obtained by multiplying the overlapping thread end produced by each back-and-forth turn by the thread diameter. The build-up heights from multiple back-and-forth turns are summed to form the total build-up thickness value. If the total build-up thickness value exceeds a preset flatness threshold, it is determined to severely affect surface flatness. Control parameters are determined based on a comprehensive evaluation of the degree of damage and the degree of impact on flatness. Based on the control parameters, an upper limit is set for the number of times the lead thread passes through densely textured areas, and an allowable range is set for the number of lead thread back-and-forth turns. When the lead thread path at a candidate position exceeds the upper limit or allowable range, the position is removed from the candidate list of starting positions, resulting in a list of selected starting positions that meet the texture protection requirements.
[0048] For example, in one implementation, the texture density index is calculated based on the gray-level distribution characteristics of local image regions. For each pixel on the lead-line path, the system extracts a 7×7 pixel window centered on that point and calculates the variance of the gray-level values of all pixels within the window. The gray-level variance reflects the texture complexity of a local region; a larger variance value indicates more dramatic changes in brightness and a denser texture in that region. In Cantonese embroidery patterns, the folds of petals, the intersections of leaf veins, and the details of bird feathers typically have higher gray-level variance values. When the gray-level variance values of eight or more consecutive pixels exceed a preset threshold of 50, these consecutive points are marked as a texture-dense region. The entire lead-line path is traversed, and all texture-dense regions traversed by the path are counted, recording the start and end positions of each region.
[0049] Specifically, tracking changes in the direction of the lead thread path is achieved by calculating the angle difference between adjacent path segments. The lead thread path is divided into segments of 10 pixels each, and the direction angle of each segment is calculated. When the direction angle difference between two consecutive segments exceeds 75 degrees, and the turning point is within 5 pixels of the edge of the dark area, it is recorded as a reversal. In Cantonese embroidery, reversals typically occur in the recesses of the pattern outline or in narrow passages in dark areas, where the lead thread needs to detour to remain within the dark area. The mechanism by which reversals generate additional needle holes is closely related to the physical characteristics of the embroidery process. In normal straight-line sewing, needle holes are evenly distributed along the line direction, and the fabric fibers between adjacent needle holes can support each other. However, at reversal points, because the thread end needs to change direction, the needle must pierce the fabric multiple times in the same local area. Specifically, each reversal will generate 3 to 4 additional needle holes in densely textured areas because the dense areas already have many original texture lines, and additional piercing points can easily damage the original texture structure. In less dense areas, due to the relatively flat base fabric, only 1 to 2 additional pinholes are generated with each fold. The degree of damage is assessed by calculating the ratio of the number of additional pinholes to the original texture line density in that area. The original texture line density is obtained through an edge detection algorithm, which counts the number of edge pixels per unit area.
[0050] Preferably, the calculation of the thickness of the embroidery thread takes into account the physical properties of the thread and the way the thread ends are handled when folding back. Standard Cantonese embroidery uses No. 6 embroidery thread, with a diameter of approximately 0.4 mm. At the folding point, the thread end needs to be knotted and secured on the back of the base fabric. Each folding back will create an overlap segment at that point with a length of approximately twice the thread diameter, i.e., an additional thickness of 0.8 mm. When multiple folding backs occur in the same local area, these overlap segments will superimpose on each other.
[0051] For example, in a dark passage containing three folds, the total build-up thickness can reach 2.4 mm. Comparing this build-up thickness to the standard base fabric thickness, which is about 0.8 mm for cotton base fabric commonly used in Cantonese embroidery, when the build-up thickness exceeds 40% of the base fabric thickness, i.e., 0.32 mm, it will cause obvious bulges on the surface of the embroidery, affecting the overall smoothness.
[0052] For example, when processing a plum blossom pattern, the guide thread path at a certain starting point needs to pass through a densely textured area formed by the folds of two petals, and there are two backspinnings at the corner of the flower branch. The first backspinning is located in the densely textured area at the edge of the petals, creating 4 additional pinholes compared to the original 12 textured lines in that area; the second backspinning is in the relatively smooth flower branch area, creating 2 additional pinholes. The cumulative thickness of the two backspinnings reaches 1.6 mm, more than twice the thickness of the base fabric, severely affecting the surface smoothness.
[0053] Understandably, the determination of control parameters is based on a comprehensive assessment of the degree of damage and the impact on surface smoothness. A weighted summation method is used, with the degree of damage to texture clarity normalized to 0-1 and assigned a weight of 0.6, and the impact on surface smoothness normalized to 0-1 and assigned a weight of 0.4. When the comprehensive assessment value exceeds 0.5, the guide thread path is considered to have an unacceptable impact on the embroidery quality. Based on statistical analysis of a large number of Cantonese embroidery works, the upper limit for the number of densely textured areas traversed by the guide thread is set to two areas. This maintains the concealment of the thread ends while avoiding excessive damage to the original texture.
[0054] For example, the allowable number of lead-thread backspins is set to no more than once. This limitation is mainly due to the fact that multiple backspins not only create excessive additional needle holes but also cause thread tangling on the back of the base fabric, affecting the overall quality of the embroidery. In practical applications, each starting position in the candidate list is evaluated, and positions exceeding the control limit or allowable range are marked as unqualified and eliminated. The selected starting positions not only meet the requirements of traditional techniques but also ensure the fineness and flatness of the embroidery. This refined evaluation mechanism allows the robotic arm embroidery system to simulate the decision-making process of a skilled embroiderer and find the ideal starting position in complex pattern structures.
[0055] Step S105: Evaluate the degree of conformity between each starting position and the hidden stitch technique based on the total stitch length, and determine the starting point of the sewing pattern.
[0056] The median of the sorted numerical sequence is used as the median of the total stitch length. Simultaneously, the leader length from the starting point to the beginning of the pattern boundary is extracted for each position. These leader lengths are sorted separately, and their medians are calculated. This yields two evaluation benchmarks: the median of the total stitch length and the median of the leader length. The sorted starting positions are iterated. If the total stitch length of a position is greater than both the median and the median leader length, the path at that position is deemed too long and inefficient. This position is removed from the selection list, and the remaining positions are reordered according to their total stitch length. The position with the smallest total stitch length is selected from the reordered list as a candidate starting point. If multiple positions have the same minimum stitch length, the ratio of the number of pixels in the dark area traversed by the leader path to the total number of pixels in the leader path is calculated. The position with the highest ratio is selected as the starting point for sewing the pattern.
[0057] For example, in one implementation, the median is calculated using standard statistical methods. The total stitch length values for all positions in the starting stitch position list are extracted to form a numerical sequence, which is then arranged in ascending order. If the sequence contains an odd number of elements, the value at the middle position is taken as the median; if it contains an even number of elements, the average of the two middle values is taken.
[0058] For example, a list containing 7 lead-in positions with total trace lengths of 680, 720, 750, 820, 890, 950, and 1100 pixels has a median of 820 pixels after sorting. The same method is applied to calculate the median value of the lead length.
[0059] Specifically, the dual-condition judgment mechanism is designed based on the principles of "short thread priority" and "straight to the point is best" in Cantonese embroidery techniques. When the total thread length at a starting point exceeds the median value, it indicates that the overall path at that point is too long; simultaneously, if its lead thread length also exceeds the median value, it means that the transition path from the starting point to the actual embroidery starting position is also too long. This double excess is considered wasteful of thread and inefficient in Cantonese embroidery. Only positions that meet both conditions are eliminated; positions with one criterion exceeding the standard but the other performing well can still be retained, reflecting the balance of the evaluation. When there are multiple candidate positions with the same minimum thread length, the overlap ratio becomes the decisive factor. The lead thread path is checked pixel by pixel, and the number of pixels located in the dark area is counted. This number is divided by the total number of pixels in the lead thread path to obtain the overlap ratio. The higher the ratio, the more the lead thread path is hidden in the dark area, which better meets the requirement of concealed thread.
[0060] Preferably, in a practical application of a chrysanthemum embroidery pattern, after screening, three candidate positions remain, with two positions having a total stitch length of 650 pixels each. The first position has 45 pixels in the dark area as its lead-line path, totaling 60 pixels in length, with an overlap ratio of 0.75; the second position has 35 pixels in the dark area as its lead-line path, totaling 55 pixels in length, with an overlap ratio of 0.64. Choosing the first position as the starting point achieves a balance between efficiency and the requirements of traditional techniques.
[0061] For example, this screening mechanism ensures that the selected starting point not only has a reasonable path length, but also makes the most of the dark areas to hide the thread ends, which is in line with the traditional requirement of Cantonese embroidery to "hide the needle invisibly".
[0062] Step S106: Generate a complete embroidery stitch path in the stitch path generation module based on the starting point, and determine the optimized stitch path.
[0063] The initial stitch path is constructed starting from the starting point. Each area to be sewn in the pattern is traversed, and the number of stitches per unit area is counted as the stitch density value. The difference in density values between adjacent areas is calculated. When the difference exceeds a preset threshold, it is marked as a density transition area. Within the transition area, the compatibility of straight stitches with the pattern texture is checked. If the angle between the straight stitch direction and the texture direction is greater than a preset angle, the straight stitch is deemed unsuitable. For unsuitable areas, an alternative stitch is selected based on texture characteristics. When the texture is radially distributed, it is converted to a binding stitch; when the texture is scattered, it is converted to a sprinkling stitch. The stitch conversion is completed by adjusting the start and end points of the stitches and the stitch spacing parameters. The converted stitch parameters are then updated to the corresponding positions in the initial stitch path. Identify the locations of the dark areas traversed by the updated stitch path. Within each dark area, locate the intersections of the base fabric textures or the gaps between parallel textures as hiding positions for the thread ends. Select a hiding method based on the relative relationship between the hiding position and the base fabric textures: if located at a texture intersection, use the base fabric to pass the thread end through the bottom layer; if located between parallel textures, use the overlocking method to tuck the thread end under the texture; if located in a sparse texture area, use the interlacing method to weave through the textures. Adjust the direction angle of the thread end at the hiding position according to the selected hiding method. Add a backstitch before and after the hiding position to secure the thread end. Integrate the adjusted direction angle and backstitch positions into the stitch path to determine the optimized stitch path.
[0064] For example, in one implementation, the stitch density is statistically analyzed using a gridded analysis method. The pattern area is divided into 5×5 mm grid cells, and the number of stitches within each grid is counted. In floral embroidery, the stitch density in the central area of the petals is typically 16-20 stitches per square centimeter, while the density decreases to 8-12 stitches in the gradient area at the edge of the petals. When the density difference between adjacent grids exceeds 4 stitches per square centimeter, the boundary between these two grids is marked as a density transition zone. This transition zone often appears in Cantonese embroidery works at the junction of petals and stamens, and at the junction of the main vein and leaf tissue of leaves, and is a key area for stitch transitions.
[0065] Specifically, the suitability of straight needles is tested by analyzing the relationship between the needle direction and the local texture direction. The main texture direction in the transition area is extracted and statistically obtained through gradient direction histogram. When the angle between the standard vertical direction of the straight needle and the main texture direction exceeds 60 degrees, the straight needle will disrupt the natural flow of the texture, creating a visually harsh feeling. In the radial texture of plum blossom petals, straight needles are suitable for the area from the center of the flower outwards, while the arc-shaped texture at the edge of the petals is not suitable and requires needle conversion. The binding stitch is a traditional needlework technique used in Cantonese embroidery to handle radial textures. The characteristic of this needlework is that the main lines of the texture are first outlined with long needles, and then short needles are used to bind between the long needles to form a bundle-like effect. When performing the binding stitch, the main needle is first set along the center line of the radial texture, with a length of 80% of the texture length. Then, a binding point is set every 2 mm on both sides of the main needle, with the length of the binding needle being 1.5 times the width of the main needle. This cross binding forms a stable radial texture. The scattered needle is suitable for scattered textures, such as the dotted decorations in the stamen part of the flower. The characteristic of the sprinkled needles is that the needles are irregularly distributed, with the length of each needle varying randomly between 2 and 5 millimeters, and the spacing between the needles also showing a random distribution of 1 to 3 millimeters, creating a natural scattered effect.
[0066] Preferably, the identification of the thread end hiding location relies on the analysis of the backing fabric's texture. A magnifying glass effect is used to simulate the interlacing points of the warp and weft threads in the backing fabric. In cotton backing fabric, the intersections of warp and weft threads form natural depressions, which become ideal hiding locations for thread ends. Specifically, the embroidery needle is inserted from the back of the backing fabric, passing a warp or weft thread below the intersection, and then exiting from an adjacent intersection. The thread end is naturally held in place by the backing fabric fibers. This method is suitable for handling thicker thread ends and can withstand greater tensile force.
[0067] For example, the quilting method is mainly applied to areas with parallel textures, such as between the parallel veins of a leaf. During the operation, two parallel texture lines are identified, the thread end is passed under one of these lines, and then secured with the upper layer of embroidery thread. The tightness of the quilting needs to be controlled; too tight will deform the texture, while too loose will not effectively hide the thread end. By calculating the radius of curvature of the texture line, a tight quilting method is used when the radius of curvature is greater than 10 mm, and a loose quilting method is used when it is less than 10 mm, ensuring the natural shape of the texture. The interlacing method is used to handle the hiding of thread ends in areas with sparse textures. These areas typically appear in the background of a pattern or large areas of monochrome. The interlacing operation involves zigzagging between sparse stitches, crossing 2-3 existing embroidery threads each time to create an interlacing effect. When calculating the interlacing path, ensure that the spacing between each interlacing point is maintained at 4-6 mm to avoid local protrusions caused by overly dense interlacing.
[0068] Understandably, backstitches play a crucial role in securing the thread end. A backstitch is essentially a reverse stitch on top of the original stitch, creating a double securing effect. A backstitch placed before the concealed position prevents the thread from coming loose during subsequent embroidery; a backstitch after the concealed position locks in the concealment, preventing the thread from slipping out. The backstitch length is set to 60% of the original stitch length, ensuring both strong securing without compromising the finesse of the design due to excessive length.
[0069] For example, when embroidering a peony flower, straight stitches are used for the petals, transitioning to stitches in the folds of the petals, and stamen stitches are used. Thread ends are hidden in the shadows of the petals by using the base fabric, quilting is used in the leaf areas, and interlacing is used in the background areas. Through this comprehensive application of multiple stitches and concealment techniques, the final stitch path maintains embroidery efficiency while perfectly showcasing the traditional characteristics of Cantonese embroidery. Furthermore, the path integration process unifies all adjusted parameters into a complete stitch sequence, including the coordinates of each stitch, stitch type, and thread end handling, forming an optimized stitch path that the robotic arm can directly execute.
[0070] Step S107: Feed the optimized needlework path back to the digital embroidery system to record the association between the starting position and the needlework path, identify the gaps in the traditional starting and hidden needlework techniques of Cantonese embroidery in the inheritance knowledge base, and store them in the inheritance knowledge base to realize the digital analysis and inheritance of traditional Cantonese embroidery techniques.
[0071] The optimized needlework paths are input into the digital embroidery system to establish a mapping relationship between the starting needle position coordinates and the complete needlework path sequence. The system records the lead thread path, needlework type sequence, and hidden thread position coordinates corresponding to each starting point, forming a structured association record stored in the system database. The starting needle position coordinates and the boundary coordinates of the dark area are extracted from these association records. The minimum distance from the starting point to the dark area is calculated; if the distance is zero, it is considered a complete overlap. The overlap rate is obtained by statistically analyzing the overlap of all records. Simultaneously, the direction sequence of the needlework path and the pattern line direction sequence are extracted, and the degree of agreement is determined by comparing the average difference of the direction angles of the two sequences point by point. The association records are compared with existing technique rules in the heritage knowledge base to identify unrecorded starting needle position types and hidden needle path patterns. The newly identified technique parameters are stored as supplementary entries under the corresponding category in the heritage knowledge base. Different application modes are set according to the overlap rate and degree of agreement values. Records with an overlap rate higher than a preset threshold are configured as an auxiliary mode for beginners to learn, while records with a degree of agreement higher than a preset threshold are configured as a creative mode for creators, realizing the digital analysis and inheritance of the traditional Cantonese embroidery technique.
[0072] For example, in one implementation, the associated records are established using a key-value pair data structure. Each starting position is assigned a unique identifier, which serves as the primary key and is associated with the complete stitch path data. The stitch path data contains multiple subfields: the lead thread path is stored as a sequence of coordinate points, with each coordinate point recording its horizontal and vertical coordinate values; the stitch type sequence records the name of the stitch used for each segment of the path, such as straight stitch, tufted stitch, or split stitch; and the thread end hiding position records the specific coordinates and the hiding method used. This structured data is stored in a tabular format in the system database for easy retrieval and access.
[0073] Specifically, the overlap rate is calculated using geometric distance determination. The coordinates of the starting point are extracted and their spatial relationship with the boundary polygon of the dark area is determined. If the starting point is inside the polygon or on its boundary, the distance is zero, and it is considered a complete overlap. If it is outside, the perpendicular distance from the point to the nearest edge of the polygon is calculated. All starting point records are counted, and the number of complete overlaps is divided by the total number to obtain the overlap rate. The matching degree is calculated by extracting the tangent direction of each sampling point on the stitch path, forming a direction angle sequence. This sequence is compared point-by-point with the direction angle sequence of the pattern lines at the corresponding positions, and the average of the angle differences is calculated. The smaller the difference, the higher the matching degree. Technique rule recognition is achieved through pattern matching. The type of the starting point of a new record is compared with existing classifications in the knowledge base. If a feature combination of a starting point does not appear in the existing classifications, it is identified as a new technique type.
[0074] For example, starting the stitch at a specific point where the petal folds meet the flower stem might be an innovative approach not recorded in traditional techniques. The application mode configuration is based on a threshold judgment of the evaluation results. When the overlap rate exceeds 85%, it indicates that the starting stitch position conforms to traditional norms and is suitable as a learning example for beginners; the system configures it as an auxiliary mode, providing detailed operational guidance. When the matching degree exceeds 90%, it indicates that the stitch path and pattern texture are highly compatible, possessing artistic creative value; it is configured as a creative mode for designers to reference and utilize.
[0075] For example, in an embroidery record of a floral and bird pattern, the overlap rate of the starting stitch position reaches 92%, and the matching degree of the stitch path is 88%. The system can configure it in two modes at the same time. Beginners can learn its standardized starting stitch technique, and creators can learn from its smooth stitch path, realizing the digital inheritance of traditional skills at different levels.
[0076] The above embodiments are merely one of the preferred embodiments of the present invention and should not be used to limit the scope of protection of the present invention. Any modifications or refinements made to the main design concept and spirit of the present invention that are not of substantial significance, but solve the same technical problem as the present invention, should be included within the scope of protection of the present invention.
Claims
1. A method for digital analysis and inheritance of traditional Cantonese embroidery techniques, characterized in that, The method includes: Based on the input pattern image, determine the line direction, boundary shape, position coordinates within the pattern area, and color transition area of the embroidery pattern, and determine the dark edge outline; identify the embroidery stitch distribution density based on the ratio between the area of the light-colored area and the area of the dark-colored area, distinguish between dense and sparse stitch areas, compare the overlap range between the dark edge outline and the dense stitch area, and obtain a list of positions for hiding thread ends that meet the requirements of the Cantonese embroidery hidden thread technique; analyze the starting positions of the thread ends in the dark area within the list of positions for hiding thread ends, extend along the dark edge outline towards the starting point of the pattern, identify the thread path area, and generate a candidate list of starting positions. The process involves iterating through the lead-in thread paths of each position in the candidate list of starting positions, counting the number of densely textured areas traversed by the lead-in thread path and the number of back-turns at the edges of dark areas; calculating the number of additional needle holes based on the number of back-turns to assess the degree of damage to texture clarity; calculating the thread pile thickness based on the number of back-turns and the thread diameter to assess the impact on surface smoothness; performing a normalized weighted comprehensive evaluation of the degree of damage and the impact on smoothness, setting control parameters based on the comprehensive evaluation value, and setting an upper limit for the number of densely textured areas traversed by the lead-in thread and an allowable range for the number of back-turns based on the control parameters. If the number of densely textured areas traversed exceeds the upper limit or the number of back-turns exceeds the allowable range, the position is discarded to generate an optimized starting position sequence; evaluating the stitch direction from each starting position to the starting point of the pattern in the optimized starting position sequence, and ranking the total stitch length of the sewn pattern. The process involves: 1) Assessing the compatibility of each starting position with the hidden stitch technique based on the total stitch length of the sewing pattern, thus determining the starting point of the sewing pattern; 2) Generating embroidery stitch paths based on the starting points of the sewing pattern, selecting alternative stitches based on texture characteristics for areas where straight stitches are not suitable, converting radial textures to binding stitches and scattered textures to interlacing stitches to update the stitch path; 3) Identifying dark areas in the updated stitch path, selecting thread hiding methods based on the base fabric texture within these dark areas, using the base fabric if located at texture intersections, using the pressing stitch if located between parallel textures, and using the interlacing stitch if located in sparse texture areas to optimize the thread direction angle and obtain an optimized stitch path; 4) Feeding the optimized stitch path back to the digital embroidery system, recording the association between starting positions and stitch paths, identifying and storing technique gaps in the heritage knowledge base.
2. The method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to claim 1, characterized in that, The process of determining the line direction, boundary shape, position coordinates within the pattern area, and color transition area of the embroidery pattern based on the input pattern image, and determining the outline of the dark area edges, includes: Edge detection is performed on the pattern image to obtain a set of contour points. The tangent angle is calculated based on the coordinate difference between adjacent points in the set of contour points to determine the distribution of smooth and transition regions, and a spatial topology containing contour line segments is constructed. The pixel color values of the closed regions within the spatial topology are grouped, the color difference between adjacent color block boundaries is calculated, color transition boundaries are marked, and pixels with brightness values higher than the median constitute bright regions, while those lower than the median constitute dark regions. Based on the dark regions and color transition boundaries, the geometric center points and boundary point sets of connected domains within the dark regions are extracted to generate dark edge bands. Line segments that conform to the hidden needle path criterion are selected to generate dark edge contour lines.
3. The method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to claim 1, characterized in that, The method involves identifying the density of embroidery stitches based on the ratio between the areas of light and dark regions, distinguishing between densely stitched and sparsely stitched areas, and comparing the overlap between the dark area's edge outline and the densely stitched area to obtain a list of locations where thread ends can be hidden, meeting the requirements of the Cantonese embroidery hidden thread technique. This list includes: Determine the actual stitch density value; divide the pattern area into grids, calculate the ratio of the stitch density value in each grid to the actual stitch density value, and mark dense stitch areas and sparse stitch areas; extract the overlapping line segments of the outer boundary line of the dense stitch area and the outline of the dark area, and generate a list of positions where thread ends can be hidden that meet the requirements of the thread hiding technique.
4. The method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to claim 1, characterized in that, The analysis identifies the starting positions of the needlework within the dark area distribution of the hidden thread position list, extends along the edge contour of the dark area towards the starting point of the pattern, identifies the lead thread path area, and generates a candidate list of starting positions, including: Extract the distance from each position point to the geometric center of the pattern from the list of possible hidden thread ends, filter candidate points close to the center, determine whether the candidate points are located in the dark area, and mark the starting position that meets the dark area priority principle; search for a continuous path along the edge contour of the dark area from the starting position, record the coordinates of the path pixels, and generate the lead thread path area; expand the sampling of the pixels in the lead thread path area to generate a candidate list of starting positions.
5. The method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to claim 1, characterized in that, The evaluation of the stitch direction from each starting position in the optimized starting position sequence to the starting point of the pattern, and the sorting of the total stitch length of the sewn pattern, includes: Based on the stitch direction from each starting position in the optimized starting position sequence to the starting point of the pattern, the sewing process is simulated, the pattern area is traversed, the pixel coordinate sequence and cumulative path length are recorded, and the total stitch length of the sewing pattern is generated; the color transition points in the pixel coordinate sequence are identified, the angle between the texture direction and the stitch direction at the color transition point is calculated, and the hiding effect weight is determined; the total stitch length is adjusted according to the hiding effect weight, and the optimized starting position sequence is generated.
6. The method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to claim 1, characterized in that, The process of evaluating the conformity of each starting position with the hidden stitch technique based on the total stitch length of the sewing pattern, and determining the starting point of the sewing pattern, includes: Calculate the median total stitch length and the median lead-in path length; after removing positions in the optimized starting position sequence where both the total stitch length and the lead-in path length exceed the median, select the position with the minimum total stitch length to generate the starting point of the sewing pattern.
7. The method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to claim 1, characterized in that, The process of generating embroidery stitch paths based on the starting point of the sewing pattern, and optimizing these paths to obtain optimized stitch paths, includes: Traverse the pattern area from the starting point, count the stitch density value, mark the density transition area, and detect the straight needle compatibility; for the incompatible area, select the binding needle or the sprinkling needle according to the texture characteristics, and update the needle path; identify the dark area in the needle path, optimize the direction angle of the thread end according to the hidden position of the thread end in the dark area, and generate the optimized needle path.
8. The method for digital analysis and inheritance of traditional Cantonese embroidery techniques according to claim 1, characterized in that, The process of feeding the optimized stitch path back to the digital embroidery system, recording the association between the starting position and the stitch path, and identifying and storing technique gaps in the heritage knowledge base includes: The needlework paths are stored in the digital embroidery system, recording the mapping relationship between the starting position and the needlework path, and recording the lead thread path, needlework type sequence, and hidden thread position coordinates corresponding to each starting point, forming a structured association record; the association record is compared with the heritage knowledge base to identify unrecorded technique parameters and store them in the heritage knowledge base.
Citation Information
Patent Citations
Embroidery pattern intelligent optimization processing system and method
CN119180382A
Embroidery data creating system for embroidery machine
US5576968A
Producing an object-based design description file for an embroidery pattern from a vector-based stitch file
US6510360B1