Pattern Reconstruction Method Based on Adaptive Transformation of Primitive Space Relationships
By using an unsupervised vector graphic generation algorithm and a pattern reconstruction method based on directed graph representation, the problem of low efficiency in generating graphic patterns in existing design software is solved, and the efficient generation of beautiful and harmonious graphic patterns is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2026-04-03
AI Technical Summary
Existing design software struggles to generate beautiful, harmonious, and rich graphic patterns, and the process of converting bitmaps to vector graphics is laborious and inefficient.
An unsupervised vector graphics generation algorithm is used to extract primitives from the image. The primitive spatial relationships of the pattern graph are represented by a directed graph. Global regularization and energy optimization methods are used to optimize the adaptive pattern transformation and generate the optimal and harmonious reconstructed image.
It improves the efficiency of pattern reconstruction, generates beautiful and harmonious graphics that are not limited by image format, and meets users' editing needs.
Smart Images

Figure CN116206013B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a pattern reconstruction method based on adaptive transformation of primitive spatial relationships, belonging to the technical field of computer vision and graphics. Background Technology
[0002] Generating new patterns from existing patterns is a significant manifestation of creative thinking. Pattern generation is widely applied in many fields, such as industrial manufacturing, clothing design, interior design, advertising and printing, and digital heritage preservation. Currently, the most common pattern creation methods involve manipulating the elements that make up the pattern or using different snapping strategies to align groups of elements into a grid-like arrangement. These methods produce a limited variety of patterns and are labor-intensive and inefficient. Compared to bitmaps, vector graphics offer the advantages of arbitrary scaling without distortion, small storage space, and high precision. In the industrial design community, tools such as Visio, Illustrator, and InDesign are commonly used to create vector graphics.
[0003] Current mainstream design software generates a limited number of patterns by arranging basic elements and manually transforming them. Creating beautiful, harmonious graphics with a rich variety of patterns is difficult using mainstream design software. Furthermore, most of these software tools are based on vector graphics, while the basic components used in most patterns need to be extracted from images. Therefore, converting commonly used bitmap images to vector graphics for pattern editing and transformation is a problem that urgently needs to be solved.
[0004] Therefore, it is necessary to develop a pattern reconstruction method based on adaptive transformation of primitive spatial relationships. This method extracts the basic elements that make up the pattern from the input image. These basic elements include the center, periphery, and connecting parts, which are then spatially arranged. By adaptively adjusting and optimizing the basic elements and spatial arrangement of the pattern, patterns with the same primitives but different variations can be generated, resulting in new patterns that are regular, symmetrical, and aesthetically pleasing. Summary of the Invention
[0005] The purpose of this invention is to provide a pattern reconstruction method based on adaptive transformation of primitive spatial relationships. First, the input image is preprocessed using an unsupervised vector image generation algorithm to convert it into a vector image, and primitives such as the center, periphery, and connections of the pattern are extracted. Then, a directed graph is used to represent the primitive spatial connections that make up the pattern, an optimization equation for the pattern primitive transformation is established, an effective solution space for the pattern transformation is found, and global regularization and energy optimization methods are used to optimize and obtain the optimal harmonious reconstructed pattern.
[0006] To achieve the above objectives, the technical solution adopted by this invention is: a pattern reconstruction method based on adaptive transformation of primitive spatial relationships, which includes the following steps:
[0007] Step 1: Image preprocessing is performed using an unsupervised vector graphic generation algorithm, and convolutional neural networks are used to extract vector primitives;
[0008] Step 2: Extract the outline framework of the region, and generate vector primitives by differentiably combining the original paths according to the region containment relationship;
[0009] Step 3: Construct primitive relationships through geometric relationships, represent the pattern graph using a directed graph, find strong spatial regularities in pattern variants, perform adaptive pattern transformation, and achieve image reconstruction.
[0010] Step 4: Optimize the adaptive mode transformation using global regularization and the method of harmonious optimal solution to obtain the optimal harmonious reconstructed image.
[0011] Furthermore, in steps one and two, an unsupervised vector graphics generation algorithm is used for image preprocessing. For images requiring mode transformation, a convolutional neural network is used for format conversion to generate vector graphics; specifically, this includes:
[0012] Train an end-to-end variational autoencoder as a vector graphics decoder to encode bitmaps into latent codes. Then decode it into a set of ordered closed vector paths;
[0013] For images with multiple primitives, a recurrent neural network (RNN) is used to generate a latent code for each path. The path is rasterized and combined to obtain a primitive region image;
[0014] The primitive region is compared with the input image, the loss between the two is calculated, and the model is trained using error backpropagation and gradient descent.
[0015] Based on the region inclusion relationship, vector form primitives are generated by differentiably combining the original paths.
[0016] Furthermore, generating vector-form primitives includes:
[0017] For each primitive vector extraction, it is initially represented by a unit circle. 3k points are sampled along the circumference of the unit circle, corresponding to k control points of the cubic Bézier curve. The two-dimensional position of each point is then calculated. Use one-hot encoding Notes are added to distinguish whether the point is an endpoint of a line segment or a control point;
[0018] Path code With sample location and dot type tags In combination, each sampling control point on the circle is represented as a fusion latent vector. k is the number of control points sampled along the circumference. The spatial positions of the path control points are obtained by performing one-dimensional convolutional CNN processing on the neural network. ;
[0019] Apply a bidirectional LSTM to the latent code Z of the image. Before training, calculate the maximum number of primitives that an image in the dataset can have, T. Use a recurrent neural network to process T paths to obtain the latent code of each primitive. The primitives composed of patterns are obtained. .
[0020] Furthermore, the primitive group that makes up a pattern includes a central primitive, peripheral primitives, and connecting primitives that connect the center and the periphery; the central primitive determines the pattern type, the peripheral primitives are used for embellishment and modification, and the connecting primitives determine the pattern framework.
[0021] Furthermore, in step three, the geometric relationships between primitives include the distance between the centroids of the primitives, the angle between the principal axes of the centroids and the coordinate axes, the relative angles between adjacent primitives, and the relationship between their centroids. Primitive relationships are represented using geometric relationships, and a primitive pair containing two primitives is represented as follows: The mapping relationship is A tuple relation containing multiple primitives is represented as The mapping relationship is The relation set of the pattern diagram is represented as ;
[0022] Represent the pattern diagram as a directed graph. Nodes of a directed graph Representing primitives and relations, edges of a directed graph. Indicates the relationship Connect to two input nodes , ;
[0023] A schema consists of a central primitive, edge primitives, connecting primitives, and primitive groups. The schema's structure is encoded and its structural features are saved. Then, the user edits the schema to generate primitive relationships. The changes in the tuple structure re-encode the schema, and the relationships between tuples are constrained to the original values, constrained to the new values, or unconstrained, thus producing schema variants.
[0024] Furthermore, each relation can be constrained to the original value, constrained to a new value, or unconstrained, resulting in schema variants including:
[0025] gather Corresponding to relations constrained by the original value, relations constrained by the new value, and unconstrained relations, each relation in the pattern diagram selects a set to generate pattern variants;
[0026] The new relationship satisfies the constraints. It also includes user editing. The state of the node set is The state after mode transformation is During the mode transformation process, the optimal solution state is sought. .
[0027] Furthermore, in step four, optimizing the adaptive mode transformation using global regularization includes:
[0028] Global regularization preserves repeating structures with symmetry and regularity, and penalizes structures that disrupt harmony. A tuple of repeating structures is defined as... The corresponding relation group is ;
[0029] Reduce user edits that alter primitive relation values, thus fully preserving the structure of the schema diagram;
[0030] The global regularization method is defined as follows:
[0031]
[0032]
[0033]
[0034] in, It is the initial state of the pattern, weight , This represents the average value of all nodes.
[0035] Furthermore, in step four, optimizing the adaptive mode transformation using an optimization method includes:
[0036] To obtain the optimal solution, when a primitive in the pattern changes and other related primitives adjust accordingly, we ensure that the distance between the transformed primitives is minimized while the adjustment angle is also minimized. The formula is as follows:
[0037]
[0038]
[0039] in, It is the location of the center of mass of other elementary elements. It is the position of the centroid of the elementary element after the transformation. It is from the perspective of the original basic unit's center of mass. It is the angle of the centroid of the transformed primitive.
[0040] The beneficial effects of this invention are as follows: This invention provides a pattern reconstruction method based on adaptive transformation of primitive spatial relationships. It uses an unsupervised vector image generation algorithm to preprocess the input image, convert it into a vector image, and is not limited by image format. It extracts the primitives of the image, uses a directed graph to represent the pattern graph, finds the optimal pattern variant based on user editing, makes adaptive adjustments, and further optimizes it through global regularization and harmonious optimal solution to generate a reconstructed pattern, thereby improving the efficiency of pattern reconstruction.
[0041] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0042] Figure 1 This is a flowchart of the present invention.
[0043] Figure 2 This is a schematic diagram of primitive types.
[0044] Figure 3 This is a flowchart of an unsupervised vector graphic generation algorithm.
[0045] Figure 4 It involves extracting the primitive architecture diagram.
[0046] Figure 5 This is a schematic diagram of extracting primitives.
[0047] Figure 6 It involves constructing a primitive relationship diagram.
[0048] Figure 7 It is a pattern variant generation graph.
[0049] Figure 8 It is a pattern variant reconstruction graph.
[0050] Figure 9 It is a mode transformation diagram. Detailed Implementation
[0051] Preferred embodiments of the invention will now be described in more detail. While preferred embodiments of the invention are described below, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0052] like Figure 1 As shown, this invention provides a pattern reconstruction method based on adaptive transformation of primitive spatial relationships, which mainly includes:
[0053] Step 101: Image preprocessing is performed using an unsupervised vector graphic generation algorithm, and vector primitives are extracted using a convolutional neural network;
[0054] Step 102: Extract the outline framework of the region, and generate vector primitives by differentiably combining the original paths according to the region containment relationship;
[0055] Step 103: Construct primitive relationships through geometric relationships, use directed graphs to represent pattern graphs, find strong spatial regularities in pattern variants, perform adaptive pattern transformation, and achieve image reconstruction.
[0056] Step 104: The adaptive mode transformation is optimized by global regularization and the method of harmonious optimal solution to obtain the optimal harmonious reconstructed image.
[0057] like Figure 2 As shown, in a vector representation image, the pattern composition includes three categories: center, periphery, and connecting elements between the center and periphery. The center element determines the pattern type, the periphery elements are mainly used for embellishment and modification, and the connecting elements define the pattern framework. This patent extracts these three types of elements from the image and combines them according to the pattern type to determine the pattern's elemental composition. An affine transformation is then applied to the constituent pattern elements to obtain pattern variants.
[0058] like Figure 3 As shown, in one example, an unsupervised vector graphic generation algorithm is used for image preprocessing, and a convolutional neural network is used to extract vector-form primitives, including:
[0059] Train an end-to-end variational autoencoder as a vector graphics decoder to encode bitmaps into latent codes. Then decode it into a set of ordered closed vector paths;
[0060] For images with multiple primitives, a recurrent neural network (RNN) is used to generate a latent code for each path. The path is rasterized and combined to obtain a primitive region image;
[0061] The primitive region is compared with the input image, the loss between the two is calculated, and the model is trained using error backpropagation and gradient descent.
[0062] Based on the region inclusion relationship, vector form primitives are generated by differentiably combining the original paths.
[0063] like Figure 4 , Figure 5 As shown, in one example, the extraction of the region's outline framework, and the generation of vector-form primitives based on the region's containment relationship through differentiable combination of the original paths, includes:
[0064] For each primitive vector extraction, it is initially represented by a unit circle. 3k points are sampled along the circumference of the unit circle, corresponding to k control points of the cubic Bézier curve. The two-dimensional position of each point is then calculated. Use one-hot encoding Notes are added to distinguish whether the point is an endpoint of a line segment or a control point;
[0065] Path code With sample location and dot type tags In combination, each sampling control point on the circle is represented as a fusion latent vector. (k is the number of control points sampled along the circumference), and the spatial positions of the path control points are obtained by performing one-dimensional convolutional CNN processing on the neural network. ;
[0066] A bidirectional LSTM is applied to the latent code Z of the image. Before training, the maximum number of primitives that an image in the dataset can have is calculated as T. A recurrent neural network is used to process T paths to obtain the latent code of each primitive. The primitives composed of patterns are obtained. ;
[0067] The basic elements that make up a pattern include the center, the periphery, and the connecting elements between the center and the periphery. The center element determines the pattern type, the periphery elements are mainly used for embellishment and modification, and the connecting elements determine the pattern framework.
[0068] like Figure 6 As shown in one example, primitive relationships are constructed through geometric relationships, a directed graph is used to represent the pattern graph, strong spatial regularities of pattern variants are sought, and adaptive pattern transformation is performed to achieve image reconstruction, including:
[0069] The basic element The geometric relationships between primitives include the distance between their centroids, the angles between the principal axes of their centroids and the coordinate axes, the relative angles between adjacent primitives, and the relationships between their centroids. Primitive relationships are represented using geometric relationships. A primitive pair containing two primitives is represented as follows: The mapping relationship is A tuple relation containing multiple primitives is represented as The mapping relationship is The relation set of the pattern diagram is represented as ;
[0070] Represent the pattern diagram as a directed graph. Nodes of a directed graph Representing primitives and relations, edges of a directed graph. Indicates the relationship Connect to two input nodes , ;
[0071] A schema consists of a central primitive, edge primitives, connecting primitives, and primitive groups. The schema's structure is encoded, its structural features are preserved, and user editing of the schema generates primitive relationships. The changes in the tuples re-encode the pattern structure, constraining the relationships between tuples to the original values, to the new values, or to be unconstrained, thus producing pattern variants.
[0072] gather Corresponding to relations constrained by the original value, relations constrained by the new value, and unconstrained relations, each relation in the pattern diagram selects a set to generate pattern variants, such as... Figure 7 As shown, specific assignments are represented by index vectors as follows:
[0073]
[0074] The schema transformation is modeled as an optimization problem, and the new relation satisfies the constraints. At the same time, it should include the user editing as much as possible. The state of the mode This can be represented by the relational values as follows:
[0075]
[0076] in, It is the location of the mass center of the elementary element. d is the centroid angle of the primitive, r is the primitive scale, and r is the primitive relation value.
[0077] The state of the node set is The expression is as follows:
[0078]
[0079] It is the initial state of the mode, and the state after the mode transformation. express:
[0080]
[0081] Finding the optimal solution state during mode transformation. Pattern variant reconstruction such as Figure 8 As shown.
[0082] like Figure 9 As shown, in one example, the adaptive mode transformation is optimized using global regularization and a harmonious optimal solution method to obtain the optimal harmonious reconstructed image, including:
[0083] Global regularization tries to preserve symmetrical and regular repetitive structures, and adds penalties to structures that disrupt harmony. A tuple with a repetitive structure is defined as... The corresponding relation group is ;
[0084] Minimize user edits that alter primitive relation values to fully preserve the structure of the schema diagram;
[0085] The global regularization method is defined as follows:
[0086]
[0087]
[0088]
[0089] Among them, weight , This represents the average value of all nodes;
[0090] After global regularization, the next step of optimization is to obtain the optimal solution. When a primitive in the pattern changes, other related primitives adjust accordingly. This ensures that the distance between the transformed primitives is minimized while the adjustment angle is also minimized. The formula is as follows:
[0091]
[0092]
[0093] in, It is the location of the center of mass of other elementary elements. It is the position of the centroid of the transformed primitive. It is from the perspective of the original basic unit's center of mass. It is the angle of the centroid of the transformed primitive.
[0094] In summary, the method described in this invention mainly includes: First, image preprocessing is performed using an unsupervised vector image generation algorithm to generate vector images and extract pattern primitives. Primitives are then linked by geometric relationships based on their central region, outer region, and the connection between them, and the topological connections of the patterns are represented using directed graphs. Finally, a pattern topological transformation energy function and constraints are constructed, and interactive operations such as dragging or rotation are applied to the primitives or primitive groups. Global regularization and optimization methods are used to obtain the transformed patterns, resulting in harmonious and aesthetically pleasing reconstructed patterns.
[0095] The patterns generated by this invention are not limited by image format, provide the optimal pattern variant based on user editing and dragging, and provide adaptive adjustment patterns through energy optimization, thereby improving the efficiency of pattern reconstruction.
[0096] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the scope of protection of the present invention in any way, and all technical solutions obtained by equivalent substitution or other means fall within the scope of protection of the present invention.
[0097] All parts not covered in this invention are the same as or can be implemented using existing technologies.
Claims
1. A pattern reconstruction method based on adaptive transformation of primitive spatial relations, characterized in that... Includes the following steps: Step 1: Image preprocessing is performed using an unsupervised vector graphic generation algorithm, and convolutional neural networks are used to extract vector primitives; Step 2: Extract the outline framework of the region, and generate vector primitives by differentiably combining the original paths according to the region containment relationship; Step 3: Construct primitive relationships through geometric relationships, represent the pattern graph using a directed graph, find strong spatial regularities in pattern variants, perform adaptive pattern transformation, and achieve image reconstruction. Step 4: Optimize the adaptive mode transform using global regularization and optimization methods to obtain the optimal and harmonious reconstructed image; the optimization of the adaptive mode transform using global regularization includes: Global regularization preserves repeating structures with symmetry and regularity, and penalizes structures that disrupt harmony. A tuple of repeating structures is defined as... The corresponding relation group is defined as ; Reduce user edits that alter primitive relation values, thus fully preserving the structure of the schema diagram; The global regularization method is defined as follows: in, It is the initial state of the pattern, weight , This represents the average value of all nodes; Optimizing the adaptive mode transformation using optimization methods includes: To obtain the optimal solution, when a primitive in the pattern changes and other related primitives adjust accordingly, we ensure that the distance between the transformed primitives is minimized while the adjustment angle is also minimized. The formula is as follows: in, It is the location of the center of mass of other elementary elements. It is the position of the centroid of the elementary element after the transformation. It is from the perspective of the original basic unit's center of mass. It is the angle of the centroid of the transformed primitive.
2. The pattern reconstruction method based on adaptive transformation of primitive spatial relations according to claim 1, characterized in that, In steps one and two, an unsupervised vector graphic generation algorithm is used for image preprocessing. For images requiring mode transformation, a convolutional neural network is used for format conversion to generate vector graphics. Specifically, this includes: Train an end-to-end variational autoencoder as a vector graphics decoder, and use the variational autoencoder to encode bitmaps into latent codes. Then decode it into a set of ordered closed vector paths; For images with multiple primitives, a recurrent neural network (RNN) is used to generate a latent code for each path. The path is rasterized and combined to obtain a primitive region image; The primitive region image is compared with the input image, the loss between the two is calculated, and the model is trained using error backpropagation and gradient descent. Based on the region inclusion relationship, vector form primitives are generated by differentiably combining the original paths.
3. The pattern reconstruction method based on adaptive transformation of primitive spatial relations according to claim 2, characterized in that, Generating vector-form primitives includes: For each vector primitive extraction, it is initially represented by a unit circle. 3k points are sampled along the circumference of the unit circle, corresponding to k control points of the cubic Bézier curve. The two-dimensional position of each point is then calculated. Using one-hot encoding Notes are added to distinguish whether the point is an endpoint of a line segment or a control point; Path code With sample location and dot type tags In combination, each sampling control point on the circle is represented as a fusion latent vector. k is the number of control points sampled along the circumference. The spatial positions of the path control points are obtained by performing one-dimensional convolutional CNN processing on the neural network. ; Apply a bidirectional LSTM to the latent code Z of the image. Before training, calculate the maximum number of primitives that an image in the dataset can have, T. Use a recurrent neural network to process T paths to obtain the latent code of each primitive. The primitives composed of patterns are obtained. .
4. The pattern reconstruction method based on adaptive transformation of primitive spatial relations according to claim 3, characterized in that, The primitive group that makes up a pattern includes a central primitive, peripheral primitives, and connecting primitives that connect the center and the periphery; the central primitive determines the pattern type, the peripheral primitives are used for embellishment and modification, and the connecting primitives determine the pattern framework.
5. The pattern reconstruction method based on adaptive transformation of primitive spatial relations according to claim 1, characterized in that, In step three, the geometric relationships between primitives include the distance between the centroids of the primitives, the angle between the principal axes of the centroids and the coordinate axes, the relative angles between adjacent primitives, and the relationship between their centroids. Primitive relationships are represented using geometric relationships. A primitive pair containing two primitives is represented as follows: The mapping relationship is A tuple relation containing multiple primitives is represented as The mapping relationship is The relation set of the pattern diagram is represented as ; Represent the pattern diagram as a directed graph. Nodes of a directed graph Representing primitives and relations, edges of a directed graph. Indicates the relationship Connect to two input nodes , ; A schema consists of a central primitive, edge primitives, connecting primitives, and primitive groups. The schema's structure is encoded and its structural features are saved. Then, the user edits the schema to generate primitive relationships. The changes in the tuple structure re-encode the schema, and the relationships between tuples are constrained to the original values, constrained to the new values, or unconstrained, thus producing schema variants.
6. The pattern reconstruction method based on adaptive transformation of primitive spatial relations according to claim 5, characterized in that, The relations between tuples can be constrained by the original value, constrained by the new value, or unconstrained, resulting in schema variants including: gather Corresponding to relations constrained by the original value, relations constrained by the new value, and unconstrained relations, each relation in the pattern diagram selects a set to generate pattern variants; The new relationship satisfies the constraints. It also includes user editing. The state of the node set is The state after mode transformation is During the mode transformation process, the optimal solution state is sought. .
Citation Information
Patent Citations
Generating Vector Representations of Visual Objects
US20220245296A1
Constrained modification of vector graphics
US20220277501A1