Image rotation method, device, electronic device and readable storage medium

By segmenting and three-dimensional rotation processing of the image, the problem of poor image rotation effect in the prior art is solved, and the image rotation effect with more visual impact is achieved, meeting the needs of different application scenarios.

CN114298914BActive Publication Date: 2025-02-11TAISHAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111612398.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2025-02-11
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

The prior art cannot meet the user's visual effect needs according to different application scenarios during image rotation, resulting in poor results in scenes such as animation scene transition, game map switching, slide switching, etc.

Method used

By obtaining the image to be rotated, image segmentation parameters and image three-dimensional rotation parameters, a to-be-processed image on the front and back side is generated, and the image to be processed is segmented and three-dimensional rotation processed according to the image segmentation parameters and three-dimensional rotation parameters, it is determined that each sub-picture to be rotated is The coordinates of the three-dimensional image during the three-dimensional rotation.

Benefits of technology

It achieves a smoother and gorgeous image rotation effect, enhances visual impact, and shows good transition animation effects in different application scenarios, meeting users' diverse needs for image rotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114298914B_ABST
    Figure CN114298914B_ABST
Patent Text Reader

Abstract

The present application discloses an image rotation method, device, electronic device and readable storage medium. The method includes obtaining an image to be rotated, image segmentation parameters and image three-dimensional rotation parameters; based on the image to be rotated, generating an image to be processed with front and back sides; segmenting the image to be processed according to the image segmentation parameters to obtain multiple sub-images to be rotated; determining the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image three-dimensional rotation parameters; for each sub-image to be rotated, performing a separate three-dimensional rotation process according to the image three-dimensional rotation parameters and the corresponding three-dimensional image coordinates. The present application can meet the user's processing needs for rotating images according to different application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image rotation method, device, electronic device and readable storage medium. Background Art

[0002] Image rotation refers to the process of rotating an image by a certain angle with a certain point as the center to form a new image. Currently, the relevant technology for image rotation is generally rotation on a two-dimensional plane, and generally the image is rotated as a whole.

[0003] It is understandable that the visual impact of this image rotation method in the related art is general, and it does not produce a good visual effect when used in scenes such as animation scene transition, game map switching, and slide switching, and cannot meet user needs.

[0004] In view of this, how to meet the user's processing requirements for rotating images according to different application scenarios is a technical problem that technical personnel in the relevant field need to solve. Summary of the invention

[0005] The present application provides an image rotation method, device, electronic device and readable storage medium, which can meet the user's processing needs for rotating images according to different application scenarios.

[0006] To solve the above technical problems, the embodiments of the present invention provide the following technical solutions:

[0007] An embodiment of the present invention provides an image rotation method, comprising:

[0008] Obtaining the image to be rotated, image segmentation parameters and image three-dimensional rotation parameters;

[0009] Based on the image to be rotated, generating an image to be processed having a front side and a back side;

[0010] Segment the image to be processed according to the image segmentation parameters to obtain a plurality of sub-images to be rotated;

[0011] Determine the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image three-dimensional rotation parameters;

[0012] For each sub-image to be rotated, a separate three-dimensional rotation process is performed according to the three-dimensional rotation parameters of the image and the corresponding three-dimensional image coordinates.

[0013] Optionally, the three-dimensional image rotation parameter includes a rotation duration, and the performing a separate three-dimensional rotation process according to the three-dimensional image rotation parameter and the corresponding three-dimensional image coordinates includes:

[0014] According to the three-dimensional image coordinates of each frame of the current sub-image to be rotated during the three-dimensional rotation process, a three-dimensional application program interface is called to draw the corresponding frame image until the rotation duration ends.

[0015] Optionally, the application scenario of the image to be rotated is an animation transition scenario, and after performing a separate three-dimensional rotation process on each sub-image to be rotated according to the three-dimensional rotation parameters of the image and the corresponding three-dimensional image coordinates, the method further includes:

[0016] According to each frame image of each sub-image to be rotated within the rotation duration, a scene transition animation of the image to be rotated is generated.

[0017] Optionally, the image three-dimensional rotation parameters include an image rotation direction and a rotation duration, and determining the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image three-dimensional rotation parameters includes:

[0018] Calculating the initial front graphic coordinates of each sub-image to be rotated according to the image segmentation parameters and the scene graph parameters;

[0019] Calculate the coordinates of the rotation center axis of each sub-image to be rotated according to the image rotation direction and the coordinates of each initial front image;

[0020] According to each initial front graphic coordinate, calculate the front texture coordinate of the corresponding sub-image to be rotated in the scene after rotation;

[0021] For each sub-image to be rotated, according to the initial front graphic coordinates and the corresponding front texture coordinates of the sub-image to be rotated, the initial back graphic coordinates and the back texture coordinates of the sub-image to be rotated are calculated;

[0022] According to the rotation duration, the time point of drawing each frame of the picture during the three-dimensional rotation process, the rotation central axis coordinates of each sub-image to be rotated and the three-dimensional coordinates of the image points, the three-dimensional image coordinates of each frame of the picture during the three-dimensional rotation process of each sub-image to be rotated are cyclically calculated.

[0023] Optionally, the calculating the initial front graphic coordinates of each sub-image to be rotated according to the image segmentation parameter and the scene graph parameter includes:

[0024] Calculate the coordinate information of the target point in the application scene graph of the image to be rotated according to the scene graph parameters;

[0025] Calculating the width and height of each sub-image to be rotated according to the image segmentation parameters;

[0026] The three-dimensional coordinate information of each vertex of the corresponding sub-image to be rotated is determined according to the coordinate information, the width and the height of each sub-image to be rotated, so as to serve as the initial front graphic coordinates of each sub-image to be rotated.

[0027] Optionally, the calculating the rotation central axis coordinates of each sub-image to be rotated according to the image rotation direction and the coordinates of each initial front image includes:

[0028] For each sub-image to be rotated, the three-dimensional coordinates of the horizontal rotation center axis and the vertical rotation center axis of the sub-image to be rotated are determined according to the image rotation direction and the three-dimensional coordinate information of multiple target points of the sub-image to be rotated.

[0029] Optionally, the calculating, according to each initial front graphic coordinate, the front texture coordinate of the corresponding sub-image to be rotated in the rotated scene includes:

[0030] Based on the fact that the texture of each sub-image to be rotated is a square formed by a first point, a second point, a third point and a fourth point, the two-dimensional front texture coordinates of the corresponding sub-image to be rotated are determined according to the scene graph parameters and the three-dimensional coordinate information of the target point of each sub-image to be rotated.

[0031] Optionally, the calculating of the initial backside graphic coordinates and backside texture coordinates of the sub-image to be rotated according to the initial front side graphic coordinates and the corresponding front side texture coordinates of the sub-image to be rotated currently includes:

[0032] For each sub-image to be rotated, based on the image rotation direction and the front texture coordinates of multiple target points of the current sub-image to be rotated, determine the back texture coordinates of each target point on the back of the current sub-image to be rotated when the current sub-image to be rotated is rotated horizontally and vertically.

[0033] Optionally, the step of cyclically calculating the three-dimensional image coordinates of each frame of the sub-image to be rotated during the three-dimensional rotation according to the rotation duration, the time point at which each frame of the image is drawn during the three-dimensional rotation, the rotation central axis coordinates of each sub-image to be rotated, and the three-dimensional coordinates of the image points includes:

[0034] Calculate the rotation angle at a first moment according to the rotation start time and the rotation duration;

[0035] For each sub-image to be rotated, the three-dimensional coordinates of the target image point of the current sub-image to be rotated, the corresponding rotation axis coordinates and the rotation angle are calculated to rotate the target image point to the first moment in the horizontal and vertical directions.

[0036] Another aspect of the present invention provides an image rotation device, comprising:

[0037] An information acquisition module is used to acquire the image to be rotated, image segmentation parameters and image three-dimensional rotation parameters;

[0038] An image synthesis module, used for generating an image to be processed having a front side and a back side based on the image to be rotated;

[0039] An image segmentation module, used for segmenting the image to be processed according to the image segmentation parameters to obtain a plurality of sub-images to be rotated;

[0040] A coordinate calculation module, used to determine the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image three-dimensional rotation parameters;

[0041] The image rotation module is used to perform a separate three-dimensional rotation process on each sub-image to be rotated according to the three-dimensional rotation parameters of the image and the corresponding three-dimensional image coordinates.

[0042] An embodiment of the present invention further provides an electronic device, comprising a processor, wherein the processor is configured to implement the steps of the image rotation method as described in any of the preceding items when executing a computer program stored in a memory.

[0043] Finally, an embodiment of the present invention further provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image rotation method as described in any of the preceding items are implemented.

[0044] The advantage of the technical solution provided by the present application is that image segmentation parameters and image three-dimensional rotation parameters can be customized, that is, users can make multiple combinations of the number of rows, columns, rotation direction, and rotation duration of image segmentation according to their own preferences or needs, merge the images to be rotated into front and back images, and divide the front and back into multiple parts first, and then perform three-dimensional rotation on each part separately in a direction order based on coordinate calculations, so that the rotation process can be smoother, more gorgeous, and more visually impactful. It will have a good effect when used in scenes such as animation scene transition, game map switching, and slide switching. Various three-dimensional rotation transition animations can be created, and the processing types of image rotation can be increased, which well meets the user's processing needs for rotating images according to different scenes and improves the user experience.

[0045] In addition, the embodiment of the present invention also provides a corresponding implementation device, an electronic device and a readable storage medium for the image rotation method, which further makes the method more practical, and the device, the electronic device and the readable storage medium have corresponding advantages.

[0046] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 A schematic diagram of a flow chart of an image rotation method provided by an embodiment of the present invention;

[0049] Figure 2 A schematic diagram of an image rotation process shown in an exemplary embodiment provided by an embodiment of the present invention;

[0050] Figure 3 A schematic flow chart of another image rotation method provided by an embodiment of the present invention;

[0051] Figure 4 A schematic diagram of a three-dimensional Cartesian coordinate system used in an embodiment of the present invention;

[0052] Figure 5 A schematic diagram of a method for calculating the coordinates of a front initial graphic provided by an embodiment of the present invention;

[0053] Figure 6 A schematic diagram of a method for calculating the coordinates of a central axis of a graphic rotation provided by an embodiment of the present invention;

[0054] Figure 7 A schematic diagram of a front texture coordinate generation principle and calculation method provided by an embodiment of the present invention;

[0055] Figure 8 A schematic diagram of a back surface texture coordinate calculation method provided by an embodiment of the present invention;

[0056] Fig. 9 A schematic diagram of a method for calculating the graphic coordinates of each frame of an image in a process of segmenting an image based on coordinate operations and performing three-dimensional rotation provided by an embodiment of the present invention;

[0057] Fig.10 A structural diagram of a specific implementation of the image rotation device provided by an embodiment of the present invention;

[0058] Fig.11 A structural diagram of a specific implementation of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0059] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0060] The terms "first", "second", "third", "fourth", etc. in the specification and claims of this application and the above drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.

[0061] After introducing the technical solutions of the embodiments of the present invention, various non-limiting implementation methods of the present application are described in detail below.

[0062] See first Figure 1 , Figure 1 A flowchart of an image rotation method provided by an embodiment of the present invention is provided. The embodiment of the present invention may include the following contents:

[0063] S101: Acquire an image to be rotated, image segmentation parameters, and image three-dimensional rotation parameters.

[0064] In this embodiment, the image to be rotated may be one image or two images, such as two scene images that need to be switched. Image segmentation parameters include but are not limited to the number of image segmentation rows and the number of image segmentation columns. The number of sub-images to be rotated of the image segmentation to be processed is determined according to the number of image segmentation rows and the number of image segmentation columns. Image three-dimensional rotation parameters include but are not limited to the image rotation direction and the image rotation duration. The image rotation direction refers to the rotation method of each segmented sub-image to be rotated, and the image rotation duration refers to the rotation duration of each sub-image to be rotated. In this embodiment, the user can manually select the image to be rotated and manually input parameters such as the number of image segmentation rows, the number of segmentation columns, the rotation direction, and the image rotation duration. When a trigger condition is detected, the image to be rotated, the image segmentation parameters, and the image three-dimensional rotation parameters can also be read at a specified location to provide the degree of automation of the entire method.

[0065] S102: Based on the image to be rotated, generate an image to be processed having a front side and a back side.

[0066] If the image to be rotated is two images, the two images can be adjusted to the same size and then merged into a processed image with a front and back side. The front and back sides of the two images can be flexibly limited according to the actual application scenario. If the image to be rotated is a single image, a basic image of a fully black image or a fully white image can be obtained, and the basic image and the image to be rotated can be merged into a processed image with a front and back side. The image resolutions of the front and back sides of the image to be processed may be different, and the two images need to be cropped to the same size before merging.

[0067] S103: Segment the image to be processed according to the image segmentation parameters to obtain a plurality of sub-images to be rotated.

[0068] After any two images are merged into an image with front and back sides in the previous step, the image is then segmented into multiple parts according to image segmentation parameters such as the number of image segmentation rows and columns input by the user. Each part is independently rotated 180° in three dimensions so that the image is displayed normally.

[0069] S104: Determine the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image three-dimensional rotation parameters.

[0070] Among them, the application scenario of the image to be rotated refers to the use occasion where rotation is required, such as animation scene transition, game map switching, slide switching, etc., and the scene graph parameters refer to the length, width, height and other parameters of the scene graph in the application scenario. It can be understood that the three-dimensional image rotation parameters include the duration of the image rotation, that is, each sub-image to be rotated is not rotated only once, but may be rotated continuously for multiple times. Accordingly, the three-dimensional image coordinates of each image point of the sub-image to be rotated after the current rotation can be determined according to the three-dimensional image coordinates of each sub-image to be rotated before each rotation, the scene graph parameters of the application scenario of the image to be rotated, the image segmentation parameters and the image rotation direction.

[0071] S105: For each sub-image to be rotated, perform a separate three-dimensional rotation process according to the three-dimensional image rotation parameters and the corresponding three-dimensional image coordinates.

[0072] The three-dimensional rotation of an image refers to rotating the image in a three-dimensional Cartesian coordinate system. The three-dimensional Cartesian coordinate system refers to the addition of the third dimension coordinates based on the right-hand rule on the basis of the two-dimensional Cartesian coordinate system. The three-dimensional Cartesian coordinates refer to: the three-dimensional Cartesian coordinates (X, Y, Z) are the expressions of points in the three-dimensional Cartesian coordinate system, where x, y, and z are the coordinate values ​​of the x-axis, y-axis, and z-axis that have a common zero point and are orthogonal to each other (i.e., vertical). Rotate each sub-image to be rotated according to the rotation parameters input by the user, such as the rotation duration and rotation direction, and divide the image with the front and back sides into multiple parts. After each part rotates 180° around its axis, the image on the back side is displayed correctly on the front side. After determining the three-dimensional image coordinates of each image point of each sub-image to be rotated at each rotation moment during the rotation process in the previous step, perform a separate three-dimensional rotation operation on each sub-image to be rotated based on the image rotation direction and image rotation duration.

[0073] In the technical solution provided in the embodiment of the present invention, image segmentation parameters and image three-dimensional rotation parameters can be customized, that is, the user can make multiple combinations of the number of rows, columns, rotation direction, and rotation duration of the image segmentation according to his or her own preferences or needs, merge the images to be rotated into front and back images, and divide the front and back into multiple parts first, and then perform three-dimensional rotation on each part separately in a direction order based on coordinate calculation, so that the rotation process can be smoother, more gorgeous, and more visually impactful. It will have a good effect when used in scenes such as animation scene transition, game map switching, and slide switching. Various three-dimensional rotation transition animations are created, and the processing types of image rotation are increased, which well meets the user's processing needs for rotating images according to different scenes and improves the user experience.

[0074] In order to make the technical personnel in the relevant field more clearly understand the technical solution of this application, this application is combined with Figure 2 and Figure 3 , gives an illustrative example, when receiving a user image rotation instruction, showing the user Figure 3 The human-computer interaction interface shown in the figure includes an information input area and a result display area. The information input area is used to input the image to be rotated, image segmentation parameters and image three-dimensional rotation parameters. The result display area is used to display the rotation process of the image to be rotated and the final rotated image. For example, the two buttons on the upper left are picture rotation buttons; the input box on the upper right can input the rotation duration; the two radio buttons on the upper right can select the rotation direction as horizontal rotation or vertical rotation; the bottom is the rotation process effect display area, where the picture rotation animation can be drawn. In this embodiment, Figure 4 The three-dimensional Cartesian rotation of the image to be rotated is shown. Figure 4The three-dimensional Cartesian coordinate system shown uses a right-handed coordinate system, with the origin (o) at the center of the scene, the x-axis pointing horizontally to the right, the y-axis pointing vertically upward, and the z-axis pointing toward the observer. The rotation process of the entire image may include the following:

[0075] S201: Start.

[0076] S202: Obtain the width and height of the animation transition scene.

[0077] S203: Obtain source picture 1 and source picture 2 of the scene transition animation.

[0078] S204: Obtain the number of rows and columns for image segmentation input by the user.

[0079] S205: Obtain the rotation direction input by the user.

[0080] S206: Obtain the image rotation duration input by the user.

[0081] S207: Calculate the initial front graphic coordinates of each rotatable sub-image according to the width and height of the animation transition scene and the number of rows and columns of the image segmentation input by the user.

[0082] S208: Calculate the coordinates of the rotation center axis of each sub-graphic according to the image rotation direction input by the user and the initial front graphic coordinates.

[0083] S209: Calculate the front texture coordinates of the scene according to the initial front graphic coordinates.

[0084] S210: Calculate initial backside graphic coordinates and backside texture coordinates according to initial front side graphic coordinates and front side texture coordinates.

[0085] S211: cyclically calculating the graphic coordinates of each frame of the picture according to the rotation duration, the time point at which each frame of the picture is drawn, and the initial graphic coordinates.

[0086] S212: Call the 3D API to draw each frame of the picture in a loop.

[0087] S213: Determine whether the image rotation duration has ended. If the image rotation duration has not ended, jump to S211; if the image rotation duration has ended, execute S214.

[0088] S214: End.

[0089] From the above, it can be seen that when generating a scene transition animation, this embodiment can select the appropriate number of image segmentation rows, number of image segmentation columns, rotation direction, and rotation duration according to the usage scenario and one's own preferences to produce a scene transition animation with a smoother process and greater visual impact.

[0090] Based on the above embodiment, in order to improve the practicality of the entire technical solution, this embodiment further provides an animation generation method, which may include the following contents:

[0091] The image 3D rotation parameters include the rotation duration. According to the 3D image coordinates of each frame of the current sub-image to be rotated during the 3D rotation process, the 3D application program interface is called to draw the corresponding frame image until the rotation duration ends. The final animation is generated according to each frame image drawn by the 3D application program interface, i.e., 3D API (Application Programming Interface).

[0092] Among them, 3D API refers to the direct interface between the graphics card and the application program. 3D API allows users such as programmers to design 3D software by calling the program in its API to realize the communication between the API and the hardware driver automatically, which greatly improves the design efficiency of 3D programs. 3D API can be JAVA 3D, DirectX, OpenGL, Glide, etc. If the application scene of the image to be rotated is an animation transition scene, the scene transition animation of the image to be rotated is generated according to each frame image of each sub-image to be rotated within the rotation duration.

[0093] From the above, it can be seen that this embodiment can divide any two pictures into multiple parts according to the number of rows and columns input by the user according to different scenes and user preferences, and then perform three-dimensional rotation according to the rotation direction and rotation duration input by the user to create various three-dimensional animations required by the user.

[0094] In the above embodiment, there is no limitation on how to execute step S104. In this embodiment, an optional method for calculating the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process is provided. The three-dimensional rotation parameters of the image include the image rotation direction and the rotation duration, which may include the following steps:

[0095] According to the image segmentation parameters and the scene graph parameters, the initial front graphic coordinates of each sub-image to be rotated are calculated; according to the image rotation direction and each initial front graphic coordinate, the rotation central axis coordinates of each sub-image to be rotated are calculated; according to each initial front graphic coordinate, the front texture coordinates of the corresponding sub-image to be rotated in the scene after rotation are calculated; for each sub-image to be rotated, according to the initial front graphic coordinates and the corresponding front texture coordinates of the current sub-image to be rotated, the initial back graphic coordinates and the back texture coordinates of the current sub-image to be rotated are calculated; according to the rotation duration, the time point when each frame of the picture is drawn during the three-dimensional rotation process, the rotation central axis coordinates of each sub-image to be rotated and the three-dimensional coordinates of the image point, the three-dimensional image coordinates of each frame of the sub-image to be rotated during the three-dimensional rotation process are cyclically calculated.

[0096] In this embodiment, in the art, i.e., computer graphics, texture includes both the texture of the surface of an object in the usual sense, i.e., the uneven grooves on the surface of an object, and also includes the color pattern on the smooth surface of the object. One or more two-dimensional graphics representing the details of the surface of an object are also called texture maps.

[0097] The process of calculating the initial front graphic coordinates of each sub-image to be rotated according to the image segmentation parameters and the scene graph parameters may include:

[0098] According to the scene graph parameters, the coordinate information of the target point in the application scene graph of the image to be rotated is calculated; according to the image segmentation parameters, the width and height of each sub-image to be rotated are calculated; according to the coordinate information, the width and height of each sub-image to be rotated, the three-dimensional coordinate information of each vertex of the corresponding sub-image to be rotated is determined as the initial front graphic coordinates of each sub-image to be rotated.

[0099] In this embodiment, if Figure 5 As shown, the width of the application scene graph of the image to be rotated is w, the height is h, and the aspect ratio of the scene graph is scale. The coordinates of the upper left corner of the scene graph can be (xBegin, yBegin), where xBegin = -1, yBegin = scale, that is, the coordinates of the upper left corner of the scene graph are (-1, scale), and correspondingly, the coordinates of the upper right corner of the scene graph can be (1, sacle), the coordinates of the lower left corner of the scene graph can be (-1, -sacle), and the coordinates of the lower right corner of the scene graph can be (1, -sacle). The image segmentation parameters are the number of image segmentation rows RowNum and the number of image segmentation columns ColNum. Based on the image segmentation parameters, the width of each sub-image to be rotated can be calculated as xStep = 2 / ColNum, and the height of each sub-image to be rotated can be calculated as yStep = 2*scale / RowNum. Based on this, the three-dimensional coordinate information of the sub-image to be rotated in the rowth row and the colth column of the image to be processed can be calculated as follows: the coordinates of the upper left corner are (x1, y1, z1), the coordinates of the upper right corner are (x2, y2, z2), the coordinates of the lower right corner are (x3, y3, z3), and the coordinates of the lower left corner are (x4, y4, z4). Among them, x1=xBegin+col*xStep, y1=yBegin-row*yStep, z1=0. x2=x1+xStep, y2=y1, z2=0. x3=x2, y3=y2–yStep, z3=0, x4=x1, y4=y3, z4=0.

[0100] The process of calculating the coordinates of the rotation center axis of each sub-image to be rotated according to the image rotation direction and the coordinates of each initial front image may include:

[0101] For each sub-image to be rotated, the three-dimensional coordinates of the horizontal rotation center axis and the vertical rotation center axis of the current sub-image to be rotated are determined according to the image rotation direction and the three-dimensional coordinate information of multiple target points of the current sub-image to be rotated.

[0102] In this embodiment, multiple target points can be determined according to actual needs, such as Figure 6 As shown, as an optional implementation, for each sub-image to be rotated, according to the image rotation direction and the upper left corner coordinates (x1, y1, z1), upper right corner coordinates (x2, y2, z2), and lower left corner coordinates (x4, y4, z4) of the sub-image to be rotated, the three-dimensional coordinates of the horizontal rotation axis and the vertical rotation axis of the sub-image to be rotated can be calculated as ((x1+x2) / 2, 0, 0) and (0, (y1+y4) / 2, 0), respectively. As another optional implementation parallel to the above-mentioned embodiment, for each sub-image to be rotated, according to the rotation direction and the coordinates of the upper left corner of the image (x1, y1, z1), the coordinates of the upper right corner of the image (x2, y2, z2), and the coordinates of the lower right corner of the image (x3, y3, z3), the three-dimensional coordinates of the horizontal rotation axis and the vertical rotation axis of the sub-image to be rotated can be calculated as ((x1+x2) / 2, 0, 0) and (0, (y1+y3) / 2, 0), respectively.

[0103] The process of calculating the front texture coordinates of the corresponding sub-image to be rotated in the rotated scene according to the initial front graphic coordinates may include:

[0104] Based on the fact that the texture of each sub-image to be rotated is a square formed by a first point, a second point, a third point and a fourth point, the two-dimensional front texture coordinates of the corresponding sub-image to be rotated are determined according to the scene graph parameters and the three-dimensional coordinate information of the target point of each sub-image to be rotated.

[0105] In this embodiment, the first point, the second point, the third point and the fourth point can be four coordinate points selected in the two-dimensional coordinate system according to actual needs, and these four coordinate points can form a square. In this embodiment, the texture is always regarded as a square from (0, 0) to (1, 1), and the process of mapping the texture coordinates to the graphic texture coordinates is the texture coordinate calculation method. Figure 7 As shown, the scene graph width of the application scene of the image to be rotated is W, the scene graph height is H, and the aspect ratio of the scene graph is scale = W / H. For any image point of the sub-image to be rotated, that is, the three-dimensional coordinates of the target point are (x, y, z). According to the aspect ratio scale of the scene and the graphic coordinates (x, y, z), it can be calculated that the texture coordinates corresponding to the target point can be ((x+1) / 2, (y*scale+1) / 2).

[0106] The process of calculating the initial backside graphic coordinates and backside texture coordinates of the sub-image to be rotated according to the initial front side graphic coordinates and the corresponding front side texture coordinates of the sub-image to be rotated may include:

[0107] The initial back side graphic coordinates of this embodiment correspond to the initial front side graphic coordinates, and the initial back side graphic coordinates can be calculated using the same calculation method as the above-mentioned initial front side graphic coordinates, that is, according to the scene graph parameters, the coordinate information of the target point in the application scene graph of the image to be rotated is calculated; the width and height of each sub-image to be rotated are calculated according to the image segmentation parameters; and the three-dimensional coordinate information of each vertex of the corresponding sub-image to be rotated is determined according to the coordinate information, the width and height of each sub-image to be rotated, as the initial back side graphic coordinates of each sub-image to be rotated.

[0108] The calculation process of the back texture coordinates can be as follows: for each sub-image to be rotated, according to the image rotation direction and the front texture coordinates of multiple target points of the current sub-image to be rotated, determine the back texture coordinates of each target point corresponding to the back side of the current sub-image to be rotated when the current sub-image to be rotated is rotated horizontally and vertically.

[0109] In this embodiment, if Figure 8According to the image rotation direction and the texture coordinates (x1, y1), (x2, y2), (x3, y3), and (x4, y4) of the upper left corner, upper right corner, lower left corner, and lower right corner of the front side of the sub-image to be rotated, it can be calculated that the texture coordinates of the upper left corner, upper right corner, lower right corner, and lower left corner of the back side of the sub-image to be rotated when the sub-image to be rotated is rotated in the horizontal direction are (x2, y2), (x1, y1), (x4, y4), and (x3, y3), respectively, and the texture coordinates of the upper left corner, upper right corner, lower right corner, and lower left corner of the back side of the sub-image to be rotated when the sub-image to be rotated is rotated in the vertical direction are (x4, y4), (x3, y3), (x2, y2), and (x1, y1), respectively. That is to say, the texture coordinates of the upper left corner of the front side of the sub-image to be rotated are (x1, y1). After horizontal rotation, the texture coordinates of the upper left corner of the back side of the sub-image to be rotated can be (u1, v1), where u1=x2, v1=y2; after vertical rotation, the texture coordinates of the upper left corner of the back side of the sub-image to be rotated are (u1, v1), u1=x4, v1=y4. The texture coordinates of the upper right corner of the front side of the sub-image to be rotated are (x2, y2). After horizontal rotation, the texture coordinates of the upper right corner of the back side of the sub-image to be rotated are (u2, v2), where u2=x1, v2=y1; after vertical rotation, the texture coordinates of the upper right corner of the back side of the sub-image to be rotated are (u2, v2), where u2=x3, v2=y3. The texture coordinates of the lower right corner of the front side of the sub-image to be rotated are (x3, y3). After horizontal rotation, the texture coordinates of the lower right corner of the back side of the sub-image to be rotated are (u3, v3), where u3=x4, v3=y4; after vertical rotation, the texture coordinates of the lower right corner of the back side of the sub-image to be rotated are (u4, v4), where u4=x3, v4=y3; the texture coordinates of the lower left corner of the front side of the sub-image to be rotated are (x4, y4). After horizontal rotation, the texture coordinates of the lower left corner of the back side of the sub-image to be rotated are (u3, v3), where u3=x2, v3=y2. After vertical rotation, the texture coordinates of the lower left corner of the back side of the sub-image to be rotated are (u4, v4), where u4=x1, v4=y1.

[0110] The process of cyclically calculating the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the rotation duration, the time point of drawing each frame of the image during the three-dimensional rotation process, the rotation central axis coordinates of each sub-image to be rotated, and the three-dimensional coordinates of the image points may include:

[0111] The rotation angle at the first moment is calculated according to the start rotation time and the rotation duration; for each sub-image to be rotated, the three-dimensional coordinates of the target image point of the current sub-image to be rotated, the corresponding rotation central axis coordinates and the rotation angle are calculated to rotate the target image point to the first moment in the horizontal and vertical directions respectively.

[0112] In this embodiment, if Fig. 9As shown, the start time of rotation is t0, the rotation duration is time, and the rotation angle at time t1 during the rotation process can be θ=(t1-t0) / time*180. The three-dimensional coordinates of any image point of the sub-image to be rotated are (x0, y0, z0), and the coordinates of the rotation center axis are (x, y, z). Then, it can be calculated that the three-dimensional coordinates of the image point after horizontal rotation to time t1 can be (z0*sin(θ)+(x0-x)*cos(θ), y0, z0*cos(θ)-(x0-x)*sin(θ)) and the three-dimensional coordinates of the image point after vertical rotation to time t1 are (x0, (y0-y)*cos(θ)-z0*sin(θ), (y0-y)*sin(θ)-z0*cos(θ)).

[0113] It should be noted that there is no strict order of execution between the steps in this application. As long as they comply with the logical order, these steps can be executed simultaneously or in a certain preset order. Figure 1-Figure 9 This is just a schematic and does not mean that this is the only execution order.

[0114] The embodiment of the present invention also provides a corresponding device for the image rotation method, which further makes the method more practical. The device can be described from the perspective of functional modules and hardware. The image rotation device provided by the embodiment of the present invention is introduced below. The image rotation device described below and the image rotation method described above can be referred to each other.

[0115] From the perspective of functional modules, see Fig.10 , Fig.10 The structure diagram of an image rotation device provided by an embodiment of the present invention in a specific implementation manner, the device may include:

[0116] The information acquisition module 1001 is used to acquire the image to be rotated, image segmentation parameters and image three-dimensional rotation parameters.

[0117] The image synthesis module 1002 is used to generate an image to be processed having a front side and a back side based on the image to be rotated.

[0118] The image segmentation module 1003 is used to segment the image to be processed according to the image segmentation parameters to obtain a plurality of sub-images to be rotated.

[0119] The coordinate calculation module 1004 is used to determine the 3D image coordinates of each frame of each sub-image to be rotated during the 3D rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image 3D rotation parameters.

[0120] The image rotation module 1005 is used to perform a separate three-dimensional rotation process on each sub-image to be rotated according to the three-dimensional image rotation parameters and the corresponding three-dimensional image coordinates.

[0121] Optionally, in some implementations of this embodiment, the above-mentioned image rotation module 1005 can be further used to: call the three-dimensional application program interface to draw the corresponding frame image according to the three-dimensional image coordinates of each frame of the current sub-image to be rotated during the three-dimensional rotation process, until the rotation duration ends.

[0122] As an optional implementation of the above embodiment, the above device may further include an animation generation module, for example, for generating a scene transition animation of the image to be rotated according to each frame image of each sub-image to be rotated within the rotation duration.

[0123] Optionally, in some other implementations of this embodiment, the coordinate calculation module 1004 may further include:

[0124] An initial front graphic coordinate calculation unit, used to calculate the initial front graphic coordinates of each sub-image to be rotated according to the image segmentation parameters and the scene graph parameters;

[0125] A rotation axis coordinate calculation unit is used for three-dimensional image rotation parameters including image rotation direction and rotation duration; according to the image rotation direction and the coordinates of each initial frontal graphic, the rotation axis coordinates of each sub-image to be rotated are calculated;

[0126] A front texture coordinate calculation unit, used to calculate the front texture coordinates of the corresponding sub-image to be rotated in the rotated scene according to each initial front graphic coordinate;

[0127] A back surface texture coordinate calculation unit, for calculating, for each sub-image to be rotated, the initial back surface graphic coordinates and the back surface texture coordinates of the current sub-image to be rotated according to the initial front surface graphic coordinates and the corresponding front surface texture coordinates of the current sub-image to be rotated;

[0128] The rotation coordinate calculation unit is used to cyclically calculate the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process based on the rotation duration, the time point when each frame of the image is drawn during the three-dimensional rotation process, the rotation central axis coordinates of each sub-image to be rotated, and the three-dimensional coordinates of the image points.

[0129] As an optional implementation of the above embodiment, the above-mentioned initial front graphic coordinate calculation unit can be further used to: calculate the coordinate information of the target point in the application scene graph of the image to be rotated according to the scene graph parameters; calculate the width and height of each sub-image to be rotated according to the image segmentation parameters; determine the three-dimensional coordinate information of each vertex of the corresponding sub-image to be rotated according to the coordinate information, the width and height of each sub-image to be rotated, as the initial front graphic coordinates of each sub-image to be rotated.

[0130] As another optional implementation of the above embodiment, the above-mentioned rotation central axis coordinate calculation unit can be further used to: for each sub-image to be rotated, determine the three-dimensional coordinates of the horizontal rotation central axis and the vertical rotation central axis of the current sub-image to be rotated according to the image rotation direction and the three-dimensional coordinate information of multiple target points of the current sub-image to be rotated.

[0131] As another optional implementation of the above embodiment, the above-mentioned front texture coordinate calculation unit can be further used to: based on the texture of each sub-image to be rotated being a square composed of a first point, a second point, a third point and a fourth point, determine the two-dimensional front texture coordinates of the corresponding sub-image to be rotated according to the scene graph parameters and the three-dimensional coordinate information of the target point of each sub-image to be rotated.

[0132] As another optional implementation of the above embodiment, the above-mentioned back texture coordinate calculation unit can be further used to: for each sub-image to be rotated, according to the image rotation direction and the front texture coordinates of multiple target points of the current sub-image to be rotated, determine the back texture coordinates of each target point corresponding to the back side of the current sub-image to be rotated when the current sub-image to be rotated is rotated in the horizontal direction and the vertical direction.

[0133] As another optional implementation of the above embodiment, the above-mentioned rotation coordinate calculation unit can be further used to: calculate the rotation angle at the first moment based on the start rotation time and the rotation duration; for each sub-image to be rotated, calculate the three-dimensional coordinates of the target image point after it is rotated to the first moment in the horizontal and vertical directions respectively according to the three-dimensional coordinates of the target image point of the current sub-image to be rotated, the corresponding rotation central axis coordinates and the rotation angle.

[0134] The functions of the functional modules of the image rotation device in the embodiment of the present invention can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.

[0135] It can be seen from the above that the embodiments of the present invention can meet the user's processing requirements for rotating images according to different application scenarios.

[0136] The image rotation device mentioned above is described from the perspective of functional modules. Furthermore, the present application also provides an electronic device, which is described from the perspective of hardware. Fig.11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application in one implementation manner. Fig.11 As shown, the electronic device includes a memory 110 for storing a computer program; and a processor 111 for implementing the steps of the image rotation method mentioned in any of the above embodiments when executing the computer program.

[0137] Among them, the processor 111 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the processor 111 may also be a controller, a microcontroller, a microprocessor or other data processing chip. The processor 111 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 111 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 111 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 111 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0138] The memory 110 may include one or more computer-readable storage media, which may be non-transitory. The memory 110 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the memory 110 may be an internal storage unit of an electronic device, such as a hard disk of a server. In other embodiments, the memory 110 may also be an external storage device of an electronic device, such as a plug-in hard disk equipped on a server, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Further, the memory 110 may also include both an internal storage unit of an electronic device and an external storage device. The memory 110 may not only be used to store application software and various types of data installed in the electronic device, such as: the code of the program for executing the vulnerability processing method, etc., but also be used to temporarily store data that has been output or is to be output. In this embodiment, the memory 110 is at least used to store the following computer program 1101, wherein, after the computer program is loaded and executed by the processor 111, the relevant steps of the image rotation method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 110 may also include an operating system 1102 and data 1103, and the storage method may be temporary storage or permanent storage. The operating system 1102 may include Windows, Unix, Linux, etc. The data 1103 may include but is not limited to data corresponding to the image rotation result.

[0139] In some embodiments, the electronic device may further include a display screen 112, an input / output interface 113, a communication interface 114 or a network interface, a power supply 115 and a communication bus 116. Among them, the display screen 112 and the input / output interface 113, such as a keyboard, belong to the user interface, and the optional user interface may also include a standard wired interface, a wireless interface, etc. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device, etc. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface. The communication interface 114 may optionally include a wired interface and / or a wireless interface, such as a WI-FI interface, a Bluetooth interface, etc., which is usually used to establish a communication connection between the electronic device and other electronic devices. The communication bus 116 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0140] Those skilled in the art will understand that Fig.11 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, for example, it may also include a sensor 117 to implement various functions.

[0141] The functions of the functional modules of the electronic device described in the embodiment of the present invention can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.

[0142] It can be seen from the above that the embodiments of the present invention can meet the user's processing requirements for rotating images according to different application scenarios.

[0143] It is understandable that if the image rotation method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, removable disk, CD-ROM, disk or optical disk, etc. Various media that can store program codes.

[0144] Based on this, an embodiment of the present invention further provides a readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the image rotation method described in any of the above embodiments are performed.

[0145] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the hardware disclosed in the embodiments, including devices and electronic devices, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part.

[0146] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0147] The above is a detailed introduction to an image rotation method, device, electronic device and readable storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. An image rotation method, characterized in that: include: Obtaining the image to be rotated, image segmentation parameters and image three-dimensional rotation parameters; Based on the image to be rotated, generating an image to be processed having a front side and a back side; Segment the image to be processed according to the image segmentation parameters to obtain a plurality of sub-images to be rotated; Determine the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image three-dimensional rotation parameters; For each sub-image to be rotated, a separate three-dimensional rotation process is performed according to the three-dimensional rotation parameters of the image and the corresponding three-dimensional image coordinates; The three-dimensional image rotation parameters include an image rotation direction and a rotation duration, and determining the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the three-dimensional image rotation parameters includes: Calculating the initial front graphic coordinates of each sub-image to be rotated according to the image segmentation parameters and the scene graph parameters; Calculate the coordinates of the rotation center axis of each sub-image to be rotated according to the image rotation direction and the coordinates of each initial front image; According to each initial front graphic coordinate, calculate the front texture coordinate of the corresponding sub-image to be rotated in the scene after rotation; For each sub-image to be rotated, according to the initial front graphic coordinates and the corresponding front texture coordinates of the sub-image to be rotated, the initial back graphic coordinates and the back texture coordinates of the sub-image to be rotated are calculated; According to the rotation duration, the time point of drawing each frame of the picture during the three-dimensional rotation process, the rotation central axis coordinates of each sub-image to be rotated and the three-dimensional coordinates of the image points, the three-dimensional image coordinates of each frame of the picture during the three-dimensional rotation process of each sub-image to be rotated are cyclically calculated.

2. The image rotation method according to claim 1, characterized in that: The three-dimensional image rotation parameters include a rotation duration, and the performing of a separate three-dimensional rotation process according to the three-dimensional image rotation parameters and corresponding three-dimensional image coordinates includes: According to the three-dimensional image coordinates of each frame of the current sub-image to be rotated during the three-dimensional rotation process, a three-dimensional application program interface is called to draw the corresponding frame image until the rotation duration ends.

3. The image rotation method according to claim 2, characterized in that: The application scenario of the image to be rotated is an animation transition scenario. After performing a separate three-dimensional rotation process on each sub-image to be rotated according to the three-dimensional rotation parameters of the image and the corresponding three-dimensional image coordinates, the method further includes: According to each frame image of each sub-image to be rotated within the rotation duration, a scene transition animation of the image to be rotated is generated.

4. The image rotation method according to claim 1, characterized in that: The step of calculating the initial front graphic coordinates of each sub-image to be rotated according to the image segmentation parameters and the scene graph parameters includes: Calculate the coordinate information of the target point in the application scene graph of the image to be rotated according to the scene graph parameters; Calculating the width and height of each sub-image to be rotated according to the image segmentation parameters; The three-dimensional coordinate information of each vertex of the corresponding sub-image to be rotated is determined according to the coordinate information, the width and the height of each sub-image to be rotated, so as to serve as the initial front graphic coordinates of each sub-image to be rotated.

5. The image rotation method according to claim 1, characterized in that: The step of calculating the rotation center axis coordinates of each sub-image to be rotated according to the image rotation direction and the coordinates of each initial front image includes: For each sub-image to be rotated, the three-dimensional coordinates of the horizontal rotation center axis and the vertical rotation center axis of the sub-image to be rotated are determined according to the image rotation direction and the three-dimensional coordinate information of multiple target points of the sub-image to be rotated.

6. The image rotation method according to claim 1, characterized in that: The step of calculating the front texture coordinates of the corresponding sub-image to be rotated in the rotated scene according to each initial front graphic coordinate includes: Based on the fact that the texture of each sub-image to be rotated is a square formed by a first point, a second point, a third point and a fourth point, the two-dimensional front texture coordinates of the corresponding sub-image to be rotated are determined according to the scene graph parameters and the three-dimensional coordinate information of the target point of each sub-image to be rotated.

7. The image rotation method according to claim 1, characterized in that: The step of calculating the initial backside graphic coordinates and backside texture coordinates of the sub-image to be rotated according to the initial front side graphic coordinates and the corresponding front side texture coordinates of the sub-image to be rotated currently includes: For each sub-image to be rotated, based on the image rotation direction and the front texture coordinates of multiple target points of the current sub-image to be rotated, determine the back texture coordinates of each target point on the back of the current sub-image to be rotated when the current sub-image to be rotated is rotated horizontally and vertically.

8. The image rotation method according to claim 1, characterized in that: The method of cyclically calculating the three-dimensional image coordinates of each frame of the sub-image to be rotated during the three-dimensional rotation process according to the rotation duration, the time point at which each frame of the image is drawn during the three-dimensional rotation process, the rotation central axis coordinates of each sub-image to be rotated, and the three-dimensional coordinates of the image points includes: Calculate the rotation angle at a first moment according to the rotation start time and the rotation duration; For each sub-image to be rotated, the three-dimensional coordinates of the target image point of the current sub-image to be rotated, the corresponding rotation axis coordinates and the rotation angle are calculated to rotate the target image point to the first moment in the horizontal and vertical directions.

9. An image rotation device, characterized in that: include: An information acquisition module is used to acquire the image to be rotated, image segmentation parameters and image three-dimensional rotation parameters; An image synthesis module, used for generating an image to be processed having a front side and a back side based on the image to be rotated; An image segmentation module, used for segmenting the image to be processed according to the image segmentation parameters to obtain a plurality of sub-images to be rotated; A coordinate calculation module, used to determine the three-dimensional image coordinates of each frame of each sub-image to be rotated during the three-dimensional rotation process according to the image segmentation parameters, the scene graph parameters of the application scene of the image to be rotated, and the image three-dimensional rotation parameters; An image rotation module, used for performing a separate three-dimensional rotation process on each sub-image to be rotated according to the three-dimensional rotation parameters of the image and the corresponding three-dimensional image coordinates; Wherein, the coordinate calculation module is further used for: When the three-dimensional image rotation parameters include the image rotation direction and the rotation duration, the initial front graphic coordinates of each sub-image to be rotated are calculated according to the image segmentation parameters and the scene graph parameters; Calculate the coordinates of the rotation center axis of each sub-image to be rotated according to the image rotation direction and the coordinates of each initial front image; According to each initial front graphic coordinate, calculate the front texture coordinate of the corresponding sub-image to be rotated in the scene after rotation; For each sub-image to be rotated, according to the initial front graphic coordinates and the corresponding front texture coordinates of the sub-image to be rotated, the initial back graphic coordinates and the back texture coordinates of the sub-image to be rotated are calculated; According to the rotation duration, the time point of drawing each frame of the picture during the three-dimensional rotation process, the rotation central axis coordinates of each sub-image to be rotated and the three-dimensional coordinates of the image points, the three-dimensional image coordinates of each frame of the picture during the three-dimensional rotation process of each sub-image to be rotated are cyclically calculated.

10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the processor is used to implement the steps of the image rotation method according to any one of claims 1 to 8 when executing a computer program stored in the memory.

11. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image rotation method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Camera lens optical axis calibration method and apparatus

    CN108257183A

  • Image processing method and device, electronic equipment and storage medium

    CN111754521A