Image shape deformation method, apparatus, device, medium, and program product

By introducing intermediate boundary cages and polynomial Cauchy coordinates into the image shape deformation method, the complex and fine shape deformation problem of curved boundary cages is solved, achieving high-precision and flexible shape deformation processing.

CN119379534BActive Publication Date: 2025-11-18UNIV OF SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411601952.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-11-18
Estimated Expiration
2044-11-11

AI Technical Summary

Technical Problem

Existing image shape deformation methods based on centroid coordinates are mainly designed for polygonal boundary cages, which are difficult to meet the complex and fine shape deformation requirements of curved boundary cages.

Method used

By introducing a polygonal intermediate boundary cage, and using inverse coordinate mapping and coordinate mapping algorithms, the initial image is mapped from the initial curve cage to the intermediate boundary cage, and then from the intermediate boundary cage to the target curve cage. The centroid coordinates are represented by polynomial Cauchy coordinates, which supports the shape deformation of the curve boundary cage.

Benefits of technology

It achieves shape deformation of curved boundary cages, can handle more complex and fine target shapes, has high accuracy and flexibility, and overcomes the limitations of existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119379534B_ABST
    Figure CN119379534B_ABST
Patent Text Reader

Abstract

The present disclosure provides an image shape deformation method, device, equipment, medium and program product. The image shape deformation method comprises: determining an initial curve cage surrounding the shape of an obtained initial image; performing inverse coordinate mapping processing on the initial image based on an intermediate boundary cage for the initial curve cage, to map the initial image from the initial curve cage to the intermediate boundary cage, to obtain an intermediate image; and performing coordinate mapping processing on the intermediate image based on a target curve cage, to map the intermediate image from the intermediate boundary cage to the target curve cage, to obtain a target image, wherein the target curve cage is used to control shape deformation of the initial image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of computer graphics and shape deformation, and more particularly, to an image shape deformation method, device, equipment, medium and program product. BACKGROUND

[0002] In the field of computer graphics, barycentric coordinates can be used to describe the coordinates of points inside a triangle, and have a relatively wide application in the field of shape deformation.

[0003] In the process of implementing the concept of the present disclosure, the inventors have found that related image shape deformation methods based on barycentric coordinates mainly target polygon boundary cages, and have limitations in processing curved boundary cages, making it difficult to meet more complex and more detailed shape deformation requirements. SUMMARY

[0004] Therefore, the present disclosure provides an image shape deformation method, device, equipment, medium and program product.

[0005] One aspect of the present disclosure provides an image shape deformation method, comprising: determining, for an obtained initial image, an initial curved cage surrounding the shape of the initial image; performing inverse coordinate mapping processing on the initial image based on an intermediate boundary cage for the initial curved cage, to map the initial image from the initial curved cage to the intermediate boundary cage, to obtain an intermediate image; performing coordinate mapping processing on the intermediate image based on a target curved cage, to map the intermediate image from the intermediate boundary cage to the target curved cage, to obtain a target image, wherein the target curved cage is used to control shape deformation of the initial image.

[0006] Another aspect of the present disclosure provides an image shape deformation device, comprising: a determination module configured to determine, for an obtained initial image, an initial curved cage surrounding the shape of the initial image; a first mapping module configured to perform inverse coordinate mapping processing on the initial image based on an intermediate boundary cage for the initial curved cage, to map the initial image from the initial curved cage to the intermediate boundary cage, to obtain an intermediate image; and a second mapping module configured to perform coordinate mapping processing on the intermediate image based on a target curved cage, to map the intermediate image from the intermediate boundary cage to the target curved cage, to obtain a target image, wherein the target curved cage is used to control shape deformation of the initial image.

[0007] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described above.

[0008] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, implement the method described above.

[0009] Another aspect of the present disclosure provides a computer program product comprising computer-executable instructions that, when executed, implement the method described above.

[0010] According to an embodiment of the present disclosure, by introducing the intermediate boundary cage of the polygon, the initial image can be mapped to the intermediate cage based on the inverse coordinate mapping algorithm to obtain the intermediate image, and then the intermediate image can be mapped to the target curve cage based on the coordinate mapping algorithm to obtain the target image, thereby realizing the mapping solution between the initial curve cage and the target curve cage. The image shape deformation method provided by the embodiment of the present disclosure can process the curved edge input and the curved edge output at the same time based on the barycentric coordinates of the polynomial Cauchy coordinates, can better support the shape deformation of the curve boundary cage, and can be used to process more complex target shapes, especially the target shapes enclosed by curve segments, and has high accuracy and flexibility. Therefore, the image shape deformation method provided by the embodiment of the present disclosure can at least partially overcome the technical problem that the related art has limitations in processing the curve boundary cage and is difficult to meet the more complex and more delicate shape deformation requirements. BRIEF DESCRIPTION OF DRAWINGS

[0011] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure, taken in conjunction with the accompanying drawings, in which:

[0012] Figure 1 An application scenario diagram of the image shape deformation method, apparatus, device, medium and program product according to an embodiment of the present disclosure is schematically shown;

[0013] Figure 2 A flowchart of the image shape deformation method according to an embodiment of the present disclosure is schematically shown;

[0014] Figure 3 An intermediate boundary cage according to an embodiment of the present disclosure is schematically shown;

[0015] Figure 4 A flowchart of determining the intermediate image according to an embodiment of the present disclosure is schematically shown;

[0016] Figure 5A An image shape deformation process according to an embodiment of the present disclosure is schematically shown;

[0017] Figure 5B An image shape deformation process according to an embodiment of the present disclosure is schematically shown;

[0018] Figure 6 a block diagram of an image shape morphing apparatus according to an embodiment of the present disclosure is shown schematically; and

[0019] Figure 7 a block diagram of an electronic device adapted to implement an image shape morphing method according to an embodiment of the present disclosure is shown schematically. DETAILED DESCRIPTION

[0020] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It is to be understood, however, that the description is merely exemplary of the present disclosure, and is not intended to limit the scope of the present disclosure. In the following detailed description of the embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure. However, it would be apparent to one skilled in the art that the present disclosure can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring aspects of the present disclosure.

[0021] The terms used herein are merely used to describe specific embodiments, and are not intended to limit the present disclosure. The terms "include" and "have" and the like used herein indicate the presence of the described features, steps, operations, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.

[0022] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present description, and should not be interpreted in an idealized or excessively formal manner.

[0023] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should be generally interpreted as including one or more of the corresponding items (for example, "a system having at least one of A, B, and C" should include but not be limited to a system having A alone, a system having B alone, a system having C alone, a system having both A and B, a system having both A and C, a system having both B and C, and / or a system having A, B, and C together, etc.).

[0024] In the embodiments of the present disclosure, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage, etc. of the data involved (for example, including but not limited to user personal information) comply with the relevant legal regulations, are used for legal purposes, and do not violate public order and good customs. In particular, necessary measures are taken for user personal information to prevent illegal access to user personal information data and to maintain user personal information security and network security.

[0025] In the embodiments of the present disclosure, the authorization or consent of the user is obtained before the user's personal information is acquired or collected.

[0026] In the field of computer graphics, barycentric coordinates can be used to describe the coordinates of a point inside a triangle, and have a wide range of applications in the field of shape deformation.

[0027] According to embodiments of the present disclosure, in the field of shape deformation, barycentric coordinates can be used to interpolate points inside a polygon, so as to achieve smooth deformation of the shape. For example, the boundary of the target shape can be changed by adjusting the control vertices on the boundary cage, and then the barycentric coordinates are used to calculate the new position of any point inside the deformed target shape.

[0028] According to embodiments of the present disclosure, barycentric coordinates can be used to define the position of a point on a polygon, and the barycentric coordinates represent the position of a point relative to the vertices of the polygon through weights. These weights are non-negative, and their sum is 1.

[0029] Exemplarily, in the case of a triangle, if a point P is inside the triangle ABC, it can be represented as wherein, are weights, satisfying , and are all greater than 0, and these weights are the barycentric coordinates of the point P. Further, the concept of generalized barycentric coordinates can be extended to polygons, and can be used to describe the position of any point inside a polygon. Through the boundary cage and barycentric coordinates, accurate control and smooth deformation of the target shape can be achieved while maintaining the topological structure of the shape.

[0030] In the process of implementing the present concept, the inventors found that related image shape deformation methods based on barycentric coordinates mainly focus on polygon boundary cages, and have limitations in handling curved boundary cages, providing closed-form expressions, supporting high-order derivatives, and implementing curved-to-curved mapping, making it difficult to meet more complex and fine shape deformation requirements.

[0031] Specifically, related image shape deformation methods based on barycentric coordinates still have limitations in handling curved boundaries, providing closed-form expressions, supporting high-order derivatives, and implementing curved-to-curved mapping, making it difficult to meet more complex and fine shape deformation requirements.

[0032] To at least partially solve the technical problems in the related art, the present disclosure provides an image shape deformation method, device, equipment, medium and program product. The image shape deformation method comprises: determining an initial curved cage surrounding the shape of an obtained initial image; performing inverse coordinate mapping processing on the initial image based on an intermediate boundary cage for the initial curved cage, to map the initial image from the initial curved cage to the intermediate boundary cage, to obtain an intermediate image; performing coordinate mapping processing on the intermediate image based on a target curved cage, to map the intermediate image from the intermediate boundary cage to the target curved cage, to obtain a target image, wherein the target curved cage is used to control the shape deformation of the initial image.

[0033] Figure 1 The illustrations depict application scenarios of image shape deformation methods, apparatuses, devices, media, and program products according to embodiments of the present disclosure.

[0034] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0035] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0036] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0037] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0038] It should be noted that the image shape deformation method provided in this embodiment can generally be executed by server 105. Correspondingly, the image shape deformation device provided in this embodiment can generally be located in server 105. The image shape deformation method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the image shape deformation device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Alternatively, the image shape deformation method provided in this embodiment can also be executed by the first terminal device 101, the second terminal device 102, or the third terminal device 103, or by other terminal devices different from the first terminal device 101, the second terminal device 102, or the third terminal device 103. Accordingly, the image shape deformation device provided in the embodiments of this disclosure may also be disposed in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or disposed in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.

[0039] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0040] Figure 2 A flowchart illustrating an image shape deformation method according to an embodiment of the present disclosure is shown schematically.

[0041] like Figure 2 As shown, the method 200 includes operations S210 to S230.

[0042] In operation S210, for the obtained initial image, an initial curve cage of shape surrounding the initial image is determined.

[0043] In operation S220, based on the intermediate boundary cage for the initial curve cage, the initial image is subjected to inverse coordinate mapping to map the initial image from the initial curve cage to the intermediate boundary cage, thus obtaining the intermediate image.

[0044] In operation S230, based on the target curve cage, coordinate mapping processing is performed on the intermediate image to map the intermediate image from the intermediate boundary cage to the target curve cage to obtain the target image. The target curve cage is used to control the shape deformation of the initial image.

[0045] According to embodiments of this disclosure, the initial image may include a two-dimensional image, the shape of which can be understood as the target shape described above. The initial curve cage is a curved boundary enclosing the shape of the initial image, and the initial curve cage can be used to characterize any point in the initial image based on centroid coordinates. The centroid coordinates corresponding to the initial curve cage are determined based on intermediate boundary cages.

[0046] According to embodiments of this disclosure, the intermediate boundary cage is a polygonal cage relative to the initial curve cage, and the shape of the intermediate boundary cage should conform to the shape of the initial image as closely as possible. Based on the intermediate boundary cage, the initial image can be subjected to inverse coordinate mapping to map the initial image from the initial curve cage to the intermediate boundary cage, thus obtaining an intermediate image.

[0047] According to embodiments of this disclosure, the target curve cage is a curved boundary defined by the shape of the target image. The target curve cage can be used to characterize any point in the initial image based on centroid coordinates. The centroid coordinates corresponding to the target curve cage are determined based on the intermediate boundary cage.

[0048] According to embodiments of this disclosure, a target curve cage can be used to control the shape deformation of an initial image. As an example only, the target curve cage can be obtained by adjusting the position of the control vertices of the initial curve cage. Based on the target curve cage, coordinate mapping processing can be performed on the intermediate image to map the intermediate image from the intermediate boundary cage to the target curve cage, thus obtaining the target image.

[0049] According to embodiments of this disclosure, the method for calculating the barycenter coordinates may include mean coordinates, harmonic coordinates, Green's coordinates, Cauchy coordinates, etc. Exemplarily, the barycenter coordinates corresponding to the initial curve cage and the barycenter coordinates corresponding to the target curve cage can be polynomial Cauchy coordinates. In computer graphics, polynomial Cauchy coordinates are a method for describing the position of a point inside a polygon. This method defines coordinates using polynomial functions, thereby allowing for more flexible and accurate interpolation and deformation operations on polygons.

[0050] According to embodiments of this disclosure, by introducing a polygonal intermediate boundary cage, an intermediate image can be obtained by mapping the initial image to the intermediate cage using an inverse coordinate mapping algorithm. Then, the intermediate image is mapped to the target curve cage using a coordinate mapping algorithm to obtain the target image. This achieves the mapping solution between the initial curve cage and the target curve cage. The image shape deformation method provided by this disclosure is based on polynomial Cauchy coordinates to represent the centroid coordinates. It can simultaneously handle curved edge input and curved edge output, and can better support shape deformation for curved boundary cages. Therefore, it can be used to process more complex target shapes, especially target shapes enclosed by curve segments, and has high accuracy and flexibility. Based on this, the image shape deformation method provided by this disclosure can at least partially overcome the limitations of related technologies in processing curved boundary cages, making it difficult to meet the technical problems of more complex and refined shape deformation requirements.

[0051] According to embodiments of this disclosure, the initial curve cage includes M first curve segments connected end to end and a first curve endpoint of each first curve segment; the target curve cage includes M second curve segments connected end to end and a second curve endpoint of each second curve segment, wherein the target curve cage has undergone shape deformation compared to the initial curve cage; the intermediate boundary cage includes M straight line segments connected end to end, the M vertices of the intermediate boundary cage correspond one-to-one with the M first curve endpoints, and the M vertices of the intermediate boundary cage correspond one-to-one with the M second curve endpoints.

[0052] According to an embodiment of this disclosure, the initial curve cage includes M first curve segments connected end-to-end, each first curve segment having two endpoints. Since the M first curve segments are connected end-to-end, the initial curve cage includes a total of M first curve endpoints.

[0053] According to an embodiment of this disclosure, the target curve cage includes M second curve segments connected end-to-end, each second curve segment having two endpoints. Since the M second curve segments are connected end-to-end, the target curve cage includes a total of M second curve endpoints.

[0054] According to one embodiment of this disclosure, the first curve segment and the second curve segment can be selected as Bézier curves. A Bézier curve is a parametric curve widely used in computer graphics. It defines the shape of the curve through a series of control vertices, and the polygon composed of a series of control vertices is called a Bézier control polygon. These control vertices determine the direction and curvature of the curve, enabling the curve to accurately fit complex shapes while maintaining smoothness and continuity.

[0055] According to embodiments of this disclosure, each first curve segment of the initial curve cage can be defined by sequentially specifying the coordinates of the control vertices of that first curve segment. The initial curve cage can be represented by a set of M control vertices arranged in a preset order. For each first curve segment, the following representation is given:

[0056] (1)

[0057] In equation (1), Here are the vertex coordinates of the current Bézier control polygon, j is the number of the current Bézier curve segment, and m is the number of the current control vertex. These are Bernstein basis functions.

[0058] As an example only, the first curve segment can be defined by four control vertices located at the two endpoints and two quartering points of the first curve segment. The order of the first curve segment is N=3, and it includes four control points: bj,0, bj,1, bj,2, and bj,3, where bj,3 and bj+1,0 coincide.

[0059] According to embodiments of this disclosure, the target curve cage undergoes shape deformation compared to the initial curve cage, and the target curve cage can characterize the shape boundary of the target image. The target curve cage can be represented by a set of points arranged in a preset order by M control vertices. For each second curve segment, its representation can refer to formula (1) above, and will not be repeated here.

[0060] It should be noted that the order of each second curve segment in the target curve cage may differ from that of the initial curve cage, but the number of second curve segments must be the same as the number of first curve segments. In other words, the number of curve segments and endpoints in the target curve cage must be the same as those in the initial curve cage.

[0061] As an example, each second curve segment of the target curve cage can be defined by sequentially specifying the coordinates of the control vertices of that second curve segment. As another example, each second curve segment of the target curve cage can also be obtained by adjusting the positions of the control vertices of the first curve segment.

[0062] According to an embodiment of this disclosure, the intermediate boundary cage comprises M straight line segments connected end-to-end, each straight line segment having two endpoints. Since the M straight line segments are connected end-to-end, the intermediate boundary cage is a polygonal cage composed of M vertices, and the number of vertices in the intermediate boundary cage is the same as the number of the first curve endpoints of the initial curve cage.

[0063] As an example, the intermediate boundary cage can be set by specifying the coordinates of M vertices sequentially. As another example, the intermediate boundary cage can also be obtained by sequentially connecting the M endpoints of the initial curve cage.

[0064] According to embodiments of this disclosure, the M vertices of the intermediate boundary cage correspond one-to-one with the M endpoints of the first curve, and the M vertices of the intermediate boundary cage also correspond one-to-one with the M endpoints of the second curve. Based on this, the intermediate boundary cage can map the initial image to the intermediate cage using an inverse coordinate mapping algorithm to obtain an intermediate image, and then map the intermediate image to the target curve cage using a coordinate mapping algorithm to obtain the target image. This achieves the mapping solution between the initial curve cage and the target curve cage.

[0065] According to embodiments of this disclosure, the initial curve cage includes a plurality of first control vertices, the centroid coordinates of each of the plurality of first control vertices being determined based on M vertices of the intermediate boundary cage. Based on the intermediate boundary cage with respect to the initial curve cage, the initial image is subjected to inverse coordinate mapping processing to map the initial image from the initial curve cage to the intermediate boundary cage, obtaining an intermediate image. This includes: performing coordinate mapping processing on the intermediate boundary cage based on the plurality of first control vertices and the centroid coordinates of each of the plurality of first control vertices to obtain a reference region, the reference region representing the centroid mapping of the intermediate boundary cage in the initial curve cage; checking the shape inclusion relationship between the reference region and the initial image to obtain a check result; if the check result indicates that the reference region does not completely contain the shape of the initial image, adjusting the initial curve cage until the check result indicates that the reference region completely contains the shape of the initial image; if the check result indicates that the reference region completely contains the shape of the initial image, performing inverse coordinate mapping processing on the initial image based on the reference region to map the initial image from the initial curve cage to the intermediate boundary cage, obtaining an intermediate image.

[0066] According to embodiments of this disclosure, the initial curve cage includes a plurality of first control vertices. Based on the properties of centroid coordinates, since the M vertices of the intermediate boundary cage correspond one-to-one with the M first curve endpoints of the initial curve cage, the centroid coordinates of each of the plurality of first control vertices can be determined based on the M vertices of the intermediate boundary cage. This allows for inverse coordinate mapping of the initial image to the intermediate boundary cage, thereby obtaining an intermediate image.

[0067] According to embodiments of this disclosure, barycentric mapping can be understood as mapping interior points of a target shape using barycentric coordinates. Exemplarily, barycentric mapping allows the shape of a target shape to be altered by adjusting control vertices on a Bézier control polygon, while simultaneously using barycentric coordinates to calculate new positions of interior points of the target shape.

[0068] According to embodiments of this disclosure, a reference region can be obtained by performing coordinate mapping processing on the intermediate boundary cage based on multiple first control vertices and the centroid coordinates of each first control vertices. The reference region characterizes the centroid mapping of the intermediate boundary cage onto the initial curved cage. Based on this, the shape inclusion relationship between the reference region and the initial image can be checked to obtain the check result. The reference region can be denoted as... .

[0069] According to one embodiment of this disclosure, if the inspection result indicates that the reference region does not completely contain the shape of the initial image, the initial curve cage can be adjusted until the inspection result indicates that the reference region completely contains the shape of the initial image. Exemplarily, the range of the initial curve cage can be expanded by adjusting the control vertices of the initial curve cage. After adjusting the initial curve cage, the reference region can be redefined, and the inspection result can be updated based on the new reference region until the inspection result indicates that the reference region completely contains the shape of the initial image. This ensures that inverse coordinate mapping processing can be performed on any point in the initial image based on the reference region.

[0070] According to one embodiment of this disclosure, if the inspection result indicates that the reference region completely contains the shape of the initial image, the initial image can be subjected to inverse coordinate mapping based on the reference region to map the initial image from the initial curve cage to the intermediate boundary cage, thereby obtaining an intermediate image.

[0071] According to embodiments of this disclosure, the reference region is obtained by performing coordinate mapping processing on the intermediate boundary cage based on the centroid coordinates of each of the multiple first control vertices. This includes: sampling the boundary of the intermediate boundary cage to obtain multiple first sampling points; for each first sampling point, performing coordinate mapping processing on the first sampling point based on the multiple first control vertices and the centroid coordinates of each of the multiple first control vertices to obtain a first reference point corresponding to the first sampling point, wherein the first reference point represents the centroid mapping of the first sampling point in the initial curve cage; and determining the reference region using the multiple first reference points as boundaries.

[0072] According to embodiments of this disclosure, a plurality of first sampling points are located at the boundaries of the intermediate boundary cage, that is, the plurality of first sampling points are located on M straight line segments. For example, each straight line segment of the intermediate boundary cage can be divided into N equal parts, and then the N equal division points on each straight line segment can be selected as the first sampling points.

[0073] Figure 3 An intermediate boundary cage according to an embodiment of the present disclosure is illustrated schematically.

[0074] According to embodiments of this disclosure, for the first The left endpoint of the segment of the Bézier curve is The right endpoint is All are represented by complex numbers, denoted as . , So, control the vertex The barycentric coordinates on The following formula can be used to calculate it:

[0075] (2)

[0076] refer to Figure 3 In equation (2), z is the point whose centroid coordinates need to be calculated, and Aj and Bj are in Figure 3 The diagram shows that i is the imaginary unit, N is the order of the current Bézier curve segment (equal to the number of control vertices - 1), m is the number of the current control vertex (0, 1, 2, ..., N), log is the logarithmic function, and (N m) is the combination number representing N taking m.

[0077] Therefore, the centroid coordinates of multiple control vertices can be calculated. It should be noted that two centroid coordinates need to be calculated at the endpoints. And add them together. The result can be written in matrix form; the barycentric mapping can be calculated using matrix multiplication:

[0078] (3)

[0079] In equation (3), For the centroid coordinates of each of the multiple control vertices, For multiple control vertices, This is a center-of-gravity mapping.

[0080] According to embodiments of this disclosure, based on equations (2)-(3) above, for each first sampling point, coordinate mapping processing can be performed on the first sampling point based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices to obtain a first reference point corresponding to the first sampling point. The first reference point represents the centroid mapping of the first sampling point in the initial curve cage, denoted as... Based on this, a reference area can be determined using multiple primary reference points as boundaries.

[0081] According to embodiments of this disclosure, based on a reference region, performing inverse coordinate mapping on an initial image to map the initial image from an initial curve cage to an intermediate boundary cage to obtain an intermediate image includes: sampling the interior of the intermediate boundary cage to obtain multiple second sampling points; for each second sampling point, performing coordinate mapping on the second sampling point based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices to obtain a second reference point corresponding to the second sampling point, wherein the second reference point represents the centroid mapping of the second sampling point in the initial curve cage, and the multiple second reference points are located inside the reference region; for each second reference point, performing inverse coordinate mapping on the second reference point based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices to obtain an intermediate image point corresponding to the second reference point, wherein the intermediate image point represents the centroid mapping of the second reference point in the intermediate boundary cage; and performing texture mapping on the multiple intermediate image points to obtain the intermediate image.

[0082] According to embodiments of this disclosure, a plurality of second sampling points are located inside an intermediate boundary cage, the region of which can be denoted as [missing information]. Exemplarily, a plurality of second sampling points can be evenly distributed inside the intermediate boundary cage.

[0083] According to embodiments of this disclosure, based on equations (2)-(3) above, for each second sampling point, coordinate mapping can be performed on the second sampling point based on multiple first control vertices and their respective centroid coordinates to obtain a second reference point corresponding to the second sampling point. The second reference point represents the centroid mapping of the second sampling point on the initial curve cage, denoted as... .

[0084] According to embodiments of this disclosure, solving for the inverse coordinate mapping requires the use of numerical integration formulas. For the reference region... Interior point The expression for the inverse coordinate mapping is as follows:

[0085] (4)

[0086] In equation (4), Represents the middle boundary cage Integrating over the boundaries, where z is the integration variable, representing each boundary sampling point. Calculated using a coordinate mapping algorithm It can be obtained using the derivative algorithm of coordinate mapping (i.e., the inverse coordinate mapping algorithm). The difference between the next sampling point (in counter-clockwise order) and the current sampling point. The coordinates of the point for which the inverse coordinate mapping needs to be solved.

[0087] From equation (4), it can be seen that if the boundary sampling points and Given this, we can use formula (4) to solve for the inverse mapping. The calculation method has been given in equation (3) above, and is given below. Calculation method:

[0088] Introduction notation Let be the derivative of the polynomial Cauchy coordinates, and the derivative is calculated using the following formula:

[0089] (5)

[0090] refer to Figure 3 In equation (5), z is the point whose centroid coordinates need to be calculated, and Aj and Bj are in Figure 3 The diagram shows that i is the imaginary unit, N is the order of the current Bézier curve segment (equal to the number of control vertices - 1), m is the number of the current control vertex (0, 1, 2, ..., N), log is the logarithmic function, and (N m) is the combination number representing N taking m.

[0091] Similarly, the derivative of the polynomial Cauchy coordinates is represented using matrices. Likewise, the barycentric mapping can be computed using matrix multiplication:

[0092] (6)

[0093] In equation (6), Let be the derivative of the centroid coordinates of each of the multiple control vertices. For multiple first control vertices, This is a reverse coordinate centroid mapping.

[0094] According to embodiments of this disclosure, based on equations (2) to (6) described above, for each second reference point, an inverse coordinate mapping process can be performed on the second reference point based on the multiple first control vertices and their respective centroid coordinates to obtain an intermediate image point corresponding to the second reference point. The intermediate image point represents the centroid mapping of the second reference point within the intermediate boundary cage, denoted as... .

[0095] According to embodiments of this disclosure, texture mapping can be performed on multiple intermediate image points to obtain an intermediate image. Through texture mapping, the texture and color information of an image can be applied to a two-dimensional shape, thereby creating a richer and more realistic visual effect.

[0096] For example, corresponding texture information can be generated for each control vertex, allowing the color information of intermediate image points to be mapped based on the centroid coordinates. Combined with texture mapping, the continuity and consistency of the texture can be maintained while deforming the initial image, thus supporting the processing of more complex initial images.

[0097] Figure 4 A flowchart illustrating the determination of an intermediate image according to an embodiment of the present disclosure is shown schematically.

[0098] like Figure 4 As shown, in operation S401, the boundary of the intermediate boundary cage is sampled to obtain multiple first sampling points. In operation S402, coordinate mapping is performed on each first sampling point to obtain a first reference point corresponding to the first sampling point. In operation S403, a reference region is determined using the multiple first reference points as boundaries. In operation S404, the shape inclusion relationship between the reference region and the initial image is checked to obtain the check result.

[0099] like Figure 4 As shown, if the inspection result characterization reference area does not completely contain the shape of the initial image, operation S405 can be performed to adjust the first control vertex of the initial curve cage, and operations S402~S404 can be repeated until the inspection result characterization reference area completely contains the shape of the initial image.

[0100] like Figure 4 As shown, when the inspection result indicates that the reference region completely contains the shape of the initial image, operation S406 is performed to sample the interior of the intermediate boundary cage, resulting in multiple second sampling points. In operation S407, coordinate mapping is performed on each second sampling point to obtain a second reference point corresponding to the second sampling point. In operation S408, inverse coordinate mapping is performed on each second reference point to obtain intermediate image points corresponding to the second reference points. In operation S409, texture mapping is performed on the multiple intermediate image points to obtain an intermediate image.

[0101] According to embodiments of this disclosure, the target curve cage includes a plurality of second control vertices, the centroid coordinates of each of the plurality of second control vertices being determined based on M vertices of the intermediate boundary cage. Based on the target curve cage, coordinate mapping processing is performed on the intermediate image to map the intermediate image from the intermediate boundary cage to the target curve cage, obtaining the target image. This includes: for each intermediate image point, coordinate mapping processing is performed on the intermediate image point based on the plurality of second control vertices and the centroid coordinates of each of the plurality of second control vertices to obtain a target image point corresponding to the intermediate image point, wherein the target image point represents the centroid mapping of the intermediate image point in the target curve cage; texture mapping processing is performed on the plurality of target image points to obtain the target image.

[0102] According to embodiments of this disclosure, based on equations (2)-(3) above, for each intermediate image point, coordinate mapping processing can be performed on the intermediate image point based on multiple second control vertices and the centroid coordinates of each of the multiple second control vertices to obtain a target image point corresponding to the intermediate image point. The target image point represents the centroid mapping of the intermediate image point on the target curve cage, denoted as... Based on this, texture mapping can be performed on multiple target image points to obtain the target image.

[0103] The image shape deformation method provided in this disclosure introduces a polygonal intermediate boundary cage. This allows the initial image to be mapped to the intermediate cage using an inverse coordinate mapping algorithm to obtain an intermediate image. The intermediate image is then mapped to the target curve cage using a coordinate mapping algorithm to obtain the target image. This achieves the mapping solution between the initial and target curve cages. Furthermore, the image shape deformation method provided in this disclosure extends Cauchy coordinates to the curve cage, which is based on Bézier curves, significantly improving the flexibility of shape deformation. Moreover, the image shape deformation method provided in this disclosure also provides closed-form expressions for coordinate calculation and arbitrary-order derivative calculation. Compared to methods requiring numerical approximation, closed-form expressions enable faster and more accurate calculations, resulting in higher computational efficiency and facilitating real-time interactive applications.

[0104] Figure 5A The image shape deformation process according to an embodiment of the present disclosure is illustrated schematically.

[0105] Figure 5B An image shape deformation process according to one embodiment of the present disclosure is illustrated by way of example.

[0106] refer to Figure 5B ,like Figure 5A As shown, in operation S501, the initial curve cage, target curve cage, and intermediate boundary cage for the initial image can be determined. In operation S502, the intermediate boundary cage is subjected to inverse coordinate mapping to obtain the reference region. In operation S503, the reference region is determined using multiple first reference points as boundaries. In operation S504, the shape inclusion relationship between the reference region and the initial image is checked to obtain the check result. In operation S505, if the check result indicates that the reference region completely includes the shape of the initial image, the initial image is subjected to inverse coordinate mapping to obtain the intermediate image. In operation S506, coordinate mapping is performed on each intermediate image point to obtain the target image point corresponding to the intermediate image point. In operation S507, texture mapping is performed on multiple target image points to obtain the target image.

[0107] Figure 6A block diagram of an image shape deformation apparatus according to an embodiment of the present disclosure is shown schematically.

[0108] like Figure 6 As shown, the image shape deformation device 600 includes a determining module 610, a first mapping module 620, and a second mapping module 630.

[0109] The determining module 610 is used to determine an initial curve cage of shape that surrounds the obtained initial image.

[0110] The first mapping module 620 is used to perform inverse coordinate mapping processing on the initial image based on the intermediate boundary cage of the initial curve cage, so as to map the initial image from the initial curve cage to the intermediate boundary cage to obtain an intermediate image.

[0111] The second mapping module 630 is used to perform coordinate mapping processing on the intermediate image based on the target curve cage, so as to map the intermediate image from the intermediate boundary cage to the target curve cage to obtain the target image, wherein the target curve cage is used to control the shape deformation of the initial image.

[0112] According to embodiments of this disclosure, the first mapping module 620 may include a reference area determination submodule, an inspection submodule, an adjustment submodule, and an inverse coordinate mapping submodule.

[0113] The reference region determination submodule is used to perform coordinate mapping processing on the intermediate boundary cage based on multiple first control vertices and their respective centroid coordinates to obtain a reference region. The reference region represents the centroid mapping of the intermediate boundary cage on the initial curve cage.

[0114] The inspection submodule is used to check the shape inclusion relationship between the reference area and the initial image and obtain the inspection results.

[0115] The adjustment submodule is used to adjust the initial curve cage until the inspection result characterization reference area completely contains the shape of the initial image if the inspection result characterization reference area does not completely contain the shape of the initial image.

[0116] The inverse coordinate mapping submodule is used to perform inverse coordinate mapping on the initial image based on the reference region, when the inspection result characterizes the reference region as completely containing the shape of the initial image, so as to map the initial image from the initial curve cage to the intermediate boundary cage to obtain the intermediate image.

[0117] According to embodiments of this disclosure, the reference region determination submodule may include a first sampling unit, a first coordinate mapping unit, and a reference region determination unit.

[0118] The first sampling unit is used to sample the boundary of the intermediate boundary cage to obtain multiple first sampling points.

[0119] The first coordinate mapping unit is used to perform coordinate mapping processing on each first sampling point based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices, to obtain a first reference point corresponding to the first sampling point, wherein the first reference point represents the centroid mapping of the first sampling point in the initial curve cage.

[0120] The reference region determination unit is used to determine the reference region using multiple first reference points as boundaries.

[0121] According to embodiments of this disclosure, the inverse coordinate mapping submodule may include a second sampling unit, a second coordinate mapping unit, an inverse coordinate mapping unit, and a texture mapping unit.

[0122] The second sampling unit is used to sample the interior of the intermediate boundary cage to obtain multiple second sampling points.

[0123] The second coordinate mapping unit is used to perform coordinate mapping processing on each second sampling point based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices, to obtain a second reference point corresponding to the second sampling point. The second reference point represents the centroid mapping of the second sampling point in the initial curve cage, and the multiple second reference points are located inside the reference region.

[0124] The inverse coordinate mapping unit is used to perform inverse coordinate mapping on each second reference point based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices, to obtain intermediate image points corresponding to the second reference point. The intermediate image points represent the centroid mapping of the second reference point in the intermediate boundary cage.

[0125] The texture mapping unit is used to perform texture mapping processing on multiple intermediate image points to obtain an intermediate image.

[0126] According to embodiments of this disclosure, the second mapping module 630 may include a coordinate mapping submodule and a texture mapping submodule.

[0127] The coordinate mapping submodule is used to perform coordinate mapping processing on each intermediate image point based on multiple second control vertices and the centroid coordinates of each of the multiple second control vertices, to obtain the target image point corresponding to the intermediate image point. The target image point represents the centroid mapping of the intermediate image point on the target curve cage.

[0128] The texture mapping submodule is used to perform texture mapping processing on multiple target image points to obtain the target image.

[0129] Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as hardware circuitry, such as a Field-Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a System-on-Chip, a System-on-a-Substrate, a System-on-Package, an Application-Specific Integrated Circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.

[0130] For example, any plurality of the determining module 610, the first mapping module 620, and the second mapping module 630 can be combined into one module / unit / subunit, or any one of these modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functionality of one or more of these modules / units / subunits can be combined with at least part of the functionality of other modules / units / subunits and implemented in one module / unit / subunit. According to embodiments of this disclosure, at least one of the determining module 610, the first mapping module 620, and the second mapping module 630 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the determining module 610, the first mapping module 620, and the second mapping module 630 may be at least partially implemented as a computer program module that can perform corresponding functions when the computer program module is run.

[0131] It should be noted that the image shape deformation device in the embodiments of this disclosure corresponds to the image shape deformation method in the embodiments of this disclosure. The description of the image shape deformation device is specifically referred to in the image shape deformation method section, and will not be repeated here.

[0132] Figure 7A block diagram of an electronic device suitable for implementing the methods described above, according to embodiments of the present disclosure, is illustrated schematically. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0133] like Figure 7 As shown, an electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage portion 708 into a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0134] RAM 703 stores various programs and data required for the operation of electronic device 700. Processor 701, ROM 702, and RAM 703 are interconnected via bus 704. Processor 701 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 702 and / or RAM 703. It should be noted that the programs may also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.

[0135] According to embodiments of this disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to a bus 704. The electronic device 700 may also include one or more of the following components connected to the input / output (I / O) interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.

[0136] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by processor 701, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0137] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.

[0138] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0139] For example, according to embodiments of this disclosure, a computer-readable storage medium may include the ROM 702 and / or RAM 703 described above and / or one or more memories other than ROM 702 and RAM 703.

[0140] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of this disclosure. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the image shape deformation method provided in the embodiments of this disclosure.

[0141] When the computer program is executed by the processor 701, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0142] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 709, and / or installed from a removable medium 711. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0143] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0144] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways, even if such combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments of this disclosure may be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0145] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. An image shape deformation method, comprising: For the obtained initial image, determine an initial curve cage that encloses the shape of the initial image; Based on the intermediate boundary cage of the initial curve cage, the initial image is subjected to inverse coordinate mapping to map the initial image from the initial curve cage to the intermediate boundary cage, thereby obtaining an intermediate image. Based on the target curve cage, the intermediate image is subjected to coordinate mapping processing to map the intermediate image from the intermediate boundary cage to the target curve cage to obtain the target image, wherein the target curve cage is used to control the shape deformation of the initial image; The initial curve cage includes M first curve segments connected end-to-end and a first curve endpoint of each first curve segment; the initial curve cage includes multiple first control vertices, the centroid coordinates of each of the multiple first control vertices being determined based on the M vertices of the intermediate boundary cage; based on the intermediate boundary cage with respect to the initial curve cage, the initial image is subjected to inverse coordinate mapping processing to map the initial image from the initial curve cage to the intermediate boundary cage, resulting in an intermediate image including: Based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices, coordinate mapping processing is performed on the intermediate boundary cage to obtain a reference region, which represents the centroid mapping of the intermediate boundary cage on the initial curve cage. The shape inclusion relationship between the reference region and the initial image is checked to obtain the check result; If the inspection result indicates that the reference region does not completely contain the shape of the initial image, adjust the initial curve cage until the inspection result indicates that the reference region completely contains the shape of the initial image. If the inspection result indicates that the reference region completely contains the shape of the initial image, the initial image is subjected to inverse coordinate mapping based on the reference region to map the initial image from the initial curve cage to the intermediate boundary cage, thereby obtaining the intermediate image; The first curve segment includes a Bézier curve segment; the centroid coordinates of each of the plurality of first control vertices are determined by the following operations: For the The left endpoint of the segment of the Bézier curve is The right endpoint is All are represented by complex numbers, denoted as . , , and the first The first control vertex corresponding to the segment of the Bezier curve The barycentric coordinates on Calculated based on the following formula: Where z is the point whose centroid coordinates need to be calculated, i is the imaginary unit, N is the order of the current Bézier curve segment, m is the number of the current control vertex (0,1,2,...,N), log is the logarithmic function, and (N m) is the combination number representing N taking m; The centroid mapping is calculated based on matrix multiplication, and the formula for matrix multiplication is as follows: in, For the centroid coordinates of each of the multiple control vertices, For multiple control vertices, This is a center-of-gravity mapping.

2. The method according to claim 1, wherein, The target curve cage includes M second curve segments connected end to end and a second curve endpoint of each second curve segment, wherein the target curve cage has undergone shape deformation compared to the initial curve cage; The intermediate boundary cage includes M straight line segments connected end to end. The M vertices of the intermediate boundary cage correspond one-to-one with the M endpoints of the first curve, and the M vertices of the intermediate boundary cage correspond one-to-one with the M endpoints of the second curve.

3. The method according to claim 1, wherein, The reference region obtained by performing coordinate mapping processing on the intermediate boundary cage based on the centroid coordinates of each of the multiple first control vertices includes: The boundary of the intermediate boundary cage is sampled to obtain multiple first sampling points; For each of the first sampling points, based on the multiple first control vertices and the centroid coordinates of the multiple first control vertices respectively, the first sampling point is subjected to coordinate mapping processing to obtain a first reference point corresponding to the first sampling point, wherein the first reference point represents the centroid mapping of the first sampling point in the initial curve cage. The reference region is determined by using multiple first reference points as boundaries.

4. The method according to claim 3, wherein, The step of performing inverse coordinate mapping on the initial image based on the reference region to map the initial image from the initial curve cage to the intermediate boundary cage, thereby obtaining the intermediate image, includes: The interior of the intermediate boundary cage is sampled to obtain multiple second sampling points; For each second sampling point, based on the multiple first control vertices and the centroid coordinates of each of the multiple first control vertices, coordinate mapping is performed on the second sampling point to obtain a second reference point corresponding to the second sampling point. The second reference point represents the centroid mapping of the second sampling point in the initial curve cage, and the multiple second reference points are located inside the reference region. For each second reference point, based on the multiple first control vertices and the centroid coordinates of each of the multiple first control vertices, the second reference point is subjected to inverse coordinate mapping to obtain an intermediate image point corresponding to the second reference point, wherein the intermediate image point represents the centroid mapping of the second reference point in the intermediate boundary cage. The intermediate image is obtained by performing texture mapping processing on multiple intermediate image points.

5. The method according to claim 4, wherein, The target curve cage includes multiple second control vertices, the centroid coordinates of each of the multiple second control vertices being determined based on M vertices of the intermediate boundary cage. The intermediate image is then subjected to coordinate mapping processing based on the target curve cage to map the intermediate image from the intermediate boundary cage to the target curve cage, resulting in a target image including: For each intermediate image point, a coordinate mapping process is performed on the intermediate image point based on the multiple second control vertices and the centroid coordinates of each of the multiple second control vertices to obtain a target image point corresponding to the intermediate image point, wherein the target image point represents the centroid mapping of the intermediate image point in the target curve cage; The target image is obtained by performing texture mapping processing on multiple target image points.

6. An image shape deformation device, comprising: A determining module is used to determine an initial curve cage with a shape that surrounds the obtained initial image; The first mapping module is used to perform inverse coordinate mapping processing on the initial image based on the intermediate boundary cage of the initial curve cage, so as to map the initial image from the initial curve cage to the intermediate boundary cage to obtain an intermediate image. The second mapping module is used to perform coordinate mapping processing on the intermediate image based on the target curve cage, so as to map the intermediate image from the intermediate boundary cage to the target curve cage to obtain the target image, wherein the target curve cage is used to control the shape deformation of the initial image; The initial curve cage includes M first curve segments connected end-to-end and a first curve endpoint for each first curve segment; the initial curve cage includes a plurality of first control vertices, the centroid coordinates of each of the plurality of first control vertices being determined based on the M vertices of the intermediate boundary cage; the first mapping module includes: The reference region determination submodule is used to perform coordinate mapping processing on the intermediate boundary cage based on multiple first control vertices and the centroid coordinates of each of the multiple first control vertices to obtain the reference region. The reference region represents the centroid mapping of the intermediate boundary cage on the initial curve cage. The inspection submodule is used to check the shape inclusion relationship between the reference area and the initial image and obtain the inspection results; The adjustment submodule is used to adjust the initial curve cage until the inspection result characterization reference area completely contains the shape of the initial image when the inspection result characterization reference area does not completely contain the shape of the initial image. The inverse coordinate mapping submodule is used to perform inverse coordinate mapping on the initial image based on the reference region when the inspection result characterizes the reference region as completely containing the shape of the initial image, so as to map the initial image from the initial curve cage to the intermediate boundary cage to obtain the intermediate image. The first curve segment includes a Bézier curve segment; the centroid coordinates of each of the plurality of first control vertices are determined by the following operations: For the The left endpoint of the segment of the Bézier curve is The right endpoint is All are represented by complex numbers, denoted as . , , and the first The first control vertex corresponding to the segment of the Bezier curve The barycentric coordinates on Calculated based on the following formula: Where z is the point whose centroid coordinates need to be calculated, i is the imaginary unit, N is the order of the current Bézier curve segment, m is the number of the current control vertex (0,1,2,...,N), log is the logarithmic function, and (N m) is the combination number representing N taking m; The centroid mapping is calculated based on matrix multiplication, and the formula for matrix multiplication is as follows: in, For the centroid coordinates of each of the multiple control vertices, For multiple control vertices, This is a center-of-gravity mapping.

7. An electronic device, comprising: One or more processors; Memory, used to store one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1 to 5.

8. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 5.

9. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Generating A Triangle Mesh For An Image Represented By Curves

    CN110009721A

  • Animation generation method based on harmonic interpolation of plane multi-connected shape

    CN115239851A