Image shape deformation method, device, equipment, medium and program product
By introducing the intermediate border cage and coordinate mapping algorithm in the image shape deformation method, the problem of difficulty in dealing with the curve boundary cage is difficult to handle the existing technology, and the more complex and fine shape deformation, which improves the accuracy and flexibility of deformation.
Patent Information
- Application Number
- CN202411601952.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-11-11
AI Technical Summary
The existing image shape deformation method based on center of gravity coordinates is mainly aimed at polygon boundary cages, which are difficult to effectively deal with curve boundary cages and cannot meet more complex and fine shape deformation requirements.
By introducing the middle boundary cage of polygon, the initial image is mapped to the middle cage with a counter -coordinate mapping algorithm, and the intermediate image is obtained. The mapping solution between the curve cages.
This method can handle the curvature input and curvature output at the same time, support more complicated curve boundary cage -shaped deformation, improve the accuracy and flexibility of shape deformation, and meet the more complex and fine shape deformation requirements.
Smart Images

Figure CN119379534A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of computer graphics and shape deformation, and more specifically, to an image shape deformation method, apparatus, device, medium and program product. Background Art
[0002] In the field of computer graphics, barycentric coordinates can be used to describe the coordinates of a point inside a triangle and are widely used in the field of shape deformation.
[0003] In the process of implementing the concept of the present disclosure, the inventors found that the related image shape deformation method based on barycentric coordinates is mainly aimed at polygonal boundary cages, and has limitations in processing curved boundary cages, making it difficult to meet more complex and sophisticated shape deformation requirements. Summary of the invention
[0004] In view of this, the present disclosure provides an image shape deformation method, apparatus, device, medium and program product.
[0005] One aspect of the present disclosure provides an image shape deformation method, comprising: determining an initial curve cage of a shape surrounding the initial image for an obtained initial image; performing inverse coordinate mapping processing on the initial image based on an intermediate boundary cage for 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; performing coordinate mapping processing on the intermediate image based on a target curve cage, so as to map the intermediate image from the intermediate boundary cage to a target curve cage to obtain a target image, wherein the target curve cage is used to control the shape deformation of the initial image.
[0006] Another aspect of the present disclosure provides an image shape deformation device, including: a determination module, for determining an initial curve cage of a shape surrounding the initial image for an acquired initial image; a first mapping module, for performing inverse coordinate mapping processing on the initial image based on an intermediate boundary cage for 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; and a second mapping module, for performing coordinate mapping processing on the intermediate image based on a target curve cage, so as to map the intermediate image from the intermediate boundary cage to a target curve cage to obtain a target image, wherein the target curve cage is used to control the shape deformation of the initial image.
[0007] Another aspect of the present disclosure provides an electronic device, including: one or more processors; and a memory for storing 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 as described above.
[0008] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0009] Another aspect of the present disclosure provides a computer program product, which includes computer executable instructions, and when the instructions are executed, are used to implement the method as described above.
[0010] According to the embodiments of the present disclosure, by introducing the intermediate boundary cage of the polygon, it is possible to map the initial image to the intermediate cage based on the inverse coordinate mapping algorithm to obtain the intermediate image, and then map the intermediate image 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 embodiments of the present disclosure is based on the polynomial Cauchy coordinates to represent the centroid coordinates, which can simultaneously process the curved edge input and the curved edge output, and can better support the shape deformation for the curved boundary cage, so that it can be used to process more complex target shapes, especially target shapes surrounded by curved segments, and has higher accuracy and flexibility. Based on this, the image shape deformation method provided by the embodiments of the present disclosure can at least partially overcome the technical problem that the related technology has limitations in the processing of the curved boundary cage, and it is difficult to meet the requirements of more complex and more sophisticated shape deformation. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0012] Figure 1 A diagram schematically illustrates an application scenario of an image shape deformation method, apparatus, device, medium, and program product according to an embodiment of the present disclosure;
[0013] Figure 2 A flowchart of an image shape deformation method according to an embodiment of the present disclosure is schematically shown;
[0014] Figure 3 Schematically illustrates an intermediate boundary cage according to an embodiment of the present disclosure;
[0015] Figure 4 Schematically shows a flow chart of determining an intermediate image according to an embodiment of the present disclosure;
[0016] Figure 5A The image shape deformation process according to an embodiment of the present disclosure is schematically shown;
[0017] Figure 5B The image shape deformation process according to one embodiment of the present disclosure is exemplarily shown;
[0018] Figure 6 A block diagram schematically shows an image shape deformation device according to an embodiment of the present disclosure; and
[0019] Figure 7 A block diagram of an electronic device suitable for implementing an image shape deformation method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0020] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0021] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0022] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0023] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, 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) are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.
[0025] In the embodiments of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0026] In the field of computer graphics, barycentric coordinates can be used to describe the coordinates of a point inside a triangle and are widely used in the field of shape deformation.
[0027] According to an embodiment of the present disclosure, in the field of shape deformation, barycentric coordinates can be used to interpolate points inside a polygon, thereby achieving 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 can be used to calculate the new position of any point inside the target shape after deformation.
[0028] According to an embodiment 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] For example, in the case of a triangle, if a point P is inside triangle ABC, then it can be represented as ,in, is the weight, satisfying ,and are all greater than 0, and these weights are the barycentric coordinates of point P. Furthermore, 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. Based on the boundary cage and barycentric coordinates, precise 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 concept of the present disclosure, the inventors found that the related image shape deformation method based on barycentric coordinates is mainly aimed at polygonal boundary cages, and has limitations in processing curved boundary cages, making it difficult to meet more complex and sophisticated shape deformation requirements.
[0031] Specifically, related image shape deformation methods based on barycentric coordinates still have limitations in processing curved boundaries, providing closed-form expressions, supporting high-order derivatives, and realizing curved edge to curved edge mapping, making it difficult to meet more complex and sophisticated shape deformation requirements.
[0032] In order to at least partially solve the technical problems existing in the related art, the present disclosure provides an image shape deformation method, device, equipment, medium and program product. The image shape deformation method includes: for an obtained initial image, determining an initial curve cage of the shape surrounding the initial image; based on the intermediate boundary cage for the initial curve cage, performing inverse coordinate mapping processing on the initial image to map the initial image from the initial curve cage to the intermediate boundary cage to obtain an intermediate image; based on the target curve cage, performing coordinate mapping processing on the intermediate image 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 the shape deformation of the initial image.
[0033] Figure 1 The application scenario diagram of the image shape deformation method, device, equipment, medium and program product according to the embodiments of the present disclosure is schematically shown.
[0034] like Figure 1 As shown, the 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 is used to provide a medium for 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, wireless communication links, or optical fiber cables, etc.
[0035] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through 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 platform software, etc. (only for example).
[0036] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0037] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as 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 device.
[0038] It should be noted that the image shape deformation method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the image shape deformation device provided in the embodiment of the present disclosure can generally be set in the server 105. The image shape deformation method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the image shape deformation device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Alternatively, the image shape deformation method provided in the embodiment of the present disclosure can also be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or can also be executed 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 embodiment of the present disclosure may also be arranged in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or 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 in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0040] Figure 2 The flowchart of the image shape deformation method according to the embodiment of the present disclosure is schematically shown.
[0041] like Figure 2 As shown, the method 200 includes operations S210 to S230.
[0042] In operation S210, for an obtained initial image, an initial curve cage of a shape surrounding the initial image is determined.
[0043] In operation S220 , an inverse coordinate mapping process is performed on the initial image based on the intermediate boundary cage for 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.
[0044] In operation S230 , coordinate mapping processing is performed on the intermediate image based on the 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.
[0045] According to an embodiment of the present disclosure, the initial image may include a two-dimensional image, and the shape of the initial image may be understood as the target shape described above. The initial curve cage is a curve boundary surrounding the shape of the initial image, and the initial curve cage may be used to characterize any point in the initial image based on the barycentric coordinates. The barycentric coordinates corresponding to the initial curve cage are determined based on the intermediate boundary cage.
[0046] According to an embodiment of the present disclosure, the intermediate boundary cage is a polygonal cage for the initial curve cage, and the shape of the intermediate boundary cage should conform to the shape of the initial image as much as possible. Based on the intermediate boundary cage, the initial image can be subjected to inverse coordinate mapping processing to map the initial image from the initial curve cage to the intermediate boundary cage to obtain an intermediate image.
[0047] According to an embodiment of the present disclosure, the target curve cage is a curve boundary for the shape of the target image, and the target curve cage can be used to characterize any point in the initial image based on the barycentric coordinates. The barycentric coordinates corresponding to the target curve cage are determined based on the intermediate boundary cage.
[0048] According to an embodiment of the present disclosure, a target curve cage can be used to control the shape deformation of an initial image. As just one example, the target curve cage can be obtained by adjusting the positions of the control vertices of the initial curve cage. Based on the target curve cage, a coordinate mapping process can be performed on the intermediate image to map the intermediate image from the intermediate boundary cage to the target curve cage to obtain a target image.
[0049] According to an embodiment of the present disclosure, the calculation method of the barycentric coordinates may include mean coordinates, harmonic coordinates, Green coordinates, Cauchy coordinates, etc. Exemplarily, the barycentric coordinates corresponding to the initial curve cage and the barycentric coordinates corresponding to the target curve cage may 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 by a polynomial function, thereby allowing more flexible and accurate interpolation and deformation operations on polygons.
[0050] According to the embodiments of the present disclosure, by introducing the intermediate boundary cage of the polygon, it is possible to map the initial image to the intermediate cage based on the inverse coordinate mapping algorithm to obtain the intermediate image, and then map the intermediate image 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 embodiments of the present disclosure is based on the polynomial Cauchy coordinates to represent the centroid coordinates, which can simultaneously process the curved edge input and the curved edge output, and can better support the shape deformation for the curved boundary cage, so that it can be used to process more complex target shapes, especially target shapes surrounded by curved segments, and has higher accuracy and flexibility. Based on this, the image shape deformation method provided by the embodiments of the present disclosure can at least partially overcome the technical problem that the related technology has limitations in the processing of the curved boundary cage, and it is difficult to meet the requirements of more complex and more sophisticated shape deformation.
[0051] According to an embodiment of the present disclosure, an initial curve cage includes M first curve segments connected end to end and a first curve endpoint of each first curve segment; a 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 is deformed in shape compared to the initial curve cage; an intermediate boundary cage includes M straight line segments connected end to end, the M vertices of the intermediate boundary cage correspond one-to-one to the M first curve endpoints, and the M vertices of the intermediate boundary cage correspond one-to-one to the M second curve endpoints.
[0052] According to an embodiment of the present disclosure, the initial curve cage includes M first curve segments connected end to end, each of which has two endpoints. The M first curve segments are connected end to end, so the initial curve cage includes a total of M first curve endpoints.
[0053] According to an embodiment of the present disclosure, the target curve cage includes M second curve segments connected end to end, each second curve segment has two endpoints. The M second curve segments are connected end to end, so the target curve cage includes a total of M second curve endpoints.
[0054] According to one embodiment of the present disclosure, the first curve segment and the second curve segment can be selected as Bezier curves. A Bezier curve is a parametric curve widely used in computer graphics, which defines the shape of the curve through a series of control vertices. A polygon composed of a series of control vertices is a Bezier control polygon. These control vertices determine the direction and curvature of the curve, so that the curve can accurately fit complex shapes while maintaining smoothness and continuity.
[0055] According to an embodiment of the present disclosure, each first curve segment of the initial curve cage can be defined by sequentially specifying the coordinates of the control vertices of the first curve segment. The initial curve cage can be represented by a point set of M control vertices arranged in sequence according to a preset order. For each first curve segment, there is the following representation:
[0056] (1)
[0057] In formula (1), is the vertex coordinate of the current Bezier control polygon, j is the number of the current Bezier curve segment, m is the number of the current control vertex, is the Bernstein basis function.
[0058] As just an example, the first curve segment can be defined by 4 control vertices, which are respectively located at the 2 end points and 2 quarter points of the first curve segment. The first curve segment has an order N=3, including four control points bj,0, bj,1, bj,2, and bj,3, where bj,3 and bj+1,0 coincide.
[0059] According to an embodiment of the present disclosure, the target curve cage is deformed in shape compared to the initial curve cage, and the target curve cage can represent the shape boundary of the target image. The target curve cage can be represented by a set of points in which M control vertices are arranged in sequence according to a preset order. For each second curve segment, its representation method can refer to the above formula (1), which will not be repeated here.
[0060] It should be noted that the order of each second curve segment of the target curve cage can be different 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, that is, the number of curve segments and the number of endpoints of the target curve cage must be the same as those of 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 the 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 the present disclosure, the intermediate boundary cage includes M straight line segments connected end to end, each straight line segment has two endpoints. The M straight line segments are connected end to end, so the intermediate boundary cage is a polygonal cage composed of M vertices, and the number of vertices of 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 in sequence. As another example, the intermediate boundary cage can also be obtained by sequentially connecting the M first curve endpoints of the initial curve cage.
[0064] According to the embodiment of the present disclosure, the M vertices of the intermediate boundary cage correspond one-to-one to the M first curve endpoints, and the M vertices of the intermediate boundary cage correspond one-to-one to the M second curve endpoints. Based on this, the intermediate boundary cage can realize mapping the initial image to the intermediate cage based on the inverse coordinate mapping algorithm to obtain the intermediate image, and then map the intermediate image 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.
[0065] According to an embodiment of the present disclosure, the initial curve cage includes a plurality of first control vertices, the center of gravity coordinates of each of the plurality of first control vertices are determined based on M vertices of the intermediate boundary cage, and the initial image is subjected to inverse coordinate mapping processing based on the intermediate boundary cage with respect to the initial curve cage, so as to map the initial image from the initial curve cage to the intermediate boundary cage, and obtaining the intermediate image includes: based on the center of gravity coordinates of each of the plurality of first control vertices and the plurality of first control vertices, the intermediate boundary cage is subjected to coordinate mapping processing to obtain a reference area, and the reference area represents the center of gravity mapping of the intermediate boundary cage in the initial curve cage; the shape inclusion relationship between the reference area and the initial image is checked to obtain an inspection result; when the inspection result represents that the reference area does not completely include the shape of the initial image, the initial curve cage is adjusted until the inspection result represents that the reference area completely includes the shape of the initial image; when the inspection result represents that the reference area completely includes the shape of the initial image, the initial image is subjected to inverse coordinate mapping processing based on the reference area to map the initial image from the initial curve cage to the intermediate boundary cage, so as to obtain the intermediate image.
[0066] According to an embodiment of the present disclosure, the initial curve cage includes a plurality of first control vertices. Based on the properties of the barycentric coordinates, since the M vertices of the intermediate boundary cage correspond one-to-one to the M first curve endpoints of the initial curve cage, the barycentric coordinates of each of the plurality of first control vertices can be determined based on the M vertices of the intermediate boundary cage, thereby performing inverse coordinate mapping processing on the initial image to map the initial image from the initial curve cage to the intermediate boundary cage to obtain an intermediate image.
[0067] According to an embodiment of the present disclosure, barycentric mapping can be understood as mapping the internal points of a target shape using barycentric coordinates. Exemplarily, barycentric mapping allows the shape of a target shape to be changed by adjusting the control vertices on a Bezier control polygon, while using barycentric coordinates to calculate the new positions of the internal points of the target shape.
[0068] According to the embodiments of the present disclosure, based on the multiple first control vertices and the barycentric coordinates of the multiple first control vertices, the intermediate boundary cage can be subjected to coordinate mapping processing to obtain a reference area, and the reference area represents the barycentric mapping of the intermediate boundary cage in the initial curve cage. On this basis, the shape inclusion relationship between the reference area and the initial image can be checked to obtain a check result. The reference area can be recorded as .
[0069] According to one embodiment of the present disclosure, in the case where the inspection result characterizes that the reference area does not completely contain the shape of the initial image, the initial curve cage can be adjusted until the inspection result characterizes that the reference area 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 area can be re-determined, and the inspection result can be updated based on the new reference area until the inspection result characterizes that the reference area completely contains the shape of the initial image. Thus, it can be ensured that any point in the initial image can be subjected to inverse coordinate mapping processing based on the reference area.
[0070] According to an embodiment of the present disclosure, when the inspection result indicates that the reference area completely contains the shape of the initial image, the initial image can be inversely mapped based on the reference area to map the initial image from the initial curve cage to the intermediate boundary cage to obtain an intermediate image.
[0071] According to an embodiment of the present disclosure, based on the barycentric coordinates of each of the multiple first control vertices, coordinate mapping processing is performed on the intermediate boundary cage to obtain a reference area, which includes: sampling the boundary of the intermediate boundary cage to obtain a plurality of first sampling points; for each first sampling point, based on the barycentric coordinates of each of the multiple first control vertices and the multiple first control vertices, coordinate mapping processing is performed on the first sampling point to obtain a first reference point corresponding to the first sampling point, wherein the first reference point represents the barycentric mapping of the first sampling point in the initial curve cage; and the reference area is determined with the multiple first reference points as the boundary.
[0072] According to an embodiment of the present disclosure, a plurality of first sampling points are located at the boundary of the intermediate boundary cage, that is, a plurality of first sampling points are located on M straight line segments. Exemplarily, each straight line segment of the intermediate boundary cage can be divided into N equal parts, and then N equally divided points on each straight line segment are selected as first sampling points.
[0073] Figure 3 An intermediate boundary cage according to an embodiment of the present disclosure is schematically illustrated.
[0074] According to the embodiment of the present disclosure, for A Bezier curve segment with a left endpoint , the right endpoint is , are all expressed in plural form, , , then the control vertex The barycentric coordinates on It can be calculated using the following formula:
[0075] (2)
[0076] refer to Figure 3 , in formula (2), z is the point whose centroid coordinates need to be calculated, Aj, Bj are Figure 3 It is shown in , i is an imaginary unit, N is the order of the current Bezier 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 a logarithmic function, and (N m) is the combination number representing N taking m.
[0077] Thus, the barycentric coordinates of multiple control vertices can be calculated. It should be noted that two barycentric coordinates need to be calculated at the endpoints ( ) and add them. The above results are written in matrix form, and the centroid mapping can be calculated using matrix multiplication:
[0078] (3)
[0079] In formula (3), are the centroid coordinates of multiple control vertices. For multiple control vertices, The center of gravity map.
[0080] According to the embodiment of the present disclosure, based on the above formula (2)-formula (3), for each first sampling point, the first sampling point can be subjected to coordinate mapping processing based on the multiple first control vertices and the respective barycentric coordinates of the multiple first control vertices to obtain a first reference point corresponding to the first sampling point. The first reference point represents the barycentric mapping of the first sampling point in the initial curve cage, which is recorded as On this basis, the reference area can be determined with multiple first reference points as boundaries.
[0081] According to an embodiment of the present disclosure, based on a reference area, an initial image is subjected to inverse coordinate mapping processing to map the initial image from an initial curve cage to an intermediate boundary cage, and obtaining an intermediate image includes: sampling the interior of the intermediate boundary cage to obtain a plurality of second sampling points; for each second sampling point, based on a plurality of first control vertices and the respective barycentric coordinates of the plurality of first control vertices, a coordinate mapping processing is performed on the second sampling point to obtain a second reference point corresponding to the second sampling point, wherein the second reference point represents a barycentric mapping of the second sampling point in the initial curve cage, and the plurality of second reference points are located inside the reference area; for each second reference point, based on a plurality of first control vertices and the respective barycentric coordinates of the plurality of first control vertices, an inverse coordinate mapping processing is performed on the second reference point to obtain an intermediate image point corresponding to the second reference point, wherein the intermediate image point represents a barycentric mapping of the second reference point in the intermediate boundary cage; and texture mapping is performed on the plurality of intermediate image points to obtain an intermediate image.
[0082] According to an embodiment of the present disclosure, a plurality of second sampling points are located inside the middle boundary cage, and the middle boundary cage region may be recorded as Exemplarily, a plurality of second sampling points may be evenly distributed inside the middle boundary cage.
[0083] According to an embodiment of the present disclosure, based on the above-mentioned formula (2)-formula (3), for each second sampling point, the second sampling point can be subjected to coordinate mapping processing based on the multiple first control vertices and the respective barycentric coordinates of the multiple first control vertices to obtain a second reference point corresponding to the second sampling point. The second reference point represents the barycentric mapping of the second sampling point in the initial curve cage, which is recorded as .
[0084] According to an embodiment of the present disclosure, solving the inverse coordinate mapping requires the use of a numerical integration formula. Internal Points , the expression of inverse coordinate mapping is as follows:
[0085] (4)
[0086] In formula (4), Represents the cage in the middle boundary Integrate on the boundary, z is the integral variable, representing each boundary sampling point, Use the coordinate mapping algorithm to find Use the derivative algorithm of coordinate mapping (i.e. inverse coordinate mapping algorithm) to find out, is the difference between the next sampling point (counterclockwise) and the current sampling point, The coordinates of the point for which the inverse coordinate mapping needs to be solved.
[0087] From formula (4), we can see that if the boundary sampling point of Knowing that, we can use formula (4) to solve the inverse mapping. The calculation method of has been given in the above formula (3), and is given below Calculation method:
[0088] Introduction , denoted as the derivative of the polynomial Cauchy coordinates, the derivative has the following calculation formula:
[0089] (5)
[0090] refer to Figure 3 , in formula (5), z is the point whose centroid coordinates need to be calculated, Aj, Bj are Figure 3 It is shown in , i is an imaginary unit, N is the order of the current Bezier 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 a logarithmic function, and (N m) is the combination number representing N taking m.
[0091] Similarly, the derivatives of polynomial Cauchy coordinates are represented by matrices. Similarly, the barycentric mapping can be computed using matrix multiplication:
[0092] (6)
[0093] In formula (6), is the derivative of the barycentric coordinates of multiple control vertices, are multiple first control vertices, is the inverse coordinate barycentric mapping.
[0094] According to an embodiment of the present disclosure, based on the above-mentioned formula (2) to formula (6), for each second reference point, the second reference point can be subjected to inverse coordinate mapping based on the multiple first control vertices and the respective barycentric coordinates of the multiple first control vertices to obtain an intermediate image point corresponding to the second reference point. The intermediate image point represents the barycentric mapping of the second reference point in the intermediate boundary cage, which is recorded as .
[0095] According to an embodiment of the present disclosure, a plurality of intermediate image points may be texture mapped to obtain an intermediate image. Through texture mapping, the texture and color information of an image may 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, so that the color information of the intermediate image point can be mapped based on the barycentric coordinates. Combined with texture mapping, the continuity and consistency of the texture can be maintained while the shape of the initial image is deformed, so that more complex initial images can be processed.
[0097] Figure 4 The flowchart of determining an intermediate image according to an embodiment of the present disclosure is schematically shown.
[0098] like Figure 4 As shown, in operation S401, the boundary of the intermediate boundary cage is sampled to obtain a plurality of first sampling points. In operation S402, coordinate mapping processing is performed on each first sampling point to obtain a first reference point corresponding to the first sampling point. In operation S403, a reference area can be determined with the plurality of first reference points as boundaries. In operation S404, the shape inclusion relationship between the reference area and the initial image can be checked to obtain a check result.
[0099] like Figure 4 As shown, when 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 to S404 are repeatedly performed until the inspection result characterization reference area completely contains the shape of the initial image.
[0100] like Figure 4 As shown, in the case where the inspection result indicates that the reference area completely contains the shape of the initial image, operation S406 is performed to sample the interior of the intermediate boundary cage to obtain a plurality of second sampling points. In operation S407, coordinate mapping processing 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 processing is performed on each second reference point to obtain an intermediate image point corresponding to the second reference point. In operation S409, texture mapping processing is performed on the plurality of intermediate image points to obtain an intermediate image.
[0101] According to an embodiment of the present disclosure, the target curve cage includes a plurality of second control vertices, and the center of gravity coordinates of each of the plurality of second control vertices are determined based on the M vertices of the intermediate boundary cage. Based on the target curve cage, a coordinate mapping process is performed on the intermediate image to map the intermediate image from the intermediate boundary cage to the target curve cage, and obtaining the target image includes: for each intermediate image point, based on the plurality of second control vertices and the center of gravity coordinates of each of the plurality of second control vertices, a coordinate mapping process is performed on the intermediate image point to obtain a target image point corresponding to the intermediate image point, wherein the target image point represents the center of gravity mapping of the intermediate image point in the target curve cage; and texture mapping process is performed on the plurality of target image points to obtain the target image.
[0102] According to the embodiments of the present disclosure, based on the above-mentioned formula (2)-formula (3), for each intermediate image point, the intermediate image point can be subjected to coordinate mapping processing based on the plurality of second control vertices and the respective barycentric coordinates of the plurality of second control vertices to obtain a target image point corresponding to the intermediate image point. The target image point represents the barycentric mapping of the intermediate image point in the target curve cage, which is recorded as On this basis, texture mapping processing can be performed on multiple target image points to obtain the target image.
[0103] The image shape deformation method provided by the embodiment of the present disclosure introduces the intermediate boundary cage of the polygon, so that the initial image is mapped to the intermediate cage based on the inverse coordinate mapping algorithm to obtain the intermediate image, and then the intermediate image is 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. In addition, the image shape deformation method provided by the embodiment of the present disclosure extends the Cauchy coordinates to the curve cage, which is represented based on the Bezier curve, significantly improving the flexibility of shape deformation. Moreover, the image shape deformation method provided by the embodiment of the present disclosure also provides closed-form expressions for coordinate calculation and arbitrary-order derivative calculation. Compared with the method requiring numerical approximation, the closed-form expression can achieve faster and more accurate calculations, with higher calculation efficiency, which is conducive to the realization of real-time interactive applications.
[0104] Figure 5A The image shape deformation process according to an embodiment of the present disclosure is schematically illustrated.
[0105] Figure 5B The image shape deformation process according to an embodiment of the present disclosure is exemplarily shown.
[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 processing to obtain a reference area. In operation S503, the reference area can be determined with multiple first reference points as boundaries. In operation S504, the shape inclusion relationship between the reference area and the initial image can be checked to obtain an inspection result. In operation S505, when the inspection result indicates that the reference area completely contains the shape of the initial image, the initial image is subjected to inverse coordinate mapping processing to obtain an intermediate image. In operation S506, each intermediate image point is subjected to coordinate mapping processing to obtain a target image point corresponding to the intermediate image point. In operation S507, multiple target image points are subjected to texture mapping processing to obtain a target image.
[0107] Figure 6The block diagram of the image shape deformation device according to the embodiment of the present disclosure is schematically shown.
[0108] like Figure 6 As shown, the image shape deformation device 600 includes a determination module 610 , a first mapping module 620 and a second mapping module 630 .
[0109] The determination module 610 is configured to determine, for an acquired initial image, an initial curve cage of a shape surrounding the initial image.
[0110] The first mapping module 620 is configured to perform inverse coordinate mapping processing on the initial image based on an intermediate boundary cage for 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 a target image, wherein the target curve cage is used to control the shape deformation of the initial image.
[0112] According to an embodiment of the present disclosure, the first mapping module 620 may include a reference region determination submodule, a checking 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 the multiple first control vertices and the center of gravity coordinates of each of the multiple first control vertices to obtain a reference region, wherein the reference region represents the center of gravity mapping of the intermediate boundary cage in the initial curve cage.
[0114] The checking submodule is used to check the shape inclusion relationship between the reference area and the initial image to obtain the checking result.
[0115] The adjustment submodule is used to adjust the initial curve cage when the inspection result representation reference area does not completely contain the shape of the initial image until the inspection result representation reference area completely contains the shape of the initial image.
[0116] The inverse coordinate mapping submodule is used to perform inverse coordinate mapping processing on the initial image based on the reference area when the inspection result indicates that the reference area completely contains 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 an intermediate image.
[0117] According to an embodiment of the present disclosure, the reference region determining submodule may include a first sampling unit, a first coordinate mapping unit, and a reference region determining unit.
[0118] The first sampling unit is used to sample the boundary of the middle boundary cage to obtain a plurality of first sampling points.
[0119] The first coordinate mapping unit is used to perform coordinate mapping processing on each first sampling point based on the plurality of first control vertices and the respective barycentric coordinates of the plurality of first control vertices to obtain a first reference point corresponding to the first sampling point, wherein the first reference point represents a barycentric mapping of the first sampling point in the initial curve cage.
[0120] The reference area determination unit is used to determine a reference area with a plurality of first reference points as boundaries.
[0121] According to an embodiment of the present 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 middle boundary cage to obtain a plurality of second sampling points.
[0123] The second coordinate mapping unit is used to perform coordinate mapping processing on each second sampling point based on the plurality of first control vertices and the respective barycentric coordinates of the plurality of first control vertices to obtain a second reference point corresponding to the second sampling point, wherein the second reference point represents the barycentric mapping of the second sampling point in the initial curve cage, and the plurality of second reference points are located inside the reference area.
[0124] An inverse coordinate mapping unit is used to perform inverse coordinate mapping processing on each second reference point based on the multiple first control vertices and the center of gravity 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 center of gravity 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 an embodiment of the present 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 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.
[0128] The texture mapping submodule is used to perform texture mapping processing on multiple target image points to obtain a target image.
[0129] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging circuits, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0130] For example, any multiple of the determination module 610, the first mapping module 620, and the second mapping module 630 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the determination module 610, the first mapping module 620, and the second mapping module 630 can be at least partially implemented as a hardware circuit, 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 a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the determination module 610, the first mapping module 620, and the second mapping module 630 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be performed.
[0131] It should be noted that the image shape deformation device in the embodiment of the present disclosure corresponds to the image shape deformation method in the embodiment of the present disclosure. The description of the image shape deformation device part specifically refers to the image shape deformation method part, which will not be repeated here.
[0132] Figure 7A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0133] like Figure 7 As shown, the 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 part 708 to a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an 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] In RAM 703, various programs and data required for the operation of electronic device 700 are stored. Processor 701, ROM 702 and RAM 703 are connected to each other via bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0135] According to an embodiment of the present disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the input / output (I / O) interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 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 magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage portion 708 as needed.
[0136] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0137] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0138] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0139] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 702 and / or the RAM 703 described above and / or one or more memories other than the ROM 702 and the RAM 703 .
[0140] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains a program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the image shape deformation method provided by the embodiment of the present disclosure.
[0141] When the computer program is executed by the processor 701, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0142] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0143] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0144] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0145] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for image shape deformation, comprising: For the obtained initial image, determining an initial curve cage of the shape surrounding the initial image; Based on the intermediate boundary cage for the initial curve cage, performing inverse coordinate mapping processing on the initial image to map the initial image from the initial curve cage to the intermediate boundary cage to obtain an intermediate image; 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 a target image, wherein the target curve cage is used to control the shape deformation of the initial image.
2. The method according to claim 1, wherein: 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 is deformed in shape compared with 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 to the M first curve endpoints, and the M vertices of the intermediate boundary cage correspond one-to-one to the M second curve endpoints.
3. The method according to claim 2, wherein: The initial curve cage includes a plurality of first control vertices, the center of gravity coordinates of each of the plurality of first control vertices are determined based on the M vertices of the intermediate boundary cage, and the initial image is subjected to inverse coordinate mapping processing based on the intermediate boundary cage with respect to the initial curve cage to map the initial image from the initial curve cage to the intermediate boundary cage, and obtaining the intermediate image includes: Based on the plurality of first control vertices and the barycentric coordinates of each of the plurality of first control vertices, coordinate mapping processing is performed on the intermediate boundary cage to obtain a reference area, wherein the reference area represents the barycentric mapping of the intermediate boundary cage in the initial curve cage; Checking the shape inclusion relationship between the reference area and the initial image to obtain a checking result; In a case where the inspection result indicates that the reference area does not completely contain the shape of the initial image, adjusting the initial curve cage until the inspection result indicates that the reference area completely contains the shape of the initial image; When the inspection result indicates that the reference area completely contains the shape of the initial image, the initial image is subjected to inverse coordinate mapping based on the reference area to map the initial image from the initial curve cage to the intermediate boundary cage to obtain the intermediate image.
4. The method according to claim 3, wherein: The coordinate mapping process is performed on the intermediate boundary cage based on the barycentric coordinates of each of the plurality of first control vertices to obtain a reference area including: Sampling the boundary of the intermediate boundary cage to obtain a plurality of first sampling points; For each of the first sampling points, based on the plurality of first control vertices and the respective barycentric coordinates of the plurality of first control vertices, coordinate mapping processing is performed on the first sampling point to obtain a first reference point corresponding to the first sampling point, wherein the first reference point represents a barycentric mapping of the first sampling point in the initial curve cage; The reference area is determined with the plurality of first reference points as boundaries.
5. The method according to claim 4, wherein: The performing inverse coordinate mapping processing on the initial image based on the reference area to map the initial image from the initial curve cage to the intermediate boundary cage to obtain the intermediate image comprises: Sampling the interior of the intermediate boundary cage to obtain a plurality of second sampling points; For each second sampling point, based on the plurality of first control vertices and the respective barycentric coordinates of the plurality of first control vertices, coordinate mapping processing is performed on the second sampling point to obtain a second reference point corresponding to the second sampling point, wherein the second reference point represents the barycentric mapping of the second sampling point in the initial curve cage, and the plurality of second reference points are located inside the reference area; For each second reference point, based on the plurality of first control vertices and the respective barycentric coordinates of the plurality of first control vertices, perform inverse coordinate mapping processing on the second reference point to obtain an intermediate image point corresponding to the second reference point, wherein the intermediate image point represents the barycentric mapping of the second reference point in the intermediate boundary cage; Texture mapping is performed on a plurality of the intermediate image points to obtain the intermediate image.
6. The method according to claim 5, wherein: The target curve cage includes a plurality of second control vertices, and the center of gravity coordinates of each of the plurality of second control vertices are determined based on the M vertices of the intermediate boundary cage. 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, and the target image is obtained, including: For each of the intermediate image points, based on the plurality of second control vertices and the respective centroid coordinates of the plurality of second control vertices, coordinate mapping processing is performed on the intermediate image point to obtain a target image point corresponding to the intermediate image point, wherein the target image point represents a centroid mapping of the intermediate image point in the target curve cage; Texture mapping is performed on a plurality of target image points to obtain the target image.
7. An image shape deformation device, comprising: A determination module, configured to determine, for an acquired initial image, an initial curve cage of a shape surrounding 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 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 a target image, wherein the target curve cage is used to control the shape deformation of the initial image.
8. An electronic device comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Quanton Representation For Emulating Quantum-Like Computation On Classical Processors
CN107683460A
Generating A Triangle Mesh For An Image Represented By Curves
CN110009721A
Animation generation method based on harmonic interpolation of plane multi-connected shape
CN115239851A
Image brightness dynamic range conversion method and device
CN116777753A
Helium resource quantity evaluation method and device, electronic equipment and readable storage medium
CN118409366A