Method, apparatus, computer device, and storage medium for animating an image
By constructing a pixel point offset data set and obtaining offset data in the image frame, the slow response speed problem caused by real-time calculation in the prior art is solved, and the effects of fast response and memory saving are achieved.
Patent Information
- Application Number
- CN202010798019.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-10
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2040-08-10
AI Technical Summary
The existing image animation display method leads to a large amount of calculation data through real-time calculation, which affects the response speed.
By pre-constructing the pixel point offset data set corresponding to the animation type, the offset data of the pixel points in the image in each image frame is obtained, complex real-time calculations are avoided, and the position relationship between the pixel points and the animation frame is directly determined.
The processing speed of animation continuous image frames is improved, and the rapid response to the response image display operation is achieved, reducing memory space usage.
Smart Images

Figure CN114092607B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technologies, and particularly to an image animation display method, apparatus, computer device, and storage medium. Background Art
[0002] With the development of terminal technologies, there have emerged more and more personalized image display methods, and image animation display is one of them. The display of animation is essentially a process of continuously playing multiple images.
[0003] Since each frame of the multiple frames of pictures for animation display has a large number of pixel points, the method of directly storing pictures requires a large amount of memory space. To reduce the memory occupation, a method of obtaining multiple frames of images required for animation by performing real-time calculation on the image is proposed to achieve the animation display of the image.
[0004] However, the existing method of performing real-time calculation on images has a large amount of calculation data, which affects the response speed of image animation display. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide an image animation display method, apparatus, computer device, and storage medium that can improve the response speed of animation display.
[0006] An image animation display method, the method includes:
[0007] Respond to an image display operation, and determine an image and an animation type associated with the image display operation;
[0008] Based on a pixel point offset data set corresponding to the animation type, obtain offset data of pixel points in the image in an image frame, where the image frame refers to any image frame of the animation corresponding to the animation type;
[0009] Process the pixel points in the image according to the offset data to obtain consecutive image frames of the animation corresponding to the image;
[0010] Play the consecutive image frames to display the animation of the image.
[0011] In one embodiment, before responding to an image display operation and determining an image and an animation type associated with the image display operation, it further includes:
[0012] Obtain a configured source image, and obtain consecutive image frames of the animation corresponding to the source image, where the consecutive image frames use a reference point in the source image as the offset center point;
[0013] According to the offset center point, determine the positions of pixel points in the source image in the image frame;
[0014] Obtain the offset data of the pixel according to the distance difference between the position of the pixel in the source image and the position of the pixel in the image frame;
[0015] Construct a pixel offset data set corresponding to the animation type according to the animation type of the animation and the offset data;
[0016] In one embodiment, the animation type includes an image restoration animation;
[0017] Based on the pixel offset data set corresponding to the animation type, obtaining the offset data of the pixel in the image in the image frame includes:
[0018] Determine the pixel offset data set corresponding to the image restoration animation, and the pixel offset data set contains multiple non-zero offset data and one zero offset data;
[0019] Find the offset identifier associated with the pixel offset data set;
[0020] When the offset identifier is the initial identifier, find the offset data associated with the image frame from the pixel offset data set, and when the found offset data is zero, update the initial identifier to the updated identifier;
[0021] When the offset identifier is the updated identifier, determine that the offset data of the pixel in the image frame is zero.
[0022] In one embodiment, based on the pixel offset data set corresponding to the animation type, obtaining the offset data of the pixel in the image in the image frame includes:
[0023] Obtain the serial number of the image frame and the recorded value corresponding to the pixel in the image, and the recorded value represents the number of non-zero offset data or the number of zero offset data in the offset data of the pixel;
[0024] According to the numerical size relationship between the recorded value and the serial number, determine whether the offset data of the pixel in the image frame is zero and determine the storage position of the non-zero offset data in the pixel offset data set;
[0025] According to the storage position, find the non-zero offset data corresponding to the image frame from the pixel offset data set.
[0026] In one embodiment, the animation type is an image deformation animation;
[0027] According to the numerical size relationship between the recorded value and the serial number, determining whether the offset data of the pixel in the image frame is zero and determining the storage position of the non-zero offset data in the pixel offset data set includes:
[0028] When the serial number of the image frame is not greater than the recorded value, determine that the offset data of the pixel in the image frame is zero;
[0029] When the number of image frame serial numbers is greater than the recorded value, it is determined that the offset data of the pixel point in the image frame is non-zero offset data;
[0030] According to the difference between the serial number and the recorded value, determine the storage position of the non-zero offset data in the pixel point offset dataset.
[0031] In one embodiment, the animation type is an image restoration animation;
[0032] According to the numerical size relationship between the recorded value and the serial number, determining whether the offset data of the pixel point in the image frame is zero and determining the storage position of the non-zero offset data in the pixel point offset dataset includes:
[0033] When the serial number of the image frame is not greater than the recorded value, the offset data of the pixel point in the image frame is non-zero offset data;
[0034] According to the serial number of the image frame, determine the storage position of the non-zero offset data in the pixel point offset dataset;
[0035] When the serial number of the image frame is greater than the recorded value, the offset data of the pixel point in the image frame is zero.
[0036] In one embodiment, the animation type is a splicing animation including an image deformation animation and an image restoration animation;
[0037] Processing the pixel points in the image according to the offset data to obtain consecutive image frames of the corresponding animation of the image includes:
[0038] Processing the pixel points in the image according to the offset data obtained from the pixel point offset dataset corresponding to the image deformation animation to obtain the first consecutive image frames of the corresponding image deformation animation of the image;
[0039] Processing the pixel points in the image according to the offset data obtained from the pixel point offset dataset corresponding to the image restoration animation to obtain the second consecutive image frames of the corresponding image restoration animation of the image;
[0040] Obtain the splicing order of the splicing animation, and splice the first consecutive image frames and the second consecutive image frames according to the splicing order to obtain the consecutive image frames of the corresponding splicing animation of the image.
[0041] An animation display device for an image, the device includes:
[0042] An operation response module, configured to respond to an image display operation and determine an image and an animation type associated with the image display operation;
[0043] An offset data acquisition module, configured to acquire offset data of pixel points in an image within an image frame based on a pixel point offset data set corresponding to an animation type, where the image frame refers to any image frame of the animation corresponding to the animation type;
[0044] An offset processing module, configured to process the pixel points in the image according to the offset data to obtain consecutive image frames of the animation corresponding to the image;
[0045] An animation display module, configured to play the consecutive image frames to display the animation of the image.
[0046] A computer device, comprising a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0047] Respond to an image display operation, and determine an image and an animation type associated with the image display operation;
[0048] Based on a pixel point offset data set corresponding to the animation type, acquire offset data of pixel points in the image within an image frame, where the image frame refers to any image frame of the animation corresponding to the animation type;
[0049] Process the pixel points in the image according to the offset data to obtain consecutive image frames of the animation corresponding to the image;
[0050] Play the consecutive image frames to display the animation of the image.
[0051] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0052] Respond to an image display operation, and determine an image and an animation type associated with the image display operation;
[0053] Based on a pixel point offset data set corresponding to the animation type, acquire offset data of pixel points in the image within an image frame, where the image frame refers to any image frame of the animation corresponding to the animation type;
[0054] Process the pixel points in the image according to the offset data to obtain consecutive image frames of the animation corresponding to the image;
[0055] Play the consecutive image frames to display the animation of the image.
[0056] The method, device, computer device, and storage medium for animating the above-mentioned image can quickly obtain the offset data of each pixel point in each image frame of the animation corresponding to the animation type by looking up the offset data set of pixel points corresponding to the pre-constructed animation type for each pixel point in the image. Based on the offset data, the positional relationship between the pixel points in the image and the pixel points in the image frames of the animation can be directly determined, facilitating the rapid acquisition of pixel point data, avoiding complex real-time calculations, thereby improving the processing speed of consecutive image frames of the animation and enabling a rapid response to the operation of displaying the response image. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 It is an application environment diagram of the method for animating an image in an embodiment;
[0058] Figure 2 It is a schematic flowchart of the method for animating an image in an embodiment;
[0059] Figure 3 It is a schematic flowchart of the method for animating an image in another embodiment;
[0060] Figure 4 It is a schematic flowchart of the method for animating an image in still another embodiment;
[0061] Figure 5 It is a schematic flowchart of the method for animating an image in yet another embodiment;
[0062] Figure 6 It is a schematic flowchart of the method for animating an image in another embodiment;
[0063] Figure 7 It is a schematic diagram of the effect of the image restoration animation of the method for animating an image in an embodiment;
[0064] Figure 8 It is a block diagram of the structure of the device for animating an image in an embodiment;
[0065] Figure 9 It is an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0066] In order to make the objectives, technical solutions, and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0067] In one embodiment, a method for animating an image is provided. In this embodiment, it is assumed that the method is applied to Figure 1Taking the terminal in [0] as an example, it can be understood that this method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. As Figure 2 shown, in this embodiment, the method includes the following steps 202 to step 208.
[0068] Step 202, in response to an image display operation, determine an image and an animation type associated with the image display operation.
[0069] The image display operation refers to a preset trigger operation performed by the user on the terminal for displaying a preset image, and the terminal displays a preset animation effect of the preset image by responding to this operation. In one embodiment, the preset image may be the background image of the terminal desktop, and the image display operation may be an operation for the user to unlock the mobile phone desktop and enter the desktop, such as fingerprint unlocking, face recognition unlocking, and password unlocking of the terminal. The image display operation may also be a scene switching operation when switching from a non-desktop interface such as an application interface or a web interface to the desktop. For example, an operation of clicking the "home" button of the mobile phone or clicking the one-key return button to return to the desktop. For another example, the image display operation may also be an operation for the terminal to power on and display the desktop, etc.
[0070] The image associated with the image display operation refers to a preset image that is pre-configured and needs to be displayed with a preset animation effect in response to the image display operation, and the animation type of this preset animation effect is the animation type associated with the image display operation. In the embodiment, the corresponding information of the image and the animation type can be obtained from the response configuration data of the image display operation, so as to determine the image and the animation type associated with the image display operation.
[0071] The preset animation effect may be a single animation effect such as an image deformation animation or an image restoration animation of the image, or may also be a combined animation effect combined by multiple image deformation animations and image restoration animations. For example, first display the image restoration animation of the image and then display the image deformation animation of the image, etc.
[0072] Among them, the animation effect of the image deformation animation may be an animation effect presented by playing a continuous image composed of the original image and multiple deformed images corresponding to the original image. The deformed image of the original image may specifically be an image obtained by deforming the original image in a way such as magnifying it proportionally, rotating it, or magnifying it with a fisheye effect or other distortions. Among them, the original image refers to an image that has not been deformed. Among the multiple deformed images of the image deformation animation, the degree of deformation gradually increases, that is, the offset amount corresponding to the offset data of the pixel points in the continuous image frames shows an increasing trend.
[0073] The animation effect of the image restoration animation can be based on a series of deformed images corresponding to the original image of the image and the original image, and the animation effect presented by playing this series of consecutive images. Among them, the degree of deformation of the multiple deformed images gradually decreases, that is, the offset amount corresponding to the offset data of the pixel points in the consecutive image frames shows a decreasing trend.
[0074] The essence of the processing of the image deformation animation and the image restoration animation for the image is actually the deformation of the image. The difference is that the image restoration animation first shows the image frame with the largest degree of deformation and finally shows the image, while the image deformation animation first shows the image and finally shows the image frame with the largest degree of deformation.
[0075] Step 204: Obtain the offset data of the pixel points in the image in the image frame based on the pixel point offset data set corresponding to the animation type.
[0076] An image frame refers to any image frame of the animation corresponding to the animation type.
[0077] The pixel point offset data set refers to a data set used to record the position changes of the pixel points at each position in the image in each image frame of the animation. Since in different animation types, the position change rules of the same pixel point in consecutive multiple image frames are different, it is necessary to construct the corresponding pixel point offset data set for different animation types.
[0078] The offset data of the pixel point refers to the coordinate offset of the coordinate position of the same pixel point in the image compared to its coordinate position in any image frame of the animation. In the pixel point offset data set, the coordinate offsets of the pixel points at each coordinate position in the image in any image frame shown in the animation are recorded, that is, the offset data of the pixel points in any image frame of the animation.
[0079] After determining the image associated with the image display operation and the pixel point offset data set corresponding to the animation type, the offset data of each pixel point in the image in each image frame can be obtained from the pixel point offset data set, so as to determine the corresponding position of the pixel point in each image frame, and then the image can be processed based on the offset data to obtain each image frame required for the animation display.
[0080] The number of pixels in an image is very large. Therefore, the coordinate information corresponding to the coordinate position of each pixel is also complex. The offset data is the distance difference between pixels at two different coordinate positions, and the information is relatively simple. When it is necessary to move the data of pixels at two different coordinate positions, there are two ways to achieve this. The first is to separately determine the coordinate positions of the two pixels and implement data movement based on the conversion of the coordinate positions. The second is to determine the coordinate position of one of the pixels and the coordinate offset between the two pixels, and implement data movement through the coordinate offset. Both of these methods can achieve data movement between coordinates. However, when storing information, the coordinate information needs to be implemented through int or float, which requires at least 4 bytes of memory space, while the offset value can record information through char, only requiring 1 byte of memory space. Therefore, by recording the offset data, compared with directly recording the coordinate information of pixels, the memory space occupation can be greatly reduced.
[0081] Step 206: Process the pixels in the image according to the offset data to obtain consecutive image frames of the animation corresponding to the image.
[0082] In the embodiment, according to the set time of the animation display, first determine the total number of frames required for displaying the animation and the serial number of each image frame. For example, when the display time of an animation is set to 450 ms, taking the playback speed of 60 frames per second as an example, the number of consecutive image frames required for this animation display is 27 frames.
[0083] Processing the pixels in the image can obtain each image frame in the consecutive image frames.
[0084] In one embodiment, processing the pixels in the image can be to offset the pixel data of the pixels in the image according to the offset data to obtain an image frame, and its essence is the offset of the display position of the pixel data corresponding to the pixel. The pixel data includes information such as RGB values and grayscale values.
[0085] In another embodiment, processing the pixels in the image can also be to first obtain a blank image frame to be filled with pixel data, determine the positional relationship between the pixels of the blank image frame and the pixels in the image based on the offset data, and then perform data capture and filling processing on the pixel data of the pixels in the image to obtain an image frame. Its essence is to perform pixel data capture and filling on an image frame originally without pixel data based on the pixel data and offset data of the image.
[0086] Step 208: Play the consecutive image frames to display the animation of the image.
[0087] In an embodiment, each image frame of the image corresponding to the animation is continuous. Specifically, in the process of processing each image frame in sequence, each processed image frame is played and displayed as soon as it is obtained, and multiple image frames are played within a set time, presenting the animation display corresponding to the image visually.
[0088] The above method for animating an image can quickly obtain the offset data of each pixel point in each image frame by looking up the offset data of the pixel points in the image in each image frame of the animation corresponding to the animation type based on the pre-constructed pixel point offset data set corresponding to the animation type. Based on the offset data, the positional relationship between the pixel points in the image and the pixel points in the image frames of the animation can be directly determined, facilitating the rapid acquisition of pixel point data, avoiding complex real-time calculations, thereby improving the processing speed of consecutive image frames of the animation and enabling a rapid response to the operation of displaying the response image.
[0089] In one embodiment, as Figure 3 shown, before determining the image and animation type associated with the image display operation, that is, before step 202, steps 302 to 308 are further included.
[0090] Step 302: Obtain the configured source image and obtain the continuous image frames of the animation corresponding to the source image. The continuous image frames use the reference point in the source image as the offset center point.
[0091] Step 304: Determine the position of the pixel points in the source image in the image frame according to the offset center point.
[0092] Step 306: Obtain the offset data of the pixel points according to the distance difference between the position of the pixel points in the source image and the position of the pixel points in the image frame.
[0093] Step 308: Construct a pixel point offset data set corresponding to the animation type according to the animation type of the animation and the offset data.
[0094] The source image refers to the image used to determine the offset data of pixel points in each image frame during the preprocessing process. The reference point of the source image can be the center position of the image or other custom positions. For example, by performing image type recognition on the configured source image, when the image type is a face image, the center point of the recognized face position is used as the reference point of the source image.
[0095] The position of a pixel point in an image frame can specifically be a coordinate position with the center point of the image or other fixed point as the coordinate origin. The original image and each image frame have the same coordinate system. By calculating the distance difference between the position of the pixel point in the source image and the position of the pixel point in the image frame, that is, calculating the coordinate difference between the coordinate positions of the pixel point in two different images, the offset data of the pixel point can be obtained. By calculating the offset data between two pixel points, compared with the way of directly storing the information of the coordinate position, since the value of the offset data is smaller, the occupancy of the memory space can be reduced.
[0096] Specifically, the offset data can include the offset data in the horizontal coordinate direction and the offset data in the vertical coordinate direction. Based on the offset data in the two coordinate directions, the position relationship between the two coordinate positions can be obtained.
[0097] In one embodiment, the animation type includes an image restoration animation. As Figure 4 shown, based on the pixel point offset data set corresponding to the animation type, the offset data of the pixel points in the image in the image frame is obtained, that is, step 204 includes steps 402 to 410.
[0098] Step 402, determine the pixel point offset data set corresponding to the image restoration animation. The pixel point offset data set contains multiple non-zero offset data and one zero offset data.
[0099] Step 404, search for the offset identifier associated with the pixel point offset data set.
[0100] Step 406, when the offset identifier is the initial identifier, search for the offset data associated with the image frame from the pixel point offset data set.
[0101] Step 408, when the found offset data is zero, update the initial identifier to the updated identifier.
[0102] Step 410, when the offset identifier is the updated identifier, determine that the offset data of the pixel point in the image frame is zero.
[0103] For the pixel points corresponding to the image in the image restoration animation, the offset amount corresponding to the offset data in the consecutive image frames of the image restoration animation shows a decreasing trend. In the order of the consecutive image frames of the image restoration animation, the absolute value of the offset data of its pixel points changes from large to small and finally becomes zero.
[0104] In one embodiment, the construction process of the pixel offset data set corresponding to the image restoration animation includes: after obtaining the offset data of the pixel, sequentially record the offset data corresponding to the pixel until the first offset data with a value of zero is recorded, construct the pixel offset data set corresponding to the image restoration animation, and initialize the offset identifier corresponding to the pixel offset data set to obtain the initial identifier.
[0105] According to the changing trend of the offset amount corresponding to the offset data, the offset data with a value of zero appears continuously. To reduce the memory space occupied by recording the offset data, only the first offset data with a value of zero is recorded.
[0106] The offset identifier refers to an identifier used to characterize whether the offset data is zero. The offset identifier includes two states: the initial identifier and the updated identifier. For each image frame, first look up the offset identifier table to determine whether there is an offset between the pixels in the image frame and the pixels in the image. Specifically, the number of offset identifiers recorded in the offset identifier table is the same as the number of pixels in the image, and each offset identifier corresponds to a pixel, which is used to characterize whether the pixel in the image has an offset in the image frame.
[0107] For each pixel, first look up the offset identifier, and then look up the offset data based on the state of the offset identifier. The deformation degree of the first image frame of the image restoration animation is the largest, so the absolute value of the offset data of the pixel is also the largest, which is non-zero offset data. Correspondingly, the offset identifier corresponding to the first offset data is also the initialized offset identifier, that is, the initial identifier, which is used to characterize that the corresponding offset data is non-zero offset data. After looking up the offset identifier, if the offset identifier corresponding to the pixel is the initial identifier, then look up the offset data associated with the image frame from the pixel offset data set. For example, for the first image frame, look up the first offset data recorded in the pixel offset data set, and so on. When the offset data corresponding to a certain image frame found from the pixel offset data set is zero, update the offset identifier corresponding to the pixel in the offset identifier table to obtain the updated identifier. When processing the next image frame corresponding to the pixel, if the offset identifier obtained by looking up the offset identifier table is the updated identifier, it is defaulted that the offset data of the pixel in the image frame is zero, and there is no need to look up the pixel offset data set, and the offset data does not need to be recorded in the pixel offset data set either. Therefore, the memory space occupied by recording the offset data is saved.
[0108] In one embodiment, as Figure 5 shown, based on the pixel offset data set corresponding to the animation type, obtaining the offset data of the pixels in the image in the image frame, step 204 includes steps 502 to 506.
[0109] Step 502: Obtain the sequence number of the image frame and the recorded value corresponding to the pixel point in the image.
[0110] Step 504: Determine whether the offset data of the pixel point in the image frame is zero according to the numerical size relationship between the recorded value and the sequence number, and determine the storage position of the non-zero offset data in the pixel point offset data set.
[0111] Step 506: Look up the non-zero offset data corresponding to the image frame from the pixel point offset data set according to the storage position.
[0112] The animation includes a series of consecutive image frames, and each image frame has a corresponding sequence number. For example, if an animation includes 27 image frames, the sequence numbers of the image frames are from 0 to 26.
[0113] The recorded value represents the number of non-zero offset data or the number of zero offset data in the offset data of the pixel point. Since the total number of offset data is not greater than the total number of image frames of the animation, the recorded value is not greater than the total number of image frames.
[0114] Specifically, if the animation type is an image deformation animation, the recorded value is the number of zero offset data. If the animation type is an image restoration animation, the recorded value is the number of non-zero offset data.
[0115] It should be noted that when the offset data of the pixel point records a corresponding recorded value, the data recorded in the pixel point offset data set only includes each non-zero offset data and does not record the zero offset data, so as to reduce the occupation of memory space.
[0116] The following takes the animation type as an image deformation animation and the animation type as an image restoration animation as examples to detail the steps of determining whether the offset data of the pixel point in the image frame is zero according to the numerical size relationship between the recorded value and the sequence number, and determining the storage position of the non-zero offset data in the pixel point offset data set.
[0117] First, take the animation type as an image deformation animation as an example. The change trend of the offset amount of the offset data corresponding to the pixel point in the image deformation animation starts from zero, and then the absolute value changes from small to large. The preprocessing of the image deformation animation includes the construction of the pixel point offset data set and the setting of the recorded value.
[0118] After obtaining the offset data of the pixel point, first count the number of zero offset data, set the recorded data of the pixel point, and then sequentially record the non-zero offset data corresponding to the pixel point. According to the recorded non-zero offset data, construct the pixel point offset data set corresponding to the image deformation animation.
[0119] Regarding the step of determining whether the offset data of a pixel point in an image frame is zero based on the numerical size relationship between the recorded value and the sequence number, and determining the storage position of the non-zero offset data in the pixel point offset data set, the specific processing process is as follows: When the image frame sequence number is not greater than the recorded value, it is determined that the offset data of the pixel point in the image frame is zero. When the image frame sequence number is greater than the recorded value, it is determined that the offset data of the pixel point in the image frame is non-zero offset data. According to the difference between the sequence number and the recorded value, the storage position of the non-zero offset data in the pixel point offset data set is determined.
[0120] For example, taking the i-th pixel point in the x direction of an image as an example, for the first frame of the image, its image sequence number is zero (id_frame = 0). First, check the recorded value corresponding to this pixel point. Another example is that if the recorded value is 5, it means that when id_frame < 5, the offset data dx = 0, that is, for the first image frame (id_frame = 0) to the fifth image frame (id_frame = 4), the offset data dx of this pixel point is 0. When it comes to the 6th frame of the image (id_frame = 5), it no longer satisfies id_frame < 5, that is, the deviation data is non-zero deviation data, and it is necessary to find the corresponding deviation data in the pixel point offset data set. By calculating the difference s = id_frame - 5 between the sequence number and the recorded value, the storage position of this non-zero offset data in the pixel point offset data set is determined. If s = 0, the first value is searched; if s = 1, the second value is searched, and so on.
[0121] Then, taking the image restoration animation as an example of the animation type, the changing trend of the offset amount of the offset data corresponding to the pixel points in the image restoration animation is that the absolute value changes from large to small and then becomes zero. The preprocessing of the image restoration animation also includes the construction of the pixel point offset data set and the setting of the recorded value.
[0122] After obtaining the offset data of the pixel point, first record the non-zero offset data corresponding to the pixel point in sequence. When the first offset data with a value of 0 appears, stop recording, and set the recorded value corresponding to the pixel point according to the number of non-zero offset data. Finally, according to the recorded non-zero offset data, construct the pixel point offset data set corresponding to the image restoration animation.
[0123] Regarding the step of determining whether the offset data of a pixel point in an image frame is zero based on the numerical size relationship between the recorded value and the sequence number, and determining the storage position of the non-zero offset data in the pixel point offset data set, the specific processing process is as follows: When the sequence number of the image frame is not greater than the recorded value, the offset data of the pixel point in the image frame is non-zero offset data. According to the sequence number of the image frame, the storage position of the non-zero offset data in the pixel point offset data set is determined. When the sequence number of the image frame is greater than the recorded value, the offset data of the pixel point in the image frame is zero.
[0124] For example, taking the j-th pixel point in the x direction of the image as an example, for the first frame of the image, its image serial number is zero (id_frame = 0). First, check the recorded value corresponding to this pixel point. Another example is that if the recorded value is 8, it means that when id_frame ≥ 8, the offset data dx = 0, that is, when d_frame < 8, the offset data is non-zero. That is, for the first image frame (id_frame = 0) to the eighth image frame (id_frame = 7), the condition id_frame < 8 is satisfied. Therefore, according to the image serial number, determine the storage position s = id_frame of this non-zero offset data in the pixel point offset data set. If s = 0, find the first value. If s = 1, find the second value, and so on. Starting from the 9th image frame (id_frame = 8), id_frame ≥ 8 is satisfied, and the offset data dx = 0.
[0125] By setting the recorded value, the timing of finding the offset data from the pixel point offset data set and the judgment of the offset data being zero are realized. There is no need to record the offset data being zero in the pixel point offset data set, and the recorded value only contains one digit, which occupies less memory. Therefore, the memory space occupied by implementing the offset data record is reduced.
[0126] In one embodiment, the animation type is a spliced animation including an image deformation animation and an image restoration animation. As Figure 6 shown, the pixel points in the image are processed according to the offset data to obtain consecutive image frames of the corresponding animation of the image, that is, step 206 includes steps 602 to 606.
[0127] Step 602, process the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image deformation animation to obtain the first consecutive image frame of the image corresponding to the image deformation animation.
[0128] Step 604, process the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image restoration animation to obtain the second consecutive image frame of the image corresponding to the image restoration animation.
[0129] Step 606, obtain the splicing order of the spliced animation, and splice the first consecutive image frame and the second consecutive image frame according to the splicing order to obtain the consecutive image frames of the image corresponding to the spliced animation.
[0130] For complex animation types, the animation can be split into an image deformation animation and an image restoration animation based on the original image of the image. Based on the splicing order of the splicing animation, the first continuous image frames of the image deformation animation and the second continuous image frames of the image restoration animation are spliced to obtain the continuous image frames of the splicing animation, thus realizing the diversification of the animation effect.
[0131] In one embodiment, after processing the pixel points in the image according to the offset data to obtain the continuous image frames of the animation corresponding to the image, it further includes: when there is an image frame with a resolution greater than the resolution of the image, centering on the reference point of the image, and cropping the image frame according to the resolution of the image; when there is an image frame with a resolution less than the resolution of the image, filling the blank pixel points in the image frame with pixel data according to the preset pixel data.
[0132] It should be understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above flowcharts may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.
[0133] In an application example, as Figure 7 shown, taking the animation display process of gradually restoring (the degree of image distortion gradually decreases) from the fisheye effect background image (the maximum degree of image distortion) at the unlocking moment to the original background image according to the background image set by the user and displaying it on the desktop when responding to the user's unlocking operation as an example, the animation display method of the image is described.
[0134] It should be noted that the preset data such as the pixel point offset data set, offset identifier or record data corresponding to the fisheye effect animation can be data configured at the factory settings of the terminal, which is applicable to the case where the center point of the fisheye effect is fixed. For example, for the subsequent background images set by the user, the center point of the background image is used as the distortion center of the fisheye effect.
[0135] The above preset data can also be data obtained by the terminal processing the background image based on the distortion parameters of the fisheye effect set at the factory of the terminal after the user selects and sets the background image of the desktop, which is adapted to the center point of the background image.
[0136] The terminal responds to the user's unlocking operation and obtains the background image. Taking the search process of the offset data in the x direction of one of the pixel points in the background image as an example, it is assumed that the animation includes 27 frame images, and the offset data of this pixel point are [-5, -4, -3, -2, -1, 0, 0, ……, 0, 0 (a total of 22 "0")].
[0137] The following provides two different search methods.
[0138] The first one is implemented based on a pre-configured pixel point offset data set and an offset identifier.
[0139] Corresponding to the above offset data, the data recorded in the pixel point offset data set are [-5, -4, -3, -2, -1, 0], and the initial value of the offset identifier is 1.
[0140] Process the first frame of the image (id_frame = 0), that is, the image with the largest fisheye effect magnification. First, search for the offset identifier. The found offset identifier is "1". Then, according to the sequence number S = id_frame = 0 of the first frame of the image, search for the first data recorded in the pixel point offset data set, and obtain the offset data dx = -5 in the x direction of this pixel point in the first frame of the image (the positive and negative represent the offset direction). Since the offset data dx = -5 ≠ 0, keep the offset identifier as the initial identifier unchanged. When processing the second frame of the image (id_frame = 1), also search for the offset identifier first. At this time, the offset identifier remains "1" unchanged. When the offset identifier is "1", according to the sequence number S = id_frame = 1 of the second frame of the image, obtain the second data recorded in the pixel point offset data set, and get the offset data dx = -4 in the x direction of this pixel point in the second frame of the image, and so on. When processing the sixth frame of the image, the found offset identifier is "1". According to S = id_frame = 5, obtain the sixth data recorded in the pixel point offset data set, and get the offset data dx = 0 in the x direction of this pixel point in the sixth frame of the image. At this time, the offset identifier needs to be updated from "1" to "0". When processing the seventh frame of the image, the found offset identifier is "0", then there is no need to search from the pixel point offset data set, and directly default that the offset data dx = 0 in the x direction of this pixel point in the seventh frame of the image. From the eighth frame to the 27th frame, the found offset identifier remains "0" unchanged, then the offset data dx = 0 in the x direction of this pixel point in the eighth frame to the 27th frame of the image.
[0141] The second one is implemented based on a pre-configured pixel point offset data set and recorded data.
[0142] Corresponding to the above offset data, the data recorded in the pixel point offset dataset is [-5, -4, -3, -2, -1, 0], and the recorded data is 5, indicating that when id_frame≥5, dx = 0.
[0143] Process the first frame of the image (id_frame = 0). First, search for the recorded data. The recorded data found is "5". The sequence number of the first frame of the image is id_frame = 0, which does not satisfy id_frame≥5. Then, according to the sequence number id_frame = 0, search for the first data recorded in the pixel point offset dataset to obtain the offset data dx = -5 of the pixel point in the x direction in the first frame of the image. When processing the 6th frame (id_frame = 5), since id_frame≥5 is satisfied, there is no need to search in the pixel point offset dataset anymore, and it is directly defaulted that the offset data dx = 0 of the pixel point in the x direction in the 6th frame of the image.
[0144] It can be understood that the search principle for the offset data in the y direction of the pixel point and the offset data of other pixel points is the same.
[0145] By searching for the offset data of each pixel point, the offset position of each pixel point on the background image in each frame of the image can be determined, so as to obtain each frame of the image corresponding to the animation of the background image. After each frame of the image is processed, it is played. When the processing and playing of the last frame of the image are completed, the continuous playing of the image is realized, presenting the animation effect of the background image from the maximum distortion degree of the fisheye effect to the minimum until it returns to the original background image.
[0146] In one embodiment, as Figure 8 shown, an image animation display device is provided, including: an operation response module 802, an offset data acquisition module 804, an offset processing module 806, and an animation display module 808, where:
[0147] The operation response module 802 is configured to respond to an image display operation and determine an image and an animation type associated with the image display operation.
[0148] The offset data acquisition module 804 is configured to obtain the offset data of the pixel points in the image in the image frame based on the pixel point offset dataset corresponding to the animation type, where the image frame refers to any image frame of the animation corresponding to the animation type.
[0149] The offset processing module 806 is configured to process the pixel points in the image according to the offset data to obtain continuous image frames corresponding to the animation of the image.
[0150] The animation display module 808 is configured to play the continuous image frames and display the animation of the image.
[0151] In one embodiment, the animation display device of the image further includes a pixel offset dataset construction module, which is used to obtain the configured source image, obtain consecutive image frames of the animation corresponding to the source image, and the consecutive image frames use the reference point in the source image as the offset center point; determine the positions of the pixel points in the source image in the image frames according to the offset center point; obtain the offset data of the pixel points according to the distance difference between the position of the pixel points in the source image and the position of the pixel points in the image frames; construct a pixel offset dataset corresponding to the animation type according to the animation type and the offset data of the animation.
[0152] In one embodiment, the animation type includes an image restoration animation; the offset data acquisition module is further used to determine a pixel offset dataset corresponding to the image restoration animation. The pixel offset dataset contains multiple non-zero offset data and one zero offset data, and find the offset identifier associated with the pixel offset dataset; when the offset identifier is the initial identifier, find the offset data associated with the image frame from the pixel offset dataset, and when the found offset data is zero, update the initial identifier to the updated identifier; when the offset identifier is the updated identifier, determine that the offset data of the pixel point in the image frame is zero.
[0153] In one embodiment, the offset data acquisition module is further used to obtain the sequence number of the image frame and the recorded value corresponding to the pixel point in the image. The recorded value represents the number of non-zero offset data or the number of zero offset data in the offset data of the pixel point; determine whether the offset data of the pixel point in the image frame is zero according to the numerical size relationship between the recorded value and the sequence number, and determine the storage position of the non-zero offset data in the pixel offset dataset; find the non-zero offset data corresponding to the image frame from the pixel offset dataset according to the storage position.
[0154] In one embodiment, the animation type is an image deformation animation; the offset data acquisition module is further used to determine that the offset data of the pixel point in the image frame is zero when the sequence number of the image frame is not greater than the recorded value; determine that the offset data of the pixel point in the image frame is non-zero offset data when the sequence number of the image frame is greater than the recorded value; determine the storage position of the non-zero offset data in the pixel offset dataset according to the difference between the sequence number and the recorded value.
[0155] In one embodiment, the animation type is an image restoration animation; the offset data acquisition module is further used to determine that the offset data of the pixel point in the image frame is non-zero offset data when the sequence number of the image frame is not greater than the recorded value; determine the storage position of the non-zero offset data in the pixel offset dataset according to the sequence number of the image frame; determine that the offset data of the pixel point in the image frame is zero when the sequence number of the image frame is greater than the recorded value.
[0156] In one embodiment, the animation type is a splicing animation including an image deformation animation and an image restoration animation; the offset processing module is further configured to process the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image deformation animation, so as to obtain the first continuous image frames of the image corresponding to the image deformation animation; process the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image restoration animation, so as to obtain the second continuous image frames of the image corresponding to the image restoration animation; obtain the splicing order of the splicing animation, and splice the first continuous image frames and the second continuous image frames in the splicing order to obtain the continuous image frames of the image corresponding to the splicing animation.
[0157] Based on the pre-constructed pixel point offset data set corresponding to the animation type, the above-mentioned image animation display device can quickly obtain the offset data of the pixel points in each image frame of the animation corresponding to the animation type by searching for the offset data of the pixel points in the image in each image frame of the animation corresponding to the animation type. Based on the offset data, the position relationship between the pixel points in the image and the pixel points in the image frames of the animation can be directly determined, which is convenient for quickly obtaining pixel point data, avoiding complex real-time calculations, thereby improving the processing speed of the continuous image frames of the animation and realizing a fast response to the response image display operation.
[0158] For the specific limitations of the image animation display device, reference can be made to the limitations of the image animation display method in the above text, which will not be elaborated here. Each module in the above-mentioned image animation display device can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0159] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 9As shown in the figure. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a carrier network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it realizes a method for animating the display of an image. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball, or touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0160] Those skilled in the art can understand that Figure 9 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0161] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:
[0162] Respond to an image display operation, determine the image and animation type associated with the image display operation; based on the pixel point offset data set corresponding to the animation type, obtain the offset data of the pixel points in the image in the image frame, where the image frame refers to any image frame of the animation corresponding to the animation type; process the pixel points in the image according to the offset data to obtain consecutive image frames of the animation corresponding to the image; play the consecutive image frames to display the animation of the image.
[0163] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtain the configured source image, and obtain consecutive image frames of the animation corresponding to the source image, with the reference point in the source image as the offset center point; determine the position of the pixel points in the source image in the image frame according to the offset center point; obtain the offset data of the pixel points according to the distance difference between the position of the pixel points in the source image and the position of the pixel points in the image frame; construct a pixel point offset data set corresponding to the animation type according to the animation type and offset data of the animation.
[0164] In one embodiment, the animation type includes an image restoration animation; when the processor executes the computer program, the following steps are further implemented: determining a pixel offset data set corresponding to the image restoration animation, where the pixel offset data set includes multiple non-zero offset data and one zero offset data; looking up an offset identifier associated with the pixel offset data set; when the offset identifier is an initial identifier, looking up the offset data associated with the image frame from the pixel offset data set, and when the found offset data is zero, updating the initial identifier to an updated identifier; when the offset identifier is an updated identifier, determining that the offset data of the pixel in the image frame is zero.
[0165] In one embodiment, when the processor executes the computer program, the following steps are further implemented: obtaining the sequence number of the image frame and the recorded value corresponding to the pixel in the image, where the recorded value represents the number of non-zero offset data or the number of zero offset data in the offset data of the pixel; determining whether the offset data of the pixel in the image frame is zero based on the numerical size relationship between the recorded value and the sequence number, and determining the storage position of the non-zero offset data in the pixel offset data set; looking up the non-zero offset data corresponding to the image frame from the pixel offset data set according to the storage position.
[0166] In one embodiment, the animation type is an image deformation animation; when the processor executes the computer program, the following steps are further implemented: when the sequence number of the image frame is not greater than the recorded value, determining that the offset data of the pixel in the image frame is zero; when the sequence number of the image frame is greater than the recorded value, determining that the offset data of the pixel in the image frame is non-zero offset data; determining the storage position of the non-zero offset data in the pixel offset data set according to the difference between the sequence number and the recorded value.
[0167] In one embodiment, the animation type is an image restoration animation; when the processor executes the computer program, the following steps are further implemented: when the sequence number of the image frame is not greater than the recorded value, the offset data of the pixel in the image frame is non-zero offset data; determining the storage position of the non-zero offset data in the pixel offset data set according to the sequence number of the image frame; when the sequence number of the image frame is greater than the recorded value, the offset data of the pixel in the image frame is zero.
[0168] In one embodiment, the animation type is a spliced animation including an image deformation animation and an image restoration animation; when the processor executes the computer program, the following steps are further implemented:
[0169] Process the pixel points in the image according to the offset data obtained from the pixel point offset dataset corresponding to the image deformation animation, and obtain the first continuous image frame of the image corresponding to the image deformation animation; process the pixel points in the image according to the offset data obtained from the pixel point offset dataset corresponding to the image restoration animation, and obtain the second continuous image frame of the image corresponding to the image restoration animation; obtain the splicing order of the splicing animation, and splice the first continuous image frame and the second continuous image frame according to the splicing order to obtain the continuous image frame of the image corresponding to the splicing animation.
[0170] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0171] Respond to an image display operation, and determine the image and animation type associated with the image display operation; based on the pixel point offset dataset corresponding to the animation type, obtain the offset data of the pixel points in the image in the image frame, where the image frame refers to any image frame of the animation corresponding to the animation type; process the pixel points in the image according to the offset data to obtain the continuous image frame of the image corresponding to the animation; play the continuous image frame to display the animation of the image.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: obtain the configured source image, and obtain the continuous image frame of the animation corresponding to the source image, where the continuous image frame uses the reference point in the source image as the offset center point; according to the offset center point, determine the position of the pixel points in the source image in the image frame; according to the distance difference between the position of the pixel points in the source image and the position of the pixel points in the image frame, obtain the offset data of the pixel points; according to the animation type and offset data of the animation, construct the pixel point offset dataset corresponding to the animation type.
[0173] In one of the embodiments, the animation type includes an image restoration animation; when the computer program is executed by a processor, the following steps are further implemented: determine the pixel point offset dataset corresponding to the image restoration animation, where the pixel point offset dataset contains multiple non-zero offset data and one zero offset data; find the offset identifier associated with the pixel point offset dataset; when the offset identifier is the initial identifier, find the offset data associated with the image frame from the pixel point offset dataset, and when the found offset data is zero, update the initial identifier to the update identifier; when the offset identifier is the update identifier, determine that the offset data of the pixel points in the image frame is zero.
[0174] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: obtaining the serial number of an image frame and the recorded value corresponding to a pixel point in the image, where the recorded value represents the number of non-zero offset data or the number of zero offset data in the offset data of the pixel point; determining whether the offset data of the pixel point in the image frame is zero and determining the storage position of the non-zero offset data in the pixel point offset data set according to the numerical size relationship between the recorded value and the serial number; and finding the non-zero offset data corresponding to the image frame from the pixel point offset data set according to the storage position.
[0175] In one of the embodiments, the animation type is an image deformation animation; when the computer program is executed by a processor, the following steps are further implemented: when the serial number of the image frame is not greater than the recorded value, determining that the offset data of the pixel point in the image frame is zero; when the serial number of the image frame is greater than the recorded value, determining that the offset data of the pixel point in the image frame is non-zero offset data; and determining the storage position of the non-zero offset data in the pixel point offset data set according to the difference between the serial number and the recorded value.
[0176] In one of the embodiments, the animation type is an image restoration animation; when the computer program is executed by a processor, the following steps are further implemented: when the serial number of the image frame is not greater than the recorded value, the offset data of the pixel point in the image frame is non-zero offset data; determining the storage position of the non-zero offset data in the pixel point offset data set according to the serial number of the image frame; and when the serial number of the image frame is greater than the recorded value, the offset data of the pixel point in the image frame is zero.
[0177] In one of the embodiments, the animation type is a splicing animation including an image deformation animation and an image restoration animation; when the computer program is executed by a processor, the following steps are further implemented:
[0178] Processing the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image deformation animation to obtain the first continuous image frame of the image corresponding to the image deformation animation; processing the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image restoration animation to obtain the second continuous image frame of the image corresponding to the image restoration animation; obtaining the splicing order of the splicing animation, and splicing the first continuous image frame and the second continuous image frame in the splicing order to obtain the continuous image frame of the image corresponding to the splicing animation.
[0179] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0180] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0181] The above embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for animating an image, characterized in that, The method includes: In response to an image display operation, determining an image and an animation type associated with the image display operation; Based on a pixel offset data set corresponding to the animation type, obtaining offset data of pixel points in the image in an image frame, where the image frame refers to any image frame of the animation corresponding to the animation type; the pixel offset data set refers to a data set used to record the position change of each pixel point in the image in each image frame of the animation; the offset data of the pixel point refers to the coordinate offset of the same pixel point in the coordinate position in the image compared to the coordinate position in any image frame of the animation; Processing the pixel points in the image according to the offset data to obtain consecutive image frames of the animation corresponding to the image; Playing the consecutive image frames to display the animation of the image.
2. The method according to claim 1, wherein Before the step of, in response to an image display operation, determining an image and an animation type associated with the image display operation, it further includes: Obtaining a configured source image, and obtaining consecutive image frames of the animation corresponding to the source image, where the consecutive image frames use a reference point in the source image as an offset center point; Determining the position of pixel points in the source image in the image frame according to the offset center point; Obtaining the offset data of the pixel points according to the distance difference between the position of the pixel points in the source image and the position of the pixel points in the image frame; Constructing a pixel offset data set corresponding to the animation type according to the animation type of the animation and the offset data.
3. The method according to claim 1 or 2, characterized in that, The animation type includes an image restoration animation; The step of, based on a pixel offset data set corresponding to the animation type, obtaining offset data of pixel points in the image in an image frame includes: Determining a pixel offset data set corresponding to the image restoration animation, where the pixel offset data set contains multiple non-zero offset data and one zero offset data; Searching for an offset identifier associated with the pixel offset data set; When the offset identifier is an initial identifier, searching for offset data associated with the image frame in the pixel offset data set, and when the found offset data is zero, updating the initial identifier to an updated identifier; When the offset identifier is an updated identifier, determining that the offset data of the pixel point in the image frame is zero.
4. The method according to claim 1 or 2, characterized in that, The step of, based on a pixel offset data set corresponding to the animation type, obtaining offset data of pixel points in the image in an image frame includes: Obtaining the sequence number of the image frame and the recorded value corresponding to the pixel point in the image, where the recorded value represents the number of non-zero offset data or the number of zero offset data in the offset data of the pixel point; Judging whether the offset data of the pixel point in the image frame is zero according to the numerical size relationship between the recorded value and the sequence number, and determining the storage position of the non-zero offset data in the corresponding pixel offset data set; Searching for non-zero offset data corresponding to the image frame from the pixel offset data set according to the storage position.
5. The method according to claim 4, characterized in that, The animation type includes an image deformation animation; the recorded value represents the number of zero offset data in the offset data of the pixel point; Determining whether the offset data of the pixel point in the image frame is zero and determining the storage position of the non-zero offset data in the pixel point offset data set according to the numerical size relationship between the recorded value and the serial number includes: When the serial number of the image frame is not greater than the recorded value, it is determined that the offset data of the pixel point in the image frame is zero; When the serial number of the image frame is greater than the recorded value, it is determined that the offset data of the pixel point in the image frame is non-zero offset data; According to the difference between the serial number and the recorded value, determine the storage position of the non-zero offset data in the pixel point offset data set.
6. The method according to claim 4, wherein The animation type includes an image restoration animation; the recorded value represents the number of non-zero offset data in the offset data of the pixel point; Determining whether the offset data of the pixel point in the image frame is zero and determining the storage position of the non-zero offset data in the pixel point offset data set according to the numerical size relationship between the recorded value and the serial number includes: When the serial number of the image frame is not greater than the recorded value, it is determined that the offset data of the pixel point in the image frame is non-zero offset data; According to the serial number of the image frame, determine the storage position of the non-zero offset data in the pixel point offset data set; When the serial number of the image frame is greater than the recorded value, the offset data of the pixel point in the image frame is zero.
7. The method according to claim 1, characterized in that The animation type is a splicing animation including an image deformation animation and an image restoration animation; Processing the pixel points in the image according to the offset data to obtain the continuous image frames of the animation corresponding to the image includes: Processing the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image deformation animation to obtain the first continuous image frames of the image corresponding to the image deformation animation; Processing the pixel points in the image according to the offset data obtained from the pixel point offset data set corresponding to the image restoration animation to obtain the second continuous image frames of the image corresponding to the image restoration animation; Obtain the splicing order of the splicing animation, and splice the first continuous image frames and the second continuous image frames according to the splicing order to obtain the continuous image frames of the splicing animation corresponding to the image.
8. An animation display device for an image, characterized in that, The device includes: An operation response module, configured to respond to an image display operation and determine an image and an animation type associated with the image display operation; An offset data acquisition module, configured to acquire the offset data of the pixel points in the image frame based on the pixel point offset data set corresponding to the animation type, where the image frame refers to any image frame of the animation corresponding to the animation type; the pixel point offset data set refers to a data set used to record the position change of each pixel point in the image in each image frame of the animation; the offset data of the pixel point refers to the coordinate offset of the coordinate position of the same pixel point in the image compared to the coordinate position of the pixel point in any image frame of the animation; An offset processing module, configured to process the pixel points in the image according to the offset data to obtain the continuous image frames of the animation corresponding to the image; The animation display module is used to play the continuous image frames and display the animation of the images.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for playing frame animation, computer equipment and computer storage medium
CN109816757A