Image deformation method, device, equipment and readable storage medium
Patent Information
- Application Number
- CN202210615811.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-05-31
AI Technical Summary
[0003]本发明的主要目的在于提供一种图像变形方法、装置、设备及可读存储介质,旨在解决现有技术无法实现对图像进行任意形状的变形,以及对图像进行变形时导致的图像失真的技术问题
[0044] In the present invention, based on the texture coordinate system, a preset number of first feature points are selected from the initial image; based on the vertex coordinate system, a deformed shape is set, and from the deformed shape, the preset number of second feature points are selected, the second feature points correspond one-to-one to each point of the first feature points, and the order between each point of the second feature points remains consistent with the order between each point of the first feature points; according to the deformed shape, the distribution position of the second feature points is set; based on the texture coordinates of the first feature points and the vertex coordinates of the second feature points, drawing is performed to obtain a drawn deformed image. The present invention first selects a preset number of first feature points from the initial image in the texture coordinate system, then sets the shape we want to deform in the vertex coordinate system, selects the same number of second feature points according to the shape we want to deform, and sets the distribution positions of the second feature points in the deformed shape according to the shape we want to deform, wherein the second feature points need to correspond one-to-one with the first feature points, and the position order also needs to remain consistent. Since the texture coordinates of the first feature point represent the position of the initial image from which the image data is taken, and the vertex coordinates of the second feature point represent the position on the screen where the image data is displayed, drawing based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point can obtain a drawn deformed image, and the deformed shape can be set as needed, thereby realizing the deformation of the initial image into any shape.
Smart Images

Figure CN114913060B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image deformation method, apparatus, device and readable storage medium. Background Art
[0002] Modern cars feature numerous display screens, such as LCD instrument clusters, central control screens, and heads-up displays (HUDs) (which project vehicle-related information such as navigation, speed, fuel pressure, tire pressure, and Bluetooth phone calls onto the windshield). These screens require extensive graphics. Since these devices typically utilize embedded operating systems, the primary high-performance drawing method is graphics processing units (GPUs) using the cross-platform OpenGL (Open Graphics Library, or OPenGL). Currently, most drawing methods rely on image deformation through displacement, rotation, and scaling. However, these methods are ineffective when arbitrary image shape changes are required. Furthermore, existing image deformation technologies, due to localized stretching and scaling, can easily produce color artifacts, leading to image distortion. Summary of the Invention
[0003] The main purpose of the present invention is to provide an image deformation method, device, equipment and readable storage medium, aiming to solve the technical problems that the existing technology cannot realize the deformation of images into arbitrary shapes and the image distortion caused by image deformation.
[0004] In a first aspect, the present invention provides an image deformation method, the image deformation method comprising:
[0005] Based on the texture coordinate system, a preset number of first feature points are selected from the initial image;
[0006] Based on the vertex coordinate system, a deformed shape is set, and a preset number of second feature points are selected from the deformed shape, where the second feature points correspond to each of the first feature points one-to-one, and the order between each of the second feature points is consistent with the order between each of the first feature points;
[0007] According to the deformed shape, setting the distribution position of the second feature point;
[0008] Drawing is performed based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point to obtain a drawn deformed image.
[0009] Optionally, before selecting a preset number of first feature points from the initial image based on the texture coordinate system, the method further includes:
[0010] Set the size of the preset number based on the drawing accuracy of the deformed image.
[0011] Optionally, selecting a preset number of first feature points from the initial image based on the texture coordinate system includes:
[0012] Based on the texture coordinate system, an initial image is selected from the image to be deformed according to the deformation area to be processed;
[0013] According to the main content to be drawn, a preset number of first feature points are selected from the initial image.
[0014] Optionally, the performing drawing based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point includes:
[0015] Constructing a first array based on the texture coordinates of the first feature point;
[0016] Constructing a second array based on the vertex coordinates of the second feature point;
[0017] Based on the first array and the second array, shading is performed through the OpenGL ES API;
[0018] Based on the first array and the second array, create a texture through the OpenGL ES API;
[0019] Drawing is performed through the glDrawArrays function of the opengles API.
[0020] Optionally, the drawing based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point further includes:
[0021] Based on the first feature points, performing triangular cutting on the initial image to obtain a first triangular network;
[0022] Based on the second feature point, performing triangular cutting on the deformed shape to obtain a second triangular network;
[0023] Constructing a third array based on the texture coordinates of the first triangle network;
[0024] Constructing a fourth array based on the texture coordinates of the second triangle network;
[0025] Based on the third array and the fourth array, shading is performed through the OpenGL ES API;
[0026] Based on the first array and the second array, creating a texture through the opengles API;
[0027] Drawing is performed through the glDrawArrays function of the opengles API.
[0028] In a second aspect, the present invention further provides an image deformation device, comprising:
[0029] A selection module, configured to select a preset number of first feature points from the initial image based on a texture coordinate system;
[0030] A first setting module is configured to set a deformed shape based on a vertex coordinate system, and select a preset number of second feature points from the deformed shape, wherein the second feature points correspond to each of the first feature points one-to-one, and the order between each of the second feature points is consistent with the order between each of the first feature points;
[0031] A second setting module, configured to set the distribution positions of the second feature points according to the deformed shape;
[0032] The drawing module is used to draw based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point to obtain a drawn deformed image.
[0033] Optionally, the selection module is used to:
[0034] Based on the texture coordinate system, an initial image is selected from the image to be deformed according to the deformation area to be processed;
[0035] According to the main content to be drawn, a preset number of first feature points are selected from the initial image.
[0036] Optionally, the drawing module is used to:
[0037] Constructing a first array based on the texture coordinates of the first feature point;
[0038] Constructing a second array based on the vertex coordinates of the second feature point;
[0039] Based on the first array and the second array, shading is performed through the OpenGL ES API;
[0040] Based on the first array and the second array, create a texture through the OpenGL ES API;
[0041] Drawing is performed through the glDrawArrays function of the opengles API.
[0042] In a third aspect, the present invention also provides an image deformation device, which includes a processor, a memory, and an image deformation program stored in the memory and executable by the processor, wherein when the image deformation program is executed by the processor, the steps of the image deformation method described above are implemented.
[0043] In a fourth aspect, the present invention further provides a readable storage medium, on which an image deformation program is stored, wherein when the image deformation program is executed by a processor, the steps of the image deformation method as described above are implemented.
[0044] In the present invention, based on the texture coordinate system, a preset number of first feature points are selected from the initial image; based on the vertex coordinate system, a deformed shape is set, and from the deformed shape, the preset number of second feature points are selected, the second feature points correspond one-to-one to each point of the first feature points, and the order between each point of the second feature points remains consistent with the order between each point of the first feature points; according to the deformed shape, the distribution position of the second feature points is set; based on the texture coordinates of the first feature points and the vertex coordinates of the second feature points, drawing is performed to obtain a drawn deformed image. The present invention first selects a preset number of first feature points from the initial image in the texture coordinate system, then sets the shape we want to deform in the vertex coordinate system, selects the same number of second feature points according to the shape we want to deform, and sets the distribution positions of the second feature points in the deformed shape according to the shape we want to deform, wherein the second feature points need to correspond one-to-one with the first feature points, and the position order also needs to remain consistent. Since the texture coordinates of the first feature point represent the position of the initial image from which the image data is taken, and the vertex coordinates of the second feature point represent the position on the screen where the image data is displayed, drawing based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point can obtain a drawn deformed image, and the deformed shape can be set as needed, thereby realizing the deformation of the initial image into any shape. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is a schematic diagram of the hardware structure of an image deformation device according to an embodiment of the present invention;
[0046] Figure 2 1. A schematic flow chart of an embodiment of an image deformation method according to the present invention;
[0047] Figure 3 A schematic diagram of a texture coordinate system and a vertex coordinate system in accordance with an embodiment of an image deformation method of the present invention;
[0048] Figure 4 A schematic diagram of the process of drawing a normal image in an embodiment of the image deformation method of the present invention;
[0049] Figure 5 A schematic diagram of a process for drawing a deformed image in accordance with an embodiment of an image deformation method of the present invention;
[0050] Figure 6 FIG. 1 is a schematic diagram of functional modules of an image deformation device according to an embodiment of the present invention.
[0051] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0052] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0053] In a first aspect, an embodiment of the present invention provides an image deformation device.
[0054] Reference Figure 1 , Figure 1 Schematic diagram of the hardware structure of an embodiment of the image deformation device of the present invention. In an embodiment of the present invention, the image deformation device may include a processor 1001 (such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components; the user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (such as a wireless fidelity WIreless-FIdelity, WI-FI interface); the memory 1005 may be a high-speed random access memory (random access memory, RAM), or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001. Those skilled in the art will understand that Figure 1 The hardware structure shown in the figure does not constitute a limitation of the present invention, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0055] Continue to refer to Figure 1 , Figure 1 The memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an image deformation program. The processor 1001 may call the image deformation program stored in the memory 1005 and execute the image deformation method provided by the embodiment of the present invention.
[0056] In a second aspect, an embodiment of the present invention provides an image deformation method.
[0057] In order to more clearly demonstrate the image deformation method provided in the embodiment of the present application, the application scenario of the image deformation method provided in the embodiment of the present application is first introduced.
[0058] The image deformation method provided in the embodiment of the present application is applied to embedded vehicle-mounted devices. By using the cross-programming language and cross-platform OpenGL ES open graphics interface, the deformation effect of the original image is displayed. For example, when we need to display a navigation lane line, because the shape of the route will change randomly according to the actual road conditions, if the image is drawn by using the original navigation image in a proportional manner, a good display effect cannot be achieved. At this time, it is necessary to consider the real-time changing shape of the route, and draw the route into a corresponding shape according to the navigation data without causing image display distortion. In addition, in some cases, it is necessary to deform the image into an arbitrary shape to achieve a cool display effect.
[0059] In one embodiment, referring to Figure 2 , Figure 2 FIG. 1 is a flow chart of an embodiment of an image deformation method according to the present invention. Figure 2 As shown, the image deformation method includes:
[0060] Step S10 : selecting a preset number of first feature points from the initial image based on the texture coordinate system.
[0061] In this embodiment, refer to Figure 3 , Figure 3 Schematic diagram of the texture coordinate system and vertex coordinate system of an embodiment of the image deformation method of the present invention. Figure 3 As shown, the texture coordinates in the texture coordinate system represent the mapping relationship between the texture and the image. In the texture coordinate system, each point in the image corresponds to a texture coordinate, which means that the texture data of the image is read from that position. The range of texture coordinates is between 0 and 1. The default lower left corner of the texture coordinate is (0, 0) and the upper right corner is (1, 1). The initial image is the initial image to be deformed in this embodiment. In the field of image processing, a feature point refers to a point where the grayscale value of the image changes dramatically or a point with a large curvature on the edge of the image (i.e., the intersection of two edges). It usually has the characteristics of rotation invariance, illumination invariance, and perspective invariance.
[0062] In step S20, a deformed shape is set based on a vertex coordinate system, and a preset number of second feature points are selected from the deformed shape. The second feature points correspond one-to-one to each of the first feature points, and the order between each of the second feature points is consistent with the order between each of the first feature points.
[0063] In this embodiment, continue to refer to Figure 3 ,like Figure 3 As shown, the vertex coordinates in the vertex coordinate system represent the mapping relationship between the image and the screen, that is, the feature points in the image are displayed at that position on the screen. The range of vertex coordinates is between -1 and 1. Generally, the center point of the vertex coordinate system is set to coincide with the center point of the screen. The deformation shape can be customized according to the deformation requirements. The second feature point in the vertex coordinate system and the first feature point in the texture coordinate system must be a one-to-one mapping relationship, and the position order between each point must also remain unchanged to avoid misalignment and distortion of the drawn image.
[0064] Step S30: setting the distribution positions of the second feature points according to the deformed shape.
[0065] In this embodiment, after the deformation shape is set, the distribution position of the second feature point is set according to the deformation shape. Since the vertex coordinates of the second feature point represent the display area on the screen, according to the desired deformation effect, for example, if you want to highlight the head area of the deformation shape, you can distribute a larger number of feature points in the head area and a smaller number of feature points in other limbs and torso areas.
[0066] Step S40 , performing drawing based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point to obtain a drawn deformed image.
[0067] In this embodiment, refer to Figure 4 and Figure 5 , Figure 4 This is a flow chart of drawing a normal image in accordance with an embodiment of the image deformation method of the present invention. Figure 5 FIG. 1 is a flow chart of drawing a deformed image according to an embodiment of the image deformation method of the present invention, as shown in FIG. Figure 5 As shown, after the texture coordinates of the first feature point and the vertex coordinates of the second feature point are determined, image data can be taken from the initial image according to the position of the texture coordinates, and then the image data is displayed on the screen at the position where the vertex coordinates are located, thereby realizing the drawing of the deformed image.
[0068] In this embodiment, since the texture coordinates of the first feature point represent the position of the initial image from which the image data is taken, and the vertex coordinates of the second feature point represent the position on the screen where the image data is displayed, drawing can be performed based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point to obtain a drawn deformed image. The deformed shape can be set as needed, thereby realizing the deformation of the initial image into any shape. Since OpenGL ES will automatically perform interpolation operations between each vertex, the drawn deformed image will not produce abnormal distortion of the image display. In addition, the deformation shape can be adjusted in real time to achieve a cool effect of dynamic deformation of the image.
[0069] Furthermore, in one embodiment, before step S10, the following steps are included:
[0070] Set the size of the preset number based on the drawing accuracy of the deformed image.
[0071] In this embodiment, the number of feature points is set accordingly according to the rendering accuracy of the deformed image. For example, if the rendering accuracy requirement of the deformed image is high, a larger number of feature points is selected accordingly to improve the rendering accuracy of the image.
[0072] Furthermore, in one embodiment, step S10 includes:
[0073] Based on the texture coordinate system, an initial image is selected from the image to be deformed according to the deformation area to be processed;
[0074] According to the main content to be drawn, a preset number of first feature points are selected from the initial image.
[0075] In this embodiment, we can choose to deform the entire image or select part of the image area for deformation. For example, for a full-body image of a person, we can select the image area where the head is located for deformation. According to the main content of the drawing, the position of the first feature point is set accordingly. For example, for an image of a person's head, we want to focus on the person's eyes, that is, we can select a larger number of feature points in the image area where the eyes are located, and select a smaller number of feature points in other head image areas except the eyes.
[0076] Furthermore, in one embodiment, step S40 includes:
[0077] Constructing a first array based on the texture coordinates of the first feature point;
[0078] Constructing a second array based on the vertex coordinates of the second feature point;
[0079] Based on the first array and the second array, shading is performed through the OpenGL ES API;
[0080] Based on the first array and the second array, create a texture through the OpenGL ES API;
[0081] Drawing is performed through the glDrawArrays function of the opengles API.
[0082] In this embodiment, the texture coordinates of the first feature point and the vertex coordinates of the second feature point are respectively organized into the form of arrays, each element in the array is the coordinate value of each feature point, which is transmitted to the shader through the OpenGL ES API for shading, and then the texture is created to finally realize drawing.
[0083] Furthermore, in one embodiment, step S40 further includes:
[0084] Based on the first feature points, performing triangular cutting on the initial image to obtain a first triangular network;
[0085] Based on the second feature point, performing triangular cutting on the deformed shape to obtain a second triangular network;
[0086] Constructing a third array based on the texture coordinates of the first triangle network;
[0087] Constructing a fourth array based on the texture coordinates of the second triangle network;
[0088] Based on the third array and the fourth array, shading is performed through the OpenGL ES API;
[0089] Based on the first array and the second array, creating a texture through the opengles API;
[0090] Drawing is performed through the glDrawArrays function of the opengles API.
[0091] In this embodiment, as needed, the initial image can be triangulated according to the first feature point, and the deformed shape can be triangulated according to the second feature point. The image deformation process and the expected deformation effect can be observed intuitively. Since the objects drawn by the opengles bottom layer for image drawing only include points, lines and triangles, cutting in advance can correspondingly improve the processing efficiency of image deformation. In the case of cutting triangles, it is necessary to construct a two-dimensional array for the texture coordinates of the first feature point and the vertex coordinates of the second feature point respectively, wherein the first dimension includes all the cut triangles, that is, each element of the array corresponds to each triangle, and the second dimension includes the coordinate values of each point of each triangle. The constructed two-dimensional third array and fourth array are transferred to the shader through the opengles API for shading, and then the texture is created to finally realize drawing.
[0092] In a third aspect, an embodiment of the present invention further provides an image deformation device.
[0093] Reference Figure 6 , Figure 6 FIG. 1 is a schematic diagram of functional modules of an image deformation device according to an embodiment of the present invention.
[0094] In this embodiment, the image deformation device includes:
[0095] A selection module 10 is configured to select a preset number of first feature points from the initial image based on a texture coordinate system;
[0096] A first setting module 20 is configured to set a deformed shape based on a vertex coordinate system, and select a preset number of second feature points from the deformed shape, wherein the second feature points correspond to each of the first feature points one-to-one, and the order between each of the second feature points is consistent with the order between each of the first feature points;
[0097] A second setting module 30, configured to set the distribution positions of the second feature points according to the deformed shape;
[0098] The drawing module 40 is configured to perform drawing based on the texture coordinates of the first feature points and the vertex coordinates of the second feature points to obtain a drawn deformed image.
[0099] Furthermore, in one embodiment, the image deformation device further includes a third setting module 50, configured to:
[0100] Set the size of the preset number based on the drawing accuracy of the deformed image.
[0101] Furthermore, in one embodiment, the selection module 10 is configured to:
[0102] Based on the texture coordinate system, an initial image is selected from the image to be deformed according to the deformation area to be processed;
[0103] According to the main content to be drawn, a preset number of first feature points are selected from the initial image.
[0104] Furthermore, in one embodiment, the drawing module 40 is configured to:
[0105] Constructing a first array based on the texture coordinates of the first feature point;
[0106] Constructing a second array based on the vertex coordinates of the second feature point;
[0107] Based on the first array and the second array, shading is performed through the OpenGL ES API;
[0108] Based on the first array and the second array, create a texture through the OpenGL ES API;
[0109] Drawing is performed through the glDrawArrays function of the opengles API.
[0110] Furthermore, in one embodiment, the drawing module 40 is configured to:
[0111] Based on the first feature points, performing triangular cutting on the initial image to obtain a first triangular network;
[0112] Based on the second feature point, performing triangular cutting on the deformed shape to obtain a second triangular network;
[0113] Constructing a third array based on the texture coordinates of the first triangle network;
[0114] Constructing a fourth array based on the texture coordinates of the second triangle network;
[0115] Based on the third array and the fourth array, shading is performed through the OpenGL ES API;
[0116] Based on the first array and the second array, creating a texture through the opengles API;
[0117] Drawing is performed through the glDrawArrays function of the opengles API.
[0118] The functional implementation of each module in the above-mentioned image deformation device corresponds to each step in the above-mentioned embodiment of the image deformation method, and their functions and implementation processes are not further described here.
[0119] In a fourth aspect, an embodiment of the present invention further provides a readable storage medium.
[0120] The readable storage medium of the present invention stores an image deformation program, wherein when the image deformation program is executed by a processor, the steps of the above-mentioned image deformation method are implemented.
[0121] The method implemented when the image deformation program is executed can refer to the various embodiments of the image deformation method of the present invention, and will not be described in detail here.
[0122] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0123] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0124] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device to execute the methods described in various embodiments of the present invention.
[0125] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. An image deformation method, characterized in that: The image deformation method comprises: Based on the texture coordinate system, a preset number of first feature points are selected from the initial image; Based on the vertex coordinate system, a deformed shape is set, and a preset number of second feature points are selected from the deformed shape, where the second feature points correspond to each of the first feature points one-to-one, and the order between each of the second feature points is consistent with the order between each of the first feature points; According to the deformed shape, the distribution position of the second feature point is set, and the second feature point is located within the deformed shape; Based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point, using OpenGL ES to draw a deformed image, wherein, in the process of drawing using OpenGL ES, an interpolation operation is performed based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point; The selecting a preset number of first feature points from the initial image based on the texture coordinate system includes: Based on the texture coordinate system, an initial image is selected from the image to be deformed according to the deformation area to be processed; According to the main content to be drawn, a preset number of first feature points are selected from the initial image.
2. The image deformation method according to claim 1, wherein: Before selecting a preset number of first feature points from the initial image based on the texture coordinate system, the method includes: Set the size of the preset number based on the drawing accuracy of the deformed image.
3. The image deformation method according to claim 1, wherein: The drawing based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point includes: Constructing a first array based on the texture coordinates of the first feature point; Constructing a second array based on the vertex coordinates of the second feature point; Based on the first array and the second array, shading is performed through the OpenGL ES API; Based on the first array and the second array, create a texture through the OpenGL ES API; Drawing is performed through the glDrawArrays function of the opengles API.
4. The image deformation method according to claim 1, wherein: The drawing based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point further includes: Based on the first feature points, performing triangular cutting on the initial image to obtain a first triangular network; Based on the second feature point, performing triangular cutting on the deformed shape to obtain a second triangular network; Constructing a third array based on the texture coordinates of the first triangle network; Constructing a fourth array based on the texture coordinates of the second triangle network; Based on the third array and the fourth array, shading is performed through the OpenGL ES API; Based on the first array and the second array, creating a texture through the opengles API; Drawing is performed through the glDrawArrays function of the opengles API.
5. An image deformation device, characterized in that: The image deformation device comprises: A selection module, configured to select a preset number of first feature points from the initial image based on a texture coordinate system; A first setting module is configured to set a deformed shape based on a vertex coordinate system, and select a preset number of second feature points from the deformed shape, wherein the second feature points correspond to each of the first feature points one-to-one, and the order between each of the second feature points is consistent with the order between each of the first feature points; a second setting module, configured to set the distribution positions of the second feature points according to the deformed shape, wherein the second feature points are located within the deformed shape; A drawing module, configured to use OpenGL ES to draw based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point, to obtain a drawn deformed image, wherein, during the drawing process using OpenGL ES, an interpolation operation is performed based on the texture coordinates of the first feature point and the vertex coordinates of the second feature point; The selection module is used to: Based on the texture coordinate system, an initial image is selected from the image to be deformed according to the deformation area to be processed; According to the main content to be drawn, a preset number of first feature points are selected from the initial image.
6. The image deformation device according to claim 5, wherein: The drawing module is used to: Constructing a first array based on the texture coordinates of the first feature point; Constructing a second array based on the vertex coordinates of the second feature point; Based on the first array and the second array, shading is performed through the OpenGL ES API; Based on the first array and the second array, create a texture through the OpenGL ES API; Drawing is performed through the glDrawArrays function of the opengles API.
7. An image deformation device, characterized in that: The image deformation device includes a processor, a memory, and an image deformation program stored in the memory and executable by the processor, wherein when the image deformation program is executed by the processor, the steps of the image deformation method according to any one of claims 1 to 4 are implemented.
8. A readable storage medium, characterized in that: The readable storage medium stores an image deformation program, wherein when the image deformation program is executed by a processor, the steps of the image deformation method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Image rendering method, device and equipment based on OpenGLES, and storage medium
CN108765539A
Method and apparatus for image deformation based on feature correspondence
CN108961283A