CN114049426A - Modeling method of plant, electronic device and computer storage medium - Google Patents

Modeling method of plant, electronic device and computer storage medium Download PDF

Info

Publication number
CN114049426A
CN114049426A CN202111164488.8A CN202111164488A CN114049426A CN 114049426 A CN114049426 A CN 114049426A CN 202111164488 A CN202111164488 A CN 202111164488A CN 114049426 A CN114049426 A CN 114049426A
Authority
CN
China
Prior art keywords
plant
primitive
type
branch
leaf
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111164488.8A
Other languages
Chinese (zh)
Inventor
程章林
何振邦
奥利夫·马丁·多伊森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Institute of Advanced Technology of CAS
Original Assignee
Shenzhen Institute of Advanced Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Institute of Advanced Technology of CAS filed Critical Shenzhen Institute of Advanced Technology of CAS
Priority to CN202111164488.8A priority Critical patent/CN114049426A/en
Publication of CN114049426A publication Critical patent/CN114049426A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/213Feature extraction, e.g. by transforming the feature space; Summarisation; Mappings, e.g. subspace methods
    • G06F18/2135Feature extraction, e.g. by transforming the feature space; Summarisation; Mappings, e.g. subspace methods based on approximation criteria, e.g. principal component analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application relates to a modeling method of a plant, an electronic device and a computer storage medium, wherein the modeling method comprises the following steps: obtaining a plant sketch; analyzing plant primitives and corresponding primitive types in a plant sketch, wherein the primitive types comprise petal types, leaf types and branch types; recovering the depth information of the plant primitive based on the primitive type; and establishing a plant model according to the depth information of the plant primitive. The modeling method can realize rapid modeling of various plants.

Description

Modeling method of plant, electronic device and computer storage medium
Technical Field
The present application relates generally to the field of modeling. More particularly, the present application relates to a modeling method of a plant, an electronic device, and a computer storage medium.
Background
The plant is used as a common natural landscape in the real world, and the plant three-dimensional model has wide application in scenes such as movie and television special effects, electronic games, virtual reality and the like. However, because plants have very complex structures and shapes with varying shapes, it is a difficult task to faithfully model plants in three dimensions. In the traditional plant modeling method, an artist carries out detailed manual modeling according to a real plant picture or a real object by using three-dimensional modeling software such as Maya or 3DS MAX as reference, and although the method can restore the appearance and the details of a plant to the maximum extent, the whole process is very complicated and inefficient; traditional manual methods can make the modeling task even more daunting when large-scale plant scenes are desired to be modeled. Therefore, efficient and fast plant modeling method has been a very important and challenging topic in computer graphics research.
In the past decades, researchers and scholars have developed many effective plant modeling methods, such as rule-based procedural modeling methods, reconstruction methods based on video images and three-dimensional point clouds, and modeling methods based on hand-drawn sketches. Although the procedural modeling based on the L-system can automatically generate a complex model rapidly, due to the high learning threshold and poor controllability of plant morphology, the method requires a user to have rich expert knowledge of plant science and to be familiar with adjustment of various parameters to obtain an ideal target model, and the model is not easy to modify after being generated. With the development of hardware technology, high-precision plant images and point cloud data become easier to obtain, and convenience is provided for plant modeling based on real data; however, due to the occlusion and measurement angle limitations of various objects in a real scene and the self-occlusion phenomenon of plants, the shot pictures or point cloud data obtained by three-dimensional scanning are often incomplete and noisy, so that low-quality input data provides a small challenge for reconstructing a plant model; in addition, methods based on real data can only copy plants in reality and cannot design plant models which do not exist in the real world according to creativity.
Disclosure of Invention
The application provides a plant modeling method, electronic equipment and a computer storage medium, which are used for solving the problems that the existing plant modeling calculation is complex and the number of applicable plant types is small.
In order to solve the above technical problem, the present application provides a modeling method for a plant, including: obtaining a plant sketch; analyzing plant primitives and corresponding primitive types in the plant sketch, wherein the primitive types comprise petal types, leaf types and branch types; recovering the depth information of the plant primitive based on the primitive type; and establishing a plant model according to the depth information of the plant primitive.
In one embodiment, the obtaining a plant sketch comprises: receiving a drawing stroke, and sampling the drawing stroke to obtain a plurality of sampling points; and smoothing the plurality of sampling points to generate a smooth plant sketch.
In one embodiment, the analyzing the plant primitives and corresponding primitive types in the plant sketch comprises: analyzing the stroke characteristics of the plant primitive to determine that the primitive type of the plant primitive is a branch type or a petal type and a leaf type; and if the plant primitive is of a petal type and a leaf type, analyzing the clustering root point characteristics of the plant primitive to determine that the primitive type of the plant primitive is of the petal type or the leaf type.
In one embodiment, the analyzing the stroke features of the plant primitive to determine the primitive type of the plant primitive as a branch type or a petal type and a leaf type includes: analyzing the ratio of the distance of the starting point of the stroke end point to the stroke length, the ratio of the maximum characteristic value to the minimum characteristic value after the main component of the stroke is analyzed, and the ratio of the area of a bounding box formed in the direction of the characteristic vector of the maximum characteristic value to the minimum characteristic value to the stroke length; and comparing the ratio with a threshold value to determine that the primitive type of the plant primitive is a branch type or a petal type and a leaf type.
In one embodiment, the analyzing the clustered root 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 graphic primitives, and clustering the root points to form cluster clusters; if the number of root points in the cluster is more than 2, determining the primitive type of the plant primitive as a petal type; and if the number of the root points in the cluster is less than or equal to 2, determining the primitive type of the plant primitive as the leaf type.
In one embodiment, if there are multiple plant primitives of the branch type in the plant sketch; the modeling method further includes: taking the longest stroke as a primary plant primitive; and traversing other plant primitives for multiple times to carry out hierarchical division on the plant primitives, wherein the distance between the endpoint of each plant primitive and the previous plant primitive is smaller than a threshold value.
In one embodiment, the primitive types further include a limb outline type, and the plant primitive includes a main limb and a limb outline surrounding the main limb; the modeling method further includes: sampling the main branches to obtain a plurality of growing points, and sampling the contours of the branches to obtain a plurality of suction points; generating a plurality of sub-branches connecting the main branch from the growing point to the attraction point.
In one embodiment, the primitive type further comprises a leaf contour, the plant primitive comprises a stem and a leaf contour surrounding the stem; the modeling method further includes: sampling the branches to obtain a plurality of growing points, and sampling the blade profile to obtain a plurality of suction points; and generating a leaf, aligning the root point of the leaf with the growing point, and aligning the tip point of the leaf with the attraction point.
In one embodiment, the primitive type is a petal type, and the recovering the depth information of the plant primitive based on the primitive type includes: obtaining petal root points and petal tip points in plant primitives; performing ellipse fitting on the petal cusps based on the petal root points; and 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, wherein the three-dimensional coordinates are used as the depth information.
In one embodiment, the primitive type is a leaf type, and the recovering the depth information of the plant primitive based on the primitive type includes: acquiring a leaf root point and a leaf tip point in the plant primitive; and rotating by taking the root point to the tip point of the blade as a rotating shaft, and rotating in the direction of the branch connected with the root point of the blade to determine the transformation position of the blade, wherein the transformation position is used as the depth information.
In one embodiment, the primitive type is a branch type, and the recovering the depth information of the plant primitive based on the primitive type includes: rotating the subordinate branches of the plant graphic elements after hierarchical division around the parent branches; and determining the rotation angle of the branch at the sub level so as to maximize the dispersion degree of the branch at the sub level on the branch at the parent level, wherein the rotation angle is used as the depth information.
In one embodiment, the modeling method further comprises: and carrying out detail optimization on the plant model, wherein the detail optimization comprises petal bending simulation, petal inwards concave simulation or branch radius attenuation.
In order to solve the above technical problem, the present application provides an electronic device, which includes a processor and a memory, where the memory stores a computer program, and the processor is configured to execute the computer program to implement the steps of the above method.
In order to solve the above technical problem, the present application proposes a computer storage medium storing a computer program executed to implement the steps of the above method.
Different from the prior art, the modeling method comprises the following steps: obtaining a plant sketch; analyzing plant primitives and corresponding primitive types in a plant sketch, wherein the primitive types comprise petal types, leaf types and branch types; recovering the depth information of the plant primitive based on the primitive type; and establishing a plant model according to the depth information of the plant primitive. The modeling method can realize rapid modeling of various plants.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar or corresponding parts and in which:
FIG. 1 is a schematic flow chart diagram of an embodiment of a modeling method for plants of the present application;
FIG. 2 is a diagram of primitive types in the modeling method of the present application;
FIG. 3 is a schematic diagram of the restoration of petal depth information in the modeling method of the application;
FIG. 4 is a schematic diagram of the restoration of the depth information of the blade in the modeling method of the application;
FIG. 5 is a schematic diagram of a plant modeling implementation case of the modeling method of the present application;
FIG. 6 is a schematic interface diagram of plant modeling realized by the modeling method of the present application;
FIG. 7 is a schematic structural diagram of an embodiment of an electronic device of the present application;
FIG. 8 is a schematic structural diagram of an embodiment of a computer storage medium according to the present application.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
Specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. Please refer to fig. 1-4, which are related drawings of the modeling method of the plant of the present application. The present embodiment includes the following steps.
S11: and obtaining a plant sketch.
Firstly, receiving a drawing stroke, and sampling the drawing stroke to obtain a plurality of sampling points; and then smoothing the plurality of sampling points to generate a smooth plant sketch.
Specifically, firstly, the sketch resampling is carried out, firstly, the resampling of the stroke is carried out, namely, the sampling points of all the strokes are connected in sequence to form a stroke line segment, and starting from the first point, points on the stroke line segment are resampled along the line segment with a certain radius, so as to obtain uniform new sampling points.
Then, sketch smoothing is carried out, when a user draws long lines such as branches, errors such as shaking are likely to occur, if the situation is not corrected, drawing errors can be faithfully reflected in the model, the shape of the model is unnatural, and in addition, sampling in the previous step can cause sudden change and unsmooth of stroke line segments; the invention uses the method of reference Gaussian filtering to carry out rapid smoothing processing on the strokes, namely, coordinates of each sampling point after smoothing and the result of weighted average of the coordinates of the surrounding points. Let P ═ P be the point set obtained after sampling1,p2,...,pnP ', smoothed point set P ' ═ P '1,p′2,...,p′nAnd (4) the following steps:
Figure BDA0003291227070000051
s12: analyzing plant primitives and corresponding primitive types in the plant sketch, wherein the primitive types comprise petal types, leaf types and branch types.
When the sketch is obtained, the freedom degree and the convenience of a system for authoring a user are fully considered, and the difficulty degree of subsequent processing is also considered, so that the input primitive types appointed by the text method are as follows: the outline of the petals, the leaves, the branches, the twigs and the leaves is five types, and the sketch schematic diagram of each primitive is shown in figure 2. The thin branch outline and the leaf outline are respectively drawn in a specific mode, so that further classification is not needed, and the petals, the leaves and the branches are drawn in a component mode; in order to be able to model petals, leaves and limbs separately, strokes drawn in the part mode need to be classified.
The petals and the leaves are similar in two-dimensional form, but only different in texture and spatial position, the branches are firstly distinguished, and the strokes drawn in the element mode only need to be divided into the petals, the leaves and the branches. The classification method adopted by the invention is to extract the characteristics of each stroke and then classify the characteristics by using a support vector machine. The method specifically comprises the following steps:
analyzing the stroke characteristics of the plant primitive to determine that the primitive type of the plant primitive is a branch type or a petal type and a leaf type;
analyzing the ratio of the distance of the starting point of the stroke end point to the stroke length, the ratio of the maximum characteristic value to the minimum characteristic value after the main component of the stroke is analyzed, and the ratio of the area of a bounding box formed in the direction of the characteristic vector of the maximum characteristic value to the minimum characteristic value to the stroke length;
and comparing the ratio with a threshold value to determine that the primitive type of the plant primitive is a branch type or a petal type and a leaf type.
Then further subdividing the petals and the leaves, the method comprising:
and if the plant primitive is of a petal type and a leaf type, analyzing the clustering root point characteristics of the plant primitive to determine that the primitive type of the plant primitive is of the petal type or the leaf type.
Determining root points in the plant graphic primitives, and clustering the root points to form cluster clusters;
if the number of root points in the cluster is more than 2, determining the primitive type of the plant primitive as a petal type;
and if the number of the root points in the cluster is less than or equal to 2, determining the primitive type of the plant primitive as the leaf type.
Namely, the leaves and the root points of the petals are clustered, and the petals which are mutually gathered are classified from the leaves which are separately distributed. This classification method does not require the user to specify the number of flowers, the number of clusters to cluster is unknown, and thus the Mean Shift algorithm can be used to cluster the root points of the petals and leaves. Clusters with an element number greater than 2 among the clusters are classified as flowers, and clusters with an element number less than or equal to 2 among the clusters are classified as leaves.
The hierarchical division of the branches and the filling of the areas can be carried out in the step. Specifically, the hierarchical division of the branches includes the steps of:
taking the longest stroke as a primary plant primitive;
and traversing other plant primitives for multiple times to carry out hierarchical division on the plant primitives, wherein the distance between the endpoint of each plant primitive and the previous plant primitive is smaller than a threshold value.
Specifically, two sets of a processing set P and an unprocessed set N are specified, and all branches are in the set N in an initial state; firstly, taking the longest branch from N as a 0-level node and adding the longest branch into P in the algorithm; traversing all the branches in the N, matching with all the branches belonging to the current maximum level in the P, and if the branch N in the N setjThe end point of the point set and the branch P in P which belongs to the maximum leveliN is less than a threshold value when the Euclidean distance of any point in the point set of (2) is minimumjAnd piMatch, njIs piNext level of (a), piIs njA parent node of njMoving from N into P; the above operations are repeated until the set N is an empty set.
The region filling comprises branch filling and leaf filling.
If the primitive type is a branch outline type, the corresponding plant primitive comprises a main branch and a branch outline surrounding the main branch; the region filling includes the following steps.
Sampling the main branches to obtain a plurality of growing points, and sampling the contours of the branches to obtain a plurality of suction points;
generating a plurality of sub-branches connecting the main branch from the growing point to the attraction point.
When a user desires to describe a dense branch structure, the system allows the user to draw a contour stroke around a main branch to be branched, and represents that a plurality of branches in the contour are generated from the main branch and the formed new branch contour conforms to the stroke; to accomplish this, the contour needs to be filled in to add new twigs. According to the algorithm, firstly, the branches are sampled to obtain a plurality of growing points, and meanwhile, the contours are sampled to obtain a plurality of attraction points; from a certain growth point p0The coordinates of the next point are
Figure BDA0003291227070000071
Wherein k ispIs the contour attraction coefficient, kbIs the branch attraction coefficient, kmIs the direction memory coefficient, r is the growth rate; the branches continue to grow until they travel close to the contour.
If the primitive type further comprises a leaf outline, the corresponding plant primitive comprises a branch and a leaf outline surrounding the branch; the region filling includes the following steps.
Sampling the branches to obtain a plurality of growing points, and sampling the blade profile to obtain a plurality of suction points;
and generating a leaf, aligning the root point of the leaf with the growing point, and aligning the tip point of the leaf with the attraction point.
When a user needs to fully distribute the leaves around one branch, a contour can be drawn around the branch to represent that a plurality of leaves grow on the branch and form a shape which is consistent with the contour. The leaf contour filling algorithm is similar to the branch filling algorithm, and the only difference is that in the last step of the branch filling algorithm, the leaf contour filling algorithm randomly selects one leaf from the drawn leaves, performs affine transformation on the leaf, aligns the root point of the affine-transformed leaf with the growing point of the new branch obtained by growth, aligns the cusp point of the leaf (i.e., the point with the largest curvature change in the leaf stroke, the point with the visually prominent leaf) with the end point of the branch obtained by growth, and adds the obtained new leaf to the existing leaf set.
S13: and recovering the depth information of the plant primitive based on the primitive type.
The method specifically comprises the depth information recovery of plant primitives of a petal type, a leaf type and a branch type.
For petal types, the depth information recovery steps are as follows.
Obtaining petal root points and petal tip points in plant primitives;
performing ellipse fitting on the petal cusps based on the petal root points;
and 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, wherein the three-dimensional coordinates are used as the depth information.
The principle is as follows: the method of the invention considers that a flower composed of a plurality of petals is highly symmetrical, and the petals approximately form a cone around the center of the flower; the top point of the cone is positioned at the center of the flower, the petals are approximately attached to the side surface of the cone, the sharp points of the petals form a circular cone bottom surface in a surrounding mode, the sharp points of the petals are defined as the points with the largest curvature change in the stroke, and the sharp points are visually the points at the outermost periphery of the petals. The sketch is assumed to be obtained by parallel projection of a flower entity in a direction perpendicular to a drawing screen, so that an equation of a three-dimensional space cone can be recovered by analyzing the cone projection formed by each petal of each flower in the sketch, and Z-axis depth information of the petals can be obtained by solving the equation by substituting XY two-dimensional coordinates of each petal.
The flower depth information recovery algorithm of the invention is as follows:
(1) calculating the mean value of the coordinates of the root points of all the petals in the flower, and recording as the flower center cf
(2) Carrying out ellipse fitting on cusps of all petals by using a least square method to obtain an ellipse E;
(3) according to the hypothesis, 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 bottom surface of the cone in the original three-dimensional space; the angle θ formed by the major axis of the cone and the drawing plane is related to: sin θ is a/b, where a and b are the minor and major axes of the ellipse E, and θ can be obtained from this relationship.
(4) Calculating the ellipse E to the center of the flower c on the sketch planefThe distance "l" is determined from the geometrical relationship, and the height "h" of the cone in the three-dimensional space is l/sin θ; by integrating known conditions, an ellipse equation of a three-dimensional space can be obtained.
(5) The ellipse equation obtained in the last step is processed in a standard form with the Z axis as the main axis of the cone, and the ellipse rotation angle theta is not considered; calculating the vector from the center of the sketch plane space flower to the center c of the ellipse E
Figure BDA0003291227070000091
Unit vector of Z axis
Figure BDA0003291227070000092
Rotation axis capable of calculating ellipse
Figure BDA0003291227070000093
Calculating winding
Figure BDA0003291227070000094
Rotation matrix RM obtained by rotating θ:
(6) each point p of each petal, transforming the coordinates to cfIn a coordinate system of origin, a point p '═ x', y 'is obtained'](ii) a Let p "be p ' corresponding three-dimensional space point p ═ x ', y ', z]Wherein z is an unknown number; the following formula is combined to form the compound,
Figure BDA0003291227070000095
and solving out z, wherein z is the depth information corresponding to the point p. The algorithm process is schematically shown in fig. 3.
For the leaf type, the depth information recovery steps are as follows.
Acquiring a leaf root point and a leaf tip point in the plant primitive;
and rotating by taking the root point to the tip point of the blade as a rotating shaft, and rotating in the direction of the branch connected with the root point of the blade to determine the transformation position of the blade, wherein the transformation position is used as the depth information.
The blade depth information acquisition algorithm of the invention considers that all the initial states of the blades are positioned on an XY plane, and the depth values z are all 0; on a two-dimensional sketch, taking a root point of a leaf and a branch node obtained in the previous step for matching, if the distance from one point in a certain branch point set to the leaf root point is smaller than a threshold value, matching the leaf with the branch, and modifying depth values z of all points of the leaf into depth values of matching points of the branch; main shaft for defining blade
Figure BDA0003291227070000096
The vector from the root point to the tip point is adopted, and then the blade of the sketch plane is rotated to be vertical to the XY plane by the main shaft of the blade; calculating spindle
Figure BDA0003291227070000097
Rotating the blade in the direction of-Z axis by theta + delta at an included angle theta with the X axis, wherein delta is a random disturbance which is uniformly distributed within-30 degrees; calculating blade main shaft in original two-dimensional sketch
Figure BDA0003291227070000098
Direction vector of branch at matching point with branch
Figure BDA0003291227070000099
The included angle phi of the two-dimensional spherical mirror; calculating a rotation angle thetab=Φ·π-|cosΦ|+ Delta, and rotating the blade by theta about + Y axisbAt this time, the position of the blade is the final position in the three-dimensional space, the depth value obtained by transforming each point of the blade is the final depth value, and a schematic diagram of the algorithm process is shown in fig. 4.
For the branch type, the depth information recovery steps are as follows.
Rotating the subordinate branches of the plant graphic elements after hierarchical division around the parent branches;
and determining the rotation angle of the branch at the sub level so as to maximize the dispersion degree of the branch at the sub level on the branch at the parent level, wherein the rotation angle is used as the depth information.
The geometric structure of the branch is simple, and the depth information of each point on the branch can be obtained through interpolation only by knowing the depth information of two end points of the branch. The main idea of the branch depth recovery algorithm is that the sub-branches rotate around the parent branch according to the hierarchical relationship between the branch and the parent branch obtained before, and the three-dimensional distribution of the branch is found, so that the entropy of the branch is maximum in the state, namely the scattering degree of the branch distribution is maximum, and the branch forms a uniform and natural distribution effect in a three-dimensional space.
Figure BDA0003291227070000101
Wherein b is the current limb, biIs a sub-branch of the current branch, theta (b)i,bj) Is the angle between the two limbs, Δ (b)k) Represents a branch bkThe difference between the length under the current three-dimensional distribution and the projected length of the two-dimensional sketch.
The algorithm is recursive, the current branch is taken as a father branch, all the son branches of the father branch are traversed, the son branches are divided into two groups, the son branch on the left side and the son branch on the right side are given a random disturbance angle which obeys Gaussian distribution to each son branch as an initial value; and (5) solving the rotation angle of the sub-branch with the maximum current branch entropy by using an optimization method. The Z-axis depth coordinate of the three-dimensional space can be reversely solved from the two-dimensional projection coordinate through the rotation angle of the three-dimensional space, so that the acquisition of depth information is realized.
S14: and establishing a plant model according to the depth information of the plant primitive.
After the depth information of each part of the sketch is obtained, a three-dimensional model can be generated through Delaunay triangulation. The method of the invention also fully considers the shape detail changes of the flowers and the branches during modeling, and reflects the shape detail changes in the model, thereby increasing the reality of the model.
S15: and carrying out detail optimization on the plant model, wherein the detail optimization comprises petal bending simulation, petal inwards concave simulation or branch radius attenuation.
Petal bending simulation
The bending of the petals is a phenomenon widely existing in various types of flowers, and is a result of being influenced by gravity in some cases, and is generated by the inherent shape of the petals themselves in some cases. The method considers that the petals are a soft plane and meet the principle of elastic mechanics; according to the related knowledge of mechanics, the ideal length L soft rod can be deduced to have the deformation y generated by the bending of the length x away from the bottom end, and the relationship between y and x is as follows:
Figure BDA0003291227070000111
wherein A, B is the material modulus of elasticity of the object itself. The petal can be regarded as an elastic soft plane with uniform quality, the bending offset of each point can be calculated by applying the formula, and the main axis of the petal is recorded
Figure BDA0003291227070000112
In the formula
Figure BDA0003291227070000113
For each point p in the petal, a vector is calculated
Figure BDA0003291227070000114
On the main shaft
Figure BDA0003291227070000115
Upper projection
Figure BDA0003291227070000116
And calculating the offset y by substituting the formula, and enabling the point p to move by the offset y along the normal direction of the petal plane.
Petal inner concave simulation
The inward concavity of the petals is also a phenomenon widely existing in the petals, and the inward concavities of many petals are curved and sunken to a greater extent as the inward concavities are closer to the center of the petals. To simulate this phenomenon, a coordinate system is first established with the petal root point as the origin, and the petal principal axis is calculated
Figure BDA0003291227070000117
Will the main shaft
Figure BDA0003291227070000118
Is expressed as v-axis, perpendicular principal axis vector
Figure BDA0003291227070000119
Recording the coordinate of each vertex in a new coordinate system as a u axis in the right direction; when v is constant, the closer u is to 0, the greater the degree of concavity of the vertex; the closer v is to a certain value of u
Figure BDA00032912270700001110
The greater the degree of concavity of the apex.
Determination of radius of branches at different stages
The plant branches have different radiuses after branching, the radius of the branch at the final stage is smaller, and the branches of the plant branches follow a certain rule in fact: let r be the branch radius at the branch point, r being the branch radius at each level, assuming that the branch radius at each level is uniform everywhere1...rmThe radius of each branch above the branch point is satisfied
rp=r1 p+…+rm p
Wherein the power series p controls the accumulation degree of the radius of the branches, influences the relative thickness of the radius of the next-stage branches, and different plants have different power series p; when p is 2, the relation is the radius relation of the branch and the trunk of the tree proposed by DaVinci; for herbaceous plants such as flowers and the like, better effect can be achieved by taking p > 2. In the step of sketch analysis, a parent-child hierarchical relationship among branches is constructed, the number of child nodes and child nodes of a certain branch can be obtained through statistics of traversal of the nodes of the branches, and relevant information is brought into a formula to obtain the radius of the child branches for reference of subsequent modeling.
Branch radius decay
The radius of a certain level of branches of the plant is not constant, and for the level one branches, the radius gradually decreases from the root to the top, which is caused by the sequence of plant growth and the growth accumulation effect; in order to capture the phenomenon, the method uses a radius attenuation formula, and the radius attenuation ratio r at the position where the ratio of the length of the root to the total length of the branch is x is as follows:
Figure BDA0003291227070000121
wherein s and alpha control the speed of attenuation, s is generally greater than 10, alpha is generally 0.3-0.5, and m controls the ratio of the radius of the tail end of the branch to the radius of the root and is generally 0-1.
Modeling of geometric shape of branches
Based on the comprehensive performance consideration of modeling and rendering, the method uses octaprisms to model the branches. The branch construction method uses a regular octagon, moves the center of the octagon along the branch framework for lofting, and adjusts the radius of the octagon by referring to the radius of each level of the branch and the radius attenuation formula in the previous step.
The modeling process of the plant sketch comprises the steps of firstly preprocessing the sketch, mainly resampling handwriting and smoothing the strokes; and then analyzing the sketch, wherein the analysis process mainly comprises the steps of primitive classification, branch level analysis and area filling. And then, restoring the depth information of the sampling points of the primitives in the sketch to obtain a point set of the three-dimensional space. And finally, constructing a plant model with high reality sense from the three-dimensional point set according to the morphological characteristics of the plants. After the model is built, a user can also view the model in the three-dimensional view, and the texture of the model is changed, so that the model can be stored after the expected effect is achieved.
The method and the device can support a user to quickly draw a two-dimensional sketch of the plant with the branch and leaf structure and quickly give a plant model conforming to the two-dimensional sketch, and can display and modify the two-dimensional sketch in a window in real time. The software can support various two-dimensional primitives of the outlines of flowers, leaves, branches and leaves, more types of three-dimensional plant models can be established, and the creation freedom degree given to a user is higher. And only a user is required to draw a two-dimensional sketch, strict perspective relation and detail information are not needed, and other additional semantic or control information is not needed to be provided by the user. And the existing plant modeling method based on the sketch usually focuses on the overall outline and shape, and the detail simulation is poor, so that the method can simulate the detail characteristics of plant flower bending, flower concave, branch radius at each level and branch radius attenuation, and improves the reality sense of the established model.
The three-dimensional modeling method based on the hand-drawn sketch is quick, simple, convenient and flexible, a user can draw the sketch according to own idea and quickly generate an expected model without special training, compared with other methods, the whole modeling process is greatly simplified, and the modeling efficiency is greatly improved; the modeling method based on the hand-drawn sketch can provide great freedom for a user to generate plant models with various complex shapes without knowing relevant details generated by the models, so the modeling method based on the hand-drawn sketch has high practical value.
The software system constructed based on the method provides a basic sketch drawing function: curve drawing, redoing, undoing, loading of reference pictures, and saving and loading of draft files. The software realizes the end-to-end construction of the plant model from the sketch to the three-dimensional model; if the user is not satisfied with the modeling result, the user can return to the previous step to draft again or modify a plurality of software parameters in the interface. The software provides a window to display the three-dimensional plant model, and can rotate, translate and zoom the three-dimensional plant model for observation, and adjust the model and select different plant textures. And saving the established three-dimensional model in an obj format.
Referring to fig. 6, the software uses C + + to implement a core algorithm, uses Qt as a graphical interface frame and OpenGL to render and display a model, and a user can draw a sketch on the left side of the interface and observe a generated model on the right side in real time. The system can operate normally. In order to test the feasibility of modeling by the method, different testers are invited to carry out on-board testing, the testers are required to draw sketches and use the system to establish the model, the expected modeling effect can be achieved in the test example, and the input sketches and the established plant model are shown in FIG. 5.
The modeling method of the plant can be implemented by an electronic device, so the present application also provides an electronic device, please refer to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of the electronic device of the present application, the electronic device 100 of the present embodiment may be a computer, and includes a processor 11 and a memory 12 that are connected to each other, and the electronic device 100 of the present embodiment can implement the embodiment of the method. Wherein the memory 12 has stored therein a computer program, and the processor 11 is configured to execute the computer program to implement the above-mentioned method.
The processor 11 may be an integrated circuit chip having signal processing capabilities. The processor 11 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
For the method of the above embodiment, it may exist in the form of a computer program, so that the present application provides a computer storage medium, please refer to fig. 8, and fig. 8 is a schematic structural diagram of an embodiment of the computer storage medium of the present application. The computer storage medium 200 of the present embodiment stores therein a computer program 21 that can be executed to implement the method in the above-described embodiments.
The computer storage medium 200 of this embodiment may be a medium that can store program instructions, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, or may also be a server that stores the program instructions, and the server may send the stored program instructions to other devices for operation, or may self-operate the stored program instructions.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules or units is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
While various embodiments of the present application have been shown and described herein, it will be obvious to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, changes, and substitutions will occur to those skilled in the art without departing from the spirit and scope of the present application. It should be understood that various alternatives to the embodiments of the application described herein may be employed in practicing the application. The following claims are intended to define the scope of the application and, accordingly, to cover module compositions, equivalents, or alternatives falling within the scope of these claims.

Claims (14)

1. A modeling method for a plant, the modeling method comprising:
obtaining a plant sketch;
analyzing plant primitives and corresponding primitive types in the plant sketch, wherein the primitive types comprise petal types, leaf types and branch types;
recovering the depth information of the plant primitive based on the primitive type;
and establishing a plant model according to the depth information of the plant primitive.
2. The modeling method of claim 1, wherein the obtaining a plant sketch comprises:
receiving a drawing stroke, and sampling the drawing stroke to obtain a plurality of sampling points;
and smoothing the plurality of sampling points to generate a smooth plant sketch.
3. The modeling method of claim 1, wherein said analyzing plant primitives and corresponding primitive types in said plant sketch comprises:
analyzing the stroke characteristics of the plant primitive to determine that the primitive type of the plant primitive is a branch type or a petal type and a leaf type;
and if the plant primitive is of a petal type and a leaf type, analyzing the clustering root point characteristics of the plant primitive to determine that the primitive type of the plant primitive is of the petal type or the leaf type.
4. The modeling method of claim 3, wherein said analyzing the stroke features of the plant primitive to determine the primitive type of the plant primitive as a stem type or a petal type and a leaf type comprises:
analyzing the ratio of the distance of the starting point of the stroke end point to the stroke length, the ratio of the maximum characteristic value to the minimum characteristic value after the main component of the stroke is analyzed, and the ratio of the area of a bounding box formed in the direction of the characteristic vector of the maximum characteristic value to the minimum characteristic value to the stroke length;
and comparing the ratio with a threshold value to determine that the primitive type of the plant primitive is a branch type or a petal type and a leaf type.
5. The modeling method of claim 3, wherein said analyzing the clustered root features of the plant primitives to determine if the primitive type of the plant primitives is a petal type or a leaf type comprises:
determining root points in the plant graphic primitives, and clustering the root points to form cluster clusters;
if the number of root points in the cluster is more than 2, determining the primitive type of the plant primitive as a petal type;
and if the number of the root points in the cluster is less than or equal to 2, determining the primitive type of the plant primitive as the leaf type.
6. The modeling method of claim 1, wherein if there are multiple plant primitives of the branch type in the plant sketch; the modeling method further includes:
taking the longest stroke as a primary plant primitive;
and traversing other plant primitives for multiple times to carry out hierarchical division on the plant primitives, wherein the distance between the endpoint of each plant primitive and the previous plant primitive is smaller than a threshold value.
7. The modeling method of claim 1, wherein the primitive types further include a limb outline type, and the plant primitive includes a main limb and a limb outline surrounding the main limb; the modeling method further includes:
sampling the main branches to obtain a plurality of growing points, and sampling the contours of the branches to obtain a plurality of suction points;
generating a plurality of sub-branches connecting the main branch from the growing point to the attraction point.
8. The modeling method of claim 1, wherein the primitive types further include leaf contours, and the plant primitives include stems and leaf contours surrounding the stems; the modeling method further includes:
sampling the branches to obtain a plurality of growing points, and sampling the blade profile to obtain a plurality of suction points;
and generating a leaf, aligning the root point of the leaf with the growing point, and aligning the tip point of the leaf with the attraction point.
9. The modeling method of claim 1, wherein the primitive type is a petal type, and the recovering the depth information of the plant primitive based on the primitive type comprises:
obtaining petal root points and petal tip points in plant primitives;
performing ellipse fitting on the petal cusps based on the petal root points;
and 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, wherein the three-dimensional coordinates are used as the depth information.
10. The modeling method of claim 1, wherein the primitive type is a leaf type, and the recovering the depth information of the plant primitive based on the primitive type comprises:
acquiring a leaf root point and a leaf tip point in the plant primitive;
and rotating by taking the root point to the tip point of the blade as a rotating shaft, and rotating in the direction of the branch connected with the root point of the blade to determine the transformation position of the blade, wherein the transformation position is used as the depth information.
11. The modeling method of claim 6, wherein the primitive type is a branch type, and the recovering the depth information of the plant primitive based on the primitive type comprises:
rotating the subordinate branches of the plant graphic elements after hierarchical division around the parent branches;
and determining the rotation angle of the branch at the sub level so as to maximize the dispersion degree of the branch at the sub level on the branch at the parent level, wherein the rotation angle is used as the depth information.
12. The modeling method of claim 1, further comprising:
and carrying out detail optimization on the plant model, wherein the detail optimization comprises petal bending simulation, petal inwards concave simulation or branch radius attenuation.
13. An electronic device, characterized in that the electronic device comprises a processor and a memory, in which a computer program is stored, the processor being adapted to execute the computer program to implement the steps of the method according to any of claims 1-12.
14. A computer storage medium, characterized in that the computer storage medium stores a computer program which is executed to implement the steps of the method according to any one of claims 1-12.
CN202111164488.8A 2021-09-30 2021-09-30 Modeling method of plant, electronic device and computer storage medium Pending CN114049426A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111164488.8A CN114049426A (en) 2021-09-30 2021-09-30 Modeling method of plant, electronic device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111164488.8A CN114049426A (en) 2021-09-30 2021-09-30 Modeling method of plant, electronic device and computer storage medium

Publications (1)

Publication Number Publication Date
CN114049426A true CN114049426A (en) 2022-02-15

Family

ID=80205453

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111164488.8A Pending CN114049426A (en) 2021-09-30 2021-09-30 Modeling method of plant, electronic device and computer storage medium

Country Status (1)

Country Link
CN (1) CN114049426A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114969917A (en) * 2022-05-25 2022-08-30 广州山水比德设计股份有限公司 Method and device for generating 3D vegetation map, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114969917A (en) * 2022-05-25 2022-08-30 广州山水比德设计股份有限公司 Method and device for generating 3D vegetation map, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
Neubert et al. Approximate image-based tree-modeling using particle flows
Livny et al. Automatic reconstruction of tree skeletal structures from point clouds
US8334872B2 (en) Inverse kinematics for motion-capture characters
Jalba et al. Surface and curve skeletonization of large 3D models on the GPU
WO2019200683A1 (en) Sketch-based shape-preserving tree deformation animation method
WO2015149302A1 (en) Method for rebuilding tree model on the basis of point cloud and data driving
Zhang et al. Data-driven synthetic modeling of trees
US11010952B1 (en) Method and user interface for generating tangent vector fields usable for generating computer-generated imagery
CN114049426A (en) Modeling method of plant, electronic device and computer storage medium
US11803998B2 (en) Method for computation of local densities for virtual fibers
US11682156B2 (en) Method for controlling digital feather growth between two manifolds in a computer simulated creature
Meyer et al. PEGASUS: Physically Enhanced Gaussian Splatting Simulation System for 6DOF Object Pose Dataset Generation
Chaudhry et al. Modelling and Simulation of Lily flowers using PDE Surfaces
US11783516B2 (en) Method for controlling digital feather generations through a user interface in a computer modeling system
US11354878B2 (en) Method of computing simulated surfaces for animation generation and other purposes
Zhang et al. EnergyHair: Sketch-Based Interactive Guide Hair Design Using Physics-Inspired Energy
CN117576280B (en) Intelligent terminal cloud integrated generation method and system based on 3D digital person
US8896607B1 (en) Inverse kinematics for rigged deformable characters
Wang et al. GPU-based Grass Simulation with Accurate Blade Reconstruction
WO2023023404A1 (en) Method for controlling digital object generations through a user interface in a computer modeling system
Argudo Medrano et al. Tree variations
Pellegrin et al. Curvature analysis of sculpted hair meshes for hair guides generation
Ma-thi et al. Image-Based Approach for Preparing Artifacts for Virtual Puppetry Museum
WO2022005302A1 (en) Method for computation of local densities for virtual fibers
McCormick Interactive freeform editing techniques for large-scale, multiresolution level set models

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination