Embroidery pattern generation method based on texture synthesis, computer device, storage medium and program product
Patent Information
- Application Number
- CN202310350373.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-04-04
AI Technical Summary
[0028]作为一个总的发明构思,本发明还提供了一种计算机程序产品,包括计算机程序,在计算机程序被计算机设备执行的情况下,使得计算机设备执行所述的基于纹理合成的刺绣图案生成方法。
Smart Images

Figure CN118781167B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of three-dimensional clothing design, and more specifically to a method for generating embroidery patterns based on texture synthesis. Background Technology
[0002] Embroidery is a handicraft with a strong ethnic style and a common clothing accessory widely used in clothing design and production. With the digitalization of clothing becoming a trend, embroidery will also participate as an important element in the virtual design and online display of clothing.
[0003] Embroidery embellishments in 3D clothing can be achieved by creating material maps of the embroidered garment. This method requires a designer to create an embroidery pattern, determining the base fabric, embroidery thread, and color scheme. A pattern maker then uses industrial software to create the pattern, which is then produced using an electronic embroidery machine. Finally, professional material scanning software is used to scan the pattern and obtain its material map. This method is cumbersome and time-consuming. Alternatively, professional designers can directly design and draw the embroidery, but this method has a high skill threshold and is more difficult.
[0004] Converting sample designs directly into embroidery style through image processing is more in line with the needs of virtual clothing design and display. These methods simulate the visual effect of embroidery style using images, and these studies can be divided into synthesis methods based on overall style and synthesis methods based on local units.
[0005] Global style-based synthesis methods focus on macroscopically simulating or transferring embroidery styles. These methods typically combine neural networks and deep learning techniques to extract semantic features from images for style transfer. Existing solutions suffer from two problems that are difficult to address simultaneously: either they fail to maintain clear details, or they lack scalability due to reliance on high-resolution datasets. Furthermore, after completing the embroidery style transfer, these methods often struggle to adjust and improve the embroidery effect according to specific needs.
[0006] Local embroidery texture synthesis methods focus on simulating embroidery styles from unit textures or local details. Existing methods can produce neat and aesthetically pleasing embroidery patterns when dealing with designs with simple structures and colors. However, when faced with patterns with more complex structures or colors, on the one hand, color block segmentation operations result in messy embroidery blocks and false boundaries within the areas; on the other hand, the stitch trends are difficult to match the shape of the areas, causing obvious joining problems. Furthermore, for typical satin embroidery effects commonly used in production, existing embroidery generation methods either rely on user interaction (see the work of Cui D, Sheng Y, Zhang G. Image-based embroidery modeling and rendering[J]. Computer Animation and Virtual Worlds, 2017, 28(2):e1725.) or require a longer time for region structure matching and generation (see the work of Guan X., Luo L., Li H. et al. Automatic embroidery texture synthesis for garment design and online display[J]. The VisualComputer, 2021, 37(9):2553-2565.).
[0007] In conclusion, in the context of digital clothing design, there is still a need for an efficient method for generating embroidery patterns that can automatically convert between the design draft and the displayed embroidery effect, adapt to complex and diverse patterns, colors and structures, and facilitate modifications. Summary of the Invention
[0008] This invention provides a method for generating embroidery patterns based on texture synthesis. Compared with previous methods, this invention can adapt to image areas with complex structures and gradient colors, and quickly convert images into embroidery effects of a specified stitch type.
[0009] The specific technical solution is as follows:
[0010] An embroidery pattern generation method based on texture synthesis includes an embroidery layer decomposition stage and an embroidery type-based texture synthesis stage;
[0011] The embroidery layer decomposition stage includes: extracting a set of main colors and a set of grayscale layers corresponding to each monochrome from the input image, and dividing each grayscale layer into the same number of grayscale regions according to a uniform preset threshold range;
[0012] The texture synthesis stage based on embroidery type includes the following steps:
[0013] 1) Decompose the input stitch sample material to extract the material skeleton; replace the original color of the stitch sample material with the main color extracted in the embroidery layer decomposition stage to obtain a set of sample texture materials corresponding to each monochrome.
[0014] 2) Extract a set of embroidery paths for each grayscale region, and merge the embroidery paths extracted from grayscale regions with the same threshold range in all grayscale layers into the same path group.
[0015] 3) For each embroidery path, use a texture synthesis algorithm to synthesize embroidery textures along the embroidery path. Each path group obtains an embroidery texture layer. All embroidery texture layers are superimposed to obtain the final embroidery texture synthesis result.
[0016] In one embodiment, the embroidery pattern generation method based on texture synthesis, in the embroidery layer decomposition stage, first preprocesses the input image using smoothing filtering to reduce image noise interference, and then extracts a set of main colors and a set of grayscale layers corresponding to each monochrome.
[0017] In one embodiment, the embroidery pattern generation method based on texture synthesis, in the embroidery layer decomposition stage, uses an image layering method based on RGB color space geometry to extract a set of main colors from the input image, and extracts a set of grayscale layers corresponding to each monochrome based on this set of main colors.
[0018] In the embroidery layer decomposition stage, the lower limit of the threshold range of a grayscale region reflects the density level of that grayscale region. In one embodiment, the embroidery pattern generation method based on texture synthesis, in a grayscale layer, there are overlapping areas between grayscale regions of adjacent density levels, as well as between the grayscale regions of the lowest and highest density levels. This avoids discontinuities and false boundaries after grayscale layer segmentation of the same color, and subsequent texture synthesis can achieve better fusion results.
[0019] In one embodiment, in step 2) of the texture synthesis-based embroidery pattern generation method, the embroidery path is extracted using a corresponding method based on the stitch type selected by the user. Specifically:
[0020] For flat stitch embroidery: use grayscale morphological erosion operation to progressively erode grayscale areas. After each erosion is completed, use contour extraction algorithm to extract the current contour as an embroidery path. Repeat this operation until the grayscale area is completely eroded to obtain a set of embroidery paths for this grayscale area.
[0021] For satin embroidery: First, extract the grayscale region outline. Then, sample the grayscale region outline at equal intervals to obtain a set of outline sample points. Use triangulation to segment the grayscale region using this set of outline sample points. For each segmented triangular facet, the two longest triangular sides determine the main direction of the facet. The two endpoints of each specific path within each triangular facet are determined as follows: take the intersection of the two long sides of the triangular facet as a fixed endpoint of each path within the triangular facet. For the other endpoint of each path, obtain it by sampling at equal intervals between the two endpoints of the shortest side of the triangular facet. This interval is an integer multiple of the width of the stitch sample material. This yields a set of embroidery paths with approximate directions and arranged side by side within a triangular facet. Traverse all the segmented triangular facets to obtain a set of embroidery paths for the target grayscale region.
[0022] In one embodiment, in the texture synthesis-based embroidery pattern generation method, step 3) involves synthesizing embroidery textures along the embroidery path using a corresponding texture synthesis algorithm based on the stitch type selected by the user. Specifically:
[0023] For flat stitch embroidery, texture generation is performed using UV mapping: For an embroidery path, the length of the material skeleton pixels extracted in step 1) is calculated. The embroidery path is then segmented according to the length of the material skeleton pixels, and the length number of each segment's path points is marked as the U coordinate value. For the embroidery path and its surrounding pixels, the V coordinate value is calculated based on the distance transformation of the effective pixels to the embroidery path. Then, texture mapping is performed on the sample texture material corresponding to each monochrome and the surrounding pixels of the embroidery path according to the UV coordinate values to obtain an embroidery texture.
[0024] For satin embroidery: For an embroidery path, the sample texture material corresponding to each monochrome color is rotated and scaled using affine transformation according to the direction and length of the embroidery path, and then placed at the center point of the embroidery path to generate an embroidery texture.
[0025] In one embodiment, in the embroidery pattern generation method based on texture synthesis, step 3) is set according to the order of all embroidery texture layers being superimposed, with the embroidery texture layer having the lowest threshold interval as the bottom layer.
[0026] The present invention also provides a computer device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, wherein when the computer program is run, the processor executes the aforementioned embroidery pattern generation method based on texture synthesis.
[0027] The present invention also provides a computer-readable storage medium storing a program or instructions that, when executed by a computer device, cause the computer device to perform the texture synthesis-based embroidery pattern generation method.
[0028] As a general inventive concept, the present invention also provides a computer program product, including a computer program that, when executed by a computer device, causes the computer device to perform the aforementioned texture synthesis-based embroidery pattern generation method.
[0029] Compared with the prior art, the beneficial effects of this invention are as follows:
[0030] 1. Design and implement a multi-layer automatic digital embroidery framework, including two stages: image layering and embroidery synthesis. The embroidery process includes automatic path extraction strategy and texture synthesis strategy. Its core ideas are: (1) to reduce the problem of false color boundaries in complex color images during synthesis by using the color diffusion effect generated by the overlapping and interlacing of multiple embroidery patterns; (2) to adapt to complex area shapes by adding an automatic path extraction step.
[0031] 2. Two partitioning steps, color and density (threshold), were designed in the image layering stage, so that the embroidery threads in each layer are arranged in an alternating manner in the result.
[0032] 3. During the texture synthesis stage, specific synthesis strategies were designed based on the different characteristics of straight stitch and satin weave. The straight stitch scheme uses morphological erosion and contour extraction to adapt to complex boundaries. The satin weave scheme uses triangulation to divide the facets and quickly determine the embroidery thread arrangement and direction. Attached Figure Description
[0033] Figure 1 This is a schematic flowchart of an embroidery pattern generation method based on texture synthesis according to the present invention.
[0034] Figure 2 This is an example diagram of the needle stitch sample material in a specific implementation method.
[0035] Figure 3 This is an example diagram illustrating the extraction of the main color and grayscale layers in a specific implementation.
[0036] Figure 4 This is an example diagram illustrating the division of grayscale regions into grayscale layers in a specific implementation method.
[0037] Figure 5 This is an example diagram for extracting the embroidery path of the flat stitch embroidery type in a specific implementation.
[0038] Figure 6 This is an example diagram for extracting the embroidery path of the satin embroidery type in a specific implementation.
[0039] Figure 7 This is an example diagram for calculating the U-coordinate value in a specific implementation.
[0040] Figure 8 This is an example diagram for calculating the V coordinate value in a specific implementation. Detailed Implementation
[0041] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention.
[0042] An embroidery pattern generation method based on texture synthesis takes a stitch sample image and an embroidery design draft (i.e., the input image) as input, where the stitch sample image is a pre-defined single stitch image, for example, such as... Figure 2 As shown. The needle mark sample material can be changed to achieve different effects.
[0043] like Figure 1 As shown, an embroidery pattern generation method based on texture synthesis includes an embroidery layer decomposition stage (i.e., a layering stage) and a texture synthesis stage based on embroidery type.
[0044] The embroidery layer decomposition stage includes:
[0045] 1) The input image is first preprocessed using a smoothing filter to reduce image noise interference. Then, an image layering method based on RGB color space geometry is used to extract the convex hull of the pixel information in the preprocessed image in multi-dimensional space and simplify it. A set of main colors of the image is extracted based on the convex hull vertices, and a set of grayscale layers corresponding to each monochrome is extracted based on this set of main colors. For example, ... Figure 3 As shown.
[0046] 2) Each grayscale layer is divided into three grayscale regions according to a uniformly preset threshold range: low-density, medium-density, and high-density regions. There are overlapping areas between low-density and medium-density regions, between medium-density and high-density regions, and between low-density and high-density regions. For example, ... Figure 4 As shown.
[0047] The texture synthesis stage based on embroidery type includes the following steps:
[0048] 3) Decompose the input stitch sample material to extract the material skeleton; replace the original color of the stitch sample material with the main color extracted in the embroidery layer decomposition stage to obtain a set of sample texture materials corresponding to each monochrome.
[0049] 4) Extract a set of embroidery paths for each grayscale area. Based on the stitch type selected by the user, the corresponding method is used to extract the embroidery paths. Specifically:
[0050] For flat stitch embroidery: Grayscale morphological erosion is used to progressively erode the grayscale area. After each erosion, a contour extraction algorithm is used to extract the current contour as an embroidery path. This operation is repeated until the grayscale area is completely eroded, resulting in a set of embroidery paths for that grayscale area. For example, ... Figure 5 As shown.
[0051] For satin embroidery: First, extract the grayscale region outline. Then, sample the grayscale region outline at equal intervals to obtain a set of outline sample points. Use triangulation to segment the grayscale region from this set of outline sample points. For each segmented triangular facet, the two longest sides determine the facet's main direction. The endpoints of each specific path within each triangular facet are determined as follows: the intersection of the two longest sides of the triangular facet is taken as one fixed endpoint of each path within that facet. The other endpoint of each path is obtained by sampling at equal intervals between the two endpoints of the shortest side of the triangular facet. This interval is an integer multiple of the width of the stitch sample material. This results in a set of embroidery paths with approximate directions and arranged side-by-side within a triangular facet. For example, ... Figure 6 As shown; by traversing all the triangular faces obtained from the segmentation, a set of embroidery paths for the target grayscale area is obtained.
[0052] In the flat stitch embroidery type, the path spacing generated for grayscale regions within the same threshold range is equal. In the satin stitch embroidery type, the contour sampling interval for grayscale regions within the same threshold range is equal.
[0053] Embroidery paths extracted from grayscale regions with the same threshold range in all grayscale layers are merged into the same path group.
[0054] 5) For each embroidery path, based on the stitch type selected by the user, the corresponding texture synthesis algorithm is used to synthesize the embroidery texture along the embroidery path. Specifically:
[0055] For flat stitch embroidery, texture generation is performed using UV mapping: For an embroidery path, the length of the material skeleton pixel extracted in step 1) is calculated. The embroidery path is then segmented based on the material skeleton pixel length, and the path points of each segment are marked with a length number, which serves as the U-coordinate value (see example). Figure 7 For the embroidery path and its surrounding pixels, calculate the V coordinate value based on the distance transformation of the effective pixels to the embroidery path (for example, see...). Figure 8 Then, texture mapping is performed on the sample texture material corresponding to each monochrome and the pixels around the embroidery path according to the UV coordinate values to obtain an embroidery texture.
[0056] For satin embroidery: For an embroidery path, the sample texture material corresponding to each monochrome color is rotated and scaled using affine transformation according to the direction and length of the embroidery path, and then placed at the center point of the embroidery path to generate an embroidery texture.
[0057] Each path group yields an embroidery texture layer. All embroidery texture layers are superimposed to obtain the final embroidery texture composite result. Specifically, the order in which all embroidery texture layers are superimposed is set according to the size of the lower limit of the threshold interval, with the embroidery texture layer with the lowest lower limit of the threshold interval serving as the bottom layer.
[0058] The embroidery pattern generation method based on texture synthesis of the present invention can simulate gradient effects using a limited number of embroidery thread colors, and can adapt well to complex area shapes for both flat stitch embroidery and satin embroidery types.
[0059] Furthermore, it should be understood that after reading the above description of the present invention, those skilled in the art can make various alterations or modifications to the present invention, and these equivalent forms also fall within the scope defined by the appended claims.
Claims
1. A method for generating embroidery patterns based on texture synthesis, characterized in that, This includes the embroidery layer decomposition stage and the texture synthesis stage based on embroidery type; The embroidery layer decomposition stage includes: extracting a set of main colors and a set of grayscale layers corresponding to each monochrome from the input image, and dividing each grayscale layer into the same number of grayscale regions according to a uniform preset threshold range; The texture synthesis stage based on embroidery type includes the following steps: 1) Decompose the input stitch sample material to extract the material skeleton; replace the original color of the stitch sample material with the main color extracted in the embroidery layer decomposition stage to obtain a set of sample texture materials corresponding to each monochrome. 2) Extract a set of embroidery paths for each grayscale region, and merge the embroidery paths extracted from grayscale regions with the same threshold range in all grayscale layers into the same path group; 3) For each embroidery path, use a texture synthesis algorithm to synthesize embroidery textures along the embroidery path. Each path group yields an embroidery texture layer, and all embroidery texture layers are superimposed to obtain the final embroidery texture synthesis result. In step 3), based on the stitch type selected by the user, the corresponding texture synthesis algorithm is used to synthesize the embroidery texture along the embroidery path. Specifically: For flat stitch embroidery, texture generation is performed using UV mapping: For an embroidery path, the length of the material skeleton pixels extracted in step 1) is calculated. The embroidery path is then segmented according to the length of the material skeleton pixels, and the length number of each segment's path points is marked as the U coordinate value. For the embroidery path and its surrounding pixels, the V coordinate value is calculated based on the distance transformation of the effective pixels to the embroidery path. Then, texture mapping is performed on the sample texture material corresponding to each monochrome and the pixels surrounding the embroidery path according to the UV coordinate values to obtain an embroidery texture. For satin embroidery: For an embroidery path, the sample texture material corresponding to each monochrome color is rotated and scaled using affine transformation according to the direction and length of the embroidery path, and then placed at the center point of the embroidery path to generate an embroidery texture.
2. The method for generating embroidery patterns based on texture synthesis according to claim 1, characterized in that, In the layer decomposition stage, the input image is first preprocessed using a smoothing filter, and then a set of main colors and a set of grayscale layers corresponding to each monochrome are extracted.
3. The method for generating embroidery patterns based on texture synthesis according to claim 1, characterized in that, In the embroidery layer decomposition stage, an image layering method based on RGB color space geometry is used to extract a set of main colors from the input image, and a set of grayscale layers corresponding to each monochrome is extracted based on this set of main colors.
4. The method for generating embroidery patterns based on texture synthesis according to claim 1, characterized in that, In the embroidery layer decomposition stage, the lower limit of the threshold range of the grayscale region reflects the density level of the grayscale region. In a grayscale layer, there are overlapping areas between grayscale regions of adjacent density levels, as well as between the grayscale regions of the lowest density level and the grayscale regions of the highest density level.
5. The method for generating embroidery patterns based on texture synthesis according to claim 1, characterized in that, In step 2), the embroidery path is extracted using the appropriate method based on the stitch type selected by the user. Specifically: For flat stitch embroidery: use grayscale morphological erosion operation to progressively erode grayscale areas. After each erosion is completed, use contour extraction algorithm to extract the current contour as an embroidery path. Repeat this operation until the grayscale area is completely eroded to obtain a set of embroidery paths for this grayscale area. For satin embroidery: First, extract the grayscale region outline. Then, sample the grayscale region outline at equal intervals to obtain a set of outline sample points. Use triangulation to segment the grayscale region using this set of outline sample points. For each segmented triangular facet, the two longest triangular sides determine the main direction of the facet. The two endpoints of each specific path within each triangular facet are determined as follows: take the intersection of the two long sides of the triangular facet as a fixed endpoint of each path within the triangular facet. For the other endpoint of each path, obtain it by sampling at equal intervals between the two endpoints of the shortest side of the triangular facet. This interval is an integer multiple of the width of the stitch sample material. This yields a set of embroidery paths with approximate directions and arranged side by side within a triangular facet. Traverse all the segmented triangular facets to obtain a set of embroidery paths for the target grayscale region.
6. The method for generating embroidery patterns based on texture synthesis according to claim 1, characterized in that, In step 3), the order in which all embroidery texture layers are superimposed is set according to the size of the lower limit of the threshold interval, with the embroidery texture layer with the lowest lower limit of the threshold interval being the bottom layer.
7. A computer device comprising a memory and a processor, the memory for storing a computer program, and the processor for executing the computer program stored in the memory, characterized in that, When the computer program is executed, the processor performs the embroidery pattern generation method based on texture synthesis as described in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that, when executed by a computer device, cause the computer device to perform the embroidery pattern generation method based on texture synthesis as described in any one of claims 1-6.
9. A computer program product, comprising a computer program, characterized in that, When a computer program is executed by a computer device, the computer device performs the embroidery pattern generation method based on texture synthesis as described in any one of claims 1-6.
Citation Information
Patent Citations
Image data processing method and system in Hunan embroidery platemaking process
CN113298081A
Embroidery VR image processing method and system based on hybrid guided filtering
CN114387263A