Embroidery needle path generation method, storage medium and computer program product
By generating multiple layers and integrating needle data, the distortion problem caused by color clustering in mechanical embroidery is solved, and the goal of using fewer colors to express the original image effect is achieved, reducing costs.
Patent Information
- Application Number
- CN202111354187.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2041-11-16
AI Technical Summary
In mechanical embroidery, the prior art generates needle paths through color clustering, resulting in severe distortion of the finished embroidery product and increasing costs.
By receiving images, multiple layers are generated, each layer contains unique color information and opacity information, and the needle data of each layer is integrated to generate complete needle data.
Use less colors to show an effect close to the original image, reducing distortion and saving mechanical embroidery costs.
Smart Images

Figure CN114155310B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of mechanical embroidery, and in particular to an embroidery needle path generation method, a storage medium and a computer program product. Background Art
[0002] Currently, in machine embroidery, the image needs to be preprocessed first, and the embroidery needle path is generated based on the processed image so that the machine can perform embroidery. The usual preprocessing method is to color cluster the image and generate needle paths of corresponding colors based on the color clustered image. However, the number of clustered colors is too small, which will cause the embroidery product to be seriously distorted compared to the original image. In order to reduce the distortion, the number of clustered colors needs to be increased, but this will also increase the cost of machine embroidery. Summary of the invention
[0003] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art, and to provide an embroidery needle path generation method, a storage medium and a computer program product, which can enable the embroidery product to show an effect close to the original image with fewer colors.
[0004] In a first aspect, the present invention provides an embroidery needle path generation method, comprising:
[0005] receiving an image;
[0006] A plurality of layers are obtained according to the image, wherein the layers include color regions, the color regions have unique color information, the color regions of different layers have different color information, and the color regions have opacity information corresponding to the color information;
[0007] Generate needle path data corresponding to the layer according to the color information and the opacity information of the layer;
[0008] The needle path data corresponding to each of the layers are integrated to obtain complete needle path data corresponding to the image.
[0009] The embroidery needle path generation method provided in the first aspect of the present invention has at least the following beneficial effects: based on the received image, a plurality of layers are obtained, the layers include color areas, the color area of one layer has unique color information, the color areas of different layers have different color information, each layer includes opacity information corresponding to each pixel position of each color in each color area, corresponding needle path data can be generated according to the color and opacity information of the layer, the needle path data corresponding to the plurality of layers are integrated to obtain complete needle path data corresponding to the original image, the generated needle path data includes opacity information corresponding to the color at different pixel positions, and the embroidery product completed according to the needle path data can show light and dark effects with a single color, that is, a single color can provide different visual effects on the embroidery product, so that an effect close to the original image can be shown with a limited number of colors, while reducing distortion and saving the cost of mechanical embroidery.
[0010] In one embodiment of the present invention, generating needle path data corresponding to the layer according to the color of the layer and the opacity information includes:
[0011] According to the layer color, determine the embroidery thread color of the corresponding needle path;
[0012] Controlling the corresponding needle path density according to the opacity information of the layer;
[0013] The needle path data corresponding to the layer is generated according to the embroidery thread color and the needle path density.
[0014] In one embodiment of the present invention, obtaining multiple layers according to the image includes:
[0015] According to the image, obtaining the color convex hull of the image;
[0016] Simplifying the color convex hull to obtain a simplified convex hull, wherein the simplified convex hull includes vertex information, and the vertex information is a predetermined layer color;
[0017] Obtaining opacity information of the predetermined layer color at each pixel position according to the vertex information and the pixel information of the image;
[0018] Each layer of the image is obtained according to the vertex information and the opacity information.
[0019] In one embodiment of the present invention, simplifying the color convex hull to obtain a simplified convex hull includes:
[0020] Uniformly sampling on the surface of the color convex hull to obtain sampling points;
[0021] According to the sampling points, plane fitting is iteratively performed to obtain a set of simplified planes, and the simplified planes constitute a simplified convex hull.
[0022] In one embodiment of the present invention, simplifying the color convex hull to obtain a simplified convex hull further includes:
[0023] The number of layers is received, and the vertices of the color convex hull are deleted one by one iteratively. When the number of remaining vertices is consistent with the number of layers, the iteration stops, and a simplified convex hull is obtained.
[0024] In one embodiment of the present invention, the iterative deletion of the vertices of the color convex hull one by one, when the number of remaining vertices is consistent with the number of layers, the iteration stops, and the simplified convex hull is obtained, including:
[0025] Excluding a vertex of the color convex hull, calculating the volume of the convex hull formed by the remaining vertices, and obtaining a remaining volume value corresponding to the excluded vertex;
[0026] Traversing the vertices of the color convex hull to obtain the residual volume value corresponding to each vertex;
[0027] Deleting one of the vertices according to the remaining volume value corresponding to each of the vertices;
[0028] Iteratively delete the vertices one by one, and when the number of remaining vertices is consistent with the number of layers, the iteration stops, and the simplified convex hull is obtained. The remaining vertices are the vertices of the simplified convex hull, and the simplified convex hull is obtained.
[0029] In one embodiment of the present invention, deleting a vertex according to the remaining volume value corresponding to each vertex includes:
[0030] Compare the remaining volume values corresponding to each of the vertices to obtain the maximum remaining volume value;
[0031] Delete the vertex corresponding to the maximum remaining volume value.
[0032] In one embodiment of the present invention, obtaining the opacity information of the predetermined layer color at each pixel position according to the vertex information and the pixel information of the image includes:
[0033] According to the color synthesis operation, a set of equations for synthesizing the pixel color with the predetermined layer color is obtained, wherein the set of equations includes opacity information to be solved;
[0034] The set of equations is optimized and solved to obtain opacity information of the predetermined layer color at each pixel position.
[0035] In a second aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the embroidery needle path generation method as described in any embodiment of the first aspect.
[0036] The computer-readable storage medium according to the second aspect of the present invention has at least the following beneficial effects: by executing the computer-executable instructions stored in the computer-readable storage medium, a plurality of layers can be obtained according to the received image, the layers including color areas, the color area of one layer having unique color information, the color areas of different layers having different color information, each layer including opacity information corresponding to each pixel position of each color in each color area, corresponding needle path data can be generated according to the color and opacity information of the layer, the needle path data corresponding to the plurality of layers can be integrated to obtain complete needle path data corresponding to the original image, the generated needle path data including opacity information corresponding to the color at different pixel positions, the finished embroidery product completed according to the needle path data can show light and dark effects with a single color, that is, a single color can provide different visual effects on the finished embroidery product, so that an effect close to the original image can be shown with a limited number of colors, while reducing distortion and saving the cost of mechanical embroidery.
[0037] In the third aspect, an embodiment of the present invention further provides a computer program product, comprising a computer program or computer instructions, wherein the computer program or the computer instructions are stored in a computer-readable storage medium, a processor of a computer device reads the computer program or the computer instructions from the computer-readable storage medium, and the processor executes the computer program or the computer instructions, so that the computer device executes the embroidery needle path generation method as described in any one of the embodiments of the first aspect.
[0038] The computer program product according to the third aspect of the present invention has at least the following beneficial effects: the computer program product includes a computer program or a computer instruction, and by executing the computer program or the computer instruction, a plurality of layers can be obtained according to the received image, the layers including color areas, the color area of one layer having unique color information, the color areas of different layers having different color information, each layer including opacity information corresponding to each pixel position of each color in each color area, corresponding needle path data can be generated according to the color and opacity information of the layer, the needle path data corresponding to the plurality of layers can be integrated to obtain complete needle path data corresponding to the original image, the generated needle path data including opacity information corresponding to the color at different pixel positions, the finished embroidery product completed according to the needle path data can show light and dark effects with a single color, that is, a single color can provide different visual effects on the finished embroidery product, so that an effect close to the original image can be shown with a limited number of colors, while reducing distortion and saving the cost of mechanical embroidery.
[0039] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be achieved by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.
[0041] The present invention is further described below in conjunction with the accompanying drawings and embodiments;
[0042] Figure 1 is a flowchart of the steps of an embroidery needle path generation method provided by an embodiment of the present invention;
[0043] Figure 2 is a flowchart of steps of an embroidery needle path generation method provided by another embodiment of the present invention;
[0044] Figure 3 is a flowchart of steps of an embroidery needle path generation method provided by another embodiment of the present invention;
[0045] Figure 4 is a flowchart of steps of an embroidery needle path generation method provided by another embodiment of the present invention;
[0046] Figure 5 is a flowchart of steps of an embroidery needle path generation method provided by another embodiment of the present invention;
[0047] Figure 6 is a flowchart of steps of an embroidery needle path generation method provided by another embodiment of the present invention;
[0048] Figure 7 It is a flowchart of the steps of an embroidery needle path generation method provided by another embodiment of the present invention. DETAILED DESCRIPTION
[0049] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.
[0050] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0051] The embodiments of the present invention provide an embroidery needle path generation method, a storage medium and a computer program product, which can enable an embroidery product to show an effect close to the original image with fewer colors.
[0052] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.
[0053] Reference Figure 1 A first aspect of the present invention provides an embroidery needle path generation method, including but not limited to step S1000, step S2000, step S3000 and step S4000.
[0054] Step S1000, receiving an image.
[0055] Step S2000: obtaining multiple layers according to the image. The layers include color regions, the color regions have unique color information, the color regions of different layers have different color information, and the color regions have opacity information corresponding to the color information.
[0056] It should be noted that the color area of a layer has a corresponding color, which corresponds to a unique RGB value. The RGB color mode is a color standard in the industry. RGB represents the colors of the three channels of red, green, and blue. This standard includes almost all colors that human vision can perceive and is one of the most widely used color systems. The color of a layer is unique, and the colors of different layers are different.
[0057] It should also be noted that the color of each layer has an opacity value corresponding to each pixel position within its own color area. The layer has no color at the pixel position outside its own color area. It can be understood that the opacity value corresponding to the color of the layer at the pixel position is zero. The opacity information of the layer includes the opacity values corresponding to each pixel position of the layer.
[0058] It can be understood that the opacity information of a layer refers to the opacity value corresponding to each pixel position, which implies the pixel position information.
[0059] Step S3000, generating needle path data corresponding to the layer according to the color information and opacity information of the layer.
[0060] Step S4000, integrating the needle path data corresponding to each layer to obtain complete needle path data corresponding to the image.
[0061] It is easy to understand that needle path data is generated according to the color information and opacity information of each layer, and mechanical embroidery is performed according to the complete needle path data. The finished embroidery product can show the opacity information corresponding to the color, so a single color can show light and dark effects, that is, a single color can provide different visual effects on the finished embroidery product, so that a limited number of colors can be used to show an effect close to the original image, reducing distortion while saving the cost of mechanical embroidery. In addition, the edge transition of the embroidery is smooth and can be better consistent with the outline of the original image.
[0062] It should also be noted that the obtained layers can be displayed so that users can view the effects of image layering, or the obtained layers can be synthesized to obtain a synthesized image, and the synthesized image can be displayed. The synthesized image has a visual effect similar to that of the embroidery, so that users can preview the effect of mechanical embroidery.
[0063] Reference Figure 2 The embodiment of the present invention provides another embroidery needle path generation method. Figure 2 yes Figure 1 Schematic diagram of another embodiment of the detailed step process of step S3000, where step S3000 includes but is not limited to step S3100, step S3200 and step S3300.
[0064] Step S3100, determining the embroidery thread color of the corresponding needle path according to the layer color. The layer has unique color information, and the embroidery thread color corresponding to the layer color can be selected according to the layer color. When there is no embroidery thread color that is completely consistent with the layer color, the color closest to the layer color can be selected as the embroidery thread color.
[0065] Step S3200, according to the opacity information of the layer, the corresponding needle density is controlled. According to the opacity information of each pixel position of the layer in the color area, the needle density of the corresponding position of the embroidery is controlled, and the embroidery product can achieve the effect of showing different shades of a single color through different needle densities.
[0066] Specifically, the greater the corresponding opacity value of the layer color at a certain pixel position, the greater the needle density of the embroidery at the corresponding position, so that the embroidery can express different shades using a single color.
[0067] Step S3300, generating needle path data corresponding to the layer according to the embroidery thread color and needle path density. The embroidery thread color is determined, and the needle path density of the corresponding embroidery needle at each position of the embroidery product is determined, and the needle path data corresponding to the layer can be generated.
[0068] It should be noted that in embroidery, the embroidery needle cooperates with the embroidery thread. For a layer, the layer color corresponds to the color of the embroidery thread used, and the opacity value of each pixel position in the layer color area corresponds to the needle path density of the embroidery needle at the corresponding position of the embroidery product.
[0069] It can be understood that by embroidering according to the needle path data obtained by the embroidery needle path generation method, the embroidery product can show different shades of effects using a single color, so that the embroidery product can show a visual effect close to the original image through fewer embroidery thread colors, with less distortion and saving the cost of embroidery machinery.
[0070] Reference Figure 3 The embodiment of the present invention provides another embroidery needle path generation method. Figure 3 yes Figure 1 Schematic diagram of another embodiment of the detailed process of step S2000 in FIG. 1 , wherein step S2000 includes but is not limited to step S2100, step S2200, step S2300 and step S2400.
[0071] Step S2100, obtaining the color convex hull of the image according to the image. According to all observed pixel colors of the image, the corresponding convex hull of the RGB space is calculated to obtain the color convex hull corresponding to the image.
[0072] Those skilled in the art should understand that PorterDuff.Mode is a set of methods for digital image synthesis. In digital images, the colors of many pixels are synthesized multiple times by different colors, and the color synthesis operation in PorterDuff.Mode is a linear synthesis between different colors. Since the color synthesis operation has a linear property, the colors of all pixels in the image are in the color convex hull of the image.
[0073] It is understandable that any pixel color can be expressed as a linear combination of the original colors, such as the following formula:
[0074] w i ∈(0,1) and Where P is the pixel color, c i is the original layer color, w i is the weight corresponding to the original layer color, and i is a natural number starting from 1.
[0075] It should also be noted that w i It is not an opacity value, and the formula is not applicable to non-linear synthesis. This embodiment adopts linear synthesis in PorterDuff.Mode, which is a set of commonly used digital image synthesis methods.
[0076] Step S2200, simplifying the color convex hull to obtain a simplified convex hull, wherein the simplified convex hull includes vertex information, and the vertex information is a predetermined layer color.
[0077] It can be understood that the number of vertices of the simplified convex hull is the number of layers.
[0078] It should be noted that the vertices of the color convex hull are color information. In practice, the color convex hull of an image is usually complex, that is, there are too many vertices. In order to obtain the layer of the original image, the color convex hull needs to be simplified. The vertex information of the simplified convex hull can be used as the predetermined layer color.
[0079] Step S2300, based on the vertex information and the pixel information of the image, the opacity information of the predetermined layer color at each pixel position is obtained. The vertex information of the simplified convex hull is the predetermined layer color, and the opacity value of each predetermined layer color at each pixel position can be obtained based on the vertex information and the pixel information of the image, that is, based on the predetermined layer color and the pixel of the image, and the opacity information includes the opacity value and the pixel position information.
[0080] Step S2400, obtaining each layer of the image according to the vertex information and the opacity information.
[0081] It should be noted that the vertex information of the simplified convex hull is the predetermined layer color, and the opacity information is the opacity value of each predetermined layer color at each pixel position. The layer of the image can be obtained based on the predetermined layer color and the opacity value of each predetermined layer color at each pixel position.
[0082] Reference Figure 4 The embodiment of the present invention provides another embroidery needle path generation method. Figure 4 yes Figure 3FIG. 2 is a schematic diagram of another embodiment of a detailed process of step S2200 in FIG. 2 , wherein step S2200 includes but is not limited to step S2210 and step S2220.
[0083] Step S2210: uniformly sample the color convex hull surface to obtain sampling points.
[0084] Step S2220, iteratively performing plane fitting according to the sampling points to obtain a set of simplified planes, and the simplified planes constitute a simplified convex hull.
[0085] In one embodiment, sampling points are uniformly selected on the surface of the color convex hull, and plane fitting is performed on the sampling points. Specifically, when the distance from the sampling point to the fitting plane is less than a first preset threshold, the sampling point is regarded as an inner point. When the proportion of the inner points in the sampling points reaches a certain value, the inner points are deleted, and the plane fitting is iteratively performed. When the remaining sampling points are less than a certain degree, the iteration stops, and a group of planes is obtained. The group of planes can better adapt to the sampling points, and the simplified convex hull formed by the group of planes can better conform to the original color convex hull with less distortion.
[0086] It should be noted that the preset threshold for determining whether a sampling point is an interior point can be adjusted, and this embodiment does not limit the specific value of the preset threshold, as long as a suitable fitting plane can be obtained according to the preset threshold.
[0087] It should also be noted that the remaining sampling points are less than a certain degree, that is, the ratio of the remaining sampling points to the total selected sampling points is less than the second preset threshold. This embodiment does not specifically limit the second preset threshold as long as an ideal fitting plane can be obtained.
[0088] Reference Figure 5 The embodiment of the present invention provides another embroidery needle path generation method. Figure 5 yes Figure 3 Schematic diagram of another embodiment of a detailed process of step S2200 in FIG. 2 , wherein step S2200 includes but is not limited to step S2230 and step S2240.
[0089] Step S2230, receiving the number of layers.
[0090] Step S2240, iteratively delete the vertices of the color convex hull one by one. When the number of remaining vertices is consistent with the number of layers, the iteration stops and a simplified convex hull is obtained.
[0091] In one embodiment, the number of layers is received, and the vertices of the color convex hull are iteratively deleted one by one. When the number of remaining vertices is consistent with the number of layers, the iteration stops and a simplified convex hull is obtained. The remaining vertices are used as the vertices of the simplified convex hull. The vertices of the simplified convex hull are the predetermined layer colors. The number of layers can be controlled, increasing the user's freedom.
[0092] It should be noted that the number of layers should be less than the number of vertices of the original color convex hull. In practice, the number of layers is usually in single digits.
[0093] It should also be noted that Figure 5 The methods provided are Figure 4 The methods provided are two parallel solutions, both of which can be used to simplify the color convex hull, but the simplification methods are different and the final layer effects are also different.
[0094] Reference Figure 6 The embodiment of the present invention provides another embroidery needle path generation method. Figure 6 yes Figure 5 Schematic diagram of another embodiment of the detailed process of step S2240 in , step S2240 includes but is not limited to step S2241, step S2242, step S2243 and step S2244.
[0095] Step S2241, exclude one vertex of the color convex hull, calculate the volume of the convex hull formed by the remaining vertices, and obtain the remaining volume value corresponding to the excluded vertex.
[0096] Step S2242, traverse the vertices of the color convex hull to obtain the residual volume value corresponding to each vertex.
[0097] Step S2243, delete a vertex according to the remaining volume value corresponding to each vertex.
[0098] Step S2244, iteratively delete vertices one by one, and when the number of remaining vertices is consistent with the number of layers, the iteration stops, and the remaining vertices are the vertices of the simplified convex hull, and the simplified convex hull is obtained.
[0099] In one embodiment, all vertices of the color convex hull are traversed, the residual volume value corresponding to each vertex is calculated, and one of the vertices is deleted according to the residual volume value corresponding to each vertex. The vertices of the color convex hull are deleted one by one in an iterative manner. When the number of remaining vertices is consistent with the layer, the iteration stops, and the remaining vertices are the vertices of the simplified convex hull.
[0100] Specifically, in one embodiment, the residual volume values corresponding to each vertex are compared, the largest residual volume value is found, and the vertex corresponding to the largest residual volume value is deleted.
[0101] It should be noted that the initial volume value of the original color convex hull may also be calculated, and then the difference between the initial volume value and the remaining volume value corresponding to each vertex may be calculated, and the vertex corresponding to the minimum difference may be found and deleted.
[0102] Reference Figure 7 The embodiment of the present invention provides another embroidery needle path generation method. Figure 7 yes Figure 3FIG. 2 is a schematic diagram of another embodiment of the detailed process of step S2300 in FIG. 2 , wherein step 2300 includes but is not limited to step S2310 and step S2320.
[0103] Step S2310, based on the color synthesis operation, obtain a set of equations for synthesizing pixel colors using predetermined layer colors, and the set of equations includes opacity information to be solved.
[0104] Step S2320, optimizing and solving the equation group to obtain opacity information of the predetermined layer color at each pixel position.
[0105] In one embodiment, the synthesis order of the layer colors is determined, the linear synthesis operation of PorterDuff.Mode is applied, the color of each pixel of the original image is synthesized with the predetermined layer colors, an equation group for solving the opacity information is established, and the equation group is optimized and solved to obtain the opacity information of the predetermined layer color at each pixel position. The application of the color synthesis operation is as follows: Where p is the pixel color, c i is the layer color, alpha i It is c i The opacity value of the color p and c i is the RGB value. Since RGB is three-dimensional, the formula is a group of three polynomial equations. For semi-transparent RGBA images, pre-increased colors should be used. The formula becomes a group of four polynomial equations. The background layer c0 is considered transparent, that is, the zero vector, and the remaining layers are color c i Considered opaque.
[0106] It should be noted that the synthesis order of layer colors can be specified by the user so that the final layer can better meet the user's expectations. It can also be determined randomly or according to certain conditions. This embodiment does not specifically limit the method for determining the synthesis order of layer colors.
[0107] It should also be noted that the system of equations may have infinite solutions. In order to obtain a satisfactory solution from the infinite solutions, regularization needs to be introduced to optimize the solution of the equation. Regularization means that in linear algebra theory, ill-posed problems are usually defined by a set of linear algebraic equations, and this set of equations usually comes from ill-posed inverse problems with large condition numbers. Large condition numbers mean that rounding errors or other errors will seriously affect the results of the problem. Specifically, two regularizations can be introduced. When a layer that is not a background layer is almost opaque, due to numerical reasons, the system of equations will have infinite solutions, so the first regularization is used to penalize opacity. The first regularization is: With the first regularization, fewer solutions can be obtained. For spatial continuity, only a local minimum of opacity is sometimes better than the global minimum, so the second regularization is the Laplace energy of the opacity value. The second regularization is where Δα i is the Laplacian operator, which is the difference between the opacity value of a pixel and the average opacity value of its neighboring pixels.
[0108] An embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions are used to enable a computer to execute the embroidery needle path generation method of any one of the above embodiments. Mechanical embroidery is performed according to the embroidery needle path generation method. A single color of the embroidery product can show light and dark effects, that is, a single color can provide different visual effects on the embroidery product, so that an effect close to the original image can be expressed with a limited number of colors, reducing distortion while saving the cost of mechanical embroidery. In addition, the edge transition of the embroidery product is smooth and can be better consistent with the outline of the original image.
[0109] An embodiment of the present invention further provides a computer program product, including a computer program or computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer program or computer instructions from the computer-readable storage medium, and the processor executes the computer program or computer instructions, so that the computer device executes an embroidery needle path generation method as described in any one of the above embodiments. Mechanical embroidery is performed according to the embroidery needle path generation method, and a single color of the embroidery product can show a light and dark effect, that is, a single color can provide different visual effects on the embroidery product, so that an effect close to the original image can be expressed with a limited number of colors, which reduces distortion and saves the cost of mechanical embroidery. In addition, the edge transition of the embroidery product is smooth and can be well consistent with the outline of the original image.
[0110] It will be appreciated by those skilled in the art that all or some of the steps and systems in the method disclosed above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium or a non-transitory medium and a communication medium or a temporary medium. As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk DVD or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0111] The embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.
Claims
1. A method for generating an embroidery needle path, characterized in that: include: receiving an image; A plurality of layers are obtained according to the image, wherein the layers include color regions, the color regions have unique color information, the color regions of different layers have different color information, and the color regions have opacity information corresponding to the color information; Generate needle path data corresponding to the layer according to the color information and the opacity information of the layer; Integrate the needle path data corresponding to each of the layers to obtain complete needle path data corresponding to the image; Wherein, obtaining multiple layers according to the image includes: According to the image, a color convex hull of the image is obtained; the color convex hull is simplified to obtain a simplified convex hull, wherein the simplified convex hull includes vertex information, and the vertex information is a predetermined layer color; according to the vertex information and the pixel information of the image, opacity information of the predetermined layer color at each pixel position is obtained; according to the vertex information and the opacity information, each layer of the image is obtained; The step of simplifying the color convex hull to obtain a simplified convex hull includes: The number of layers is received, and the vertices of the color convex hull are deleted one by one iteratively. When the number of remaining vertices is consistent with the number of layers, the iteration stops, and a simplified convex hull is obtained; The iterative step of deleting the vertices of the color convex hull one by one and stopping the iteration when the number of remaining vertices is consistent with the number of layers to obtain a simplified convex hull includes: Exclude one vertex of the color convex hull, calculate the volume of the convex hull formed by the remaining vertices, and obtain the remaining volume value corresponding to the excluded vertex; traverse the vertices of the color convex hull to obtain the remaining volume value corresponding to each vertex; delete one vertex according to the remaining volume value corresponding to each vertex; iteratively delete the vertices one by one, and when the number of the remaining vertices is consistent with the number of layers, the iteration stops, and the remaining vertices are the vertices of the simplified convex hull, and the simplified convex hull is obtained.
2. The embroidery needle path generation method according to claim 1, characterized in that: Generating needle path data corresponding to the layer according to the color information and the opacity information of the layer includes: Determining the embroidery thread color of the corresponding needle path according to the color information of the layer; Controlling the corresponding needle path density according to the opacity information of the layer; The needle path data corresponding to the layer is generated according to the embroidery thread color and the needle path density.
3. The embroidery needle path generation method according to claim 1, characterized in that: The deleting a vertex according to the remaining volume value corresponding to each vertex includes: Compare the remaining volume values corresponding to each of the vertices to obtain the maximum remaining volume value; Delete the vertex corresponding to the maximum remaining volume value.
4. The embroidery needle path generation method according to claim 1, characterized in that: The step of obtaining the opacity information of the predetermined layer color at each pixel position according to the vertex information and the pixel information of the image includes: According to the color synthesis operation, a set of equations for synthesizing the pixel color with the predetermined layer color is obtained, wherein the set of equations includes opacity information to be solved; The set of equations is optimized and solved to obtain opacity information of the predetermined layer color at each pixel position.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the embroidery needle path generation method according to any one of claims 1 to 4.
6. A computer program product comprising a computer program or computer instructions, characterized in that The computer program or the computer instructions are stored in a computer-readable storage medium, and a processor of a computer device reads the computer program or the computer instructions from the computer-readable storage medium. The processor executes the computer program or the computer instructions, so that the computer device executes the embroidery needle path generation method as described in any one of claims 1 to 4.