Plant Modeling Method, Electronic Device, and Computer Storage Medium

By analyzing the element types in the plant sketch and recovering in-depth information, the existing plant modeling methods are solved, and the rapid and simple generation of multiple plant models and detailed simulations are achieved, which improves modeling efficiency and sense of reality.

CN114049426BActive Publication Date: 2025-08-05SHENZHEN INST OF ADVANCED TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111164488.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-08-05
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

The existing plant modeling methods are complex in calculations and have few suitable plant species, traditional manual methods are inefficient, and the input data based on real data is incomplete and it is difficult to creatively design plant models.

Method used

By obtaining plant sketches, analyzing the element types in the sketches, including petals, leaves and branches, performing in-depth information recovery, and establishing a plant model.

Benefits of technology

It realizes the rapid and simple generation of multiple plant models, improves modeling efficiency and creative freedom, and can simulate plant details such as petal bending, concave and branch radius attenuation, enhancing the realism of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114049426B_ABST
    Figure CN114049426B_ABST
Patent Text Reader

Abstract

This application relates to a plant modeling method, electronic device, and computer storage medium. The modeling method includes: obtaining a plant sketch; analyzing plant primitives and corresponding primitive types in the plant sketch, including petal types, leaf types, and branch types; recovering depth information of the plant primitives based on the primitive types; and establishing a plant model based on the depth information of the plant primitives. This modeling method can achieve rapid modeling of a variety of plants.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates generally to the field of modeling. More specifically, the present application relates to a plant modeling method, an electronic device, and a computer storage medium. Background Art

[0002] Plants are a common natural landscape in the real world, and 3D plant models are widely used in film and television special effects, video games, and virtual reality scenarios. However, due to the complex structure and diverse shapes of plants, faithfully modeling them in 3D is a difficult task. Traditionally, artists use 3D modeling software such as Maya or 3DS MAX to meticulously hand-model plants based on real plant images or physical objects. While this method can accurately reproduce the appearance and details of plants, the entire process is cumbersome and inefficient. When modeling large-scale plant scenes, traditional manual methods make the modeling task even more arduous. Therefore, efficient and fast plant modeling methods have always been a very important and challenging topic in computer graphics research.

[0003] Over the past few decades, researchers and scholars have developed numerous effective plant modeling methods, including rule-based procedural modeling, reconstruction methods based on video images and 3D point clouds, and modeling methods based on hand-drawn sketches. While L-system-based procedural modeling can rapidly and automatically generate complex models, its high learning threshold and poor control over plant morphology require extensive botanical expertise and familiarity with adjusting various parameters to achieve the desired target model. Furthermore, the generated model is difficult to modify. With the advancement of hardware technology, high-precision plant images and point cloud data have become increasingly accessible, facilitating plant modeling based on real-world data. However, due to occlusion and measurement angle limitations in real-world scenes, coupled with plant self-occlusion, point cloud data obtained from photographs or 3D scans is often incomplete and noisy. Therefore, low-quality input data poses significant challenges for reconstructing plant models. Furthermore, methods based on real-world data often only replicate real-world plants and cannot creatively design plant models that do not exist in the real world. Summary of the Invention

[0004] The present application provides a plant modeling method, electronic equipment and computer storage medium to solve the problems of complex calculations and limited applicable plant species in existing plant modeling.

[0005] To solve the above technical problems, the present application proposes a plant modeling method, including: obtaining a plant sketch; analyzing plant primitives and corresponding primitive types in the plant sketch, the primitive types including petal types, leaf types and branch types; restoring depth information of plant primitives based on the primitive types; and establishing a plant model based on the depth information of the plant primitives.

[0006] In one embodiment, obtaining the plant sketch includes: receiving a drawing stroke, sampling the drawing stroke to obtain a plurality of sampling points; and smoothing the plurality of sampling points to generate a smooth plant sketch.

[0007] In one embodiment, the analyzing of the plant primitives and the corresponding primitive types in the plant sketch includes: analyzing the stroke features of the plant primitives to determine whether the primitive type of the plant primitive is a branch type, or a petal type and a leaf type; if the plant primitive is a petal type and a leaf type, analyzing the clustering root point features of the plant primitives to determine whether the primitive type of the plant primitive is a petal type, or a leaf type.

[0008] In one embodiment, the analyzing the stroke features of the plant primitive to determine whether the primitive type of the plant primitive is a branch type, or a petal type and a leaf type includes: analyzing the ratio of the distance from the starting point of the stroke endpoint to the stroke length, the ratio of the maximum eigenvalue to the minimum eigenvalue after principal component analysis of the stroke, and the ratio of the area of the bounding box formed in the direction of the eigenvector of the maximum eigenvalue and the minimum eigenvalue to the stroke length; comparing the ratio with a threshold value to determine whether the primitive type of the plant primitive is a branch type, or a petal type and a leaf type.

[0009] In one embodiment, the analysis of the clustering root point features of the plant primitive to determine whether the primitive type of the plant primitive is a petal type or a leaf type includes: determining the root points in the plant primitive, clustering the root points to form clusters; if the number of root points in the clusters is greater than 2, determining that the primitive type of the plant primitive is a petal type; if the number of root points in the clusters is less than or equal to 2, determining that the primitive type of the plant primitive is a leaf type.

[0010] In one embodiment, if there are multiple branch-type plant primitives in the plant sketch; the modeling method also includes: taking the one with the longest stroke as the primary plant primitive; traversing other plant primitives multiple times to divide the plant primitives into levels, and the distance between the endpoint of each plant primitive and the previous level plant primitive is less than a threshold.

[0011] In one embodiment, the graphic element type also includes a branch outline type, and the plant graphic element includes a main branch and a branch outline surrounding the main branch; the modeling method also includes: sampling the main branch to obtain multiple growth points, sampling the branch outline to obtain multiple attraction points; and generating multiple sub-branches connecting the main branch from the growth point to the attraction point.

[0012] In one embodiment, the primitive type also includes a leaf outline, and the plant primitive includes a branch and a leaf outline surrounding the branch; the modeling method also includes: sampling the branch to obtain multiple growth points, sampling the leaf outline to obtain multiple attraction points; generating leaves, and aligning the root point of the leaf with the growth point, and aligning the tip point of the leaf with the attraction point.

[0013] In one embodiment, the primitive type is a petal type, and the depth information recovery of the plant primitive based on the primitive type includes: obtaining the petal root point and the petal tip point in the plant primitive; performing ellipse fitting on the petal tip point based on the petal root point; transforming the ellipse into a three-dimensional cone, and determining the three-dimensional coordinates of each point in the plant primitive according to the three-dimensional cone, and the three-dimensional coordinates are used as the depth information.

[0014] In one embodiment, the primitive type is a leaf type, and the depth information recovery of the plant primitive based on the primitive type includes: obtaining the leaf root point and the leaf tip point in the plant primitive; rotating with the leaf root point to the leaf tip point as the axis, and rotating based on the direction of the branch connected to the leaf root point to determine the transformed position of the leaf, and the transformed position is used as the depth information.

[0015] In one embodiment, the primitive type is a branch type, and the depth information recovery of the plant primitive based on the primitive type includes: rotating the child branches in the hierarchically divided plant primitives around the parent branches; determining the rotation angle of the child branches so that the dispersion of the child branches on the parent branches is maximized, and the rotation angle is used as the depth information.

[0016] In one embodiment, the modeling method further includes: performing detail optimization on the plant model, wherein the detail optimization includes petal bending simulation, petal concavity simulation, or branch radius attenuation.

[0017] To solve the above technical problems, the present application proposes an electronic device, which includes a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the steps of the above method.

[0018] To solve the above technical problem, the present application proposes a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program is executed to implement the steps of the above method.

[0019] Unlike existing technologies, the modeling method of this application includes: obtaining a plant sketch; analyzing plant primitives and their corresponding primitive types, including petal types, leaf types, and branch types, in the plant sketch; recovering the depth information of the plant primitives based on the primitive types; and establishing a plant model based on the depth information of the plant primitives. This modeling method of this application can achieve rapid modeling of a variety of plants. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an illustrative and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0021] Figure 1 This is a flow chart of an embodiment of a plant modeling method of the present application;

[0022] Figure 2 It is a schematic diagram of the primitive types in the modeling method of this application;

[0023] Figure 3 Schematic diagram of recovering petal depth information in the modeling method of this application;

[0024] Figure 4 It is a schematic diagram of recovering blade depth information in the modeling method of this application;

[0025] Figure 5 This is a schematic diagram of a case study of plant modeling using the modeling method of this application;

[0026] Figure 6 This is a schematic diagram of the interface for implementing plant modeling using the modeling method of this application;

[0027] Figure 7 This is a structural diagram of an embodiment of an electronic device of the present application;

[0028] Figure 8 It is a structural diagram of an embodiment of the computer storage medium of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the accompanying drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the embodiments described are part of the embodiments of the present disclosure, not all of them. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present disclosure.

[0030] The following describes the specific implementation of the present disclosure in detail with reference to the accompanying drawings. Figures 1-4 , are figures related to the plant modeling method of this application. This embodiment includes the following steps.

[0031] S11: Obtain plant sketch.

[0032] In this step, a drawing stroke is first received, and the drawing stroke is sampled to obtain a plurality of sampling points; and then the plurality of sampling points are smoothed to generate a smooth plant sketch.

[0033] Specifically, sketch resampling is performed first, and stroke resampling is performed first, that is, all stroke sampling points are connected in order to form a stroke segment. Starting from the first point, the points on the stroke segment are resampled along the segment with a certain radius to obtain uniform new sampling points.

[0034] Then the sketch is smoothed. When users draw long lines such as branches, they are likely to make mistakes such as jitter. If this situation is not corrected, the drawing errors will be faithfully reflected in the model, causing the model shape to be unnatural. In addition, the sampling in the previous step may cause the stroke segments to be abrupt and not smooth. The present invention uses the reference Gaussian filtering method to quickly smooth the strokes, that is, the smoothed coordinates of each sampling point are the weighted average of the coordinates of the surrounding points. Suppose the point set P obtained after sampling = {p1, p2, ..., p n}, the smoothed point set P′={p′1,p′2,...,p′ n},have:

[0035]

[0036] S12: Analyze the plant primitives and corresponding primitive types in the plant sketch, where the primitive types include petal type, leaf type, and branch type.

[0037] When obtaining sketches, we must fully consider the system's freedom and convenience for users' creation, while also taking into account the difficulty of subsequent processing. Therefore, the text method stipulates that the input primitive types are: petals, leaves, branches, twig outlines, and leaf outlines. The sketch diagrams of each primitive are as follows: Figure 2As shown in the figure, the outlines of the twigs and leaves are drawn in specific modes, so no further classification is required. However, the petals, leaves, and branches are all drawn in component mode. In order to model the petals, leaves, and branches separately, the strokes drawn in component mode need to be classified.

[0038] Petals and leaves are similar in two-dimensional form, differing only in texture and spatial position. First, we distinguish the branches. Strokes drawn in element mode only need to be divided into petals, leaves, and branches. The classification method employed in this invention extracts features from each stroke and then classifies them using a support vector machine. Specifically, this includes:

[0039] Analyzing the stroke features of the plant primitive to determine whether the primitive type of the plant primitive is a branch type, or a petal type and a leaf type;

[0040] Analyze the ratio of the distance between the stroke endpoint and the starting point to the stroke length, the ratio of the maximum eigenvalue to the minimum eigenvalue after principal component analysis of the stroke, and the ratio of the area of the bounding box formed in the direction of the eigenvectors of the maximum eigenvalue and the minimum eigenvalue to the stroke length;

[0041] The ratio is compared with a threshold value to determine whether the graphic element type of the plant graphic element is a branch type, or a petal type and a leaf type.

[0042] Then further subdivide the petals and leaves by:

[0043] If the plant primitive is a petal type or a leaf type, the cluster root point features of the plant primitive are analyzed to determine whether the primitive type of the plant primitive is a petal type or a leaf type.

[0044] Determining root points in the plant primitives, and clustering the root points to form clusters;

[0045] If the number of root points in the cluster is greater than 2, the primitive type of the plant primitive is determined to be the petal type;

[0046] If the number of root points in the cluster is less than or equal to 2, the primitive type of the plant primitive is determined to be a leaf type.

[0047] This clustering algorithm clusters the root points of leaves and petals, separating clustered petals from isolated leaves. This classification method doesn't require the user to specify the number of flowers; the number of clusters is unknown. Therefore, the MeanShift algorithm is used to cluster the root points of petals and leaves. Clusters with more than two elements are classified as flowers, while clusters with two or fewer elements are classified as leaves.

[0048] In this step, the hierarchical division of branches and the filling of regions can also be performed. Specifically, the hierarchical division of branches includes the following steps:

[0049] The one with the longest stroke is used as the primary plant primitive;

[0050] Traverse other plant primitives multiple times to divide the plant primitives into levels, and the distance between the endpoint of each plant primitive and the previous level plant primitive is less than a threshold.

[0051] Specifically, two sets are specified: the processed set P and the unprocessed set N. In the initial state, all branches are in the set N. The algorithm first takes the longest branch from N as the level 0 node and adds it to P. It traverses all branches in N and matches them with all branches in P that belong to the current maximum level. If there is a branch n in the set N, j The endpoints of the point set and the branches p belonging to the largest level in P i The Euclidean distance of any point in the point set is the smallest and less than the threshold, then n j With p i Match, n j For p i The next level, p i n j The parent node of n j Move from N to P; repeat the above operation until the set N is empty.

[0052] Area filling includes branch filling and leaf filling.

[0053] If the graphic element type is a branch outline type, the corresponding plant graphic element includes a main branch and a branch outline surrounding the main branch; the area filling includes the following steps.

[0054] Sampling the main branches to obtain a plurality of growth points, and sampling the outlines of the branches to obtain a plurality of attraction points;

[0055] A plurality of sub-branches connected to the main branch are generated from the growth point to the attraction point.

[0056] When the user wants to describe a dense structure of thin branches, the system allows the user to draw an outline stroke around the main branch to be branched, which means that there are many thin branches generated from the main branch and the outline of the new branch formed matches the stroke; to achieve this goal, the outline needs to be filled to add new thin branches. The algorithm first samples the branches to obtain several growth points and samples the outline to obtain several attraction points; starting from a growth point p0, the coordinates of the next point are where k p is the contour attraction coefficient, k b is the branch attraction coefficient, k mis the directional memory coefficient, r is the growth rate; the branches continue to grow until they move close to the outline.

[0057] If the graphic element type also includes leaf outlines, the corresponding plant graphic element includes branches and leaf outlines surrounding the branches; the area filling includes the following steps.

[0058] Sampling the branches to obtain a plurality of growth points, and sampling the leaf contours to obtain a plurality of attraction points;

[0059] Generate leaves and align their root points with the growth points and their tips with the attraction points.

[0060] When the user needs to fill a branch with leaves, he can draw an outline around the branch to represent that there are several leaves growing on the branch and form a shape that matches the outline. The leaf outline filling algorithm is similar to the branch filling algorithm. The only difference is that in the last step of the branch filling algorithm, the leaf outline filling algorithm will randomly select a leaf from the already drawn leaves and perform an affine transformation on the leaf, so that the root point of the leaf after the affine transformation is aligned with the growth point of the new branch, and the tip of the leaf (that is, the point with the largest curvature change in the leaf stroke, the point where the leaf visually protrudes) is aligned with the end point of the branch, and the new leaf is added to the existing leaf set.

[0061] S13: Recovering depth information of the plant primitive based on the primitive type.

[0062] Specifically, it includes the depth information recovery of petal-type, leaf-type and branch-type plant primitives.

[0063] For the petal type, the steps of depth information recovery are as follows.

[0064] Get the petal root point and petal tip point in the plant primitive;

[0065] Based on the petal root point, performing ellipse fitting on the petal apex point;

[0066] The ellipse is transformed into a three-dimensional cone, and the three-dimensional coordinates of each point in the plant primitive are determined according to the three-dimensional cone, and the three-dimensional coordinates are used as the depth information.

[0067] The principle behind this approach is that a flower composed of several petals is highly symmetrical, with the petals forming a near-cone around the center. The cone's apex is located at the center, with the petals roughly attached to the sides. The apex of each petal forms the base of the cone. The petal apex is defined as the point with the greatest change in curvature within the stroke, visually the outermost point of the petal. Assuming the sketch is a parallel projection of the flower entity perpendicular to the drawing screen, the cone's equation can be recovered by analyzing the projection of each petal in the sketch. This equation can then be substituted into the XY coordinates of each petal to obtain the Z-axis depth information for that petal.

[0068] The flower depth information recovery algorithm of the present invention is as follows:

[0069] (1) Calculate the mean of the root coordinates of all petals in the flower, denoted as the flower center c f ;

[0070] (2) Use the least squares method to fit the ellipse to the cusp of all petals and obtain the ellipse E;

[0071] (3) According to the assumption, the two-dimensional sketch is obtained by parallel projection in the direction perpendicular to the drawing screen, so the major axis b of the ellipse E is the radius r of the base of the cone in the original three-dimensional space; the angle θ between the main axis of the cone and the drawing plane is related by: sinθ=a / b, where a and b are the minor axis and major axis of the ellipse E. According to this relationship, θ can be calculated.

[0072] (4) Calculate the distance from the ellipse E to the center c on the sketch plane f According to the geometric relationship, the height of the cone in three-dimensional space is h = l / sinθ; by integrating the known conditions, the equation of the ellipse in three-dimensional space can be obtained.

[0073] (5) The ellipse equation obtained in the previous step is in the standard form with the Z axis as the main axis of the cone, without considering the ellipse rotation angle θ; calculate the vector from the sketch plane space center to the ellipse E center c Z-axis unit vector The rotation axis of the ellipse can be calculated Calculate the winding The rotation matrix RM obtained by rotating θ is:

[0074] (6) Each point p of each petal is transformed into a coordinate system with c f In the coordinate system with as the origin, we get point p′=[x′, y′]; let p″ be the three-dimensional point p″=[x′, y′, z] corresponding to p′, where z is an unknown number; solve the following equations together,

[0075]

[0076] Solve z, z is the depth information corresponding to point p. The algorithm process diagram is as follows Figure 3 shown.

[0077] For the leaf type, the steps of depth information recovery are as follows.

[0078] Obtaining a leaf root point and a leaf tip point in the plant primitive;

[0079] The blade is rotated with the root point to the tip point of the blade as the rotation axis and rotated based on the direction of the branch connected to the root point of the blade to determine the transformed position of the blade, and the transformed position is used as the depth information.

[0080] The leaf depth information acquisition algorithm of the present invention assumes that all leaves are initially located on the XY plane, and the depth value z is 0; on the two-dimensional sketch, the root point of the leaf is matched with the branch node obtained in the previous step. If there is a point in a branch point set with a distance from the leaf root point less than a threshold, the leaf is matched with the branch, and the depth value z of all leaf points is modified to the depth value of the branch matching point; the main axis of the leaf is defined The vector from the root point to the tip point is then rotated to make the blade of the sketch plane perpendicular to the XY plane with its own main axis; calculate the main axis The angle θ with the X axis rotates the blade around the -Z axis by θ+Δ, where Δ is a random perturbation uniformly distributed between -30° and 30°; calculate the main axis of the blade in the original 2D sketch Branch direction vector at the point where it matches the branch The angle Φ; calculate the rotation angle θ b =Φ·π- |cosΦ| +Δ, and rotate the blade around the +Y axis by θ b At this time, the position of the leaf is the final position in the three-dimensional space, and the depth value obtained by transforming each point of the leaf is the final depth value. The schematic diagram of the algorithm process is as follows Figure 4 shown.

[0081] For the branch type, the steps for recovering depth information are as follows.

[0082] Rotate the child branches of the hierarchically divided plant primitives around the parent branches;

[0083] The rotation angle of the child branches is determined so as to maximize the dispersion of the child branches on the parent branches, and the rotation angle is used as the depth information.

[0084] The geometric structure of branches is relatively simple; knowing only the depth information of the branch's two endpoints allows interpolation to determine the depth information of each point on the branch. The main idea behind the proposed branch depth recovery algorithm is to rotate child branches around their parent branches based on the previously determined parent-child hierarchical relationships, finding a three-dimensional distribution of branches that maximizes the entropy of the branches, i.e., the degree of branch distribution is maximized, resulting in a uniform and natural distribution of branches in three-dimensional space.

[0085]

[0086] Where b is the current branch, b i is the child branch of the current branch, θ(b i , b j ) is the angle between the two branches, Δ(b k ) represents sub-branch b k The difference between the length of the current 3D distribution and the length of the 2D sketch projection.

[0087] The algorithm is recursive. Considering the current branch as the parent, it traverses all its child branches and divides them into two groups: left and right. Each child is given a random perturbation angle that follows a Gaussian distribution as its initial value. An optimization method is then applied to find the child branch rotation angle that maximizes the entropy of the current branch. The three-dimensional rotation angle can be used to inversely resolve the three-dimensional Z-axis depth coordinate from the two-dimensional projection coordinate, thereby acquiring depth information.

[0088] S14: Establish a plant model according to the depth information of the plant primitive.

[0089] After obtaining the depth information of each part of the sketch, the three-dimensional model can be generated through Delaunay triangulation. The method of the present invention also fully considers the shape details of flowers and branches during modeling and reflects them in the model to increase the realism of the model.

[0090] S15: Optimize the details of the plant model, including petal bending simulation, petal concave simulation, or branch radius attenuation.

[0091] Simulating the bending of petals

[0092] The bending of petals is a common phenomenon in all types of flowers. Some petals bend due to gravity, while others are due to the petal's inherent shape. This method considers the petal as a soft, flat surface that satisfies the principles of elasticity. Based on relevant knowledge of mechanics, we can deduce that the deformation of an idealized soft rod of length L, bent at a distance x from its base, is y. The relationship between y and x is:

[0093]

[0094] Where A and B are the elastic coefficients of the material of the object itself. The present invention believes that the petals can be regarded as a uniform elastic soft plane, and the above formula can be used to calculate the bending offset of each point, and the main axis of the petals is recorded as Set in For each point p in the petal, calculate the vector On the spindle Upper projection Substitute the offset y into the formula to move point p by the offset y along the normal direction of the petal plane.

[0095] Simulation of the concave petals

[0096] The concavity of petals is also a common phenomenon in petals. Many petals have curved concavities inside, and the closer to the center of the petal, the greater the degree of concavity. In order to simulate this phenomenon, we first establish a coordinate system with the petal root as the origin and calculate the main axis of the petal. The spindle Recorded as v axis, vertical principal axis vector The right direction is recorded as u axis, and the coordinates of each vertex in the new coordinate system are calculated; when v is constant, the closer u is to 0, the greater the concavity of the vertex; when u is constant, the closer v is to The greater the concavity of the vertex.

[0097] Determination of branch radius at each level

[0098] Plant branches have different radii after bifurcation. The radius of the branches at the end is smaller. In fact, the branching of plant branches follows a certain rule: Assume that the radius of each level of branches is the same everywhere, let r be the radius of the branches below the branch point, r1...r m is the radius of each branch above the branch point, then

[0099] r p =r1 p +…+r m p

[0100] The power series p controls the accumulation of branch radius, influencing the relative thickness of the next-level branch radius. Different plant species have different power series p values. When p = 2, this corresponds to the relationship between tree branch radius proposed by Leonardo da Vinci. For herbaceous plants like flowers, a p > 2 achieves better results. During the sketch analysis step, a parent-child hierarchical relationship between branches is constructed. By traversing branch nodes, the child nodes and the number of child nodes for a given branch can be counted. By entering this information into the formula, the radius of the child branches can be calculated for subsequent modeling.

[0101] Branch radius attenuation

[0102] The radius of a branch at a certain level of a plant is not constant. For a first-level branch, its radius gradually decreases from the root to the tip. This is caused by the order of plant growth and the cumulative effect of growth. To capture this phenomenon, this method uses a radius attenuation formula. The radius attenuation ratio r at the point where the ratio of the root length to the total branch length is x is:

[0103]

[0104] Among them, s and α control the speed of attenuation. s is generally taken as s>10, α is generally taken as 0.3~0.5, and m controls the ratio of the radius of the branch end to the root radius, which is generally taken as 0~1.

[0105] Branch geometry modeling

[0106] Based on comprehensive modeling and rendering performance considerations, the present invention uses an octagonal prism to model the branches. The present invention's branch construction method uses a regular octagon, moving the center of the octagon along the branch skeleton to form a loft, while adjusting the radius of the octagon by referring to the branch radius and radius attenuation formulas at each level in the previous steps.

[0107] The above describes the modeling process for a plant sketch. First, the sketch undergoes preprocessing, primarily involving resampling and smoothing the strokes. Next, the sketch undergoes analysis, primarily for primitive classification, branch hierarchy analysis, and region filling. Depth information is then restored for each primitive sampled in the sketch, resulting in a 3D point set. The final step is to construct a highly realistic plant model from this 3D point set based on the plant's morphological characteristics. After the model is constructed, users can view it in a 3D view, change its texture, and save it once the desired effect is achieved.

[0108] The present application can support users to quickly sketch out a two-dimensional sketch of a plant with a branch and leaf structure and quickly give a plant model that matches the two-dimensional sketch, and can be displayed and modified in the window in real time. The software can support a variety of two-dimensional graphic elements such as flowers, leaves, branches, and branch and leaf outlines, and can establish a wide variety of three-dimensional plant models, giving users a higher degree of freedom in creation. And it only requires the user to draw a two-dimensional sketch, without the need for rigorous perspective relationships and detailed information, nor does it require the user to provide other additional semantic or control information. The present application automatically infers the type of graphic element and the user's modeling intention, and the entire process does not require user intervention. In addition, existing sketch-based plant modeling methods often focus on the overall outline and shape, and the simulation of details is poor. The present invention can simulate detailed features such as the bending of plant flowers, the concaveness of flowers, the radius of branches at various levels, and the attenuation of branch radius, thereby improving the realism of the established model.

[0109] The 3D modeling method based on hand-drawn sketches is fast, simple and flexible. Users can draw sketches according to their own ideas and quickly generate the desired model without special training. Compared with other methods, the entire modeling process is greatly simplified and the modeling efficiency is greatly improved. The modeling method based on hand-drawn sketches can give users greater freedom to generate plant models of various complex shapes without having to understand the relevant details of model generation. Therefore, the modeling method based on hand-drawn sketches has high practical value.

[0110] The software system built based on the above method provides basic sketching functions: curve drawing, redo, undo, loading reference images, and saving and loading sketch files. The software implements end-to-end plant model construction, from sketch to 3D model. If the user is not satisfied with the modeling result, they can return to the previous step and sketch again or modify certain software parameters in the interface. The software provides a window to display the 3D plant model, which can be rotated, translated, and scaled for observation, as well as adjustments and the selection of different plant textures. The created 3D model is saved in .obj format.

[0111] The software system interface can be found in Figure 6 The software uses C++ to implement the core algorithm, Qt as the graphical interface framework and OpenGL for model rendering and display. Users can draw sketches on the left side of the interface and observe the generated model in real time on the right side. The system can operate normally. In order to test the feasibility of the modeling method of the present invention, different testers were invited to conduct computer tests. The testers were required to draw sketches and use the system to build models. The expected modeling effect was achieved in all the test examples. Figure 5 A sketch of the test input and the resulting plant model are shown.

[0112] The above plant modeling method can be implemented by electronic devices, so this application also proposes electronic devices, please refer to Figure 7 , Figure 7 This is a schematic diagram of the structure of an embodiment of an electronic device of the present application. In this embodiment, electronic device 100 may be a computer, comprising a processor 11 and a memory 12 connected to each other. This embodiment of electronic device 100 can implement the above-described method. Memory 12 stores a computer program, and processor 11 is configured to execute the computer program to implement the above-described method.

[0113] The processor 11 can be an integrated circuit chip with signal processing capabilities. The processor 11 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor can be a microprocessor or any conventional processor.

[0114] The method of the above embodiment may exist in the form of a computer program, so the present application proposes a computer storage medium, see Figure 8 , Figure 8 The computer storage medium 200 of this embodiment stores a computer program 21 which can be executed to implement the method of the above embodiment.

[0115] The computer storage medium 200 in this embodiment can be a medium that can store program instructions, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or it can also be a server that stores the program instructions. The server can send the stored program instructions to other devices for execution, or it can also execute the stored program instructions itself.

[0116] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation methods described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0117] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0118] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0119] Although this specification has shown and described a plurality of embodiments of the present application, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will think of many changes, modifications and alternatives without departing from the thought and spirit of the present application. It should be understood that in the process of practicing the present application, various alternatives to the embodiments of the present application described herein may be adopted. The appended claims are intended to define the scope of protection of the present application and therefore cover modular compositions, equivalents or alternatives within the scope of these claims.

Claims

1. A plant modeling method, characterized in that: The modeling method includes: Get a sketch of the plant; Analyzing plant primitives and corresponding primitive types in the plant sketch, wherein the primitive types include petal types, leaf types, and branch types; Performing depth information restoration on the plant primitive based on the primitive type; Establish plant models based on the depth information of plant primitives; The modeling method further includes: optimizing the details of the plant model, wherein the detail optimization includes petal bending simulation, petal concavity simulation, or branch radius attenuation; Among them, the following formula is used to optimize the petal bending simulation: Where A and B are the elastic coefficients of the petal itself, L represents the length of the main axis of the petal, x represents the projection of a vector at a point on the petal on the main axis, and y represents the displacement of a point on the petal along the normal direction of the petal plane; The optimization method for simulating the concave petals includes: establishing a coordinate system with the petal root as the origin, calculating the main axis of the petal, and recording the main axis as the v axis, and recording the direction perpendicular to the main axis to the right as the u axis, and calculating the coordinates of each vertex of the petal in the new coordinate system; wherein, when v is constant, the closer u is to 0, the greater the degree of concavity of the vertex; when u is constant, the closer v is to half the length of the main axis, the greater the degree of concavity of the vertex; Among them, the following formula is used to optimize the branch radius attenuation: Among them, s and α control the speed of attenuation, s is taken as s>10, α is taken as 0.3~0.5, m controls the ratio of the radius of the branch end to the root radius, and is taken as 0~1, and r represents the radius attenuation ratio at point x where the ratio of the length from the branch root to the total length of the branch is x.

2. The modeling method according to claim 1, characterized in that The obtaining of the plant sketch comprises: receiving a drawing stroke, sampling the drawing stroke to obtain a plurality of sampling points; Smoothing is performed on multiple sample points to produce a smooth plant sketch.

3. The modeling method according to claim 1, characterized in that The analyzing of the plant primitives and corresponding primitive types in the plant sketch includes: Analyzing the stroke features of the plant primitive to determine whether the primitive type of the plant primitive is a branch type, or a petal type and a leaf type; If the plant primitive is a petal type or a leaf type, the cluster root point features of the plant primitive are analyzed to determine whether the primitive type of the plant primitive is a petal type or a leaf type.

4. The modeling method according to claim 3, characterized in that The analyzing the stroke features of the plant primitive to determine whether the primitive type of the plant primitive is a branch type, or a petal type or a leaf type includes: Analyze the ratio of the distance between the stroke endpoint and the starting point to the stroke length, the ratio of the maximum eigenvalue to the minimum eigenvalue after principal component analysis of the stroke, and the ratio of the area of the bounding box formed in the direction of the eigenvectors of the maximum eigenvalue and the minimum eigenvalue to the stroke length; The ratio is compared with a threshold value to determine whether the graphic element type of the plant graphic element is a branch type, or a petal type and a leaf type.

5. The modeling method according to claim 3, characterized in that: The analyzing the cluster root point features of the plant primitive to determine whether the primitive type of the plant primitive is a petal type or a leaf type includes: Determining root points in the plant primitives, and clustering the root points to form clusters; If the number of root points in the cluster is greater than 2, the primitive type of the plant primitive is determined to be the petal type; If the number of root points in the cluster is less than or equal to 2, the primitive type of the plant primitive is determined to be a leaf type.

6. The modeling method according to claim 1, characterized in that If there are multiple plant primitives of branch type in the plant sketch, the modeling method further includes: The one with the longest stroke is used as the primary plant primitive; Traverse other plant primitives multiple times to divide the plant primitives into levels, and the distance between the endpoint of each plant primitive and the previous level plant primitive is less than a threshold.

7. The modeling method according to claim 1, characterized in that The graphic element type further includes a branch outline type, wherein the plant graphic element includes a main branch and branch outlines surrounding the main branch; The modeling method further comprises: Sampling the main branches to obtain a plurality of growth points, and sampling the outlines of the branches to obtain a plurality of attraction points; A plurality of sub-branches connected to the main branch are generated from the growth point to the attraction point.

8. The modeling method according to claim 1, characterized in that: The graphic element type further includes a leaf outline, and the plant graphic element includes a branch and a leaf outline surrounding the branch; The modeling method further comprises: Sampling the branches to obtain a plurality of growth points, and sampling the leaf contours to obtain a plurality of attraction points; Generate leaves and align their root points with the growth points and their tips with the attraction points.

9. The modeling method according to claim 1, characterized in that: The primitive type is a petal type, and the recovering of depth information of the plant primitive based on the primitive type includes: Get the petal root point and petal tip point in the plant primitive; Based on the petal root point, performing ellipse fitting on the petal apex point; The ellipse is transformed into a three-dimensional cone, and the three-dimensional coordinates of each point in the plant primitive are determined according to the three-dimensional cone, and the three-dimensional coordinates are used as the depth information.

10. The modeling method according to claim 1, characterized in that: The primitive type is a leaf type, and the depth information restoration of the plant primitive based on the primitive type includes: Obtaining a leaf root point and a leaf tip point in the plant primitive; The blade is rotated with the root point to the tip point of the blade as the rotation axis and rotated based on the direction of the branch connected to the root point of the blade to determine the transformed position of the blade, and the transformed position is used as the depth information.

11. The modeling method according to claim 6, characterized in that: The primitive type is a branch type, and the depth information restoration of the plant primitive based on the primitive type includes: Rotate the child branches of the hierarchically divided plant primitives around the parent branches; The rotation angle of the child branches is determined so as to maximize the dispersion of the child branches on the parent branches, and the rotation angle is used as the depth information.

12. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to execute the computer program to implement the steps of the method according to any one of claims 1 to 11.

13. A computer storage medium, characterized in that The computer storage medium stores a computer program, and the computer program is executed to implement the steps of the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Symmetric structure-based three-dimensional flower modeling method

    CN105957141A