A method for automatically generating four-color tie patterns
By drawing curves and dyeing in a rectangular coordinate system using mathematical functions to generate four-color tie flower patterns, the problems of long design cycles and fewer types of tie flower patterns are solved, and a variety of flower patterns are quickly generated to meet modern production needs.
Patent Information
- Application Number
- CN202210778462.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-06-30
AI Technical Summary
In the prior art, the design cycle of tie patterns is long, the types of patterns are few, the design is complex and lacks flexibility, and the lack of open source software and algorithm support, so the traditional production model is difficult to meet the pace of modern life and market demand.
The automatic generation method of four-color tie-shaped flowers is adopted. By drawing curves and dyeing them in the Cartesian coordinate system using specific mathematical functions, the point set is established, and pixel points are randomly selected for dyeing, and the flower pattern picture is finally generated.
It realizes the rapid generation of a large number of different flower patterns, improves the flexibility and variability of flower patterns, reduces the computational complexity, and meets modern production needs.
Smart Images

Figure CN115187696B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of digital image processing, and in particular relates to a method for automatically generating a four-color tie pattern. Background Art
[0002] The development of a tie pattern, from design to finished product, often requires a long time, and the design process itself is an even longer one. From conception to composition, from draft to final draft, and especially the flash of creative inspiration, it requires not only artistic refinement and cultivation, but also long-term life experience. Often, consumers have to wait a long time for a good work to go from design creation to production. Obviously, this traditional production model is no longer adapted to the pace of modern life and market demand. This traditional production model is composed of traditional design methods and traditional production methods. It is a product of the past era. It is based on manual operation and has the obvious characteristics of "narrow, few, slow and difficult", namely: narrow - the creative design subject matter is limited to the "visual" field, and the design vision and ideas are relatively narrow; few - restricted by factors such as subject matter, design, and production, the design patterns are relatively few; slow - mainly refers to three aspects: slow design and long creation cycle; affected by the old production process, the sample is slow and the delivery is slow; difficult - the production is restricted by the old process, which is not only complicated and time-consuming, but also the relevant information and objects of the design and process are difficult to keep and store, which increases the difficulty of production. In contrast, nonlinear digital graphics represented by fractals are widely used in artistic pattern design. The research objects of nonlinear graphics are those geometric figures or shapes that appear chaotic and unpredictable on the surface, but actually contain some kind of internal regularity. It is a pseudo-random phenomenon occurring in a deterministic system. It is a movement of a dynamic system, usually with initial value amplification effect, creative appeal, non-linear superposition, non-periodicity, structural self-similarity and fractal geometry characteristics. It perfectly combines computer technology with artistic creativity, transforms the visual information displayed on fabrics into decorative art, opens up a new visual world, and assists designers in completing visual effects that were difficult to achieve by hand in the past.
[0003] In terms of automatic digital generation of tie patterns, there are already some software that can achieve this function, but these software require payment; there is currently no open source software that can achieve this function, and there is also a lack of relevant algorithm research literature.
[0004] In terms of academic research, there are currently a small number of research results on automatic pattern generation, such as the literature [Chen Li, Ye Jiemao. Preliminary study on knitted fabric pattern design method based on mathematical function [J]. Journal of Textile Research, 2008(07):38-40] and the literature [Chen Li, Ye Jiemao. Pattern generation and knitted product design based on function Z=ax~c+by~d [J]. Journal of Textile Research, 2013, 34(02):65-68.] which introduced the method of drawing patterns using mathematical models. However, the mathematical models they proposed are too simple and lack variation, so the types of patterns that can be generated are very few and lack practical application value. In addition, there are some studies that use classic fractal algorithms to generate patterns, such as the literature [Chen Li, Xie Yuefeng. M-set knitting pattern design method based on escape time algorithm [J]. Journal of Textile Research, 2010, 31(06): 62-65.] and the literature [Qi Yuqing, Shao Shihuang, Geng Zhaofeng. Generation of chaotic and fractal patterns in computerized flat knitting machine pattern preparation system [J]. Journal of China Textile University, 1997(01): 56-62.], which use fractal functions such as Mandelbrot set to generate pattern. However, classic fractal patterns have been proposed for more than 30 years and are widely known to people, lacking novelty. Summary of the Invention
[0005] In view of the above, the present invention provides a method for automatically generating four-color tie patterns, which meets the needs of automatic generation of tie patterns and realizes flexible and effective automatic generation of four-color tie patterns with lower complexity and smaller calculation amount.
[0006] A method for automatically generating a four-color tie pattern comprises the following steps:
[0007] (1) Draw a curve according to a specific function f(x) in the rectangular coordinate system Z and color it, and then evenly select points on the curve to obtain a point set A1;
[0008] (2) For any point P in point set A1 i , take this point as the origin and establish a rectangular coordinate system M parallel to the coordinate system Z i , in the rectangular coordinate system M i Press the specific function g i (x) Draw a curve and color it, then evenly select points on the curve and include them in point set A2, and then traverse the above operation for all points in point set A1;
[0009] (3) For any point Q in the point set A2 j , with this point as the origin, establish a rectangular coordinate system N parallel to the coordinate system Z j , in the rectangular coordinate system N j Press the specific function h j(x) Draw a curve and color it, then evenly select points on the curve and include them in point set A3, and then repeat the above operation for all points in point set A2;
[0010] (4) intercepting all curves in a specific interval [X1, X2] based on the rectangular coordinate system Z, and scaling all the intercepted curves to a pixel matrix of a specific resolution;
[0011] (5) For any point in the pixel matrix that belongs to the point set A3, take this point as the center, randomly select multiple pixel points from its surroundings and color these points, then traverse the above operation for all points in the pixel matrix that belong to the point set A3, and finally convert the pixel matrix into a flower pattern image.
[0012] Furthermore, in the step (1), a curve is drawn in the rectangular coordinate system Z according to the following specific function f(x) expression:
[0013]
[0014] Where: x represents the coordinate value on the X-axis, T1 and T2 are adjustable parameters;
[0015] The curve is then colored with color C1, and points are evenly sampled from the curve in the set interval [-X0, X0] starting from the origin in both the positive and negative directions of the X axis at intervals of B1. All the obtained points are included in the point set A1, where B1 is an adjustable parameter and X0 is a preset parameter (generally set to 1000).
[0016] Furthermore, the adjustable parameters B1, T1 and T2 are determined by the following formulas:
[0017]
[0018] Where: w and h are the length and width of the flower pattern image to be generated.
[0019] Furthermore, in the step (2), in the rectangular coordinate system M i In the following specific function g i (x) expression to draw the curve:
[0020]
[0021] Where: x represents the coordinate value on the X-axis, T3 is an adjustable parameter, mod is the remainder operator, and i is the point P i The points in point set A1 located on the positive half of the original coordinate system's X-axis are numbered 1, 2, 3, ... from left to right, and the points located on the negative half of the original coordinate system's X-axis are numbered -1, -2, -3, ... from right to left.
[0022] The curve is then colored with color C2, and points are uniformly taken from the curve in the set interval [-X0, X0] starting from the origin in both the positive and negative directions of the X axis at intervals of B2. All the obtained points are included in the point set A2, where B2 is an adjustable parameter and X0 is a preset parameter.
[0023] Furthermore, the adjustable parameters B2 and T3 are determined by the following formula:
[0024]
[0025] Where: w and h are the length and width of the flower pattern image to be generated.
[0026] Furthermore, in the step (3), in the rectangular coordinate system N j According to the following specific function h j (x) expression to draw the curve:
[0027] h j (x)=T4xsinxj+T5x 2 cosxj
[0028] Where: x represents the coordinate value on the X-axis, T4 and T5 are adjustable parameters, j is the point Q j The points in point set A2 located on the positive half of the original coordinate system's X-axis are numbered 1, 2, 3, ... from left to right, and the points located on the negative half of the original coordinate system's X-axis are numbered -1, -2, -3, ... from right to left.
[0029] The curve is then colored with color C3, and points are evenly sampled from the curve in the set interval [-X0, X0] starting from the origin in both the positive and negative directions of the X axis at intervals of B3. All the obtained points are included in the point set A3, where B3 is an adjustable parameter and X0 is a preset parameter.
[0030] Furthermore, the adjustable parameters B3, T4 and T5 are determined by the following formulas:
[0031]
[0032]
[0033] Where: w and h are the length and width of the flower pattern image to be generated.
[0034] Furthermore, in step (4), all curves in the specific interval [X1, X2] are intercepted based on the rectangular coordinate system Z, and all the intercepted curves are horizontally enlarged. times, vertically magnified times to scale to a pixel matrix of w×h resolution, Y maxand Y min The maximum and minimum coordinate values of all curves in the Y-axis direction are obtained respectively.
[0035] Furthermore, the specific implementation of step (5) is as follows:
[0036] 5.1 For any point in the pixel matrix that belongs to point set A3, take that point as the center;
[0037] 5.2 Randomly select a direction, find the pixel point that is L away from the center point along this direction and color the pixel point with color C4;
[0038] 5.3 Repeat step 5.2 multiple times, and randomly select multiple pixels around the center point for coloring;
[0039] 5.4 Repeat the above operation for all points in the pixel matrix that belong to point set A3.
[0040] Furthermore, in step (5), the pixel matrix is finally converted into a flower pattern picture using the ffmpeg function library.
[0041] Based on the above technical solution, the method of the present invention has the following beneficial technical effects:
[0042] 1. The curve combination image of the present invention can be extended infinitely on the X-axis, and an infinite number of different patterns can be generated according to different interception intervals.
[0043] 2. The present invention allows users to randomly select some parameters, which greatly improves the variability of the pattern.
[0044] 3. The present invention has low computational complexity and can quickly generate a large number of flower patterns. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 The figure is a flow chart of the method for automatically generating four-color tie patterns according to the present invention. DETAILED DESCRIPTION
[0046] In order to describe the present invention more specifically, the technical solution of the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0047] The principle of the present invention is to use mathematical functions to draw curve patterns in a rectangular coordinate system and establish a mapping relationship between points on the coordinate system and digital graphic pixels, so as to quickly draw various flower patterns. The flower pattern drawn by the present invention is composed of four parts of points, which are derived from four mathematical function models and generated in four steps. The specific process is as follows: Figure 1 As shown:
[0048] (1) In the rectangular coordinate system Z, a curve is drawn according to a specific function f(x) and colored. Then, points are evenly selected on the curve to obtain a point set A1. The specific process is as follows:
[0049] 1.1 Establish rectangular coordinate system Z and draw function The curve, where
[0050] 1.2 For the curve drawn in step 1.1, color the curve with color C1(R1, G1, B1), where R1, G1, and B1 are color components in the RGB color space, and their values are determined by the user.
[0051] 1.3 For the curve drawn in step 1.1, starting from the origin, select points on the curve every B1 in the positive and negative directions of the X axis, limiting the interval to [-X0, X0]. X0 is generally set to 1000. This type of points is named A1 set.
[0052] (2) For any point P in point set A1 i , take this point as the origin and establish a rectangular coordinate system M parallel to the coordinate system Z i , in the rectangular coordinate system M i Press the specific function g i (x) Draw a curve and color it, then evenly select points on the curve and include them in point set A2. Then, repeat the above operation for all points in point set A1. The specific process is as follows:
[0053] 2.1 Taking the points in set A1 as the origin, sequentially superimpose to establish a rectangular coordinate system M parallel to coordinate system Z i , plot the function in this coordinate system The curve, where The value of i is related to the choice of the origin. When the origin is a point in set A1 located in the positive direction of the X-axis of the original coordinate system, the values taken from left to right are 1, 2, 3... When the origin is a point in set A1 located in the negative direction of the X-axis of the original coordinate system, the values taken from right to left are -1, -2, -3...
[0054] 2.2 For the curve drawn in step 2.1, color the curve with color C2(R2, G2, B2), where R2, G2, and B2 are color components in the RGB color space, and their values are determined by the user.
[0055] 2.3 For the curve drawn in step 2.1, starting from the origin, select points on the curve every B2 in the positive and negative directions of the X axis, limiting the interval to [-X0, X0]. This type of points is named A2 set.
[0056] (3) For any point Q in the point set A2 j , with this point as the origin, establish a rectangular coordinate system N parallel to the coordinate system Z j , in the rectangular coordinate system N j Press the specific function h j (x) Draw a curve and color it, then evenly select points on the curve and include them in point set A3. Then, repeat the above operation for all points in point set A2. The specific process is as follows:
[0057] 3.1 Taking the points in set A2 as the origin, sequentially superimpose to establish a rectangular coordinate system N parallel to coordinate system Z j , plot the function h in this coordinate system j (x)=T4xsinxj+T5x 2 The curve of cosxj, where The value of j is related to the choice of the origin. When the origin is a point in set A2 located in the positive direction of the X-axis of the original coordinate system, the values taken from left to right are 1, 2, 3... When the origin is a point in set A2 located in the negative direction of the X-axis of the original coordinate system, the values taken from right to left are -1, -2, -3...
[0058] 3.2 For the curve drawn in step 3.1, color the curve with color C3 (R3, G3, B3), where R3, G3, and B3 are color components in the RGB color space, and their values are determined by the user.
[0059] 3.3 For the curve drawn in step 3.1, starting from the origin, select points on the curve every B3 in the positive and negative directions of the X axis, limiting the interval to [-X0, X0]. This type of points is named A3 set.
[0060] (4) All curves within the specific interval [X1, X2] are intercepted based on the rectangular coordinate system Z, and all the intercepted curves are scaled to a pixel matrix of a specific resolution. The specific process is as follows:
[0061] 4.1 For the curves drawn in steps 1.1, 2.1, and 3.1, use coordinate system Z as the standard and intercept all curves within the interval [X1, X2], where X1 and X2 are selected by the user.
[0062] 4.2 For the curve obtained in step 4.1, enlarge it horizontally times, vertically magnified times, scaled to a pixel matrix with a resolution of w×h, and the points on the curve correspond one to one with the pixels in the w×h pixel matrix, where Y max and Y minThey are the maximum and minimum vertical coordinate values of all curves, respectively. w and h are selected by the user.
[0063] (5) For any point in the pixel matrix that belongs to the point set A3, take this point as the center, randomly select multiple pixel points from its surroundings and color these points, and then traverse the above operation for all points in the pixel matrix that belong to the point set A3. The specific process is as follows:
[0064] With each point in the A3 set as the center point, select a pixel point at a distance L in a random direction θ and color the point with color C4 (R4, G4, B4). Repeat the operation D times for each center point to obtain D colored points. Where θ is a random value between 0 and 360 degrees, L is a random value between 0 and 10, and D is a random value between 5 and 12. R4, G4, and B4 are color components in the RGB color space, and their values are determined by the user.
[0065] (6) Call the ffmpeg function library to compress the pixel matrix into a jpg format image, which is the final four-color tie pattern; users can obtain different styles of patterns by adjusting the parameter values of X1, X2, w, h, etc.
[0066] The above description of the embodiments is intended to facilitate understanding and application of the present invention by those skilled in the art. It will be apparent that those skilled in the art can readily make various modifications to the above embodiments and apply the general principles described herein to other embodiments without requiring inventive effort. Therefore, the present invention is not limited to the above embodiments, and improvements and modifications made by those skilled in the art based on the disclosure of the present invention should fall within the scope of protection of the present invention.
Claims
1. A method for automatically generating a four-color tie pattern, comprising the following steps: (1) In the rectangular coordinate system Z, a curve is drawn according to a specific function f(x) and colored. Then, points are evenly selected on the curve to obtain a point set A1. Specifically: First, draw the curve in the rectangular coordinate system Z according to the following specific function f(x) expression: in: x represents the coordinate value on the X-axis, T1 and T2 are both adjustable parameters; Then, the curve is colored with color C1, and points are evenly sampled from the curve in the set interval [-X0, X0] starting from the origin in both the positive and negative directions of the X axis at intervals B1. All the obtained points are included in the point set A1, where B1 is an adjustable parameter and X0 is a preset parameter. (2) For any point P in point set A1 i , take this point as the origin and establish a rectangular coordinate system M parallel to the coordinate system Z i , in the rectangular coordinate system M i Press the specific function g i (x) Draw a curve and color it, then evenly select points on the curve and include them in point set A2. Then, repeat the above operation for all points in point set A1. Specifically: First, in the rectangular coordinate system M i In the following specific function g i (x) expression to draw the curve: Where: T3 is an adjustable parameter, mod is the remainder operator, i is the point P i The points in point set A1 located on the positive half of the original coordinate system's X-axis are numbered 1, 2, 3, ... from left to right, and the points located on the negative half of the original coordinate system's X-axis are numbered -1, -2, -3, ... from right to left. Then, the curve is colored with color C2, and points are evenly sampled from the curve in the set interval [-X0, X0] in both the positive and negative directions of the X axis at intervals of B2. All the obtained points are included in the point set A2, where B2 is an adjustable parameter. (3) For any point Q in the point set A2 j , with this point as the origin, establish a rectangular coordinate system N parallel to the coordinate system Z j , in the rectangular coordinate system N j Press the specific function h j (x) Draw a curve and color it, then evenly select points on the curve and include them in point set A3. Then, repeat the above operation for all points in point set A2. Specifically: First, in the rectangular coordinate system N j According to the following specific function h j (x) expression to draw the curve: h j (x)=T4xsinxj+T5x 2 cosxj Among them: T4 and T5 are adjustable parameters, j is point Q j The points in point set A2 located on the positive half of the original coordinate system's X-axis are numbered 1, 2, 3, ... from left to right, and the points located on the negative half of the original coordinate system's X-axis are numbered -1, -2, -3, ... from right to left. Then, the curve is colored with color C3. Points are evenly sampled from the curve in the set interval [-X0, X0] from the origin in both the positive and negative directions of the X axis at intervals of B3. All the obtained points are included in the point set A3, where B3 is an adjustable parameter. (4) intercepting all curves in a specific interval [X1, X2] based on the rectangular coordinate system Z, and scaling all the intercepted curves to a pixel matrix of a specific resolution; (5) For any point in the pixel matrix that belongs to the point set A3, take this point as the center, randomly select multiple pixel points from its surroundings and color these points, then traverse the above operation for all points in the pixel matrix that belong to the point set A3, and finally convert the pixel matrix into a flower pattern image.
2. The method for automatically generating a color tie pattern according to claim 1, wherein: The adjustable parameters B1, T1 and T2 are determined by the following formula: Where: w and h are the length and width of the flower pattern image to be generated.
3. The method for automatically generating a color tie pattern according to claim 1, characterized in that: The adjustable parameters B2 and T3 are determined by the following formula: Where: w and h are the length and width of the flower pattern image to be generated.
4. The method for automatically generating a color tie pattern according to claim 1, wherein: The adjustable parameters B3, T4 and T5 are determined by the following formula: Where: w and h are the length and width of the flower pattern image to be generated.
5. The method for automatically generating a color tie pattern according to claim 1, wherein: In the step (4), all curves in the specific interval [X1, X2] are intercepted based on the rectangular coordinate system Z, and all the intercepted curves are magnified horizontally. times, vertically magnified times to scale to a pixel matrix of w×h resolution, Y max and Y min The maximum and minimum coordinate values of all curves in the Y-axis direction are obtained respectively.
6. The method for automatically generating a color tie pattern according to claim 1, wherein: The specific implementation of step (5) is as follows: 5.1 For any point in the pixel matrix that belongs to point set A3, take that point as the center; 5.2 Randomly select a direction, find the pixel point that is L away from the center point along this direction and color the pixel point with color C4; 5.3 Repeat step 5.2 multiple times, and randomly select multiple pixels around the center point for coloring; 5.4 Repeat the above operation for all points in the pixel matrix that belong to point set A3.
7. The method for automatically generating a color tie pattern according to claim 1, characterized in that: In the step (5), the pixel matrix is finally converted into a flower pattern picture using the ffmpeg function library.
Citation Information
Patent Citations
Image edge feature analysis-based necktie pattern retrieval method
CN104036232A
Image processing method, apparatus, terminal device and storage medium
EP3901895A1