An animation generation method based on harmonic interpolation of planar multi-connected shapes
By using a harmonic interpolation method based on planar multi-connected shapes, and by optimizing function mapping using basis function representation and iterative solvers, the problems of long computation time and limited applicability in existing technologies are solved, and animations of complex boundary multi-connected regions are generated efficiently.
Patent Information
- Application Number
- CN202210782957.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-07-05
AI Technical Summary
Existing animation generation methods rely heavily on mesh quality for interpolation results when dealing with multi-connected shapes, resulting in long computation times. Furthermore, existing function mapping-based methods can only handle simple, single-connected regions and cannot effectively generate intermediate frames with complex boundaries.
A harmonic interpolation method based on planar multi-connected shapes is adopted. Intermediate frames are generated by calculating the basis function representation of the planar domain and linear interpolation, and an iterative solver is used to optimize the function mapping to generate efficient intermediate frame results.
It effectively avoids the problem of long computation time caused by gridding, expands the applicability of function mapping methods, can handle multi-connected regions with complex boundaries, and improves computational efficiency and generation effect.
Smart Images

Figure CN115239851B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of animation generation technology, and in particular to an animation generation method based on harmonic interpolation of planar multi-connected shapes. Background Technology
[0002] Animation generation is a technique that, given keyframes of a shaped object, generates a series of consecutive intermediate frames, connecting these keyframes into a continuous animation sequence. Existing techniques typically fall into two categories: one involves meshing the given shape, using the resulting mesh data structure as the processing object, and interpolating the mesh structure corresponding to the keyframes to obtain the mesh structure of the corresponding intermediate frames, thereby reconstructing the shape of the intermediate frames; the second method treats the given shape as a planar mapping function, using this function as the processing object, and interpolating the function corresponding to the keyframes to obtain the function corresponding to the intermediate frames, thus obtaining the shape of the intermediate frames.
[0003] The inventors studied two existing methods for generating planar animations and found that the first method has a high correlation between interpolation results and meshing results. To obtain fine intermediate interpolation results, extremely fine meshing data is required, which often means that such methods have a huge time cost. The existing second method has a strong limitation on the original shape object. The existing technology can only handle the case where the domain of the function is a simply connected region. It cannot obtain complete intermediate frame results for the more complex multi-connected case. Summary of the Invention
[0004] In view of this, the present invention provides an animation generation method based on harmonic interpolation of planar multi-connected shapes to solve the two main problems in existing methods: the intermediate results of interpolation are highly dependent on mesh quality, the generation takes a lot of time, and effective intermediate results cannot be obtained for original shapes with complex boundaries.
[0005] The technical solution of this invention is: an animation generation method based on harmonic interpolation of planar multi-connected shapes, comprising:
[0006] Select the original planar shape and set keyframes;
[0007] Input the number of intermediate frames N;
[0008] N intermediate frames are generated sequentially by interpolation, and all generated results are stored in the array IBN in order.
[0009] Output the N results in IBN;
[0010] Play all frames sequentially to create a continuous animation.
[0011] Optionally, the above method involves selecting the original planar shape and setting keyframes, including:
[0012] Given the original shape, determine the shape boundary and the corresponding two-dimensional plane domain;
[0013] Calculate and store the harmonic function basis functions corresponding to the multi-connected planar regions of the domain;
[0014] Set keyframes and calculate the geometric quantities corresponding to the keyframes.
[0015] Optionally, the above method involves sequentially interpolating to generate N intermediate frames and storing all generated results in an array IBN, including:
[0016] For the current counter, calculate the corresponding intermediate time.
[0017] The geometric quantities of the keyframes are obtained by linear interpolation, and the geometric quantities corresponding to the intermediate time points are obtained.
[0018] Construct an optimization problem concerning the geometry at an intermediate time step, to compute the function mapping corresponding to this intermediate time step geometry, which consists of the harmonic function basis functions of the connected planar region corresponding to the original shape;
[0019] Use an iterative solver to compute the function mapping corresponding to the optimization problem;
[0020] The obtained function mapping corresponding to the intermediate time is applied to the original domain to obtain the corresponding intermediate time shape;
[0021] The obtained intermediate time shape is stored in the IBN array in order.
[0022] Beneficial effects:
[0023] Compared with the prior art, the present invention has the following advantages:
[0024] This invention discloses an animation generation method based on harmonic interpolation of planar multi-connected shapes. Compared with existing first-type methods, this method abandons using meshed results as interpolation objects, effectively avoiding the problem of long computation time caused by the fineness of the mesh. Compared with existing second-type methods, this method greatly expands the applicable objects of existing function mapping-based methods, extending the original method, which could only handle simple simply connected region shapes, to be able to handle more general multi-connected region shapes with complex boundaries. Furthermore, to further improve computational speed, this method designs and uses an efficient and parallelizable iterative descent method during the iterative solution of the optimization problem. Attached Figure Description
[0025] Figure 1This is an overall flowchart of the 2D animation generation method disclosed in the embodiments of this application;
[0026] Figure 2 This is a detailed flowchart of 103 in the overall flowchart of the planar animation generation method disclosed in the embodiments of this application;
[0027] Figure 3 This is a detailed flowchart of the iterative solver 1035 in the flowchart 103 disclosed in the embodiments of this application;
[0028] Figure 4 This is a demonstration of the results of the 2D animation generation method disclosed in the embodiments of this application;
[0029] Figure 5 This is a demonstration of the shape boundary and two-dimensional plane domain determined for the selected original planar shape in embodiment 101 of this application;
[0030] Figure 6 This is a schematic diagram illustrating the expression for a harmonic function of a general planar multi-connected region as disclosed in embodiment 101 of this application. Detailed Implementation
[0031] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0032] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined in this invention may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0033] This invention discloses an animation generation method based on harmonic interpolation of planar multi-connected shapes. Applied in the planar animation generation process, it can handle more planar shapes while maintaining extremely high computational efficiency. The overall execution flow for generating planar animations is as follows: Figure 1 As shown, the steps include:
[0034] 101. Select the original planar shape and set keyframes;
[0035] In this embodiment of the invention, after given the original planar shape, it is first necessary to determine the shape boundary and the corresponding two-dimensional plane domain Ω, such as... Figure 5 As shown, for the original shape input on the left, the resulting shape boundary is the boundary shown on the right, and the region enclosed by the boundary is the two-dimensional planar domain corresponding to the shape boundary. Then, for the determined shape boundary, this invention uses the harmonic function representation method for multi-connected regions mentioned in the published paper "GPU-accelerated locally injective shape deformation. ACMTrans.Graph.36,6 (Nov.2017)" to obtain the basis function representation corresponding to the planar domain Ω. Here, if we assume the boundary of the region is a polygon P = {z1, z2, ..., z...} composed of m vertices... m}, where z is a vertex of a polygon, and there are n holes in the multi-connected region, with the center point of each hole being {ρ1,...,ρ n The function can be represented as:
[0036]
[0037]
[0038] in, It corresponds to the boundary point z j The Cauchy barycentric coordinates are represented. Figure 6 The notation for a general multi-connected region is given, where z is the boundary vertex, the gray area is the planar multi-connected region, the blank area in the middle is a hole in a connected region, and point ρ1 corresponds to the center point of this hole. Meanwhile, this invention uses D... j (z) is C j The first derivative of (z) is expressed as follows:
[0039]
[0040] Finally, a set of keyframes is determined, for example, two keyframes in this invention, such as... Figure 4 As shown in (a) and (c), the default number of keyframes in this embodiment is 2. It should be noted that for cases with more than 2 keyframes, they can be easily regrouped in pairs for animation generation, thus posing no operational difficulty. The harmonic functions corresponding to the two defined keyframes are denoted as f. 0 and f 1 The method of this invention calculates its corresponding boundary geometry M. 0 and M 1 The specific formula for calculating geometric quantities is as follows:
[0041] M = J T J
[0042] In the formula, J represents the Jacobian matrix corresponding to the plane mapping function.
[0043] 102. Input the number of intermediate frames N;
[0044] In this embodiment of the invention, it is necessary to specify the number N of intermediate frames that should be obtained between a set of keyframes. Generally, N = 500 is selected, that is, 500 intermediate frames will be obtained between every two selected keyframes as the final result, which is used to generate the animation sequence.
[0045] 103. Generate N intermediate frames by interpolation in sequence, and store all the generated results in the array IBN in sequence;
[0046] The specific process of embodiment 103 of the present invention will be described below. Figure 2 As explained in the explanation.
[0047] 104. Output the N results in IBN;
[0048] In this embodiment of the invention, all intermediate frame results stored in array IBN in 103 are saved in the corresponding disk storage address according to the image storage format of JPG. Figure 4 The reconstruction results of some intermediate frames are given in (b1)(b2)(b3)(b4).
[0049] 105. Play all frames in sequence to obtain a continuous animation;
[0050] In this embodiment of the invention, for the N intermediate result images output in 104, the video synthesis function built into the MATLAB mathematical software is used to play a series of intermediate frame images sequentially and generate an AVI format video data, which is then stored in the corresponding disk storage address.
[0051] The specific calculation and solution process of embodiment 103 of the present invention is as follows: Figure 2 As shown, it includes the following steps:
[0052] 1031. Initialize counter k = 1;
[0053] 1032. Calculate the intermediate time t corresponding to the current counter k;
[0054] 1033. Obtain the geometric quantities M of the intermediate frame at time t by linear interpolation of the keyframe. t ;
[0055] In this embodiment of the invention, since the default number of keyframes processed is 2, the boundary geometry M corresponding to the keyframes has already been calculated in step 101. 0 and M1 For the boundary geometry M corresponding to the intermediate time t t This invention uses linear interpolation, and:
[0056] M t = (1-t)M 0 +tM 1
[0057] 1034. Using M t Construct an optimization problem;
[0058] In this embodiment of the invention, the boundary geometry of linear interpolation is assumed. It is calculated in 1033 steps, and the geometric quantity corresponding to the objective function mapping is... Then, the optimized energy form for a sampling point ω on the region boundary is:
[0059]
[0060] Therefore, the optimized energy form for all sampling points on the region boundary is:
[0061]
[0062] 1035. Using an iterative solver, obtain the function mapping f corresponding to the intermediate frame. t ;
[0063] In this embodiment of the invention, the solver used to solve the optimization problem designed in 1034 is a Newton solver. The specific process of the Newton solver designed in this invention will be described below. Figure 3 As explained in the explanation.
[0064] 1036, the corresponding intermediate frame shape result is S t =f t (Ω);
[0065] In this embodiment of the invention, Ω comes from the planar multi-connected domain defined in 101, f t The final output of the iterative solver in 1035.
[0066] 1037. S t Stored sequentially in the IBN array;
[0067] 1038. Calculator k = k + 1;
[0068] 1039. Determine whether the number of generated intermediate frames has reached the specified number;
[0069] In the embodiment of the present invention, N is the number of intermediate frames to be generated specified by the user in 102. By judging the size relationship between the current counter k and N, when k < N, the number of generated intermediate frames has not reached the specified number, and the process should continue to jump to 1032 to generate the intermediate frame result at the next moment; when the judgment of k < N fails, it means that the number of generated intermediate frames has reached the specified requirement, and the program step 103 of circularly generating intermediate frames ends, and the program jumps to 104.
[0070] The specific solution process of the Newton iterative solver in 1035 of the embodiment of the present invention is as Figure 3 shown, which includes the steps:
[0071] 10351. Set the initial value ψ 0 , and the counter j = 0;
[0072] In the embodiment of the present invention, each time the Newton solver is initialized, the initial value ψ 0 comes from the final result of the previous frame. The actual variable in the solver is derived from the function representation of the current multiply-connected region in 101.
[0073] 10352. Calculate the optimized energy E;
[0074] In the embodiment of the present invention, the energy is calculated using the energy form mentioned in 1034.
[0075] 10353. Calculate the gradient G of the optimized energy E;
[0076] In the embodiment of the present invention, the calculation formula of the gradient G is:
[0077]
[0078] Among them, E is the optimized energy calculated in 10352, and h i is the geometric quantity of the objective function in the energy formula mentioned in 1034 The corresponding h i at this time has the specific expression:
[0079]
[0080]
[0081]
[0082]
[0083]
[0084] 10354. Calculate the projection H of the Hessian matrix of the optimized energy E;
[0085] In this embodiment of the invention, the original form of the Hessian matrix is:
[0086]
[0087] The expanded form of H1 is as follows:
[0088]
[0089]
[0090] The eigenvalues of the matrix corresponding to K are:
[0091]
[0092]
[0093] Regarding the relationship between the magnitudes of eigenvalues, this method handles three different cases:
[0094] Case 1, λ 1,2 ≥λ 3,4 ≥0, K + =K;
[0095] Case 2, 0 ≥ λ 1,2 ≥λ 3,4 K + =0;
[0096] Case 3, λ 1,2 ≥0≥λ 3,4 ;
[0097]
[0098] Finally, the expression for the projection H of the Hessian matrix is:
[0099]
[0100] 10355. Calculate the descent direction. dψ;
[0101] In this embodiment of the invention, a system of linear equations is solved. The descent direction of the current iteration is obtained.
[0102] 10356. Calculate the descent step size s;
[0103] In this embodiment of the invention, the binary search method is used to determine the descent step size. When the step size satisfies local monotonicity, the shortening is stopped and set as the descent step size of the current iteration.
[0104] 10357, Counter j = j + 1;
[0105] 10358. Calculate the energy change ΔE, the new variable value. ψ j ;
[0106] In this embodiment of the invention, the energy change ΔE = E in the current j-th iteration j-1 -E j new variable value
[0107] 10359. Determine if the iterative solver has terminated;
[0108] In this embodiment of the invention, the determination of whether to terminate the current iteration process is made by judging the magnitude of the energy change in the current iteration, and the final result is output.
[0109] Finally, it should be noted that in this invention, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0110] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, in implementing this invention, the functions of each unit can be implemented in one or more software and / or hardware components.
[0111] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of the present invention.
[0112] The above provides a detailed description of an animation generation method based on harmonic interpolation of planar multi-connected shapes provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. An animation generation method based on harmonic interpolation of planar multi-connected shapes, characterized in that, Includes the following steps: Select the original planar shape and set keyframes; Input the number of intermediate frames N; N intermediate frames are generated sequentially by interpolation, and all generated results are stored in the array IBN in order. Specifically, the steps include the following: 1031. Initialize counter k=1; 1032. Calculate the intermediate time t corresponding to the current counter k; 1033. Obtain the geometric quantities of the keyframes through linear interpolation, and then obtain the geometric quantities of the intermediate frames at time t. ; The number of keyframes processed is 2, and the boundary geometry corresponding to the keyframes is... and For the boundary geometry corresponding to the intermediate time t Using linear interpolation, i.e.: 1034. Use Construct an optimization problem; Assuming the boundary geometry of linear interpolation It is calculated in 1033 steps, and the geometric quantity corresponding to the objective function mapping is... Then, the optimized energy form for a sampling point ω on the region boundary is: Therefore, the optimized energy form for all sampling points on the region boundary is: 1035. Using an iterative solver, obtain the function mapping corresponding to the intermediate frame. ; The solver used to solve the optimization problem designed in 1034 is the Newton solver; 1036, the corresponding intermediate frame shape result is ; From the planar multi-connected domain defined in 101, This is derived from the final output of the iterative solver in step 1035; 1037. Stored sequentially in the IBN array; 1038. Calculator k = k + 1; 1039. Determine whether the number of generated intermediate frames has reached the specified number; Output the N results in IBN; Play all frames sequentially to create a continuous animation.
2. The animation generation method based on harmonic interpolation of planar multi-connected shapes according to claim 1, characterized in that, The process of selecting the original planar shape and setting keyframes includes: Given the original shape, determine the shape boundary and the corresponding two-dimensional plane domain; Calculate and store the harmonic function basis functions corresponding to the multi-connected planar regions of the domain; Set keyframes and calculate the geometric quantities corresponding to the keyframes.
3. The animation generation method based on harmonic interpolation of planar multi-connected shapes according to claim 1, characterized in that, N intermediate frames are generated sequentially by interpolation, and all generated results are stored sequentially in the array IBN, including: For the current counter, calculate the corresponding intermediate time. The geometric quantities of the keyframes are obtained by linear interpolation, and the geometric quantities corresponding to the intermediate time points are obtained. Construct an optimization problem concerning the geometry at an intermediate time step, to compute the function mapping corresponding to this intermediate time step geometry, which consists of the harmonic function basis functions of the connected planar region corresponding to the original shape; Use an iterative solver to compute the function mapping corresponding to the optimization problem; The obtained function mapping corresponding to the intermediate time is applied to the original domain to obtain the corresponding intermediate time shape; The obtained intermediate time shape is stored in the IBN array in order.