Method and apparatus for controlling puppet animation by binding animation control nodes
By binding animation control nodes, constructing triangular meshes, and combining control points for image processing, the problem of stiff animation in existing technologies is solved, achieving highly free and realistic animation effects and simplifying user operation.
Patent Information
- Application Number
- CN202211324492.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-27
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-10-27
AI Technical Summary
Existing technology cannot meet users' needs for creating dynamic content, and it cannot flexibly adjust and freely control parts of images, resulting in stiff and unnatural animation effects.
By binding animation control nodes, constructing triangular meshes, and combining position control points, hardening control points, and hierarchical control points, local deformation and rendering processing of images can be achieved, including preprocessing, contour detection, meshing, and rendering operations.
It achieves highly free and realistic morphing animations, making user editing more flexible and vivid, simplifying the operation, and enhancing the naturalness and vividness of the animations.
Smart Images

Figure CN115619910B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and specifically relates to a method and apparatus for controlling puppet animation by binding animation control nodes. Background Technology
[0002] Puppet animation analyzes the non-transparent pixels in a 2D image, automatically and efficiently extracts the main subject, and establishes a content relationship grid. This allows users to freely add control points to the image, creating keyframe animations with subtle shape adjustments and natural, vivid deformations. This effect is one of the most popular image animation effects and remains in high demand.
[0003] Currently, almost all video and image editing applications on the mobile market only offer affine deformation. This processing technique can only perform uniform processing on the entire image, without extracting or processing the main subject within the image, nor can it freely adjust a specific part of the image. Although this method can create keyframe-based animations, the effects are stiff, rigid, and inflexible, far from meeting the needs of real users. Additionally, some applications use techniques similar to liquefaction, but this method is difficult to control, requires high precision, and cannot create keyframe animations, meaning it cannot truly achieve dynamic effects, turning images into videos, and therefore cannot meet users' needs for creating dynamic content. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to overcome the shortcomings of the prior art and provide a method and apparatus for controlling puppet animation by binding animation control nodes, so as to solve the problem that the prior art cannot meet the needs of users to create dynamic content.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for controlling puppet animation by binding animation control nodes, comprising:
[0006] Obtain the original texture of the input image, preprocess the original texture, and obtain the result texture;
[0007] Contour detection is performed on the resulting texture to obtain contour detection results with inclusion relationships and hierarchical structures. The contour detection results are then meshed to obtain a first triangular mesh.
[0008] The first triangular mesh is meshed using preset position control points and hardening control points to obtain the second triangular mesh;
[0009] The second triangular mesh is rendered by combining the preset hierarchical control points, the original texture, and the first triangular mesh, and the texture result is output.
[0010] Furthermore, the original texture is preprocessed to obtain the resulting texture, including:
[0011] The original texture is segmented to obtain a segmented mask texture;
[0012] The segmented mask texture is subjected to Gaussian blurring to obtain a Gaussian blurred texture;
[0013] The Gaussian blurred texture is binarized to obtain a binarized texture;
[0014] Morphological operations are performed on the binarized texture to obtain the resulting texture.
[0015] Furthermore, the contour detection results are subjected to a meshing operation to obtain a first triangular mesh, including:
[0016] Traverse each element of the contour detection result, and then traverse the sub-contours contained in each element of the contour detection result in layer order to obtain the shape segmentation result.
[0017] Traverse each element in the shape segmentation result, merge adjacent key points and approximate the shape of each element in the shape segmentation result to obtain the merged result;
[0018] The merging result is calculated using a triangular mesh partitioning algorithm to obtain the first triangular mesh.
[0019] Furthermore, one element in the position control point represents the target position of a corresponding vertex in the first triangular mesh, and one element in the hardening control point represents the weight of a corresponding triangle in the first triangular mesh; the step of performing a meshing operation on the first triangular mesh using preset position control points and hardening control points to obtain a second triangular mesh includes:
[0020] Determine whether the vertices of the first triangular mesh appear in the position control point, and divide those that do not appear into the first group and those that do appear into the second group;
[0021] The vertices in the first and second groups are expanded to obtain expansion vectors, and the coordinates to be solved and the constraint coordinates are determined based on the expansion vectors.
[0022] Based on the loss function, the minimum value of the loss function is obtained, and the solution value is determined as the second triangular mesh.
[0023] Furthermore, each element in the hierarchical control point represents a positional information, a depth value, and an area of influence; the rendering process of the second triangular mesh, combining the preset hierarchical control points, the original texture, and the first triangular mesh, to output the texture result includes:
[0024] The original texture is divided into multiple triangular textures based on the first triangular mesh;
[0025] Based on the mapping relationship between the first and second triangular meshes, multiple triangular textures are mapped onto the second triangular mesh;
[0026] Calculate the depth information of each triangle in the second triangular mesh based on the hierarchical control points;
[0027] Based on the depth information, the second triangular mesh is sorted in the order of drawing to obtain the output texture; wherein, the larger the depth information, the later it is drawn.
[0028] Furthermore, mapping the plurality of triangular textures onto the second triangular mesh includes:
[0029] Determine the coordinates of the points in the original triangle;
[0030] Determine the value of the coordinate point in the coordinate system formed by the vectors containing the vertices of the triangle;
[0031] Determine the new coordinates of the coordinate point after deformation;
[0032] Calculate the new values for the new coordinates.
[0033] Furthermore, the step of calculating the depth information of each triangle in the second triangular mesh based on the hierarchical control points includes:
[0034] Iterate through each triangle in the first triangular grid, performing the following steps for each triangle:
[0035] Initialize the depth information of the triangle; where the initial depth information is zero.
[0036] Traverse the hierarchical control points and determine whether the distance between the center of each triangle and the current hierarchical control point is less than a preset value. If it is less than the preset value, add the depth information of the triangle to the depth information of the current hierarchical control point.
[0037] Furthermore, the Levenberg-Marquardt algorithm is used to solve the loss function.
[0038] This application provides a device for controlling puppet animation by binding animation control nodes, comprising:
[0039] The acquisition module is used to acquire the original texture of the input image, preprocess the original texture, and obtain the result texture.
[0040] The operation module is used to perform contour detection on the resulting texture to obtain contour detection results with inclusion relationships and hierarchical structures, and to perform meshing operation on the contour detection results to obtain a first triangular mesh.
[0041] The processing module is used to perform a meshing operation on the first triangular mesh using preset position control points and hardening control points to obtain a second triangular mesh;
[0042] The output module is used to combine preset layer control points, original texture, and first triangular mesh to render the second triangular mesh and output the texture result.
[0043] This application provides a mobile terminal, including: a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor performs the steps of any of the above-described methods for controlling puppet animation by binding animation control nodes.
[0044] The beneficial effects that can be achieved by adopting the above technical solution in this invention include:
[0045] This invention provides a method and apparatus for controlling puppet animation by binding animation control nodes. This application establishes an image content relationship grid by analyzing the non-transparent pixels of a two-dimensional image, and then adds position control points, hardening control points, and hierarchical control points to the image to perform rigid deformation on the planar grid, thereby creating highly free and realistic deformation animations. Position control points can distort the image content at their location; hardening control points can solidify the image content in their area, used to reduce or increase the degree of deformation in a specified image region; hierarchical control points can adjust the rendering hierarchy of the divided deformation areas. Compared with existing deformation algorithms, this application adds a grid-based mutual influence relationship, resulting in non-linear deformation, thus making the user-edited deformation animations more realistic and vivid. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a schematic diagram illustrating the steps of the method for controlling puppet animation by binding animation control nodes according to the present invention;
[0048] Figure 2 This is a flowchart illustrating the method for controlling puppet animation by binding animation control nodes according to the present invention.
[0049] Figure 3 This is a schematic diagram of the device for controlling puppet animation by binding animation control nodes according to the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0051] The following describes, with reference to the accompanying drawings, a specific method and apparatus for controlling puppet animation by binding animation control nodes, as provided in an embodiment of this application.
[0052] like Figure 1 As shown in the embodiments of this application, the method for controlling puppet animation by binding animation control nodes includes:
[0053] S101, Obtain the original texture of the input image, preprocess the original texture, and obtain the result texture;
[0054] It should be noted that the method provided in this application can be implemented on a mobile device, such as a smartphone, tablet, or handheld device. The input image can be acquired by capturing a picture with the mobile device's camera or by retrieving it from the mobile device's photo album. The original texture of the input image can be obtained from the input image, and then the original texture is preprocessed to obtain the final texture.
[0055] S102, Perform contour detection on the resulting texture to obtain contour detection results with inclusion relationships and hierarchical structures, and perform meshing operation on the contour detection results to obtain a first triangular mesh;
[0056] Then, contour detection is performed on the resulting texture to obtain the contour detection result. The contour detection result is then meshed to obtain the first triangular mesh.
[0057] S103, the first triangular mesh is meshed using preset position control points and hardening control points to obtain the second triangular mesh;
[0058] It is understood that users can set position control points and harden control points on the mobile device. Position control points can distort the image content at the control point's location; harden control points can solidify the image content in their respective areas, used to reduce or increase the degree of distortion in a specified image area. After performing a meshing operation on the first triangular mesh using position control points and harden control points, a second triangular mesh is obtained.
[0059] S104 combines preset layer control points, original texture, and first triangular mesh to render the second triangular mesh and output the texture result.
[0060] Layer control points can adjust the rendering layer order of the divided deformation areas, and then render the second triangular mesh to obtain the final texture result.
[0061] The working principle of the method for controlling puppet animation by binding animation control nodes is as follows: See Figure 2 The input image is captured by the mobile device's camera or retrieved from the mobile device's photo album, thus obtaining the original texture of the input image. After preprocessing the original texture, a result texture is obtained. Then, contour detection is performed on the result texture to obtain the contour detection result. A meshing operation is performed on the contour detection result to obtain a first triangular mesh. Using position control points and hardening control points set by the user on the mobile device, the first triangular mesh is further meshed to obtain a second triangular mesh. Finally, using hierarchical control points set by the user on the mobile device, the acquired original texture, and the first triangular mesh, the second triangular mesh is rendered to output the texture result.
[0062] In some embodiments, the original texture is preprocessed to obtain a resulting texture, including:
[0063] The original texture is segmented to obtain a segmented mask texture;
[0064] The segmented mask texture is subjected to Gaussian blurring to obtain a Gaussian blurred texture;
[0065] The Gaussian blurred texture is binarized to obtain a binarized texture;
[0066] Morphological operations are performed on the binarized texture to obtain the resulting texture.
[0067] Specifically, this module is used to segment the original input texture A into a segmented mask texture B. Each pixel in the segmented mask texture B has a segmentation value x ranging from 0 to 255, representing the probability that it belongs to the segmented subject; the larger the value, the higher the probability. For the specific image subject segmentation algorithm, this application uses a segmentation model trained based on a self-developed and improved UNet network to perform texture segmentation.
[0068] Then, Gaussian blur is applied to the segmented mask texture B to obtain Gaussian blurred texture C.
[0069] For a Gaussian blurred texture C, binarization is performed to obtain a binarized texture D. A threshold t is set, and each segmentation probability x in the Gaussian blurred texture C is binarized to obtain x1. The specific formula is:
[0070]
[0071] Preferably, 31 is used as the threshold t in this invention.
[0072] For the binary texture D, morphological operations are performed to obtain the resulting texture E. The resulting texture E will be the output. The specific steps of the morphological operations are as follows:
[0073] First, perform 3 verifications. The etching process is used to remove fine burrs and smooth the segmented mask.
[0074] Then, perform 5 nuclear tests. The expansion operation is used to eliminate small holes, reduce the time cost of subsequent mesh building, improve mesh stability, and avoid overfitting.
[0075] Finally, two verifications were performed. The erosion operation is used to keep the total area of the segmented image stable.
[0076] In some embodiments, the contour detection results are meshed to obtain a first triangular mesh, including:
[0077] Traverse each element of the contour detection result, and then traverse the sub-contours contained in each element of the contour detection result in layer order to obtain the shape segmentation result.
[0078] Traverse each element in the shape segmentation result, merge adjacent key points and approximate the shape of each element in the shape segmentation result to obtain the merged result;
[0079] The merging result is calculated using a triangular mesh partitioning algorithm to obtain the first triangular mesh.
[0080] Specifically, after obtaining the resulting texture, contour detection is first performed to obtain a contour detection result H with inclusion relationships and hierarchical structure. Preferably, the present invention uses The Chin Chain algorithm as the specific implementation method for contour detection. The contour detection result H is an array. Each element contour0 in the array represents a contour that is not included by any contour, i.e., the outermost contour. Each contour0 can contain other sub-contours1, and sub-contours1 can continue to nest sub-contours2, and so on.
[0081] The contour detection result H is further processed to obtain the shape segmentation result K. The specific steps are as follows:
[0082] Iterate through each element in the contour detection result H, and then iterate through the sub-contours contained in each element in H in layer order. The contours of even-numbered layers are extracted as the outer contour, and the next odd-numbered layer contour of the even-numbered layer contour is taken as the hole of that even-numbered layer contour. After iterating through all elements in the contour detection result H, a shape segmentation result K is obtained. Each element in the shape segmentation result K is a shape represented by a two-layer contour structure. The upper layer is the contour of the shape, and the lower layer is the contour of the hole that exists in the shape.
[0083] Iterate through each element in the shape partitioning result K, merge adjacent key points and approximate the shape of each element's contour to obtain the merged result K2. The purpose of this step is to reduce the number of nodes in the contour, thereby reducing the number of triangular meshes in subsequent mesh construction and alleviating performance pressure.
[0084] For each shape in the merged result K2, a triangular mesh subdivision algorithm is executed to obtain a uniformly subdivided first triangular mesh as the output.
[0085] In some embodiments, one element of the position control point represents the target position of a corresponding vertex in the first triangular mesh, and one element of the hardening control point represents the weight of a corresponding triangle in the first triangular mesh; the step of performing a meshing operation on the first triangular mesh using preset position control points and hardening control points to obtain a second triangular mesh includes:
[0086] Determine whether the vertices of the first triangular mesh appear in the position control point, and divide those that do not appear into the first group and those that do appear into the second group;
[0087] The vertices in the first and second groups are expanded to obtain expansion vectors, and the coordinates to be solved and the constraint coordinates are determined based on the expansion vectors.
[0088] Based on the loss function, the minimum value of the loss function is obtained, and the solution value is determined as the second triangular mesh.
[0089] Specifically, after obtaining the first triangular mesh, the user manually inputs a set of position control points poslist. Each element in poslist represents the target position of a certain vertex in the triangular mesh. Then, the following operations are performed:
[0090] The vertices of the triangular mesh are divided into two groups based on whether they appear in the poslist, denoted as the first group (alist) and the second group (blist). Here, the first group (alist) represents the positions of the vertices to be solved, and the second group (blist) represents the user-inputted, already anchored vertex positions. The problem then becomes: given information about certain points in the mesh and the original connection relationships (forming a triangle) of the vertices in the mesh, we only need to construct constraints and solve for the positions of the remaining free vertices after deformation.
[0091] Specifically, the vertices in alist and blist are expanded to obtain a vector form of [alist1.x, alist1.y…alistN.x, alistN.y, blist1.x, blist1.y,…, blistM.x, blistM.y], where the first N*2 terms are the coordinates to be solved and the last M*2 terms are the constraint coordinates.
[0092] Next, we define the loss function E, and by finding the minimum value of this function, we obtain the final value to be solved.
[0093] E = E edges +E radians
[0094]
[0095]
[0096]
[0097] in, This is obtained by solving for each edge vector in the original mesh. Let θ be the edge vector of the mesh to be solved. i Let θ be the included angle formed by the two sides of a vertex of the triangle. i ′ is the included angle formed by two sides of a vertex of a triangle in the mesh to be solved.
[0098] The above equation is a least-squares problem. Typically, such optimal solution problems can be solved using optimization algorithms such as Newton's method, quasi-Newton's method, and Gauss-Newton's method. Considering performance and effectiveness, this application employs the Levenberg-Marquardt algorithm to solve this least-squares problem, obtaining the deformed second triangular mesh, Mesh2.
[0099] In some embodiments, one element of the hierarchical control point represents a location information, a depth value, and an area of influence; the rendering process of the second triangular mesh by combining the preset hierarchical control points, the original texture, and the first triangular mesh to output the texture result includes:
[0100] The original texture is divided into multiple triangular textures based on the first triangular mesh;
[0101] Based on the mapping relationship between the first and second triangular meshes, multiple triangular textures are mapped onto the second triangular mesh;
[0102] Calculate the depth information of each triangle in the second triangular mesh based on the hierarchical control points;
[0103] Based on the depth information, the second triangular mesh is sorted in the order of drawing to obtain the output texture; wherein, the larger the depth information, the later it is drawn.
[0104] Preferably, the step of calculating the depth information of each triangle in the second triangular mesh based on the hierarchical control points includes:
[0105] Iterate through each triangle in the first triangular grid, performing the following steps for each triangle:
[0106] Initialize the depth information of the triangle; where the initial depth information is zero.
[0107] Traverse the hierarchical control points and determine whether the distance between the center of each triangle and the current hierarchical control point is less than a preset value. If it is less than the preset value, add the depth information of the triangle to the depth information of the current hierarchical control point.
[0108] In some embodiments, mapping the plurality of triangular textures onto the second triangular mesh includes:
[0109] Determine the coordinates of the points in the original triangle;
[0110] Determine the value of the coordinate point in the coordinate system formed by the vectors containing the vertices of the triangle;
[0111] Determine the new coordinates of the coordinate point after deformation;
[0112] Calculate the new values for the new coordinates.
[0113] Specifically, this application already has an original texture A, a first triangular mesh Mesh, and a second triangular mesh Mesh2. Then, it obtains a user-input layer control point array depthlist. Each element in depthlist represents a position (x, y), a depth value z, and an influence range radius. The following processing is then performed:
[0114] Based on the original texture A and the first triangular mesh, the original texture A is divided into small triangular textures (triangleTextureList).
[0115] Based on the mapping relationship between the first triangular mesh (Mesh1) and the second triangular mesh (Mesh2), the `triangleTextureList` is mapped to the second triangular mesh (Mesh2). The specific mapping rules are as follows:
[0116] Suppose a point (X, Y) lies in the original triangle P0, P1, P2, with... If the coordinate system formed has a value of (a, b), then after deformation, the new value (X′, Y′) calculated based on the new point coordinates P0′, P1′, P2′ is:
[0117] Based on the hierarchical control point depthlist, calculate the depth information of each triangle in the second triangular mesh Mesh2.
[0118] Based on the depth information of the triangles in the second triangular mesh Mesh2, the triangles in Mesh2 are sorted in terms of drawing order, with those having greater depth information being drawn later. The final output texture F is obtained.
[0119] The specific steps are as follows:
[0120] Iterate through each triangle in the Mesh and execute the following for each triangle:
[0121] Initialize the depth information of the triangle to 0;
[0122] Iterate through the depthlist of the hierarchical control points, and determine whether the distance from the center of the triangle to the current hierarchical control point is less than the radius. If it is less than the radius, add the depth information of the triangle to the depth information of the current hierarchical control point.
[0123] like Figure 3 As shown, this application embodiment provides a device for controlling puppet animation by binding animation control nodes, including:
[0124] The acquisition module 301 is used to acquire the original texture of the input image, preprocess the original texture, and obtain the result texture.
[0125] Operation module 302 is used to perform contour detection on the result texture to obtain contour detection results with inclusion relationship and hierarchical structure, and to perform meshing operation on the contour detection results to obtain a first triangular mesh;
[0126] Processing module 303 is used to perform a meshing operation on the first triangular mesh using preset position control points and hardening control points to obtain a second triangular mesh;
[0127] Output module 304 is used to combine preset hierarchical control points, original texture, and first triangular mesh to render the second triangular mesh and output the texture result.
[0128] The working principle of the device for puppet animation control by binding animation control nodes provided in this application is as follows: the acquisition module 301 acquires the original texture of the input image, preprocesses the original texture to obtain the result texture; the operation module 302 performs contour detection on the result texture to obtain contour detection results with inclusion relationship and hierarchical structure, performs meshing operation on the contour detection results to obtain a first triangular mesh; the processing module 303 uses preset position control points and hardening control points to perform meshing operation on the first triangular mesh to obtain a second triangular mesh; the output module 304 combines preset hierarchical control points, original texture, and first triangular mesh to perform rendering processing on the second triangular mesh and output the texture result.
[0129] This application provides a mobile terminal, including: a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method for controlling puppet animation by binding animation control nodes provided in any of the above embodiments:
[0130] Obtain the original texture of the input image, preprocess the original texture, and obtain the result texture;
[0131] Contour detection is performed on the resulting texture to obtain contour detection results with inclusion relationships and hierarchical structures. The contour detection results are then meshed to obtain a first triangular mesh.
[0132] The first triangular mesh is meshed using preset position control points and hardening control points to obtain the second triangular mesh;
[0133] The second triangular mesh is rendered by combining the preset hierarchical control points, the original texture, and the first triangular mesh, and the texture result is output.
[0134] Compared with existing deformation algorithms on mobile devices that use affine transformations, this application achieves flexible local transformations by constructing triangular meshes and applying constraints, resulting in natural and dynamic effects.
[0135] Compared with existing deformation algorithms implemented using liquefaction on mobile devices, this invention greatly simplifies the user's operation and improves convenience, accuracy, and reliability by using position control points, hardened control points, and overlapping control points for operation and editing.
[0136] It is understood that the method embodiments provided above correspond to the device embodiments described above, and the specific details can be referred to each other, which will not be repeated here.
[0137] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0138] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0139] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction methods implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0140] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0141] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for marionette animation control by binding animation control nodes, characterized in that, include: Obtain the original texture of the input image, preprocess the original texture to obtain the result texture, including: The original texture is segmented to obtain a segmented mask texture; The segmented mask texture is subjected to Gaussian blurring to obtain a Gaussian blurred texture; The Gaussian blurred texture is binarized to obtain a binarized texture; Perform morphological operations on the binarized texture to obtain the resulting texture; Contour detection is performed on the resulting texture to obtain contour detection results with inclusion relationships and hierarchical structures. The contour detection results are then meshed to obtain a first triangular mesh, including: Traverse each element of the contour detection result, and then traverse the sub-contours contained in each element of the contour detection result in layer order to obtain the shape segmentation result. Traverse each element in the shape segmentation result, merge adjacent key points and approximate the shape of each element in the shape segmentation result to obtain the merged result; The merging result is calculated using a triangular meshing algorithm to obtain the first triangular mesh; The first triangular mesh is meshed using preset position control points and hardening control points to obtain the second triangular mesh; One element in the position control point represents the target position of a corresponding grid vertex in the first triangular mesh, and one element in the hardening control point represents the weight of a corresponding triangle in the first triangular mesh. The step of performing a meshing operation on the first triangular mesh using preset position control points and hardening control points to obtain a second triangular mesh includes: Determine whether the vertices of the first triangular mesh appear in the position control point, and divide those that do not appear into the first group and those that do appear into the second group; The vertices in the first and second groups are expanded to obtain expansion vectors, and the coordinates to be solved and the constraint coordinates are determined based on the expansion vectors. Based on the loss function, the minimum value of the loss function is solved to obtain the solution value, and the solution value is determined as the second triangular mesh; The second triangular mesh is rendered by combining the preset hierarchical control points, the original texture, and the first triangular mesh, and the texture result is output.
2. The method of claim 1, wherein, Each element in the hierarchical control point represents a location, depth value, and influence range; the rendering process of the second triangular mesh, combining the preset hierarchical control points, the original texture, and the first triangular mesh, outputs the texture result, including: The original texture is divided into multiple triangular textures based on the first triangular mesh; Based on the mapping relationship between the first and second triangular meshes, multiple triangular textures are mapped onto the second triangular mesh; Calculate the depth information of each triangle in the second triangular mesh based on the hierarchical control points; Based on the depth information, the second triangular mesh is sorted in the order of drawing to obtain the output texture; wherein, the larger the depth information, the later it is drawn.
3. The method of claim 2, wherein, The step of mapping the multiple triangular textures onto the second triangular mesh includes: Determine the coordinates of the points in the original triangle; Determine the value of the coordinate point in the coordinate system formed by the vectors containing the vertices of the triangle; Determine the new coordinates of the coordinate point after deformation; Calculate the new values for the new coordinates.
4. The method of claim 3, wherein, The step of calculating the depth information of each triangle in the second triangular mesh based on the hierarchical control points includes: Iterate through each triangle in the first triangular grid, performing the following steps for each triangle: Initialize the depth information of the triangle; where the initial depth information is zero. Traverse the hierarchical control points and determine whether the distance between the center of each triangle and the current hierarchical control point is less than a preset value. If it is less than the preset value, add the depth information of the triangle to the depth information of the current hierarchical control point.
5. The method according to claim 1, characterized in that, The Levenberg-Marquardt algorithm is used to solve the loss function.
6. A device for controlling puppet animation by binding animation control nodes, characterized in that, include: The acquisition module is used to acquire the original texture of the input image, preprocess the original texture to obtain the result texture, including: The original texture is segmented to obtain a segmented mask texture; The segmented mask texture is subjected to Gaussian blurring to obtain a Gaussian blurred texture; The Gaussian blurred texture is binarized to obtain a binarized texture; Perform morphological operations on the binarized texture to obtain the resulting texture; The operation module is used to perform contour detection on the resulting texture to obtain contour detection results with inclusion relationships and hierarchical structures, and to perform a meshing operation on the contour detection results to obtain a first triangular mesh, including: Traverse each element of the contour detection result, and then traverse the sub-contours contained in each element of the contour detection result in layer order to obtain the shape segmentation result. Traverse each element in the shape segmentation result, merge adjacent key points and approximate the shape of each element in the shape segmentation result to obtain the merged result; The merging result is calculated using a triangular meshing algorithm to obtain the first triangular mesh; The processing module is used to perform a meshing operation on the first triangular mesh using preset position control points and hardening control points to obtain a second triangular mesh; One element in the position control point represents the target position of a corresponding grid vertex in the first triangular mesh, and one element in the hardening control point represents the weight of a corresponding triangle in the first triangular mesh. The step of performing a meshing operation on the first triangular mesh using preset position control points and hardening control points to obtain a second triangular mesh includes: Determine whether the vertices of the first triangular mesh appear in the position control point, and divide those that do not appear into the first group and those that do appear into the second group; The vertices in the first and second groups are expanded to obtain expansion vectors, and the coordinates to be solved and the constraint coordinates are determined based on the expansion vectors. Based on the loss function, the minimum value of the loss function is solved to obtain the solution value, and the solution value is determined as the second triangular mesh; The output module is used to combine preset hierarchical control points, the original texture, and the first triangular mesh to render the second triangular mesh and output the texture result.
7. A mobile terminal, characterized in that include: A memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method for controlling puppet animation by binding animation control nodes as described in any one of claims 1 to 5.
