Embroidery track generation method for embroidering target image

CN122510380APending Publication Date: 2026-08-04HUNAN SIJIU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUNAN SIJIU TECH CO LTD
Filing Date
2026-03-17
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

优秀的版案需要专业的制版师根据自己丰富的制版经验通过专业的制版软件来进行制版,具有非常高的门槛,并且耗费大量时间成本

Benefits of technology

[0056] The embroidery order of the closed regions of each of the second skeleton boundary pairs is determined, and the embroidery parameters of the monochrome connected region are determined based on the embroidery order and the attribute characteristics of each closed region.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122510380A_ABST
    Figure CN122510380A_ABST
Patent Text Reader

Abstract

This application relates to a method for generating embroidery trajectories for embroidering target images, comprising: dividing a skeleton into multiple initial skeleton segments; dividing the boundary of a monochromatic connected region into multiple boundary segments; determining the boundary segments associated with the initial skeleton segments based on the distance between the initial skeleton segments and the boundary segments; removing unreliable parts of the initial skeleton segments to obtain multiple skeleton segments; for each set, determining the two closest first endpoints from the endpoints of the skeleton segments; determining the first intersection point between the normal of the first endpoint and the boundary segment associated with the skeleton segment; scaling, rotating, and translating the boundary between the first intersection points to obtain a first connecting line; connecting the first connecting line to the first endpoint to obtain a first repaired skeleton segment after repairing the skeleton segment to which the first endpoint belongs; determining the embroidery parameters for embroidering the monochromatic connected region based on each first repaired skeleton segment; and generating the embroidery trajectory of the target image based on the embroidery parameters of the monochromatic connected region. This method can improve the quality and efficiency of embroidered products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the interdisciplinary field of computer vision and the textile industry, and in particular to a method for generating embroidery trajectories for embroidering target images. Background Technology

[0002] Embroidery pattern making refers to the process of converting a design pattern into stitch data (such as executable files in DST, EXP, etc.) that an embroidery machine can recognize and execute. It is the core step in transforming digital images into physical embroidery products. The quality and efficiency of pattern making directly determine the artistic effect and production efficiency of the final embroidery. Excellent patterns require professional pattern makers to create them using specialized pattern-making software based on their extensive experience; this process has a very high barrier to entry and consumes a significant amount of time.

[0003] Current plate-making software has certain automated plate-making functions, but the effect of dividing the basic embroidery units is poor or even impossible to divide automatically, resulting in low product quality and low embroidery efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide a method for generating embroidery trajectories that can improve the quality of embroidery target images, addressing the aforementioned technical problems.

[0005] A method for generating embroidery trajectories for embroidering target images, the method comprising:

[0006] S1. Divide the skeleton of the monochrome connected region in the target image into multiple initial skeleton segments, and divide the boundary of the monochrome connected region into multiple boundary segments;

[0007] S2. Based on the distance between each initial skeleton segment and each boundary segment, determine the boundary segment associated with each initial skeleton segment, and remove the unreliable parts of each initial skeleton segment to obtain multiple skeleton segments; the skeleton segments associated with the same boundary segment constitute a set.

[0008] S3. For each set, determine the two closest first endpoints from the endpoints of the skeleton segments in the set; determine the first intersection points of the normals of the two first endpoints and the boundary segments associated with the skeleton segments in the set; scale, rotate and translate the boundary between the two first intersection points to obtain a first connecting line, and connect the first connecting line to the two first endpoints to obtain the first repaired skeleton segment after the skeleton segments to which the two first endpoints belong are repaired.

[0009] S4. Based on the first repair skeleton segment corresponding to each set, determine the embroidery parameters for embroidering the monochrome connected region, and generate an embroidery trajectory for embroidering the target image based on the embroidery parameters of the monochrome connected region.

[0010] In this application, the skeleton of a monochrome connected region in the target image is divided into multiple initial skeleton segments, and the boundary of the monochrome connected region is divided into multiple boundary segments. Based on the distance between each initial skeleton segment and each boundary segment, the boundary segments associated with each initial skeleton segment are determined, and unreliable parts of each initial skeleton segment are removed, resulting in multiple skeleton segments. This process removes line segments in each initial skeleton segment that cannot accurately and stably reflect the original shape's geometric or topological features, ensuring that the subsequently repaired skeleton segments accurately and stably reflect the original shape's geometric or topological features. For each set, the two closest first endpoints are determined from the endpoints of the skeleton segments in the set; the normals of the two first endpoints are determined to intersect the first points of the boundary segments associated with the skeleton segments in the set; the boundary between the two first intersection points is scaled, rotated, and translated to obtain a first connecting line, which is then connected to the two first endpoints. This yields the first repaired skeleton segment after the skeleton segments to which the two first endpoints belong are repaired. This allows for the generation of accurate embroidery trajectories based on the embroidery parameters of the monochrome connected region, improving the quality and efficiency of the final embroidered product.

[0011] In one embodiment, the method for obtaining the monochromatic connected component in step S1 includes:

[0012] Determine the target image to be embroidered;

[0013] The target image is semantically segmented to obtain a semantic region map, where each region in the semantic region map corresponds to a category;

[0014] Perform color similarity analysis on each of the regions to obtain the analysis results for each region.

[0015] Based on the analysis results of each region, color merging is performed on each region to obtain the color-simplified region corresponding to each region;

[0016] Each of the color simplification regions is divided into monochrome connected regions formed by merging pixels with the same pixel value and adjacent positions, to obtain at least one monochrome connected region in each color simplification region, and each monochrome connected region is subjected to noise reduction and edge smoothing processing.

[0017] In this application, semantic segmentation is performed on the target image to obtain a semantic region map. Color similarity analysis is performed on each region to obtain the analysis results of each region. Based on the analysis results of each region, color merging is performed on each region to obtain the color simplified region corresponding to each region. This can reduce the number of colors in the color simplified region while preserving the original visual effect as much as possible, making the subsequent monochrome connected component segmentation more efficient.

[0018] In one embodiment, step S1 includes:

[0019] The skeleton of the monochrome connected region after denoising and edge smoothing is extracted to obtain a skeleton binary map, and the contour of the monochrome connected region after denoising and edge smoothing is detected to obtain a set of boundary points.

[0020] The number of adjacent skeleton pixels of each skeleton pixel in the skeleton binary image is determined. The number of adjacent skeleton pixels is the number of skeleton pixels in the neighborhood of the skeleton pixel. The skeleton pixel is the pixel point where the skeleton is located in the skeleton binary image.

[0021] Based on the number of adjacent skeleton pixels of each skeleton pixel, the endpoints and connection points in the skeleton are determined, and the inflection points in the set of boundary points are determined.

[0022] Based on the endpoints and connection points in the skeleton, the skeleton is divided into multiple initial skeleton segments; based on the inflection points, the boundary points in the boundary point set are divided into multiple groups, and each group of boundary points constitutes a boundary segment, resulting in multiple boundary segments.

[0023] In this application, the skeleton of the monochrome connected region after denoising and edge smoothing is extracted to obtain a skeleton binary map. Contour detection is then performed on the monochrome connected region after denoising and edge smoothing to obtain a set of boundary points. The number of adjacent skeleton pixels of each skeleton pixel in the skeleton binary map is determined. The number of adjacent skeleton pixels is the number of skeleton pixels in the neighborhood of the skeleton pixel. The skeleton pixel is the pixel point where the skeleton is located in the skeleton binary map. Based on the number of adjacent skeleton pixels of each skeleton pixel, the endpoints and connection points in the skeleton are determined, and the inflection points in the set of boundary points are determined. In this way, the skeleton can be divided into multiple initial skeleton segments based on the endpoints and connection points in the skeleton, and the boundary points in the set of boundary points can be divided into multiple groups based on the inflection points.

[0024] In one embodiment, the process of determining the inflection points in the set of boundary points includes:

[0025] Gaussian filtering is applied to each boundary point in the boundary point set to obtain filtered boundary points.

[0026] Based on each of the adjacent filter boundary points, the derivative of each filter boundary point is calculated respectively, where the adjacent filter boundary points are the filter boundary points of adjacent boundary points.

[0027] Using each of the boundary points as the center point, and based on the derivative of each of the filtered boundary points, calculate the first distance between each of the boundary points in the neighborhood of each of the center points and the tangent of the center point;

[0028] The first distances of each of the stated center points are summed to obtain the inflection point scores of each center point, and the first median of each inflection point score is determined. Score ;

[0029] Calculate the first difference between each inflection point score and the first median, and determine the second median MAD from the first difference;

[0030] Through formula Calculate the dynamic score threshold T. As a regulating factor;

[0031] The boundary point corresponding to the inflection point score that is greater than the dynamic score threshold is determined as the inflection point.

[0032] In this application, by means of the formula Calculate the dynamic score threshold T, and determine the boundary point corresponding to the inflection point score that is greater than the dynamic score threshold as the inflection point. This allows the dynamic score threshold to change dynamically according to the actual inflection point score, avoiding the problem of incorrect judgment caused by a fixed score threshold.

[0033] In one embodiment, step S2 includes:

[0034] Calculate the target distance between each first sampling point in each of the initial skeleton segments and each of the boundary segments;

[0035] Based on the target distances of each of the first sampling points, determine the shortest distance d corresponding to each of the first sampling points. min and the shortest distance d min With preset weighting coefficients Multiply by each sample to obtain the weighted distance corresponding to each of the first sampling points. ;

[0036] For each of the first sampling points, a boundary segment from the boundary segments in which the target distance is less than the corresponding weighted distance is determined, and this boundary segment is identified as the boundary segment associated with the first sampling point.

[0037] Construct multiple first skeleton boundary pairs; each first skeleton boundary pair consists of an initial skeleton segment and boundary segments associated with each of the first sampling points of the initial skeleton segment;

[0038] For each pair of the first skeleton boundaries, determine the normal angle N of each first sampling point in the initial skeleton segment. sample The normals of each of the first sampling points intersect the two second intersection points of the associated boundary segment; the average value S of the normal angles at the two second intersection points is calculated. mean ;based on Unreliable sampling points in the initial skeleton segment are determined, and K1 is the threshold for judging whether the first sampling point is reliable;

[0039] Unreliable portions between adjacent unreliable sampling points in each of the initial skeleton segments are removed.

[0040] In this application, the normal angle N of each first sampling point in the initial skeleton segment is determined for each first skeleton boundary pair. sample Calculate the average value S of the normal angle between the two second intersection points of the normal to each first sampling point and the associated boundary segment. mean ,based on Unreliable sampling points in the initial skeleton segment are identified, and K1 is the threshold for judging whether the first sampling point is reliable. Unreliable parts between adjacent unreliable sampling points in each initial skeleton segment are removed. In this way, line segments in each initial skeleton segment that cannot truly and stably reflect the original shape geometry or topological features can be removed, so that the subsequently repaired skeleton segment can truly and stably reflect the original shape geometry or topological features.

[0041] In one embodiment, the method further includes:

[0042] Based on the first endpoint in each of the skeleton segments, determine the non-first endpoints in each of the skeleton segments;

[0043] Using the non-first endpoint as the second endpoint, determine the normal angle of each second endpoint;

[0044] Calculate the second difference between each of the normal angles, and determine the target difference that is less than the angle difference threshold among the second differences, and the two second endpoints to which the target difference belongs, wherein the two second endpoints to which the target difference belongs constitute an endpoint set;

[0045] Calculate the second distance between the two second endpoints in each endpoint set, and sort the endpoint sets from smallest to largest according to the second distance to obtain the endpoint set sorting result;

[0046] According to the sorting result of the endpoint set, connect the two second endpoints in each endpoint set in sequence to obtain the second repaired skeleton segment after the skeleton segment to which the two second endpoints in the endpoint set belong. The second endpoints are prohibited from being connected twice.

[0047] In this application, by taking non-first endpoints as second endpoints and determining the normal angle of each second endpoint, the second difference between each normal angle is calculated, and the target difference less than the angle difference threshold in the second difference is determined, as well as the two second endpoints to which the target difference belongs. The two second endpoints to which the target difference belongs constitute an endpoint set. The second distance between the two second endpoints in each endpoint set is calculated, and each endpoint set is sorted from smallest to largest according to the second distance to obtain the endpoint set sorting result. The two second endpoints in each endpoint set are connected sequentially according to the endpoint set sorting result. In this way, the second repaired skeleton segment after the skeleton segment to which the two second endpoints in the endpoint set belong is obtained can be obtained.

[0048] In one embodiment, the method further includes:

[0049] Identify the third endpoint in each of the skeleton segments, excluding the first endpoint and the second endpoint that is already connected to other endpoints;

[0050] For each of the third endpoints, a third intersection point is determined between the normal of the third endpoint and the associated boundary segment, and a third distance is determined between the third intersection point and each endpoint of the associated boundary segment. Based on the third distance, a target endpoint closest to the third intersection point is determined from each endpoint of the associated boundary segment, and the portion between the third intersection point and the target endpoint is scaled and rotated to obtain a second connecting line. One end of the second connecting line is connected to the third endpoint, and the other end of the second connecting line is connected to the associated boundary segment to obtain the third repaired skeleton segment to which the third endpoint belongs.

[0051] In this application, the third endpoint of each skeleton segment is determined, excluding the first endpoint and the second endpoint that is already connected to other endpoints. For each third endpoint, the third intersection point between the normal of the third endpoint and the associated boundary segment is determined, and the third distance between the third intersection point and each endpoint of the associated boundary segment is determined. Based on the third distance, the target endpoint closest to the third intersection point is determined from each endpoint of the associated boundary segment, and the portion between the third intersection point and the target endpoint is scaled and rotated to obtain a second connecting line. One end of the second connecting line is connected to the third endpoint, and the other end of the second connecting line is connected to the associated boundary segment. In this way, the third repaired skeleton segment to which the third endpoint belongs can be obtained.

[0052] In one embodiment, the process of determining the embroidery parameters of the monochromatic connected region in step S4 includes:

[0053] Based on the first repair skeleton segment, each second repair skeleton segment, and each third repair skeleton segment corresponding to each set, a repair skeleton is obtained;

[0054] Based on the endpoints and connection points in the repair skeleton, the repair skeleton is divided into multiple optimized skeleton segments, and based on the distance between each optimized skeleton segment and each boundary segment, a boundary segment associated with each optimized skeleton segment is determined from the boundary segments; the optimized skeleton segments and the associated boundary segments constitute a second skeleton boundary pair.

[0055] For each second skeleton boundary pair, determine the fourth intersection point between the normal of each second sampling point in the optimized skeleton segment and the boundary segment, and calculate the distance between each fourth intersection point and the corresponding second sampling point. Take the maximum distance as the reference value of the second skeleton boundary pair. Calculate the fourth distance between each boundary point in the boundary segment and the optimized skeleton segment, and determine the boundary points corresponding to the fourth distances less than the reference value as reliable boundary points. Connect the reliable boundary points in the boundary segment in a clockwise or counterclockwise direction to obtain the closed region of the second skeleton boundary pair.

[0056] The embroidery order of the closed regions of each of the second skeleton boundary pairs is determined, and the embroidery parameters of the monochrome connected region are determined based on the embroidery order and the attribute characteristics of each closed region.

[0057] In this application, a repair skeleton is obtained based on the first, second, and third repair skeleton segments corresponding to each set. This effectively avoids the problem of discontinuity in the original skeleton caused by image noise, breaks, or missing parts. By determining the fourth intersection point between the normal of each second sampling point in the optimized skeleton segment and the boundary segment, and calculating the distance between each fourth intersection point and the corresponding second sampling point, the maximum distance is used as the reference value for the second skeleton boundary pair, thus enabling dynamic setting of the reference value. By calculating the fourth distance between each boundary point in the boundary segment and the optimized skeleton segment, and determining the boundary points corresponding to the fourth distance less than the reference value as reliable boundary points, noise points, burrs, or false detection boundaries can be effectively eliminated, improving the accuracy of closed regions.

[0058] In one embodiment, the embroidery sequence of each of the enclosed areas includes:

[0059] S102. Determine the boundary point with the smallest abscissa from the reliable boundary points of each closed region, and use the boundary point with the smallest abscissa as a candidate reference point.

[0060] S104. From the candidate reference points of each closed region, determine the reference point with the smallest horizontal coordinate, and take the closed region corresponding to the reference point as the initial backbone;

[0061] S106. The closed regions that are connected to the initial trunk end to end are added to the initial trunk to obtain a new trunk, and the closed regions that are not connected to the initial trunk end to end are determined as branches of the initial trunk.

[0062] S108. Update the initial trunk in step S106 to the new trunk, and repeat step S106 until there are no closed regions connected to the beginning and end of the initial trunk, to obtain the final new trunk.

[0063] S110. The order in which each of the closed regions is added to the final new trunk is determined as the first traversal order of each of the closed regions in the final new trunk.

[0064] S112. Determine the second traversal order of each closed region in the branches of the new trunk in the order of the first traversal;

[0065] S114. Based on the second traversal order and the first traversal order of each closed area in the branch of the new main trunk, determine the embroidery order of each closed area.

[0066] In this application, the embroidery sequence of each closed area is determined by the second traversal sequence and the first traversal sequence of each closed area in the branch of the new trunk. This generates an embroidery sequence that is spatially continuous, has the fewest skipped stitches, and has a reasonable process. It effectively solves the problems of chaotic paths, low efficiency, and easy wrinkling in automatic embroidery of multi-closed area patterns, and significantly improves the automation level and embroidery quality of the intelligent embroidery system.

[0067] In one embodiment, the embroidery parameters of the monochromatic connected region are determined based on the embroidery sequence and the attribute characteristics of each of the closed regions, including:

[0068] The stitch type of each closed region is determined based on the perimeter and area of ​​the closed region.

[0069] The stitch length of each closed region is determined according to the stitch type, perimeter, and area of ​​each closed region.

[0070] Through formula Calculate the stitch density ρ of each closed region, where ρ0 is the reference density, and S s S is the area factor. s =a / a0, where a0 is the baseline area, a is the area of ​​the enclosed region, and F t For fabric compensation coefficient, T s Here are the coefficients corresponding to the stitch type, k1 and k2 are weight parameters, and C is a complexity factor;

[0071] The stitch direction of each of the closed areas is determined according to the embroidery sequence of each closed area;

[0072] Based on the stitch type, stitch length, and stitch direction of each closed region in the monochrome connected region, the embroidery parameters of the monochrome connected region are determined.

[0073] In this application, the stitch type for each closed area is determined based on its perimeter and area. This avoids the accumulation caused by using filler stitches in small areas or the sparseness caused by using flat stitches in large areas, ensuring visual consistency and process rationality. Furthermore, by determining the stitch length for each closed area based on its stitch type, perimeter, and area, material utilization is improved and thread consumption costs are reduced. (The formula is used to...) Calculating the stitch density of each enclosed area allows for adaptive density control, preventing deformation, exposed fabric, or loose stitches caused by a "one-size-fits-all" approach. By determining the stitch direction of each enclosed area based on the embroidery sequence, continuous needle movement is maximized during actual embroidery, reducing idle movement and thread cutting, minimizing mechanical wear on the embroidery machine, improving production efficiency, and preventing fabric tension imbalance or wrinkling caused by sudden changes in direction. Attached Figure Description

[0074] Figure 1 This is an application environment diagram of an embroidery trajectory generation method for embroidering target images in one embodiment;

[0075] Figure 2 This is a flowchart illustrating a method for generating embroidery trajectories for embroidering a target image in one embodiment.

[0076] Figure 3 This is a schematic diagram of a monochrome connected region after noise reduction and edge smoothing in one embodiment;

[0077] Figure 4 This is a schematic diagram of the skeleton in one embodiment;

[0078] Figure 5 This is a schematic diagram of the skeleton after removing unreliable parts in one embodiment;

[0079] Figure 6 This is a schematic diagram of the repaired skeleton in one embodiment;

[0080] Figure 7 This is a schematic diagram of each enclosed region in a color-connected domain in one embodiment;

[0081] Figure 8 This is a schematic diagram of the overall process of generating embroidery trajectory for embroidering target image in one embodiment;

[0082] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0083] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0084] The embroidery trajectory generation method for embroidered target images provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the terminal interacts with the server via a wired / wireless channel. The data storage system stores the data the server needs to process. The server divides the skeleton of the monochrome connected components in the target image into multiple initial skeleton segments and the boundaries of the monochrome connected components into multiple boundary segments. Based on the distance between each initial skeleton segment and each boundary segment, the server determines the boundary segments associated with each initial skeleton segment and removes unreliable parts of each initial skeleton segment, resulting in multiple skeleton segments. Skeleton segments associated with the same boundary segment form a set. For each set, the server determines the two closest first endpoints from the endpoints of the skeleton segments in the set. It determines the first intersection points of the normals of the two first endpoints with the boundary segments associated with the skeleton segments in the set. The boundary between the two first intersection points is scaled, rotated, and translated to obtain a first connecting line, which is then connected to the two first endpoints to obtain the first repaired skeleton segment after the skeleton segments to which the two first endpoints belong are repaired. Based on the first repaired skeleton segments corresponding to each set, the server determines the embroidery parameters for embroidering the monochrome connected components, and generates an embroidery trajectory for embroidering the target image based on the embroidery parameters of each monochrome connected component. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, etc. The server can be a single server, a server cluster consisting of multiple servers, or a cloud computing center consisting of multiple servers.

[0085] In one embodiment, such as Figure 2 As shown, a method for generating embroidery trajectories from a target image is provided, which can be applied to... Figure 1 Taking the server in the example, the following steps are included:

[0086] S1. Divide the skeleton of the monochrome connected region in the target image into multiple initial skeleton segments, and divide the boundary of the monochrome connected region into multiple boundary segments;

[0087] The target image is the image to be embroidered, and the embroidery produced by the embroidery machine according to the execution document should be consistent with the color and style of the target image.

[0088] The target images include images of various styles, such as real-life photographs, anime images, and digital images of artwork.

[0089] Monochromatic connected regions are regions in a target image that consist of pixels of the same color and adjacent positions (according to 4-connectivity or 8-connectivity rules).

[0090] Furthermore, based on the result that there are multiple monochrome connected components in the target image, each monochrome connected component is processed according to the process of S1, S2, S3 and S4 respectively, so as to obtain the embroidery trajectory of the entire target image.

[0091] The skeleton of a monochromatic connected component can be obtained using skeleton extraction algorithms. Skeleton extraction algorithms include, but are not limited to, traditional thinning algorithms such as Zhang-Suen and GuoHall, as well as skeleton extraction algorithms based on deep learning models.

[0092] The boundaries of a monochromatic connected domain can be obtained using a contour detection algorithm.

[0093] The skeleton of a monochromatic connected domain can be divided into multiple initial skeleton segments, and the boundary of a monochromatic connected domain can be divided into multiple boundary segments. Both can be segmented using deep learning-based models.

[0094] S2. Based on the distance between each initial skeleton segment and each boundary segment, determine the boundary segments associated with each initial skeleton segment, and remove the unreliable parts of each initial skeleton segment to obtain multiple skeleton segments; skeleton segments associated with the same boundary segment form a set.

[0095] The boundary segments associated with each initial skeleton segment are determined based on the target distances between each first sampling point in the initial skeleton segment and each boundary segment. Specifically, the target distances between each first sampling point in each initial skeleton segment and each boundary segment are calculated; based on the target distances of each first sampling point, the shortest distance corresponding to each first sampling point is determined, and the shortest distance is multiplied by a preset weighting coefficient to obtain the weighted distance corresponding to each first sampling point; for each first sampling point, boundary segments whose target distances are less than the corresponding weighted distances are determined and identified as the boundary segments associated with the first sampling point. The boundary segments associated with each first sampling point of the initial skeleton segment are the associated boundary segments of that initial skeleton segment. Each boundary segment may be associated with one initial skeleton segment, multiple initial skeleton segments, or no initial skeleton segment.

[0096] Unreliable parts refer to the line segments in each initial skeleton segment that cannot truly and stably reflect the geometric or topological characteristics of the original shape.

[0097] The initial skeleton segment after removing unreliable parts is called the skeleton segment. The boundary segment associated with the skeleton segment is the boundary segment associated with the initial skeleton segment to which the skeleton segment belongs. For example, if the initial skeleton segment 1 and the boundary segment 2 are associated, after removing the unreliable parts in the initial skeleton segment 1, we get skeleton segments 3 and 4. Then the boundary segment associated with skeleton segment 3 is boundary segment 2, and the boundary segment associated with skeleton segment 4 is also boundary segment 2.

[0098] Since there may be multiple target boundary segments, and each target boundary segment is a boundary segment associated with at least two skeleton segments, the number of sets may also be multiple. Therefore, step S3 needs to be performed independently for each set to obtain the first repaired skeleton segment corresponding to each set.

[0099] S3. For each set, determine the two closest first endpoints from the endpoints of the skeleton segments in the set; determine the first intersection points of the normals of the two first endpoints with the boundary segments associated with the skeleton segments in the set; scale, rotate and translate the boundary between the two first intersection points to obtain the first connecting line, and connect the first connecting line with the two first endpoints to obtain the first repaired skeleton segment after the skeleton segments to which the two first endpoints belong are repaired.

[0100] Here, the two first endpoints are the endpoints of different skeleton segments in the set, that is, the two closest first endpoints do not belong to the same skeleton segment.

[0101] The normal to the first endpoint is a line perpendicular to the tangent to the first endpoint. The normal to the first endpoint points from the first endpoint to the boundary segment associated with the skeleton segment in the set. The tangent to the first endpoint can be estimated based on several skeleton pixels adjacent to the first endpoint using line fitting or directional averaging.

[0102] The process of determining the first intersection point includes: determining the coordinates of the first endpoint E = (xc, yc), and based on the coordinates of the first endpoint and the normal to the first endpoint... Constructing rays The intersection of ray r(d) and the boundary segment is determined as the first intersection point, where d is the step size.

[0103] Since the boundary segments associated with each skeleton segment in a set are the same, the two first intersection points are also located on the same boundary segment. Therefore, the boundary between the two first intersection points is the boundary segment between the two first intersection points in that boundary segment.

[0104] The process of scaling, rotating, and translating the boundary between the two first intersection points to obtain the first connecting line is as follows: a) Calculate the boundary vector of the boundary segment associated with each skeleton segment in the set: P b1 and P b2Let be the coordinates of the two endpoints of the boundary segment, where norm represents vector normalization; b) Calculate the connection vector between the two first endpoints: P c1 and P c2 c) Calculate the coordinates of the two first endpoints of the pair; c) Calculate the coordinates of the center point C of each boundary segment. b and the coordinates of the center point C of the two first endpoints c : d) Calculate the minimum directed angle required to rotate the boundary vector around its origin until it aligns with the direction of the connection vector between the two first endpoints: and the minimum directional angle Switch to e) Calculate the scaling factor for the angle values ​​of the interval. f) For each point P in the boundary between the two first intersection points b The first connecting line is obtained by performing the following transformation: 1) According to Point P b Transformed to the center point C of the boundary segment b Point P in a coordinate system with the origin t ;2) According to , for P t Scale the points to obtain the scaled point P. s ;3) According to , for P s Rotate the point to obtain the rotated point P. r ;4) According to P trans =P r +C c , each P r Perform a translation to obtain the translated P. trans And connect each point P. b P after scaling, rotation, and translation trans Thus, the first connecting line is obtained.

[0105] S4. Based on the first repair skeleton segment corresponding to each set, determine the embroidery parameters for embroidering the monochrome connected domain, and generate the embroidery trajectory for embroidering the target image based on the embroidery parameters of each monochrome connected domain.

[0106] Among them, the embroidery parameters used to embroider monochrome connected regions include the stitch type, stitch length, and stitch direction of each closed area in the monochrome connected region.

[0107] In the above-mentioned method for generating embroidery trajectories for embroidered target images, the skeleton of the monochromatic connected domain in the target image is divided into multiple initial skeleton segments, and the boundary of the monochromatic connected domain is divided into multiple boundary segments. Based on the distance between each initial skeleton segment and each boundary segment, the boundary segments associated with each initial skeleton segment are determined, and unreliable parts of each initial skeleton segment are removed to obtain multiple skeleton segments. In this way, the line segments in each initial skeleton segment that cannot realistically and stably reflect the geometric or topological features of the original shape can be removed, so that the subsequently repaired skeleton segments can realistically and stably reflect the geometric or topological features of the original shape. For each set, the two closest first endpoints are determined from the endpoints of the skeleton segments in the set; the first intersection points of the normals of the two first endpoints and the boundary segments associated with the skeleton segments in the set are determined; the boundary between the two first intersection points is scaled, rotated, and translated to obtain the first connecting line, and the first connecting line is connected to the two first endpoints. In this way, the first repaired skeleton segment after the skeleton segment to which the two first endpoints belong can be obtained. Thus, accurate embroidery trajectories can be generated based on the embroidery parameters of the monochrome connected domain, improving the quality and efficiency of the final embroidered product.

[0108] In one embodiment, the method for obtaining the monochromatic connected component in step S1 includes:

[0109] Determine the target image to be embroidered;

[0110] Semantic segmentation is performed on the target image to obtain a semantic region map, where each region in the semantic region map corresponds to a category;

[0111] Color similarity analysis was performed on each region to obtain the analysis results for each region;

[0112] Based on the analysis results of each region, the colors of each region are merged to obtain the simplified color regions corresponding to each region.

[0113] The monochrome connected regions formed by merging pixels with the same pixel value and adjacent positions in each color simplification region are divided to obtain at least one monochrome connected region in each color simplification region, and each monochrome connected region is subjected to noise reduction and edge smoothing.

[0114] Semantic segmentation involves identifying and segmenting independent object elements within an image. These independent object elements include, but are not limited to, people, flowers, and buildings. Semantic segmentation algorithms include, but are not limited to, deep learning-based segmentation algorithms or traditional image processing algorithms. Deep learning-based segmentation algorithms include, but are not limited to, Mask-R-CNN, YOLO, and U-Net.

[0115] Color similarity analysis determines the pixel values ​​of each pixel in a region, identifies which pixels have similar values, and groups pixels with similar values ​​into one category. Algorithms for color similarity analysis include, but are not limited to, k-means, DBSCAN, and hierarchical clustering.

[0116] When performing color merging, pixels with similar values ​​are merged. For example, in a preliminarily segmented flower, the pixels are analyzed for color similarity. This flower has red flowers and green leaves. The red flowers include pixels with a color of rose red (A) and a color of pure red (B). The green leaves include pixels with a color of dark green (C) and a color of light green (D). The rose red and pure red have a high similarity that meets the merging threshold, so they are merged into a single red color (Z). That is, pixels with a color of rose red (A) and a color of pure red (B) become pixels with a color of red (Z). The dark green and light green do not meet the merging threshold, so they are not merged. Furthermore, the pixel value of each pixel after merging is the average of the pixel values ​​before merging.

[0117] Denoising each monochromatic connected component can remove redundant small color blocks or noise points that appear after color merging. Edge smoothing of each monochromatic connected component can smooth out the rough outlines of its edges. Edge smoothing algorithms include, but are not limited to, B-spline curve fitting, polynomial fitting, and other fitting algorithms. A schematic diagram of the monochromatic connected components after denoising and edge smoothing is shown below. Figure 3 As shown.

[0118] In this embodiment, semantic segmentation is performed on the target image to obtain a semantic region map. Color similarity analysis is performed on each region to obtain the analysis results of each region. Based on the analysis results of each region, color merging is performed on each region to obtain the color simplified region corresponding to each region. This can reduce the number of colors in the color simplified region while preserving the original visual effect as much as possible, making the subsequent monochrome connected component segmentation more efficient.

[0119] In some embodiments, the method for obtaining the monochromatic connected component in step S1 includes:

[0120] Determine the target image to be embroidered;

[0121] Color similarity analysis is performed on each pixel in the target image, and pixels with similar values ​​are merged to obtain a simplified color image corresponding to the target image.

[0122] The monochrome connected regions formed by merging pixels with the same pixel value and adjacent positions in each color simplified image are segmented to obtain at least one monochrome connected region of the color simplified image, and each monochrome connected region is subjected to noise reduction and edge smoothing processing.

[0123] In this embodiment, color similarity analysis is performed on each pixel in the target image, and pixels with similar pixel values ​​are merged to obtain a simplified color image corresponding to the target image. This simplifies the processing flow of the target image when there are few independent object elements and few colors in the target image, thereby quickly obtaining each monochrome connected region.

[0124] In one embodiment, step S1 includes:

[0125] The skeleton of the monochrome connected domain after denoising and edge smoothing is extracted to obtain the skeleton binary map. Contour detection is then performed on the monochrome connected domain after denoising and edge smoothing to obtain the boundary point set.

[0126] Determine the number of adjacent skeleton pixels for each skeleton pixel in the skeleton binary image. The number of adjacent skeleton pixels is the number of skeleton pixels in the neighborhood of the skeleton pixel. The skeleton pixel is the pixel point in the skeleton binary image where the skeleton is located.

[0127] Based on the number of adjacent skeleton pixels of each skeleton pixel, the endpoints and connection points in the skeleton are determined, and the inflection points in the boundary point set are determined.

[0128] Based on the endpoints and connection points in the skeleton, the skeleton is divided into multiple initial skeleton segments; based on the inflection points, the boundary points in the boundary point set are divided into multiple groups, and each group of boundary points constitutes a boundary segment, resulting in multiple boundary segments.

[0129] In the binary skeleton image, the skeleton pixels have a value of 255, and the background pixels have a value of 0, or the skeleton pixels have a value of 0, and the background pixels have a value of 255. A schematic diagram of the extracted skeleton is shown below. Figure 4 As shown.

[0130] The number of adjacent skeleton pixels can be either the number of skeleton pixels in the 8-neighborhood of a skeleton pixel or the number of skeleton pixels in the 4-neighborhood of a skeleton pixel.

[0131] An inflection point is the location where the curvature of the boundary curve of a monochromatic connected domain changes significantly.

[0132] Based on the endpoints and connections in the skeleton, the skeleton is divided into multiple initial skeleton segments. That is, at the endpoints and connections in the skeleton, the skeleton is broken to obtain multiple initial skeleton segments.

[0133] Furthermore, based on the result that the number of adjacent skeleton pixels of a skeleton pixel is 1, a skeleton pixel is determined to be an endpoint in the skeleton; based on the result that the number of adjacent skeleton pixels of a skeleton pixel is greater than or equal to 3, a skeleton pixel is determined to be a connection point in the skeleton.

[0134] Furthermore, the extracted skeleton is smoothed to obtain a binary skeleton image. Algorithms for smoothing the skeleton include, but are not limited to, B-spline curve fitting, polynomial fitting, and other fitting algorithms.

[0135] In this embodiment, the skeleton of the monochrome connected region after denoising and edge smoothing is extracted to obtain a skeleton binary map. Contour detection is then performed on the monochrome connected region after denoising and edge smoothing to obtain a set of boundary points. The number of adjacent skeleton pixels of each skeleton pixel in the skeleton binary map is determined. The number of adjacent skeleton pixels is the number of skeleton pixels in the neighborhood of the skeleton pixel. The skeleton pixel is the pixel point where the skeleton is located in the skeleton binary map. Based on the number of adjacent skeleton pixels of each skeleton pixel, the endpoints and connection points in the skeleton are determined, and the inflection points in the set of boundary points are determined. In this way, the skeleton can be divided into multiple initial skeleton segments based on the endpoints and connection points in the skeleton, and the boundary points in the set of boundary points can be divided into multiple groups based on the inflection points.

[0136] In one embodiment, the process of determining the inflection points in the boundary point set includes:

[0137] Gaussian filtering is applied to each boundary point in the boundary point set to obtain the filtered boundary points.

[0138] Based on each filtering boundary point's adjacent filtering boundary points, the derivative of each filtering boundary point is calculated separately, with adjacent filtering boundary points being the filtering boundary points of adjacent boundary points.

[0139] Using each boundary point as the center point, and based on the derivative of each filtered boundary point, calculate the first distance between the tangent of each boundary point and the center point in the neighborhood of each center point;

[0140] By summing the first distances of each center point, the inflection point score of each center point is obtained, and the first median of the inflection point scores is determined. Score ;

[0141] Calculate the first difference between the score at each inflection point and the first median, and determine the second median MAD from the first difference;

[0142] Through formula Calculate the dynamic score threshold T. As a regulating factor;

[0143] The boundary point corresponding to the inflection point score that is greater than the dynamic score threshold is determined as the inflection point.

[0144] Gaussian filtering, in particular, filters each boundary point in the boundary point set P. n is the number of boundary points in the boundary point set, i is the index of the boundary point currently being used for inflection point determination, and x is the index of the boundary point. i and yi represents the x and y coordinates of the boundary points.

[0145] Applying Gaussian filtering to each boundary point in the boundary point set, the formula for obtaining the filtered boundary points is as follows: (X) i Y i ) is the boundary point (x) i y i The filter boundary points after Gaussian filtering. For Gaussian kernel function, k is the boundary point (x i y i Each boundary point within the neighborhood (-m, m) of a boundary point is relative to the boundary point (x). i y i The offset of (x). i+k y i+k ) is the boundary point (x) i y i The neighborhood (-m, m) of ) relative to the boundary point (x) i y i The coordinates of the boundary point after being offset by k points. This is the bandwidth parameter. Furthermore, m is 2. It is 0.5.

[0146] The derivative dX at each filter boundary point i and dY i The calculation formula is .

[0147] The boundary points of the neighborhood of a center point refer to the boundary points in the boundary point set located before and after the center point. For example, if the neighborhood of a center point is L, then the L boundary points before and after the center point in the boundary point set are all boundary points of the neighborhood of the center point.

[0148] Center point (x) i y i The formula for calculating the first distance between the tangents of each boundary point and the center point within the neighborhood of ) is: , diK is the Kth boundary point in the boundary point set that is located in front of the center point and the center point (x). i y i The first distance between the tangents of ) L is the length of the neighborhood of the center point.

[0149] Center point (x) i y i Inflection point score i The calculation formula is .

[0150] In this embodiment, by using the formula... Calculate the dynamic score threshold T, and determine the boundary point corresponding to the inflection point score that is greater than the dynamic score threshold as the inflection point. This allows the dynamic score threshold to change dynamically according to the actual inflection point score, avoiding the problem of incorrect judgment caused by a fixed score threshold.

[0151] In one embodiment, step S2 includes:

[0152] Calculate the target distance between each first sampling point in each initial skeleton segment and each boundary segment;

[0153] Based on the target distances at each first sampling point, determine the shortest distance d corresponding to each first sampling point. min and the shortest distance d min With preset weighting coefficients Multiply by each sample to obtain the weighted distance for each first sampling point. ;

[0154] For each first sampling point, identify the boundary segments from the boundary segments where the target distance is less than the corresponding weighted distance, and determine them as the boundary segments associated with the first sampling point;

[0155] Construct multiple first skeleton boundary pairs; each first skeleton boundary pair consists of an initial skeleton segment and boundary segments associated with each first sampling point of the initial skeleton segment.

[0156] For each pair of first skeleton boundaries, determine the normal angle N of each first sampling point in the initial skeleton segment. sample The normals of each first sampling point intersect the two second intersection points of the associated boundary segment; calculate the average value S of the normal angles at the two second intersection points. mean ;based on Determine unreliable sampling points in the initial skeleton segment, where K1 is the threshold for judging whether the first sampling point is reliable;

[0157] Unreliable portions between adjacent unreliable sampling points in each initial skeleton segment are removed.

[0158] The target distance refers to the distance between the first sampling point and the boundary segment.

[0159] The shortest distance d corresponding to the first sampling point min This refers to the minimum target distance between the first sampling point and each boundary segment.

[0160] Each first sampling point corresponds to a weighted distance. The boundary segment associated with the first sampling point refers to the boundary segment in which the target distance to the first sampling point is less than the weighted distance.

[0161] The first skeleton boundary pair includes an initial skeleton segment and boundary segments associated with each first sampling point of the initial skeleton segment.

[0162] The multiple first sampling points in each initial skeleton segment are evenly distributed within the initial skeleton segment.

[0163] The normal angle N at the first sampling point sample It equals the tangent angle at the first sampling point plus 90°. The first sampling point (M) i N i The formula for calculating the tangent angle of ) is atan2(M i+1 -M i-1 N i+1 -N i-1 (M) i+1 N i+1 ) and (M i-1 N i-1 ) is the same as the first sampling point (M) i N i Two adjacent skeleton pixels.

[0164] The first sampling point has two normals, whose directions are perpendicular to and opposite to the tangent direction of that first sampling point. Since the boundary segments associated with the initial skeleton segment are generally located on both sides of the initial skeleton segment, the two normals of each first sampling point have a second intersection point with the boundary segment. The second intersection point can be calculated using the ray equation constructed from the first sampling point and its normals.

[0165] The normal angle at the second intersection point is equal to the tangent angle at the second intersection point plus 90°. Second intersection point (m) i n i The formula for calculating the tangent angle of a is atan2 (m) i+1 -m i-1 n i+1 -n -1 (m) i+1 n i+1 ) and (m i-1 n i-1 ) is the intersection with the second point (m) i n i Two adjacent boundary points.

[0166] based on Determining unreliable sampling points in the initial skeleton segment refers to the point where the normal angle N at the first sampling point is... sample With average S mean When the difference between the two is greater than the threshold K1, the first sampling point is determined to be an unreliable sampling point.

[0167] Since each first sampling point corresponds to two second intersection points, and the second intersection points corresponding to each sampling point are not necessarily the same, the average value S used to determine whether each first sampling point is an unreliable sampling point is... mean They may not be consistent.

[0168] For each first skeleton boundary pair, the following operation is performed: Determine the normal angle N of each first sampling point in the initial skeleton segment of the first skeleton boundary pair. sample The normals of each first sampling point intersect the two second intersection points of the associated boundary segment; calculate the average value S of the normal angles at the two second intersection points. mean ;based on Unreliable sampling points in the initial skeleton segment are identified, and K1 is the threshold for determining whether the first sampling point is reliable. A schematic diagram of the skeleton after removing unreliable parts is shown below. Figure 5 As shown.

[0169] Furthermore, the preset weighting coefficients It is 2.1.

[0170] Furthermore, if there are reliable sampling points between two unreliable sampling points in the initial skeleton segment, then the part between the two unreliable sampling points is not considered an unreliable part.

[0171] Furthermore, K1 is 10.

[0172] In this embodiment, the normal angle N of each first sampling point in the initial skeleton segment is determined for each first skeleton boundary pair. sample Calculate the average value S of the normal angle between the two second intersection points of the normal to each first sampling point and the associated boundary segment. mean ,based on Unreliable sampling points in the initial skeleton segment are identified, and K1 is the threshold for judging whether the first sampling point is reliable. Unreliable parts between adjacent unreliable sampling points in each initial skeleton segment are removed. In this way, line segments in each initial skeleton segment that cannot truly and stably reflect the original shape geometry or topological features can be removed, so that the subsequently repaired skeleton segment can truly and stably reflect the original shape geometry or topological features.

[0173] In one embodiment, the method further includes:

[0174] Based on the first endpoint of each skeleton segment, determine the non-first endpoints of each skeleton segment;

[0175] Using non-first endpoints as second endpoints, determine the normal angle of each second endpoint;

[0176] Calculate the second difference between each normal angle, and determine the target difference that is less than the angle difference threshold among the second differences, and the two second endpoints to which the target difference belongs. The two second endpoints to which the target difference belongs constitute the endpoint set.

[0177] Calculate the second distance between the two second endpoints in each endpoint set, and sort the endpoint sets from smallest to largest according to the second distance to obtain the endpoint set sorting result;

[0178] According to the sorting result of the endpoint set, connect the two second endpoints in each endpoint set in sequence to obtain the second repaired skeleton segment after the skeleton segment to which the two second endpoints belong in the endpoint set is repaired. Secondary connection of the second endpoints is prohibited.

[0179] Among them, the non-first endpoint refers to the endpoint that is not the first endpoint among the endpoints of each skeleton segment.

[0180] The normal angle of the second endpoint is equal to the tangent angle of the second endpoint plus 90°.

[0181] The angle difference threshold is a preset value. Further, the angle difference threshold is 1°.

[0182] Since each second difference is calculated based on the normal angle of the two second endpoints, the two second endpoints to which the target difference belongs refer to the second endpoints to which the two normal angles to which the target difference is obtained belong.

[0183] The number of target differences may be multiple, zero, or even one. The two second endpoints to which a target difference belongs constitute an endpoint set.

[0184] The prohibition of secondary connections to a second endpoint means that if any second endpoint in the endpoint set is already connected to another second endpoint, then no further connection operation will be performed on that second endpoint. For example, if second endpoint 1 in endpoint set A is already connected to second endpoint 2 in endpoint set B, then second endpoint 1 and second endpoint 3 in endpoint set A will not be connected again.

[0185] In this embodiment, by taking non-first endpoints as second endpoints and determining the normal angle of each second endpoint, the second difference between each normal angle is calculated, and the target difference less than the angle difference threshold in the second difference is determined, as well as the two second endpoints to which the target difference belongs. The two second endpoints to which the target difference belongs constitute an endpoint set. The second distance between the two second endpoints in each endpoint set is calculated, and each endpoint set is sorted from smallest to largest according to the second distance to obtain the endpoint set sorting result. The two second endpoints in each endpoint set are connected sequentially according to the endpoint set sorting result. In this way, the second repaired skeleton segment after the skeleton segment to which the two second endpoints in the endpoint set belong is obtained can be obtained.

[0186] In one embodiment, the method further includes:

[0187] Identify the third endpoint in each skeleton segment, excluding the first endpoint and the second endpoint that is already connected to other endpoints;

[0188] For each third endpoint, determine the third intersection point between the normal of the third endpoint and the associated boundary segment, and determine the third distance between the third intersection point and each endpoint of the associated boundary segment; based on the third distance, determine the target endpoint closest to the third intersection point from each endpoint of the associated boundary segment, and scale, rotate, and translate the part between the third intersection point and the target endpoint to obtain the second connecting line; connect one end of the second connecting line to the third endpoint, and connect the other end of the second connecting line to the associated boundary segment to obtain the third repaired skeleton segment to which the third endpoint belongs after repair.

[0189] Each third endpoint undergoes the following steps: determining the third intersection point between the normal of the third endpoint and the associated boundary segment; determining the third distance between the third intersection point and each endpoint of the associated boundary segment; based on the third distance, determining the target endpoint closest to the third intersection point from among the endpoints of the associated boundary segment; and scaling, rotating, and translating the portion between the third intersection point and the target endpoint to obtain a second connecting line; connecting one end of the second connecting line to the third endpoint and connecting the other end of the second connecting line to the associated boundary segment to obtain the third repaired skeleton segment to which the third endpoint belongs. Here, the associated boundary segment refers to the boundary segment associated with the skeleton segment to which the third endpoint belongs.

[0190] The process of scaling, rotating, and translating the portion between the third intersection point and the target endpoint is the same as the process of scaling, rotating, and translating the boundary between the two first intersection points in step S3.

[0191] The third endpoint includes endpoints that do not have a third intersection with the associated boundary segment.

[0192] In this embodiment, the third endpoint of each skeleton segment is determined, excluding the first endpoint and the second endpoint that is already connected to other endpoints. For each third endpoint, the third intersection point between the normal of the third endpoint and the associated boundary segment is determined, and the third distance between the third intersection point and each endpoint of the associated boundary segment is determined. Based on the third distance, the target endpoint closest to the third intersection point is determined from each endpoint of the associated boundary segment, and the portion between the third intersection point and the target endpoint is scaled and rotated to obtain the second connecting line. One end of the second connecting line is connected to the third endpoint, and the other end of the second connecting line is connected to the associated boundary segment. In this way, the third repaired skeleton segment to which the third endpoint belongs can be obtained.

[0193] In one embodiment, the process of determining the embroidery parameters of the monochromatic connected region in step S4 includes:

[0194] Based on the first repair skeleton segment, each second repair skeleton segment, and each third repair skeleton segment corresponding to each set, the repair skeleton is obtained;

[0195] Based on the endpoints and connection points in the repair skeleton, the repair skeleton is divided into multiple optimized skeleton segments. Based on the distance between each optimized skeleton segment and each boundary segment, the boundary segments associated with each optimized skeleton segment are determined from the boundary segments. The optimized skeleton segments and their associated boundary segments constitute the second skeleton boundary pairs.

[0196] For each second skeleton boundary pair, determine the fourth intersection point between the normal of each second sampling point in the optimized skeleton segment and the boundary segment, and calculate the distance between each fourth intersection point and the corresponding second sampling point. Take the maximum distance as the reference value of the second skeleton boundary pair. Calculate the fourth distance between each boundary point in the boundary segment and the optimized skeleton segment, and determine the boundary point corresponding to the fourth distance less than the reference value as a reliable boundary point. Connect the reliable boundary points in the boundary segment in a clockwise or counterclockwise direction to obtain the closed region of the second skeleton boundary pair.

[0197] The embroidery order of the closed regions of each second skeleton boundary pair is determined, and the embroidery parameters of the monochrome connected region are determined based on the embroidery order and the attribute characteristics of each closed region.

[0198] The schematic diagram of the skeletal repair is as follows: Figure 6 As shown.

[0199] The detection method for endpoints and connections in the repaired skeleton includes: determining the number of neighboring skeleton pixels of each skeleton pixel in the skeleton binary image corresponding to the repaired skeleton, where the number of neighboring skeleton pixels is the number of skeleton pixels in the neighborhood of the skeleton pixel, and the skeleton pixel is the pixel in the skeleton binary image where the repaired skeleton is located; and determining the endpoints and connections in the repaired skeleton based on the number of neighboring skeleton pixels of each skeleton pixel. Further, based on the result that the number of neighboring skeleton pixels of a skeleton pixel is 1, the skeleton pixel is determined to be an endpoint in the repaired skeleton; based on the result that the number of neighboring skeleton pixels of a skeleton pixel is greater than or equal to 3, the skeleton pixel is determined to be a connection point in the repaired skeleton.

[0200] Determining the boundary segment associated with each optimized skeleton segment from the boundary segments means identifying the boundary segment closest to the optimized skeleton segment as the associated boundary segment.

[0201] The second skeleton boundary pair includes an optimized skeleton segment and a boundary segment associated with that optimized skeleton segment.

[0202] For each second skeleton boundary pair, the following operations are performed: determine the fourth intersection point of the normal of each second sampling point in the optimized skeleton segment of the second skeleton boundary pair with the boundary segment, and calculate the distance between each fourth intersection point and the corresponding second sampling point, taking the maximum distance as the reference value of the second skeleton boundary pair; calculate the fourth distance between each boundary point in the boundary segment and the optimized skeleton segment, and determine the boundary point corresponding to the fourth distance less than the reference value as a reliable boundary point; connect the reliable boundary points in the boundary segment in a clockwise or counterclockwise direction to obtain the closed region of the second skeleton boundary pair.

[0203] The intersection of the normal of the second sampling point and the fourth intersection of the boundary segment can be determined by constructing a ray equation.

[0204] The second sampling point corresponding to the fourth intersection point is the second sampling point used to obtain the fourth intersection point. For example, if the normal of the second sampling point 1 intersects the boundary segment at the fourth intersection point 2, then the second sampling point corresponding to the fourth intersection point 2 is the second sampling point 1.

[0205] The maximum distance refers to the maximum value among the distances between each fourth intersection point and the corresponding second sampling point.

[0206] The boundary point corresponding to the fourth distance less than the reference value refers to the boundary point where the fourth distance is less than the reference value. For example, if the fourth distance S between boundary point 1 and the optimized skeleton segment is less than the reference value, then the boundary point corresponding to the fourth distance S is boundary point 1, which is a reliable boundary point.

[0207] Each pair of second skeleton boundaries yields a closed region, also known as a basic embroidery unit. A schematic diagram of each closed region in a monochromatic connected domain is shown below. Figure 7 As shown.

[0208] The embroidery sequence is the order in which the closed areas are embroidered. Embroidery parameters include, but are not limited to, stitch type, stitch length, stitch density, and stitch direction.

[0209] The attributes include the perimeter and area of ​​the closed region.

[0210] Furthermore, embroidery parameters can be set through a pre-defined rule base, or recommended using machine learning or deep learning models trained on a large amount of embroidery element data.

[0211] In this embodiment, a repair skeleton is obtained based on the first, second, and third repair skeleton segments corresponding to each set. This effectively avoids the problem of discontinuity in the original skeleton caused by image noise, breaks, or missing parts. By determining the fourth intersection point between the normal of each second sampling point in the optimized skeleton segment and the boundary segment, and calculating the distance between each fourth intersection point and the corresponding second sampling point, the maximum distance is used as the reference value for the second skeleton boundary pair, thus enabling dynamic setting of the reference value. By calculating the fourth distance between each boundary point in the boundary segment and the optimized skeleton segment, and determining the boundary point corresponding to the fourth distance less than the reference value as a reliable boundary point, noise points, burrs, or false detection boundaries can be effectively eliminated, improving the accuracy of closed regions.

[0212] In one embodiment, the process of determining the embroidery order of each enclosed area includes:

[0213] S102. Determine the boundary point with the smallest x-coordinate from the reliable boundary points of each closed region, and use the boundary point with the smallest x-coordinate as a candidate reference point.

[0214] Furthermore, based on the fact that there are multiple boundary points with the smallest abscissa, the boundary point with the smallest ordinate is determined from these multiple boundary points with the smallest abscissa, and the boundary point with the smallest ordinate is used as the candidate reference point.

[0215] S104. From the candidate reference points of each closed region, determine the reference point with the smallest x-coordinate, and take the closed region corresponding to the reference point as the initial backbone.

[0216] Furthermore, based on the fact that there are multiple reference points with the smallest abscissa, the reference point with the smallest ordinate is determined from these multiple reference points with the smallest abscissa, and the closed region corresponding to the reference point with the smallest ordinate is taken as the initial backbone.

[0217] S106. Add the closed regions that are connected to the beginning and end of the initial trunk to the initial trunk to obtain a new trunk, and determine the closed regions that are not connected to the beginning and end of the initial trunk as branches of the initial trunk.

[0218] The closed region that is connected to the beginning and end of the initial trunk refers to a closed region that shares a common boundary with the initial trunk, and that the common boundary is not located in the middle part of the initial trunk.

[0219] A closed region that is not connected end-to-end with the initial trunk refers to a closed region that shares a common boundary with the initial trunk, and that common boundary is located in the middle part of the initial trunk.

[0220] A closed region connected to a branch is also a branch.

[0221] S108. Update the initial trunk in step S106 to a new trunk, and repeat step S106 until there are no closed regions connected to the beginning and end of the initial trunk, thus obtaining the final new trunk.

[0222] The final new trunk and all branches form a branch tree.

[0223] S110. The order in which each closed region is added to the final new trunk is determined as the first traversal order of each closed region in the final new trunk.

[0224] S112. Determine the second traversal order of each closed region in the branches of the new main trunk in the order of the first traversal.

[0225] When traversing closed regions in a new main branch, the closed region in the currently traversed new main branch is taken as the target region. When the target region has multiple branches, the branch with the fewest branches is traversed first. When traversing a branch with the fewest branches, the deepest closed region in the branch is traversed first (in a branch, go to the end first, then backtrack). After traversing all branches of a closed region in the new main branch, the branches of the next closed region in the new main branch are traversed in the first traversal order, and the traversal order of each closed region in the branch determines the second traversal order of each closed region in the branch.

[0226] S114. Based on the second traversal order and the first traversal order of each closed area in the branch of the new main trunk, determine the embroidery order of each closed area.

[0227] In this embodiment, the embroidery sequence of each closed area is determined by the second traversal sequence and the first traversal sequence of each closed area in the branch of the new main trunk. This generates an embroidery sequence that is spatially continuous, has the fewest skipped stitches, and has a reasonable process. This effectively solves the problems of chaotic paths, low efficiency, and easy wrinkling in automatic embroidery of multi-closed area patterns, and significantly improves the automation level and embroidery quality of the intelligent embroidery system.

[0228] In one embodiment, the process of determining the stitch parameters for each closed region includes:

[0229] The stitch type for each closed region is determined based on its perimeter and area.

[0230] The stitch length of each closed area is determined based on the stitch type, perimeter, and area of ​​each closed area.

[0231] Through formula Calculate the needle density ρ in each closed region, where ρ0 is the baseline density, and S s S is the area factor. s =a / a0, where a0 is the baseline area, a is the area of ​​the enclosed region, and Ft For fabric compensation coefficient, T s Here are the coefficients corresponding to the stitch type, k1 and k2 are weight parameters, and C is a complexity factor;

[0232] The stitch direction for each closed area is determined according to the embroidery sequence of each closed area.

[0233] Based on the stitch type, stitch length, and stitch direction of each closed region in a monochrome connected region, the embroidery parameters of the monochrome connected region are determined.

[0234] Specifically, a) based on The result determined the stitch type to be the flat wrap stitch, a std The default value is 10; b) Based on and The result determined the stitch type to be a flat wrap stitch, r = p / a, r std The default value is 3, p is the perimeter of the closed region, and a is the area of ​​the region. std Here, r is the preset area threshold, and r is the ratio of the contour perimeter to the area. std c) Based on the preset ratio threshold; and The results determined the stitch type to be the tatam stitch. Further, the closed area was embroidered using the thread with the highest cosine similarity to the RGB values ​​of the closed area.

[0235] Specifically, a) calculate the reference stitch distance k base The default value is 10; b) Calculate the complexity factor. c) Define the embroidery effect parameter E. When the embroidery effect parameter E is a flat satin stitch, the embroidery effect parameter E is 0.8; when the embroidery effect parameter E is a tatami stitch, the embroidery effect parameter E is 1.2; d) Through Calculate the stitch length L, L base k is the baseline stitch distance. base This is a preset baseline value. Stitch length refers to the straight-line distance between the point where each stitch lands and the point where the next stitch lands on a sewing machine.

[0236] Methods for determining stitch direction: a) Define parent and child units: For a basic embroidery unit, if it has branches, it is the parent unit of its branches; if it is a branch of other basic embroidery units, it is the child unit of those other basic embroidery units; b) Define the length of the backbone path: the length of the shortest reachable backbone segment between any two points on the backbone; c) For a basic embroidery unit, if it has no child units or parent units, the endpoint with the smaller x-coordinate is the starting point, and the endpoint with the larger x-coordinate is the ending point; d) For a basic embroidery unit, if it has no child units but has a parent unit, the endpoint with the larger backbone path length to the parent unit's backbone is the starting point, and vice versa; e) For a basic embroidery unit, if it has child units but no parent units, the endpoint with the smaller backbone path length to the child unit's backbone is the starting point, and vice versa; f) For a basic embroidery unit, if it has child units and a parent unit, the endpoint with the smaller backbone path length to the child unit's backbone is the starting point, and vice versa.

[0237] Furthermore, ρ0 is 10, a0 is 100, and F t The value is 1, and the corresponding T for the flat wrap stitch method is 1. s The value is 1.2, corresponding to T in the Tatamyx acupuncture method. s The value is 1.2, and k1 and k2 are 1.

[0238] Furthermore, the monochromatic connected domain containing the closed region is scaled proportionally to a length of L1, and the perimeter and area of ​​the closed region are determined based on the result of the proportional scaling. The default value of L1 is 1024.

[0239] Furthermore, the needle point coordinates are calculated based on the embroidery parameters and the shape of the closed area, and the coordinates of each needle point constitute the embroidery trajectory; an executable file is generated to store the outline perimeter, area, embroidery parameters and needle point coordinates of all closed areas, so as to control the embroidery machine to perform embroidery through the executable file. The executable file includes, but is not limited to, DST, EXP and other format files.

[0240] In this embodiment, the stitch type for each closed area is determined based on its perimeter and area. This avoids the accumulation caused by using filler stitches in small areas or the sparseness caused by using flat stitches in large areas, ensuring visual consistency and process rationality. By determining the stitch length for each closed area based on its stitch type, perimeter, and area, material utilization is improved and thread consumption costs are reduced. (The formula is used to...) Calculating the stitch density of each enclosed area allows for adaptive density control, preventing deformation, exposed fabric, or loose stitches caused by a "one-size-fits-all" approach. By determining the stitch direction of each enclosed area based on the embroidery sequence, continuous needle movement is maximized during actual embroidery, reducing idle movement and thread cutting, minimizing mechanical wear on the embroidery machine, improving production efficiency, and preventing fabric tension imbalance or wrinkling caused by sudden changes in direction.

[0241] This application also provides an application scenario in which the above-described method for generating embroidery trajectories from a target embroidery image is applied. Specifically, the overall flowchart of the method for generating embroidery trajectories from a target embroidery image is as follows: Figure 8 As shown. The application of this embroidery trajectory generation method for the target image in this application scenario is as follows:

[0242] Input target image and preprocessing: Receives target images of any style and performs image processing;

[0243] Closed region generation: Segmenting closed regions based on image features;

[0244] Generate embroidery sequence for enclosed areas: Plan the embroidery sequence between enclosed areas;

[0245] Adaptive setting of embroidery parameters: Automatically sets embroidery parameters based on the metadata of the closed area;

[0246] Track generation: Generates the final embroidery track.

[0247] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0248] Based on the same inventive concept, this application also provides an embroidery trajectory generation device for implementing the embroidery trajectory generation method for embroidered target images as described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the embroidery trajectory generation device for embroidered target images provided below can be found in the limitations of the embroidery trajectory generation method for embroidered target images described above, and will not be repeated here.

[0249] In one embodiment, an embroidery trajectory generation device for embroidering a target image is provided, comprising:

[0250] The splitting module is used to divide the skeleton of the monochrome connected region in the target image into multiple initial skeleton segments and divide the boundary of the monochrome connected region into multiple boundary segments.

[0251] The association module is used to determine the boundary segments associated with each initial skeleton segment based on the distance between each initial skeleton segment and each boundary segment, and to remove unreliable parts of each initial skeleton segment to obtain multiple skeleton segments; the skeleton segments associated with the same boundary segment constitute a set.

[0252] The repair module is configured to, for each set, determine the two closest first endpoints from the endpoints of the skeleton segments in the set; determine the first intersection points of the normals of the two first endpoints with the boundary segments associated with the skeleton segments in the set; scale, rotate, and translate the boundary between the two first intersection points to obtain a first connecting line; and connect the first connecting line with the two first endpoints to obtain a first repaired skeleton segment to which the skeleton segments to which the two first endpoints belong are repaired.

[0253] The file generation module is used to determine the embroidery parameters for embroidering the monochrome connected region based on the first repair skeleton segment corresponding to each of the sets, so as to generate an embroidery trajectory for embroidering the target image based on the embroidery parameters of the monochrome connected region.

[0254] Each module in the aforementioned embroidery trajectory generation device for generating the target embroidery image can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0255] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores various types of data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a method for generating embroidery trajectories for embroidering target images.

[0256] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0257] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0258] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0259] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0260] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0261] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0262] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0263] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for generating embroidery trajectories for embroidering target images, characterized in that, The method includes: S1. Divide the skeleton of the monochrome connected region in the target image into multiple initial skeleton segments, and divide the boundary of the monochrome connected region into multiple boundary segments; S2. Based on the distance between each initial skeleton segment and each boundary segment, determine the boundary segment associated with each initial skeleton segment, and remove the unreliable parts of each initial skeleton segment to obtain multiple skeleton segments; the skeleton segments associated with the same boundary segment constitute a set. S3. For each set, determine the two closest first endpoints from the endpoints of the skeleton segments in the set; determine the first intersection points of the normals of the two first endpoints and the boundary segments associated with the skeleton segments in the set; scale, rotate and translate the boundary between the two first intersection points to obtain a first connecting line, and connect the first connecting line to the two first endpoints to obtain the first repaired skeleton segment after the skeleton segments to which the two first endpoints belong are repaired. S4. Based on the first repair skeleton segment corresponding to each set, determine the embroidery parameters for embroidering the monochrome connected region, and generate an embroidery trajectory for embroidering the target image based on the embroidery parameters of the monochrome connected region.

2. The method according to claim 1, characterized in that, The method for obtaining the monochromatic connected component in step S1 includes: Determine the target image to be embroidered; The target image is semantically segmented to obtain a semantic region map, where each region in the semantic region map corresponds to a category; Perform color similarity analysis on each of the regions to obtain the analysis results for each region. Based on the analysis results of each region, color merging is performed on each region to obtain the color-simplified region corresponding to each region; Each of the color simplification regions is divided into monochrome connected regions formed by merging pixels with the same pixel value and adjacent positions, to obtain at least one monochrome connected region in each color simplification region, and each monochrome connected region is subjected to noise reduction and edge smoothing processing.

3. The method according to claim 1 or 2, characterized in that, Step S1 includes: The skeleton of the monochrome connected region after denoising and edge smoothing is extracted to obtain a skeleton binary map, and the contour of the monochrome connected region after denoising and edge smoothing is detected to obtain a set of boundary points. The number of adjacent skeleton pixels of each skeleton pixel in the skeleton binary image is determined. The number of adjacent skeleton pixels is the number of skeleton pixels in the neighborhood of the skeleton pixel. The skeleton pixel is the pixel point where the skeleton is located in the skeleton binary image. Based on the number of adjacent skeleton pixels of each skeleton pixel, the endpoints and connection points in the skeleton are determined, and the inflection points in the set of boundary points are determined. Based on the endpoints and connection points in the skeleton, the skeleton is divided into multiple initial skeleton segments; based on the inflection points, the boundary points in the boundary point set are divided into multiple groups, and each group of boundary points constitutes a boundary segment, thus obtaining multiple boundary segments.

4. The method according to claim 3, characterized in that, The process of determining the inflection points in the set of boundary points includes: Gaussian filtering is applied to each boundary point in the boundary point set to obtain filtered boundary points. Based on each of the adjacent filter boundary points, the derivative of each filter boundary point is calculated respectively, where the adjacent filter boundary points are the filter boundary points of adjacent boundary points. Using each of the boundary points as the center point, and based on the derivative of each of the filtered boundary points, calculate the first distance between each of the boundary points in the neighborhood of each of the center points and the tangent of the center point; The first distances of each of the stated center points are summed to obtain the inflection point scores of each center point, and the first median of each inflection point score is determined. Score ; Calculate the first difference between each inflection point score and the first median, and determine the second median MAD from the first difference; Through formula Calculate the dynamic score threshold T. As a regulating factor; The boundary point corresponding to the inflection point score that is greater than the dynamic score threshold is determined as the inflection point.

5. The method according to claim 1, characterized in that, Step S2 includes: Calculate the target distance between each first sampling point in each of the initial skeleton segments and each of the boundary segments; Based on the target distances of each of the first sampling points, determine the shortest distance d corresponding to each of the first sampling points. min and the shortest distance d min With preset weighting coefficients Multiply by each sample to obtain the weighted distance corresponding to each of the first sampling points. ; For each of the first sampling points, a boundary segment from the boundary segments in which the target distance is less than the corresponding weighted distance is determined, and this boundary segment is identified as the boundary segment associated with the first sampling point. Construct multiple first skeleton boundary pairs; each first skeleton boundary pair consists of an initial skeleton segment and boundary segments associated with each of the first sampling points of the initial skeleton segment: For each pair of first skeleton boundaries, determine the normal angle N of each of the first sampling points in the initial skeleton segment. sample The normals of each of the first sampling points intersect the two second intersection points of the associated boundary segment; calculate the average value S of the normal angles at the two second intersection points. mean ;based on Unreliable sampling points in the initial skeleton segment are determined, and K1 is the threshold for judging whether the first sampling point is reliable; Unreliable portions between adjacent unreliable sampling points in each of the initial skeleton segments are removed.

6. The method according to claim 1, characterized in that, The method further includes: Based on the first endpoint in each of the skeleton segments, determine the non-first endpoints in each of the skeleton segments; Using the non-first endpoint as the second endpoint, determine the normal angle of each second endpoint; Calculate the second difference between each of the normal angles, and determine the target difference that is less than the angle difference threshold among the second differences, and the two second endpoints to which the target difference belongs, wherein the two second endpoints to which the target difference belongs constitute an endpoint set; Calculate the second distance between the two second endpoints in each endpoint set, and sort the endpoint sets from smallest to largest according to the second distance to obtain the endpoint set sorting result; According to the sorting result of the endpoint set, connect the two second endpoints in each endpoint set in sequence to obtain the second repaired skeleton segment after the skeleton segment to which the two second endpoints in the endpoint set belong. The second endpoints are prohibited from being connected twice.

7. The method according to claim 6, characterized in that, The method further includes: Identify the third endpoint in each of the skeleton segments, excluding the first endpoint and the second endpoint that is already connected to other endpoints; For each of the third endpoints, a third intersection point is determined between the normal of the third endpoint and the associated boundary segment, and a third distance is determined between the third intersection point and each endpoint of the associated boundary segment. Based on the third distance, a target endpoint closest to the third intersection point is determined from each endpoint of the associated boundary segment, and the portion between the third intersection point and the target endpoint is scaled and rotated to obtain a second connecting line. One end of the second connecting line is connected to the third endpoint, and the other end of the second connecting line is connected to the associated boundary segment to obtain the third repaired skeleton segment to which the third endpoint belongs.

8. The method according to claim 7, characterized in that, The process of determining the embroidery parameters of the monochromatic connected region in step S4 includes: Based on the first repair skeleton segment, each second repair skeleton segment, and each third repair skeleton segment corresponding to each set, a repair skeleton is obtained; Based on the endpoints and connection points in the repair skeleton, the repair skeleton is divided into multiple optimized skeleton segments, and based on the distance between each optimized skeleton segment and each boundary segment, a boundary segment associated with each optimized skeleton segment is determined from the boundary segments; the optimized skeleton segments and the associated boundary segments constitute a second skeleton boundary pair. For each second skeleton boundary pair, determine the fourth intersection point between the normal of each second sampling point in the optimized skeleton segment and the boundary segment, and calculate the distance between each fourth intersection point and the corresponding second sampling point. Take the maximum distance as the reference value of the second skeleton boundary pair. Calculate the fourth distance between each boundary point in the boundary segment and the optimized skeleton segment, and determine the boundary points corresponding to the fourth distances less than the reference value as reliable boundary points. Connect the reliable boundary points in the boundary segment in a clockwise or counterclockwise direction to obtain the closed region of the second skeleton boundary pair. The embroidery order of the closed regions of each of the second skeleton boundary pairs is determined, and the embroidery parameters of the monochrome connected region are determined based on the embroidery order and the attribute characteristics of each closed region.

9. The method according to claim 8, characterized in that, The embroidery sequence for each of the aforementioned enclosed areas includes: S102. Determine the boundary point with the smallest abscissa from the reliable boundary points of each closed region, and use the boundary point with the smallest abscissa as a candidate reference point. S104. From the candidate reference points of each closed region, determine the reference point with the smallest horizontal coordinate, and take the closed region corresponding to the reference point as the initial backbone; S106. The closed regions that are connected to the initial trunk end to end are added to the initial trunk to obtain a new trunk, and the closed regions that are not connected to the initial trunk end to end are determined as branches of the initial trunk. S108. Update the initial trunk in step S106 to the new trunk, and repeat step S106 until there are no closed regions connected to the beginning and end of the initial trunk, to obtain the final new trunk. S110. The order in which each of the closed regions is added to the final new trunk is determined as the first traversal order of each of the closed regions in the final new trunk. S112. Determine the second traversal order of each closed region in the branches of the new trunk in the order of the first traversal; S114. Based on the second traversal order and the first traversal order of each closed area in the branch of the new main trunk, determine the embroidery order of each closed area.

10. The method according to claim 9, characterized in that, Based on the embroidery sequence and the attribute characteristics of each closed region, the embroidery parameters of the monochromatic connected region are determined, including: The stitch type of each closed region is determined based on the perimeter and area of ​​the closed region. The stitch length of each closed region is determined according to the stitch type, perimeter, and area of ​​each closed region. Through formula Calculate the stitch density ρ of each closed region, where ρ0 is the reference density, and S s S is the area factor. s =a / a0, where a0 is the baseline area, a is the area of ​​the enclosed region, and F t For fabric compensation coefficient, T s Here are the coefficients corresponding to the stitch type, k1 and k2 are weight parameters, and C is a complexity factor; The stitch direction of each of the closed areas is determined according to the embroidery sequence of each closed area; Based on the stitch type, stitch length, and stitch direction of each closed region in the monochrome connected region, the embroidery parameters of the monochrome connected region are determined.