Animation data generation method, animation data playing method, equipment and storage medium
By calculating the frame difference picture and combining it with the animation starting frame to generate animation data, it solves the problems of large animation data volume and low picture quality, achieving more efficient data storage and better visual effects.
Patent Information
- Application Number
- CN202310233306.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-06
- Publication Date
- 2024-09-06
AI Technical Summary
In the existing technology, animation data is large in size and image quality is low, resulting in low compression efficiency and poor visual effects.
By obtaining the first image frame and the second image frame in the image set to be processed, the frame difference picture is calculated, and the frame difference picture and the animation starting frame are used to generate animation data, thereby reducing the data volume and improving the picture quality.
The data volume of animation data is reduced, excessive compression is avoided, and the picture quality and visual effects of animation are improved.
Smart Images

Figure CN118612447A
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of image processing technology, and in particular to an animation data generating method, an animation data playing method, a device, and a storage medium. Background Art
[0002] Animation, also known as motion effects or animated images, refers to images that can be displayed dynamically. Compared with static images that are displayed statically, animation has a better information expression effect and is widely used in various web pages and applications.
[0003] In the prior art, animation playback is usually achieved based on the orderly playback of multiple frames of images. Therefore, before playing the animation, it is necessary to first create and generate animation data containing multiple frames of static images, and then play the static images in the animation data to achieve the animation playback effect.
[0004] However, the animation data generated in the prior art, on the one hand, has the problem of large data volume and low compression efficiency; on the other hand, in order to meet the data volume limitation, the animation data is over-compressed, resulting in low animation picture quality and poor visual effects. Summary of the invention
[0005] The embodiments of the present disclosure provide an animation data generating method, an animation data playing method, a device and a storage medium to overcome the problems of large animation data volume and low picture quality.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for generating animation data, comprising:
[0007] Obtain a set of images to be processed, the set of images to be processed comprising at least a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is a subsequent image frame adjacent to the first image frame; obtain a frame difference picture based on the first image frame and the second image frame, the frame difference picture representing the difference content of the second image frame relative to the first image frame; generate animation data corresponding to the target animation based on the first image frame and the frame difference picture.
[0008] In a second aspect, an embodiment of the present disclosure provides an animation data playing method, comprising:
[0009] Obtain animation data corresponding to a target animation, wherein the animation data is generated by the animation data generation method described in the first aspect and various possible designs of the first aspect; obtain a first image frame and a second image frame based on the animation data, wherein the first image frame is an animation start frame of the target animation, and the second image frame is a subsequent image frame adjacent to the first image frame; and play at least the first image frame and the second image frame in sequence.
[0010] In a third aspect, an embodiment of the present disclosure provides an animation data generating device, comprising:
[0011] An acquisition module, used for acquiring a to-be-processed image set, wherein the to-be-processed image set includes at least a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame next to the first image frame;
[0012] A processing module, configured to obtain a frame difference picture according to the first image frame and the second image frame, wherein the frame difference picture represents a difference content of the second image frame relative to the first image frame;
[0013] A generation module is used to generate animation data corresponding to the target animation according to the first image frame and the frame difference picture.
[0014] In a fourth aspect, an embodiment of the present disclosure provides an animation data playback device, comprising:
[0015] An acquisition module, used for acquiring animation data corresponding to a target animation, wherein the animation data is generated by the animation data generation method described in the first aspect and various possible designs of the first aspect;
[0016] A processing module, configured to obtain a first image frame and a second image frame according to the animation data, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame subsequent to the first image frame;
[0017] A playing module is used to play at least the first image frame and the second image frame in sequence.
[0018] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, including:
[0019] A processor, and a memory communicatively connected to the processor;
[0020] The memory stores computer-executable instructions;
[0021] The processor executes the computer-executable instructions stored in the memory to implement the animation data generating method as described in the first aspect and various possible designs of the first aspect, or to implement the animation data playing method as described in the second aspect and various possible designs of the second aspect.
[0022] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the animation data generation method described in the first aspect and various possible designs of the first aspect is implemented, or the animation data playback method described in the second aspect and various possible designs of the second aspect is implemented.
[0023] In the seventh aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the animation data generation method as described in the first aspect and various possible designs of the first aspect, or implements the animation data playback method as described in the second aspect and various possible designs of the second aspect.
[0024] The animation data generation method, animation data playback method, device and storage medium provided in this embodiment obtain a set of images to be processed, wherein the set of images to be processed includes at least a first image frame and a second image frame, wherein the first image frame is the animation start frame of the target animation, and the second image frame is the next image frame adjacent to the first image frame; a frame difference picture is obtained based on the first image frame and the second image frame, wherein the frame difference picture represents the difference content of the second image frame relative to the first image frame; and animation data corresponding to the target animation is generated based on the first image frame and the frame difference picture. The frame difference picture is obtained by comparing the first image frame and the second image frame, and the frame difference picture is used to generate the animation data of the target animation by combining the frame difference picture and the animation start frame. Compared with the solution of directly using the original second image frame to generate animation data, the data volume of the generated animation data is reduced, while avoiding excessive compression of the animation data, thereby improving the picture quality and visual effect of the target animation. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0026] Figure 1 An application scenario diagram of the animation data generation method provided in the embodiment of the present disclosure;
[0027] Figure 2 Schematic diagram of the animation data generation method provided in the embodiment of the present disclosure Figure 1 ;
[0028] Figure 3 for Figure 2 A flowchart of a specific implementation method of step S102 in the illustrated embodiment;
[0029] Figure 4 A schematic diagram of a difference image block provided by an embodiment of the present disclosure;
[0030] Figure 5 for Figure 3 A flowchart of a specific implementation method of step S1023 in the illustrated embodiment;
[0031] Figure 6 A schematic diagram of generating a frame difference picture provided by an embodiment of the present disclosure;
[0032] Figure 7 A schematic diagram of the process of generating animation data provided by the embodiment of the present disclosure Figure 2 ;
[0033] Figure 8 A schematic diagram of a process for determining a difference image block provided by an embodiment of the present disclosure;
[0034] Fig. 9 for Figure 7 A flowchart of a specific implementation method of step S208 in the illustrated embodiment;
[0035] Fig.10 A schematic diagram of a process for generating a first frame difference picture and a second frame difference picture provided by an embodiment of the present disclosure;
[0036] Fig.11 Schematic diagram of the animation data playback method provided in the embodiment of the present disclosure Figure 1 ;
[0037] Fig.12 A structural block diagram of an animation data generating device provided in an embodiment of the present disclosure;
[0038] Fig.13 A structural block diagram of an animation data playback device provided in an embodiment of the present disclosure;
[0039] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;
[0040] Fig.15 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0042] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0043] The application scenarios of the embodiments of the present disclosure are explained below:
[0044] Figure 1 This is an application scenario diagram of the animation data generation method provided by the embodiment of the present disclosure. The animation data generation method provided by the embodiment of the present disclosure can be applied to the application scenarios of animation production and playback. Specifically, the method provided by the embodiment of the present disclosure can be applied to terminal devices, servers or other electronic devices with similar functions. Figure 1 As shown, exemplarily, with a server as the execution subject of the method provided by the embodiment of the present disclosure, the server can communicate with the drawing device and the terminal device respectively, wherein the drawing device is an electronic device operated by an animation production user for drawing and producing animations. The drawing device sends the multi-frame static pictures drawn by the user to the server, and the server processes the multi-frame static pictures using the animation data generation method provided in this embodiment to generate animation data corresponding to the target animation. The above process is the process of generating animation data. Afterwards, the terminal device obtains the animation data from the server, and after decoding the animation data locally, restores the multi-frame static pictures sent by the drawing device, and plays the multi-frame static pictures in sequence, thereby playing the target animation. The above process is the process of playing animation data.
[0045] In the prior art, in the process of generating animation data, multiple frames of static images are compressed to generate corresponding animation data. The compression process is mainly based on compressing each frame of static images, such as reducing the resolution of each frame of static images, etc., so as to reduce the data volume of each frame of static images, thereby achieving the purpose of reducing the overall data volume of animation data. However, the generated animation data still contains a large number of static images. Therefore, if a lower compression rate is used to ensure the display effect of static images, the volume of animation data will be larger, occupying additional storage resources and network resources; if a higher compression rate is used to ensure the volume of animation data is smaller, the restored static images will have problems of low resolution and clarity, affecting the viewing angle effect of animation playback. The disclosed embodiment provides an animation data generation method to solve the above problems.
[0046] refer to Figure 2 , Figure 2 Schematic diagram of the animation data generation method provided in the embodiment of the present disclosure Figure 1 The method of this embodiment can be applied to electronic devices such as servers and terminal devices. The animation data generation method includes:
[0047] Step S101: obtaining a set of images to be processed, the set of images to be processed at least comprising a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is a subsequent image frame adjacent to the first image frame.
[0048] For example, reference Figure 1 The schematic diagram of the application scenario shown in the figure uses the server as the execution subject, and the server receives a set of static pictures sent by the first terminal device, namely, the image set to be processed. The image set to be processed includes at least two frames of images, namely, a first image frame and a second image frame. Among them, the first image frame is the animation start frame of the target animation, and the second image frame is an image frame adjacent to the animation start frame. Of course, in a possible implementation method, after the second image frame, other orderly arranged image frames may also be included. By sequentially displaying multiple ordered image frames in the image set to be processed, the playback process of the target animation can be realized, and the specific process will not be repeated. Among them, exemplarily, a specific implementation method of obtaining the image set to be processed and loading the first image frame and the second image frame is obtained.
[0049] Step S102: obtaining a frame difference picture according to the first image frame and the second image frame, wherein the frame difference picture represents the difference content of the second image frame relative to the first image frame.
[0050] Exemplarily, after obtaining the first image frame and the second image frame in the image set to be processed, the two are compared, and the image difference region between the two can be determined based on the comparison result, wherein the image difference region is at least one pixel point (corresponding region), that is, a pixel point with different pixel values at the same position in the first image frame and the second image frame. In another possible implementation, after the first image frame and the second image frame are divided into regions using the same rule, the image difference region refers to a set of regions with different pixel values at the same region position in the first image frame and the second image frame. Exemplarily, as Figure 3 As shown, the specific implementation of step S102 includes:
[0051] Step S1021: Divide the first image frame and the second image frame based on the same specification to obtain a target number of first image blocks corresponding to the first image frame and a target number of second image blocks corresponding to the second image frame.
[0052] Step S1022: Compare the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block, where the difference image block is a second image block different from the first image block at the same image block position.
[0053] Step S1023: Generate a frame difference picture according to the difference image block.
[0054] Exemplarily, under normal circumstances, the sizes of the first image frame and the second image frame are the same. By dividing the first image frame and the second image frame based on the same rules, the same target number of image blocks can be obtained, that is, the first image block and the second image frame corresponding to the first image frame. Afterwards, the image blocks at the corresponding positions are compared. If the first image block and the second image block are not the same at the image block position, the image block corresponding to the image block position is a difference image block. On the contrary, if the first image block and the second image block are the same at the image block position, the image block corresponding to the image block position is a non-difference image block.
[0055] Figure 4 A schematic diagram of a difference image block provided by an embodiment of the present disclosure, such as Figure 4 As shown, after the first image frame and the second image frame are divided based on the 8x8 division rule, 64 first image blocks (8 rows and 8 columns) and 64 second image blocks (8 rows and 8 columns) are obtained respectively. Afterwards, after the image blocks at each corresponding position of the first image frame and the second image frame are compared in blocks, 3 difference image blocks can be obtained, namely, image block #1, image block #2 and image block #3 in the second image frame.
[0056] Furthermore, after determining the difference image block, in one possible implementation, a frame difference picture with the same size as the second image frame is generated according to the position of the difference image block in the second image frame, wherein at the pixel block position corresponding to the above difference image block in the frame difference picture, each pixel point on the corresponding difference image block is copied; and at the pixel block position corresponding to the above non-difference image block in the frame difference picture, a pixel point with a transparency of 0 (completely transparent) is set. In another possible implementation, after determining the difference image block, each difference image block is extracted and spliced to form a new picture, i.e., a frame difference picture. Specifically, if Figure 5 As shown, the specific implementation steps of step S1023 include:
[0057] Step S1023A: obtaining image block coordinates corresponding to the difference image block, where the image block coordinates represent the position of the difference image block in the first image frame or the second image frame.
[0058] Step S1023B: Generate a coordinate sequence according to the image block coordinates corresponding to each difference image block.
[0059] Step S1023C: Arrange and splice the difference image blocks according to the generated coordinate sequence to generate a frame difference image.
[0060] For example, Figure 6 A schematic diagram of generating a frame difference picture provided by an embodiment of the present disclosure, such as Figure 6 As shown, first, the image block coordinates of the difference image block determined in the second image frame are obtained. For example, based on the 8x8 (8 rows and 8 columns) division rule, the coordinates of image block #1 are (2,3), the coordinates of image block #2 are (3,3), and the coordinates of image block #3 are (3,4). After that, the above coordinates are saved as a coordinate sequence according to a preset rule. For example, in the order from left to right and from top to bottom, the coordinates (2,3), (3,3), and (3,4) are saved as a coordinate sequence, and then image block #1, image block #2, and image block #3 are arranged and spliced into a frame difference picture in sequence. Furthermore, if the spliced difference image block is less than a whole row, it can be filled with an image block composed of special pixels, such as a pure white, pure black or transparent pixel block, so as to form a complete frame difference picture. In this embodiment, by arranging and splicing the difference image blocks, a smaller frame difference picture can be generated, thereby reducing the overall volume of the animation data.
[0061] Exemplarily, after the frame difference picture is generated, after the frame difference picture is generated in an arrangement and splicing manner, the positioning information of the difference image block representing the difference content between the first image frame and the second image frame is lost in the frame difference picture, and therefore, in order to restore the difference content (difference image block) in the frame difference data, it is necessary to further generate restoration information corresponding to the frame difference picture. Optionally, the method of this embodiment further includes:
[0062] Step S1023D: Generate restoration information based on the frame difference picture, where the restoration information is used to represent the position of the difference content in the frame difference picture in the second image frame.
[0063] Specifically, according to the image block sequence number and image block coordinates corresponding to each difference image block obtained in the process of generating the frame difference picture, the restoration information is obtained, wherein the image block sequence number represents the position of the difference image block in the frame difference picture, and the image block coordinates represent the position of the difference image block in the second image frame. In a possible implementation, the restoration information includes a coordinate sequence, and the coordinate sequence is an array. Each element in the array corresponds to an image block in the second image frame. The position sequence number of the element in the array is the image block coordinate; the value of the element is the image block sequence number. For example, the coordinate sequence in the restoration information is [0,0,0,0,3,4,5,0,0]. The coordinate sequence includes 9 elements. According to the division specification (3x3 specification) of the first image frame (or the second image frame) recorded in the restoration information, the 9 elements in the coordinate sequence correspond to the 9 image blocks of the second image frame respectively. Among them, the first four elements in the coordinate sequence are "0", indicating that the first four image blocks in the second image frame (from left to right, from top to bottom, line by line scanning) are non-difference image blocks; the fifth element in the coordinate sequence is "3", indicating that the fifth image block in the second image frame is a difference image block, and the difference image block is stored at the position of image block number "3" in the frame difference picture. The sixth to ninth elements in the coordinate sequence are similar and will not be described in detail. Through the above-mentioned restoration information, the second image frame can be restored using the first image frame and the frame difference picture.
[0064] Optionally, the restoration information may also include relevant information of the frame difference picture, which is used to describe the mapping relationship between the image block sequence number and the position of each difference image block in the frame difference picture. The specific implementation form can be set as needed and will not be repeated here.
[0065] Step S103: Generate animation data corresponding to the target animation according to the first image frame and the frame difference picture.
[0066] Exemplarily, based on the previous steps, after obtaining the frame difference picture, the animation data of the target animation can be generated according to the difference content of the second image frame represented by the frame difference picture relative to the first image frame and the first image frame itself. In a possible implementation, the animation data also includes restoration information for representing the position of the difference content in the frame difference picture in the first image frame, and the animation data of the target animation is jointly generated by the restoration information, the first image frame and the frame difference picture. Among them, the specific implementation method of the restoration information has been introduced in detail in step S1023. At the same time, the animation data, i.e., the set of the above-mentioned first image frame, frame difference picture and restoration information, can be further compressed, encoded, etc. to generate animation data in the form of a file. The specific implementation method of packaging multiple files to generate one file is a prior art known to those skilled in the art, and can be set as needed, and will not be repeated here.
[0067] On the other hand, after the terminal device used to play the target animation obtains the animation data, the first image frame and the corresponding frame difference picture in the animation data are obtained by, for example, decoding, decompression, etc., and restored to obtain the corresponding second image frame. Further, optionally, if the image set to be processed includes other image frames in addition to the first image frame and the second image frame, the animation data also includes frame difference pictures corresponding to other image frames in the image set to be processed (except the last image frame), such as the frame difference picture corresponding to the second image frame, the frame difference picture corresponding to the third image frame, and so on. After obtaining the second image frame, further based on the frame difference picture corresponding to the second image frame, the corresponding third image frame is restored; after obtaining the third image frame, further based on the frame difference picture corresponding to the third image frame, the corresponding fourth image frame is restored, and so on, until all the image frames in the image set to be processed are obtained, thereby achieving the playback of the target animation.
[0068] In this embodiment, by obtaining a set of images to be processed, the set of images to be processed includes at least a first image frame and a second image frame, wherein the first image frame is the animation start frame of the target animation, and the second image frame is the next image frame adjacent to the first image frame; a frame difference picture is obtained according to the first image frame and the second image frame, and the frame difference picture represents the difference content of the second image frame relative to the first image frame; and animation data corresponding to the target animation is generated according to the first image frame and the frame difference picture. By comparing the first image frame and the second image frame to obtain the frame difference picture, the frame difference picture and the animation start frame are combined to generate the animation data of the target animation. Compared with the solution of directly using the original second image frame to generate the animation data, the data volume of the generated animation data is reduced, and at the same time, excessive compression of the animation data is avoided, thereby improving the picture quality and visual effect of the target animation. At the same time, in the solution provided by this embodiment, the steps of processing the first image frame and the second image frame are easy to implement and have good versatility, so it has good compatibility and can realize cross-platform operation.
[0069] refer to Figure 7 , Figure 7 A schematic diagram of the process of generating animation data provided by the embodiment of the present disclosure Figure 2 This example is described in detail in Figure 2 On the basis of the embodiment shown, step S102 is further refined, and steps such as weighted processing of the image frames are added. The animation data generation method includes:
[0070] Step S201: obtaining the first image frame in the image set to be processed, where the first image frame is the animation start frame of the target animation.
[0071] Step S202: Acquire a second image frame in the image set to be processed, where the second image frame is a subsequent image frame adjacent to the first image frame.
[0072] Exemplarily, the image set to be processed includes at least two image frames, i.e., static images. The image frames are arranged in order. The arrangement order of the image frames can be determined, for example, according to the file name or other file attributes of the image frame. Based on the arrangement order of the image frames, they are read in sequence, and all the image frames constituting the target animation can be obtained in sequence starting from the animation start frame. Wherein, at the beginning of the first cycle, the first image frame in the image set to be processed is the animation start frame, and the first image frame is an image frame adjacent to the animation start frame. For example, the first image frame is the image frame with an image sequence number [1] in the image set to be processed, and the second image frame is the image frame with an image sequence number [2] in the image set to be processed. In the subsequent cycle process, when the first image frame is updated, the second image frame is also updated accordingly. For example, when the first image frame is updated to the image frame with an image sequence number [2] in the image set to be processed, the second image frame is the image frame with an image sequence number [3] in the image set to be processed, and so on.
[0073] Step S203: weighting the first image frame and the second image frame based on the transparency of the first image frame and the second image frame respectively to obtain corresponding first weighted image frame and second weighted image frame.
[0074] Exemplarily, the transparency of the first image frame and the second image frame may refer to the transparency of each pixel in the first image frame and the second image frame, which may be represented by a numerical matrix corresponding to the pixel in the image frame, that is, each numerical value in the matrix corresponds to a pixel in the image frame. Taking the first image frame as an example, the pixel value of the pixel in the first image frame is represented based on RGBA, where RGBA is a color space module, R represents the red brightness channel, G represents the green brightness channel, B represents the blue brightness channel, and A represents the transparency channel. Therefore, the pixel value corresponding to each pixel is [R, G, B, A]. The transparency corresponding to each pixel in the first image frame can be obtained through the pixel value of the pixel A channel.
[0075] Furthermore, according to the transparency value corresponding to each pixel point of the first image frame, the color brightness value of the corresponding pixel point is weighted in turn to obtain the corresponding weighted color brightness value, and the set of pixel points represented by the weighted color brightness value is the first weighted image frame. The generation method of the second weighted image frame is the same and will not be repeated. More specifically, for example, taking the first image frame as an example, the pixel value corresponding to the P1 pixel point in the first image frame is [100, 221, 75, 255], wherein the R channel brightness value of the P1 pixel point is 100, the G channel brightness value is 221, the B channel brightness value is 75, and the A channel transparency value is 255; the pixel value corresponding to the P2 pixel point in the first image frame is [76, 111, 154, 1], wherein the R channel brightness value of the P2 pixel point is 76, the G channel brightness value is 111, the B channel brightness value is 154, and the A channel transparency value is 1. After weighted calculation of the P1 pixel and the P2 pixel according to the transparency value, the corresponding weighted color brightness value of the P1 pixel is [100, 221, 75], and the weighted color brightness value of the P2 pixel is [76 / 255, 111 / 255, 154 / 255]. Wherein, illustratively, the maximum value of each channel of the RGBA pixel is 255. In the above example, the transparency value of the A channel of the P1 pixel is 255, indicating that the P1 pixel is completely opaque, and the transparency value of the A channel of the P2 pixel is 1, indicating that the P1 pixel is almost transparent. In this case, since the completely transparent and almost transparent pixels will not change significantly visually even if the color brightness changes, therefore, after weighted calculation of the color brightness value of the pixel according to the transparency value, reducing the color brightness value of the pixel can reduce the number of difference pixels (i.e., difference content) in the first image frame and the second image frame, thereby reducing the information in the frame difference picture, and further reducing the data positive of the generated animation data.
[0076] Of course, it can be understood that the above-mentioned step S203 is optional. In a possible implementation, the above-mentioned step S203 may not be executed, and the subsequent step S204 may be directly performed, that is, the first image frame and the second image frame are divided based on the same specifications to obtain the target number of first image blocks corresponding to the first image frame and the target number of second image blocks corresponding to the second image frame, which will not be repeated here.
[0077] Step S204: Divide the first weighted image frame and the second weighted image frame based on the same specification to obtain a target number of first image blocks corresponding to the first weighted image frame and a target number of second image blocks corresponding to the second weighted image frame.
[0078] Step S205: for each image block position, respectively obtain a pixel value of a first pixel point in the first image block and a pixel value of a second pixel point in the second image block.
[0079] Exemplarily, after obtaining the first weighted image frame and the second weighted image frame, the first weighted image frame and the second weighted image frame are divided based on the same division rule, and the same number of first image blocks and second image blocks can be obtained. In a possible implementation, the first weighted image frame and the second weighted image frame are divided based on the 8x8 specification to obtain 64 corresponding first image blocks and second image blocks. Among them, the first image block and the second image block have the same size. Exemplarily, the length and width of each image block are the same, and the length and width of the image block are powers of 2. In this embodiment, the first weighted image frame and the second weighted image frame are divided based on the above specifications, and the obtained first image blocks and second image blocks meet the requirements of the Joint Photographic Experts Group (JPEG) compression standard. Since it is necessary to generate a picture in (JPEG) format based on the first image block and the second image block in the subsequent steps, the first weighted image frame and the second weighted image frame are divided based on the above specifications, which can improve the efficiency and quality of compressing the picture in the subsequent steps and improve the efficiency of generating animation data.
[0080] Further, according to the first image block and the second image block obtained after the division, for each image block position, the pixel value of the first pixel in the first image block and the pixel value of the second pixel in the second image block are respectively obtained. Specifically, for example, the first image frame has 64 first image blocks, and for each first image block, the pixel value of each pixel in the image block is respectively obtained. Wherein, exemplarily, the pixel value of the pixel is represented based on the RGBA color space, and the pixel value of each pixel includes 4 channel values. Each first image block can represent the pixel value of the first pixel it has through a structure. The specific implementation method has been introduced in the above step S203 and will not be repeated here.
[0081] Step S206: obtaining a grayscale value corresponding to the first pixel point according to the pixel value of the first pixel point, and obtaining a grayscale value corresponding to the second pixel point according to the pixel value of the second pixel point.
[0082] Exemplarily, the gray value is calculated according to the color brightness value of each first pixel in the first image block to obtain the gray value corresponding to the first pixel. For example, if the color brightness value of the first pixel is [R, G, B], the corresponding gray value Gray is calculated as follows:
[0083] Gray=R×0.299+G×0.587+B×0.114
[0084] Similarly, the grayscale value corresponding to the first pixel can be obtained by calculating the grayscale value according to the color brightness value of each second pixel in the second image block. The specific process is the same and will not be repeated here. In the steps of this embodiment, the pixel difference comparison is performed by converting the color brightness value of the three channels of the pixel point into the grayscale value of one channel, which reduces the data comparison dimension, so that the obtained frame difference picture has better stability, reduces the number of difference image blocks in the frame difference picture, and further reduces the volume of animation data.
[0085] Step S207: low-pass filter the grayscale value corresponding to the first pixel in the first image block to obtain the filtered grayscale value corresponding to the first pixel in the first image block, and low-pass filter the grayscale value corresponding to the second pixel in the second image block to obtain the filtered grayscale value corresponding to the second pixel in the second image block.
[0086] Exemplarily, after calculating each pixel in the first image block and the second image block respectively, the grayscale value corresponding to each pixel is obtained, which is equivalent to obtaining the first grayscale image block and the second grayscale image block corresponding to the first image block and the second image block respectively. After all the first image blocks in the first image frame are the first grayscale image blocks, and all the second image blocks in the second image frame are the second grayscale image blocks, it is equivalent to obtaining the first grayscale image corresponding to the first image frame and the second grayscale image corresponding to the second image frame. On this basis, each first grayscale image block in the first grayscale image and each second grayscale image block in the second grayscale image are further low-pass filtered, that is, the grayscale value corresponding to each first pixel in each first image block is low-pass filtered, and the grayscale value corresponding to each second pixel in each second image block is low-pass filtered, so as to filter out the high-frequency components in the first grayscale image block and the second grayscale image block, reduce noise and image elements that are difficult for the human eye to perceive, thereby improving the consistency of the first grayscale image block and the corresponding second grayscale image block, and then reducing the number of subsequent difference image blocks, thereby achieving data compression without affecting the visual effect, and further reducing the data volume of the frame difference picture and the final generated animation data.
[0087] Among them, exemplarily, the specific implementation method of low-pass filtering the grayscale value corresponding to the first pixel in the first image block can be, for example, by performing a discrete cosine transform (DCT) on each grayscale value, and then filtering out high-frequency features from the frequency domain dimension by windowing to achieve the purpose of filtering out low-pass filtering. The specific filtering parameters can be set according to specific needs without limitation. The specific implementation method is a prior art and will not be repeated here.
[0088] Step S208: Obtain a difference image block according to the filtered gray value corresponding to the first pixel in the first image block and the filtered gray value corresponding to the second pixel in the second image block.
[0089] Exemplarily, after obtaining the filtered grayscale value corresponding to each pixel point (first pixel point) in the first image block and the filtered grayscale value corresponding to each pixel point (second pixel point) in the second image block, the average grayscale value corresponding to the first image block and the second image block is calculated respectively, wherein the method for calculating the average grayscale value includes, for example: obtaining the filtered grayscale value corresponding to each pixel point in the first image block, and calculating the average value to obtain the average grayscale value. On this basis, it is also possible to further generate a weighting coefficient inversely proportional to the distance from each pixel point to the center of the first image block, and perform weighted calculation on the filtered grayscale value of the corresponding first pixel point based on the weighting coefficient to obtain the corresponding weighted filtered grayscale value, and then calculate the average grayscale value based on the weighted filtered grayscale value corresponding to each first pixel point in the first image block. The method for calculating the average grayscale value corresponding to the second pixel block is the same as the method for calculating the average grayscale value corresponding to the first pixel block, and will not be repeated.
[0090] Afterwards, the difference between the average grayscale value of each first image block and the average grayscale value of the corresponding second image block is calculated. If the obtained difference is greater than a first threshold, the first image block and the second image block are considered to be difference image blocks. Otherwise, if the obtained difference is less than the first threshold, the first image block and the second image block are considered to be non-difference image blocks, that is, image blocks with the same image content.
[0091] Figure 8 A schematic diagram of a process for determining a difference image block provided by an embodiment of the present disclosure is shown in FIG. Figure 8As shown, after the first image frame and the second image frame are divided according to the specification of 8x8 (8 rows and 8 columns), 64 first image blocks corresponding to the first image frame and 64 second image blocks corresponding to the second image frame are obtained respectively, and each first image block corresponds to each second image block one by one, that is, the first image block and the corresponding second image block constitute an image block group. Afterwards, traverse each image block group, and respectively calculate the average grayscale value corresponding to the first image block and the average grayscale value corresponding to the second image block in each image block group. For example, as shown in the figure, in the image group P_N, the first image block P1_N and the second image block P2_N are included, wherein N represents the image block sequence number of the first image block and the second image block in their respective image frames; after obtaining the average grayscale value G1_N of the first image block P1_N and the average grayscale value G2_N of the second image block P2_N, calculate the absolute difference value Val between G1_N and G2_N. If the absolute difference value Val is greater than the first threshold Thr_1, the image block corresponding to the image group P_N is a difference image block, that is, the second image block P2_N of the image group P_N is taken as a difference image block; in any case, if the absolute difference value Val is less than the first threshold thr_1, the image block corresponding to the image group P_N is a non-difference image block, that is, it is considered that the first image block P1_N and the second image block P2_N are the same. The first threshold is set based on needs and is not specifically limited here.
[0092] In a possible implementation, the difference image block includes a first difference image block and a second difference image block, wherein the first difference image block is an image block with a color brightness difference, and the second difference image block is an image block with a transparency difference. Fig. 9 As shown, the specific implementation of step S208 includes:
[0093] Step S2081: respectively obtain a pixel value of a first pixel in the first image block and a pixel value of a second pixel in the second image block.
[0094] Step S2082: Obtain a first difference image block and a second difference image block according to the pixel value of the first pixel and the pixel value of the second pixel.
[0095] Exemplarily, the pixel value includes three-channel color brightness values and one-channel transparency value; the specific implementation steps of step S2082 include:
[0096] Step S2082A: Obtain a first difference image block according to the color brightness value of a first pixel in the first image block and the color brightness value of a corresponding second pixel in the second image block.
[0097] Step S2082B: Obtain a second difference image block according to the transparency value of the first pixel in the first image block and the transparency value of the corresponding second pixel in the second image block.
[0098] Exemplarily, the pixel values of the first pixel and the second pixel are represented based on the RGBA color space model. R, G, and B represent the red brightness value, the green brightness value, and the blue brightness value, respectively, and A represents the transparency value. On the one hand, after obtaining the pixel values of each first pixel in the first image block and each second pixel in the second image block, the grayscale value corresponding to the pixel is calculated by the RGB value, and then the average grayscale value corresponding to the first image block and the second image block is obtained. After comparison, the first difference image block can be obtained. The method for obtaining the first difference image block is the same as the method for obtaining the difference image block introduced in the above steps S204-S204, which will not be repeated here.
[0099] On the other hand, after obtaining the pixel values of each first pixel in the first image block and each second pixel in the second image block, the transparency value corresponding to the pixel is obtained by the A value, and then the average transparency value corresponding to the first image block and the second image block is calculated, and then the first image block and the second image block are compared based on the average transparency value to obtain the second difference image block. Among them, the specific implementation method of calculating the average transparency value is similar to the implementation method of calculating the average gray value corresponding to the image block in the above embodiment, that is, the transparency value corresponding to each pixel in the image block is averaged or weighted averaged to obtain the average transparency value corresponding to the image block, and the relevant introduction of calculating the average gray value in the above embodiment can be referred to, and then the difference calculation is performed based on the average transparency value to obtain the transparency difference value. If the transparency difference value is greater than the second threshold, it is considered that the transparency has changed, and the second image block is determined as the second difference image block. The specific process is similar to the method of determining the difference image block in the above embodiment, and the relevant introduction of determining the difference image block in the above embodiment can be referred to, and it will not be repeated here.
[0100] Step S209: Generate a first frame difference picture and a second frame difference picture according to the first difference image block and the second difference image block.
[0101] Exemplarily, based on the above steps, at least one first difference image block and at least one second difference image block can be obtained, and then, at least one first difference image block and at least one second difference image block are spliced respectively, so as to obtain a first frame difference picture formed by arranging and splicing the first difference image blocks and a second frame difference picture formed by arranging and splicing the second difference image blocks. The first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame. Fig.10 A schematic diagram of a process for generating a first frame difference picture and a second frame difference picture provided by an embodiment of the present disclosure, such as Fig.10As shown, after obtaining the first image frame and the second image frame, the first image frame and the second image frame are divided into blocks and compared in blocks to obtain the first difference image block and the second difference image block. After that, the first difference image block and the second difference image block are arranged and spliced respectively to generate the corresponding first frame difference picture and the second frame difference picture. Among them, exemplarily, the first frame difference picture is in the Joint Photographic Experts Group (JPEG) image format; the second frame difference picture is in the Portable Network Graphics (PNG) image format. In the steps of this embodiment, by setting the first frame difference picture to the Joint Photographic Experts Group image format and setting the second frame difference picture to the Portable Network Graphics format, the image compression efficiency is further improved by utilizing the better compression rate of the JPEG image format compared to the PNG image format, and the data volume of the generated animation data is reduced.
[0102] Furthermore, while generating the first difference image block and the second difference image, corresponding restoration information for describing the positions of the first difference image block and the second difference image in the second image frame is also generated. The specific implementation of the restoration information has been introduced in the above embodiment. On this basis, in the coordinate sequence in the restoration information, the first difference image block and the second difference image are distinguished by the sign of the element value. For example, the coordinate sequence in the restoration information is [0,0,0,0,3,-4,5,0,0] (for the specific meaning, see the detailed introduction in step S1023D), wherein the fifth element "3" indicates that the fifth image block in the second image frame is a difference image block, and the difference image block is stored at the position of the image block number "3" in the first frame difference picture; the sixth element "-4" indicates that the sixth image block in the second image frame is a difference image block, and the difference image block is stored at the position of the image block number "4" in the second frame difference picture. In this embodiment, the difference image blocks in the first frame difference picture and the second frame difference picture are distinguished by the sign of the coordinate sequence, which further improves the information storage efficiency of the restoration information.
[0103] In this embodiment, by obtaining the first difference image block and the second difference image block respectively, the first frame difference picture and the second frame difference picture are generated, and the difference content between the first image frame and the second image frame in two dimensions of color brightness value and transparency value is obtained, so that the target animation corresponding to the animation data can show the change of transparency between the image frames, thereby further improving the visual effect of the animation.
[0104] Step S210: The first frame difference picture and the second frame difference picture are used to generate inter-frame data corresponding to the second image frame.
[0105] Step S211: If the second image frame is not the last image frame in the image set to be processed, the second image frame is set as the first image frame in the image set to be processed, and the process returns to step S202; otherwise, animation data is generated based on the animation start frame and the inter-frame data generated in each cycle.
[0106] Furthermore, based on the first frame difference picture and the second frame difference picture, the inter-frame data corresponding to the second image frame is obtained. The inter-frame data can be regarded as a temporary data before the animation data is generated. If the second image frame is not the last image frame in the image set to be processed, the second image frame is set as the first image frame in the image set to be processed, that is, the first image frame is updated, and then moved to the next image frame in the image set to be processed, and the subsequent image frames are processed continuously, and the inter-frame data corresponding to the updated second image frame is obtained, that is, the first frame difference picture and the second frame difference picture corresponding to the second image frame, and the restoration information. Repeat the above cycle until the second image frame is the last image frame in the image set to be processed, merge the inter-frame data and restoration data corresponding to the second image frame obtained in all rounds, and generate the final animation data in combination with the animation start frame.
[0107] Among them, illustratively, the specific implementation method of merging the inter-frame data can be that after the last round of loops (i.e., the second image frame is the last image frame in the image set to be processed), the first frame difference picture and the second frame difference picture in the inter-frame data obtained in each round are merged into a first frame difference picture and a first frame difference picture, and the coordinate sequence in the restoration information is merged accordingly. It can also be that after each round of loops, the first frame difference picture and the second frame difference picture obtained in the current round are merged into the first frame difference picture and the second frame difference picture obtained in the previous round to obtain updated first frame difference pictures and second frame difference pictures, i.e., updated inter-frame data, until the loop ends, and the restoration information is processed similarly and will not be repeated.
[0108] Fig.11 Schematic diagram of the animation data playback method provided in the embodiment of the present disclosure Figure 1 The method of this embodiment can be applied in a terminal device. The animation data generation method includes:
[0109] Step S301: Obtain animation data corresponding to the target animation.
[0110] Step S302: Generate a second image frame according to the animation data.
[0111] Step S303: at least the first image frame and the second image frame are played in sequence.
[0112] For example, reference Figure 1The application scenario diagram and the process of generating animation data in the above embodiment are shown. The terminal device obtains the animation data from the server, for example, and the animation data is obtained by Figure 2-Figure 10 Generated by the animation data generation method provided by any corresponding embodiment. Specifically, the animation data includes a first image frame and a frame difference picture, wherein the first image frame is the animation start frame of the target animation, the frame difference picture represents the difference content of the second image frame relative to the first image frame, and the second image frame is the subsequent image frame adjacent to the first image frame. After obtaining the animation data, the terminal device parses the animation data, and after obtaining at least the first image frame and the frame difference picture contained in the animation data, uses the first image frame and the frame difference picture to restore, obtains the corresponding second image frame, and then plays at least the first image frame and the second image frame in sequence, so as to achieve the dynamic playback effect of the picture, that is, play the target animation. Among them, the specific implementation method of the frame difference picture is in Figure 2-Figure 10 The corresponding embodiments have been described in detail and will not be repeated here.
[0113] Furthermore, optionally, the animation data also includes restoration information, and the restoration information is used to characterize the position of the difference content in the frame difference picture in the second image frame. Figure 2-Figure 10 The corresponding embodiments have been described in detail and will not be repeated here.
[0114] Further, optionally, the animation data includes a first image frame, a first frame difference picture, and a second frame difference picture, wherein the first frame difference picture represents a color brightness difference of the second image frame relative to the first image frame; and the second frame difference picture represents a transparency difference of the second image frame relative to the first image frame. The specific implementation of step S302 includes:
[0115] Step S3021: Acquire the first image frame in the animation data;
[0116] Step S3022: Generate a second image frame according to the first image frame, the first frame difference picture and the second frame difference picture.
[0117] Exemplarily, the animation data also includes restoration information, which includes a coordinate sequence. The coordinate sequence is an array. Each element in the array corresponds to an image block in the second image frame. The position number of the element in the array is the image block coordinate; the value of the element is the image block number. Through the restoration information, the difference image blocks in the first frame difference picture and the second frame difference picture can be respectively mapped to the corresponding positions (corresponding image blocks) in the first image frame and overlaid, so as to quickly restore the second image frame. The specific implementation method and technical effect of the restoration information are described in detail in the text. Figure 2-Figure 10 The corresponding embodiments have been described in detail and will not be repeated here.
[0118] In this embodiment, by using Figure 2-Figure 10 The image data generated in the corresponding embodiment is restored to obtain the first image frame and the second image frame, and the first image frame and the second image frame are played in sequence to realize the playback of the target animation. Since image data has the advantages of small data volume and high image quality, using image data to play the target animation can reduce the occupancy of storage resources and network resources and improve the loading speed and visual effect of the target animation.
[0119] Corresponding to the animation data generation method of the above embodiment, Fig.12 This is a structural block diagram of an animation data generating device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Fig.12 , the animation data generating device 4 comprises:
[0120] The acquisition module 41 is used to acquire a to-be-processed image set, wherein the to-be-processed image set includes at least a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame next to the first image frame;
[0121] A processing module 42 is used to obtain a frame difference picture according to the first image frame and the second image frame, wherein the frame difference picture represents the difference content of the second image frame relative to the first image frame;
[0122] The generating module 43 is used to generate animation data corresponding to the target animation according to the first image frame and the frame difference picture.
[0123] In one embodiment of the present disclosure, the animation data includes a first frame difference picture and a second frame difference picture, wherein the first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; and the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame.
[0124] In one embodiment of the present disclosure, the first frame difference picture is in the Joint Photographic Experts Group JPEG image format; and the second frame difference picture is in the Portable Network Graphics PNG image format.
[0125] In one embodiment of the present disclosure, the processing module 42 is specifically used to: divide the first image frame and the second image frame based on the same specifications to obtain a target number of first image blocks corresponding to the first image frame and a target number of second image blocks corresponding to the second image frame; compare the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block, which is a second image block different from the first image block at the same image block position; and generate a frame difference picture based on the difference image block.
[0126] In one embodiment of the present disclosure, when the processing module 42 compares the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block, it is specifically used to: for each image block position, respectively obtain the pixel value of the first pixel point in the first image block and the pixel value of the second pixel point in the second image block; obtain the grayscale value corresponding to the first pixel point according to the pixel value of the first pixel point; obtain the grayscale value corresponding to the second pixel point according to the pixel value of the second pixel point; obtain the difference image block according to the grayscale value corresponding to the first pixel point in the first image block and the grayscale value corresponding to the second pixel point in the second image block.
[0127] In one embodiment of the present disclosure, when the processing module 42 obtains the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block, it is specifically used to: obtain the first average grayscale value corresponding to the first image block according to the grayscale value corresponding to the first pixel in the first image block; obtain the second average grayscale value corresponding to the second image block according to the grayscale value corresponding to the second pixel in the second image block; and obtain the difference image block according to the second average grayscale value and the second average grayscale value.
[0128] In one embodiment of the present disclosure, the processing module 42 is also used to: perform low-pass filtering on the grayscale value corresponding to the first pixel in the first image block to obtain the filtered grayscale value corresponding to the first pixel in the first image block; perform low-pass filtering on the grayscale value corresponding to the second pixel in the second image block to obtain the filtered grayscale value corresponding to the second pixel in the second image block; when the processing module 42 obtains the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block, the processing module 42 is specifically used to: obtain the difference image block according to the filtered grayscale value corresponding to the first pixel in the first image block and the filtered grayscale value corresponding to the second pixel in the second image block.
[0129] In one embodiment of the present disclosure, when generating a frame difference picture based on the difference image block, the processing module 42 is specifically used to: obtain the image block coordinates corresponding to the difference image block, the image block coordinates representing the position of the difference image block in the first image frame or the second image frame; generate a coordinate sequence based on the image block coordinates corresponding to each difference image block; and arrange and splice each difference image block according to the generated coordinate sequence to generate a frame difference picture.
[0130] In one embodiment of the present disclosure, the difference image block includes a first difference image block and a second difference image block, wherein the first difference image block is an image block with a color brightness difference, and the second difference image block is an image block with a transparency difference; when the processing module 42 compares the first image block and the second image block at the same position in the first image frame and the second image frame to obtain at least one difference image block, it is specifically used to: respectively obtain the pixel value of the first pixel point in the first image block and the pixel value of the second pixel point in the second image block; and obtain the first difference image block and the second difference image block according to the pixel value of the first pixel point and the pixel value of the second pixel point.
[0131] In one embodiment of the present disclosure, the pixel value includes a three-channel color brightness value and a one-channel transparency value; when the processing module 42 obtains the first difference image block and the second difference image block according to the pixel value of the first pixel point and the pixel value of the second pixel point, it is specifically used to: obtain the first difference image block according to the color brightness value of the first pixel point in the first image block and the color brightness value of the corresponding second pixel point in the second image block; obtain the second difference image block according to the transparency value of the first pixel point in the first image block and the transparency value of the corresponding second pixel point in the second image block.
[0132] In one embodiment of the present disclosure, the processing module 42 is further used to: generate restoration information based on the frame difference picture, and the restoration information is used to characterize the position of the difference content in the frame difference picture in the second image frame; the generation module 43 is specifically used to: generate animation data corresponding to the target animation based on the first image frame, the frame difference picture and the restoration information.
[0133] In one embodiment of the present disclosure, the processing module 42 is further used to: obtain the transparency value corresponding to each pixel in the first image frame and the second image frame; based on the transparency value, weight the color brightness value corresponding to each pixel in the first image frame and the second image frame to obtain a first weighted image frame corresponding to the first image frame and a second weighted image frame corresponding to the second image frame; when the processing module 42 obtains the frame difference picture according to the first image frame and the second image frame, it is specifically used to: obtain the frame difference picture according to the first weighted image frame and the second weighted image frame.
[0134] The acquisition module 41, the processing module 42 and the generation module 43 are connected in sequence. The animation data generation device 4 provided in this embodiment can execute the above Figure 2-Figure 10 The technical solution of the corresponding method embodiment has similar implementation principles and technical effects, which will not be repeated here in this embodiment.
[0135] Corresponding to the animation data playing method of the above embodiment, Fig.13This is a structural block diagram of the animation data playback device provided by the embodiment of the present disclosure. For the convenience of explanation, only the parts related to the embodiment of the present disclosure are shown. Fig.13 , the animation data playing device 5 comprises:
[0136] The acquisition module 51 is used to acquire the animation data corresponding to the target animation. The animation data is obtained by Figure 2-Figure 10 Generated by the animation data generating method provided by any corresponding embodiment;
[0137] A processing module 52 is used to obtain a first image frame and a second image frame according to the animation data, wherein the first image frame is an animation start frame of the target animation, and the second image frame is an image frame next to the first image frame;
[0138] The playing module 53 is used to play at least the first image frame and the second image frame in sequence.
[0139] In one embodiment of the present disclosure, the animation data also includes restoration information, and the restoration information is used to represent the position of the difference content in the frame difference picture in the second image frame.
[0140] In one embodiment of the present disclosure, the animation data includes a first image frame, a first frame difference picture and a second frame difference picture, wherein the first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame; the processing module 52 is specifically used to: obtain the first image frame in the animation data; generate the second image frame according to the first image frame, the first frame difference picture and the second frame difference picture.
[0141] The acquisition module 51, the processing module 52 and the playback module 53 are connected in sequence. The animation data playback device 5 provided in this embodiment can execute the above Fig.11 The technical solution of the corresponding method embodiment has similar implementation principles and technical effects, which will not be repeated here in this embodiment.
[0142] Fig.14 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown in FIG. Fig.14 As shown, the electronic device 6 includes:
[0143] A processor 61, and a memory 62 communicatively connected to the processor 61;
[0144] The memory 62 stores computer executable instructions;
[0145] The processor 61 executes the computer execution instructions stored in the memory 62 to implement the following Figure 2-Figure 10 The animation data generation method in the embodiment shown, or, implementing the following Fig.11The animation data playing method in the illustrated embodiment.
[0146] Optionally, the processor 61 and the memory 62 are connected via a bus 63 .
[0147] For related instructions, please refer to Figure 2-Figure 11 The relevant descriptions and effects corresponding to the steps in the corresponding embodiments can be understood, and no further elaboration is made here.
[0148] The present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the following is implemented: Figure 2-Figure 10 The animation data generation method in the embodiment shown, or, implementing the following Fig.11 The animation data playing method in the illustrated embodiment.
[0149] The present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements Figure 2-Figure 10 The animation data generation method in the embodiment shown, or, implementing the following Fig.11 The animation data playing method in the illustrated embodiment.
[0150] refer to Fig.15 , which shows a schematic diagram of the structure of an electronic device 900 suitable for implementing the embodiment of the present disclosure, and the electronic device 900 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.15 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0151] like Fig.15As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 to a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0152] Typically, the following devices may be connected to the I / O interface 905: input devices 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 908 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.15 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0153] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0154] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0155] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0156] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0157] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0158] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0159] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0160] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0161] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0162] In a first aspect, according to one or more embodiments of the present disclosure, there is provided a method for generating animation data, comprising:
[0163] Obtain a set of images to be processed, the set of images to be processed comprising at least a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is a subsequent image frame adjacent to the first image frame; obtain a frame difference picture based on the first image frame and the second image frame, the frame difference picture representing the difference content of the second image frame relative to the first image frame; generate animation data corresponding to the target animation based on the first image frame and the frame difference picture.
[0164] According to one or more embodiments of the present disclosure, the animation data includes a first frame difference picture and a second frame difference picture, wherein the first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; and the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame.
[0165] According to one or more embodiments of the present disclosure, the first frame difference picture is in the Joint Photographic Experts Group JPEG image format; and the second frame difference picture is in the Portable Network Graphics PNG image format.
[0166] According to one or more embodiments of the present disclosure, obtaining a frame difference picture based on the first image frame and the second image frame includes: dividing the first image frame and the second image frame based on the same specification to obtain a target number of first image blocks corresponding to the first image frame and a target number of second image blocks corresponding to the second image frame; comparing the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block, wherein the difference image block is a second image block different from the first image block at the same image block position; and generating the frame difference picture based on the difference image block.
[0167] According to one or more embodiments of the present disclosure, the comparing the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block includes: for each image block position, respectively obtaining a pixel value of a first pixel in the first image block and a pixel value of a second pixel in the second image block; obtaining a grayscale value corresponding to the first pixel according to the pixel value of the first pixel; obtaining a grayscale value corresponding to the second pixel according to the pixel value of the second pixel; and obtaining the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block.
[0168] According to one or more embodiments of the present disclosure, obtaining the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block includes: obtaining a first average grayscale value corresponding to the first image block according to the grayscale value corresponding to the first pixel in the first image block; obtaining a second average grayscale value corresponding to the second image block according to the grayscale value corresponding to the second pixel in the second image block; and obtaining the difference image block according to the second average grayscale value and the second average grayscale value.
[0169] According to one or more embodiments of the present disclosure, the method further includes: performing low-pass filtering on the grayscale value corresponding to the first pixel in the first image block to obtain the filtered grayscale value corresponding to the first pixel in the first image block; performing low-pass filtering on the grayscale value corresponding to the second pixel in the second image block to obtain the filtered grayscale value corresponding to the second pixel in the second image block; and obtaining the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block, including: obtaining the difference image block according to the filtered grayscale value corresponding to the first pixel in the first image block and the filtered grayscale value corresponding to the second pixel in the second image block.
[0170] According to one or more embodiments of the present disclosure, generating the frame difference picture based on the difference image block includes: obtaining image block coordinates corresponding to the difference image block, the image block coordinates representing the position of the difference image block in the first image frame or the second image frame; generating a coordinate sequence based on the image block coordinates corresponding to each of the difference image blocks; and arranging and splicing each of the difference image blocks according to the generated coordinate sequence to generate a frame difference picture.
[0171] According to one or more embodiments of the present disclosure, the difference image block includes a first difference image block and a second difference image block, wherein the first difference image block is an image block with a color brightness difference, and the second difference image block is an image block with a transparency difference; comparing the first image block and the second image block at the same position in the first image frame and the second image frame to obtain at least one difference image block includes: respectively obtaining a pixel value of a first pixel point in the first image block and a pixel value of a second pixel point in the second image block; and obtaining the first difference image block and the second difference image block according to the pixel value of the first pixel point and the pixel value of the second pixel point.
[0172] According to one or more embodiments of the present disclosure, the pixel value includes a color brightness value of three channels and a transparency value of one channel; and obtaining the first difference image block and the second difference image block according to the pixel value of the first pixel point and the pixel value of the second pixel point includes: obtaining the first difference image block according to the color brightness value of the first pixel point in the first image block and the color brightness value of the corresponding second pixel point in the second image block; and obtaining the second difference image block according to the transparency value of the first pixel point in the first image block and the transparency value of the corresponding second pixel point in the second image block.
[0173] According to one or more embodiments of the present disclosure, the method further includes: generating restoration information based on the frame difference picture, the restoration information being used to characterize the position of the difference content in the frame difference picture in the second image frame; generating animation data corresponding to the target animation based on the first image frame and the frame difference picture, including: generating animation data corresponding to the target animation based on the first image frame, the frame difference picture and the restoration information.
[0174] According to one or more embodiments of the present disclosure, the method also includes: obtaining a transparency value corresponding to each pixel in the first image frame and the second image frame; based on the transparency value, weighting the color brightness value corresponding to each pixel in the first image frame and the second image frame to obtain a first weighted image frame corresponding to the first image frame and a second weighted image frame corresponding to the second image frame; obtaining a frame difference picture based on the first image frame and the second image frame, including: obtaining the frame difference picture based on the first weighted image frame and the second weighted image frame.
[0175] In a second aspect, according to one or more embodiments of the present disclosure, there is provided an animation data playback method, comprising: obtaining animation data corresponding to a target animation, wherein the animation data is generated by the animation data generation method described in the first aspect and various possible designs of the first aspect; obtaining a first image frame and a second image frame according to the animation data, wherein the first image frame is an animation start frame of the target animation, and the second image frame is a subsequent image frame adjacent to the first image frame; and playing at least the first image frame and the second image frame in sequence.
[0176] In one embodiment of the present disclosure, the animation data further includes restoration information, and the restoration information is used to represent the position of the difference content in the frame difference picture in the second image frame.
[0177] According to one or more embodiments of the present disclosure, the animation data includes the first image frame, a first frame difference picture and a second frame difference picture, wherein the first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame; obtaining the first image frame and the second image frame according to the animation data includes: acquiring the first image frame in the animation data; generating the second image frame according to the first image frame, the first frame difference picture and the second frame difference picture.
[0178] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an animation data generating device, comprising:
[0179] An acquisition module, used for acquiring a to-be-processed image set, wherein the to-be-processed image set includes at least a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame next to the first image frame;
[0180] A processing module, configured to obtain a frame difference picture according to the first image frame and the second image frame, wherein the frame difference picture represents a difference content of the second image frame relative to the first image frame;
[0181] A generation module is used to generate animation data corresponding to the target animation according to the first image frame and the frame difference picture.
[0182] According to one or more embodiments of the present disclosure, the animation data includes a first frame difference picture and a second frame difference picture, wherein the first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; and the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame.
[0183] According to one or more embodiments of the present disclosure, the first frame difference picture is in the Joint Photographic Experts Group JPEG image format; and the second frame difference picture is in the Portable Network Graphics PNG image format.
[0184] According to one or more embodiments of the present disclosure, the processing module is specifically used to: divide the first image frame and the second image frame based on the same specifications to obtain a target number of first image blocks corresponding to the first image frame and a target number of second image blocks corresponding to the second image frame; compare the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block, wherein the difference image block is a second image block different from the first image block at the same image block position; and generate the frame difference picture based on the difference image block.
[0185] According to one or more embodiments of the present disclosure, when the processing module compares the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block, the processing module is specifically used to: obtain, for each image block position, a pixel value of a first pixel in the first image block and a pixel value of a second pixel in the second image block; obtain a grayscale value corresponding to the first pixel according to the pixel value of the first pixel; obtain a grayscale value corresponding to the second pixel according to the pixel value of the second pixel; and obtain the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block.
[0186] According to one or more embodiments of the present disclosure, when the processing module obtains the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block, the processing module is specifically used to: obtain a first average grayscale value corresponding to the first image block according to the grayscale value corresponding to the first pixel in the first image block; obtain a second average grayscale value corresponding to the second image block according to the grayscale value corresponding to the second pixel in the second image block; and obtain the difference image block according to the second average grayscale value and the second average grayscale value.
[0187] According to one or more embodiments of the present disclosure, the processing module is also used to: perform low-pass filtering on the grayscale value corresponding to the first pixel in the first image block to obtain the filtered grayscale value corresponding to the first pixel in the first image block; perform low-pass filtering on the grayscale value corresponding to the second pixel in the second image block to obtain the filtered grayscale value corresponding to the second pixel in the second image block; when the processing module obtains the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block, the processing module is specifically used to: obtain the difference image block according to the filtered grayscale value corresponding to the first pixel in the first image block and the filtered grayscale value corresponding to the second pixel in the second image block.
[0188] According to one or more embodiments of the present disclosure, when generating the frame difference picture based on the difference image block, the processing module is specifically used to: obtain image block coordinates corresponding to the difference image block, the image block coordinates representing the position of the difference image block in the first image frame or the second image frame; generate a coordinate sequence based on the image block coordinates corresponding to each of the difference image blocks; and arrange and splice each of the difference image blocks according to the generated coordinate sequence to generate a frame difference picture.
[0189] According to one or more embodiments of the present disclosure, the difference image block includes a first difference image block and a second difference image block, wherein the first difference image block is an image block with a color brightness difference, and the second difference image block is an image block with a transparency difference; when the processing module compares the first image block and the second image block at the same position in the first image frame and the second image frame to obtain at least one difference image block, the processing module is specifically used to: respectively obtain a pixel value of a first pixel point in the first image block and a pixel value of a second pixel point in the second image block; and obtain the first difference image block and the second difference image block according to the pixel value of the first pixel point and the pixel value of the second pixel point.
[0190] According to one or more embodiments of the present disclosure, the pixel value includes a three-channel color brightness value and a one-channel transparency value; when the processing module obtains the first difference image block and the second difference image block according to the pixel value of the first pixel point and the pixel value of the second pixel point, it is specifically used to: obtain the first difference image block according to the color brightness value of the first pixel point in the first image block and the color brightness value of the corresponding second pixel point in the second image block; obtain the second difference image block according to the transparency value of the first pixel point in the first image block and the transparency value of the corresponding second pixel point in the second image block.
[0191] According to one or more embodiments of the present disclosure, the processing module is further used to: generate restoration information based on the frame difference picture, and the restoration information is used to characterize the position of the difference content in the frame difference picture in the second image frame; the generation module is specifically used to: generate animation data corresponding to the target animation based on the first image frame, the frame difference picture and the restoration information.
[0192] According to one or more embodiments of the present disclosure, the processing module is further used to: obtain the transparency value corresponding to each pixel in the first image frame and the second image frame; based on the transparency value, weight the color brightness value corresponding to each pixel in the first image frame and the second image frame to obtain a first weighted image frame corresponding to the first image frame and a second weighted image frame corresponding to the second image frame; when the processing module obtains the frame difference picture according to the first image frame and the second image frame, it is specifically used to: obtain the frame difference picture according to the first weighted image frame and the second weighted image frame.
[0193] In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided an animation data playback device, comprising:
[0194] An acquisition module, used for acquiring animation data corresponding to a target animation, wherein the animation data is generated by the animation data generation method described in the first aspect and various possible designs of the first aspect;
[0195] A processing module, configured to obtain a first image frame and a second image frame according to the animation data, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame subsequent to the first image frame;
[0196] A playing module is used to play at least the first image frame and the second image frame in sequence.
[0197] According to one or more embodiments of the present disclosure, the animation data further includes restoration information, and the restoration information is used to characterize the position of the difference content in the frame difference picture in the second image frame.
[0198] According to one or more embodiments of the present disclosure, the animation data includes the first image frame, a first frame difference picture and a second frame difference picture, wherein the first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame; the processing module is specifically used to: obtain the first image frame in the animation data; and generate the second image frame according to the first image frame, the first frame difference picture and the second frame difference picture.
[0199] In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the animation data generation method as described in the first aspect and various possible designs of the first aspect, or to implement the animation data playback method as described in the second aspect and various possible designs of the second aspect.
[0200] In a sixth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the animation data generation method described in the first aspect and various possible designs of the first aspect is implemented, or the animation data playback method described in the second aspect and various possible designs of the second aspect is implemented.
[0201] In the seventh aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the animation data generation method as described in the first aspect and various possible designs of the first aspect, or implements the animation data playback method as described in the second aspect and various possible designs of the second aspect.
[0202] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0203] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0204] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for generating animation data, characterized in that: include: Acquire a to-be-processed image set, wherein the to-be-processed image set includes at least a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame subsequent to the first image frame; Obtaining a frame difference picture according to the first image frame and the second image frame, wherein the frame difference picture represents a difference content of the second image frame relative to the first image frame; Animation data corresponding to the target animation is generated according to the first image frame and the frame difference picture.
2. The method according to claim 1, characterized in that The animation data includes a first frame difference picture and a second frame difference picture, wherein the first frame difference picture represents the color brightness difference of the second image frame relative to the first image frame; and the second frame difference picture represents the transparency difference of the second image frame relative to the first image frame.
3. The method according to claim 2, characterized in that The first frame difference picture is in the Joint Photographic Experts Group JPEG image format; the second frame difference picture is in the Portable Network Graphics PNG image format.
4. The method according to claim 1, characterized in that: The obtaining a frame difference picture according to the first image frame and the second image frame includes: Dividing the first image frame and the second image frame based on the same specification to obtain a target number of first image blocks corresponding to the first image frame and a target number of second image blocks corresponding to the second image frame; Comparing a first image block and a second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block, where the difference image block is a second image block different from the first image block at the same image block position; The frame difference picture is generated according to the difference image block.
5. The method according to claim 4, characterized in that The step of comparing the first image block and the second image block at the same image block position in the first image frame and the second image frame to obtain at least one difference image block includes: For each image block position, respectively obtaining a pixel value of a first pixel point in the first image block and a pixel value of a second pixel point in the second image block; Obtaining a grayscale value corresponding to the first pixel point according to the pixel value of the first pixel point; Obtaining a grayscale value corresponding to the second pixel point according to the pixel value of the second pixel point; The difference image block is obtained according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block.
6. The method according to claim 5, characterized in that The obtaining the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block includes: Obtaining a first average grayscale value corresponding to the first image block according to the grayscale value corresponding to the first pixel in the first image block; Obtaining a second average grayscale value corresponding to the second image block according to the grayscale value corresponding to the second pixel in the second image block; The difference image block is obtained according to the second average grayscale value and the second average grayscale value.
7. The method according to claim 5, characterized in that The method further comprises: Performing low-pass filtering on the grayscale value corresponding to the first pixel in the first image block to obtain a filtered grayscale value corresponding to the first pixel in the first image block; Performing low-pass filtering on the grayscale value corresponding to the second pixel in the second image block to obtain a filtered grayscale value corresponding to the second pixel in the second image block; Obtaining the difference image block according to the grayscale value corresponding to the first pixel in the first image block and the grayscale value corresponding to the second pixel in the second image block, comprising: The difference image block is obtained according to the filtered gray value corresponding to the first pixel in the first image block and the filtered gray value corresponding to the second pixel in the second image block.
8. The method according to claim 4, characterized in that The step of generating the frame difference picture according to the difference image block comprises: Acquire image block coordinates corresponding to the difference image block, where the image block coordinates represent a position of the difference image block in the first image frame or the second image frame; Generate a coordinate sequence according to the image block coordinates corresponding to each of the difference image blocks; The difference image blocks are arranged and spliced according to the generated coordinate sequence to generate a frame difference picture.
9. The method according to claim 4, characterized in that The difference image block includes a first difference image block and a second difference image block, wherein the first difference image block is an image block with a color brightness difference, and the second difference image block is an image block with a transparency difference; Comparing a first image block and a second image block at the same position in the first image frame and the second image frame to obtain at least one difference image block includes: Respectively obtaining a pixel value of a first pixel point in the first image block and a pixel value of a second pixel point in the second image block; The first difference image block and the second difference image block are obtained according to the pixel value of the first pixel point and the pixel value of the second pixel point.
10. The method according to claim 9, characterized in that The pixel value includes three-channel color brightness values and one-channel transparency value; The obtaining the first difference image block and the second difference image block according to the pixel value of the first pixel point and the pixel value of the second pixel point includes: Obtaining the first difference image block according to a color brightness value of a first pixel in the first image block and a color brightness value of a corresponding second pixel in the second image block; The second difference image block is obtained according to the transparency value of a first pixel in the first image block and the transparency value of a corresponding second pixel in the second image block.
11. The method according to any one of claims 1 to 10, characterized in that: The method further comprises: Generate restoration information according to the frame difference picture, where the restoration information is used to represent the position of the difference content in the frame difference picture in the second image frame; Generating animation data corresponding to the target animation according to the first image frame and the frame difference picture, including: Animation data corresponding to the target animation is generated according to the first image frame, the frame difference picture and the restoration information.
12. The method according to any one of claims 1 to 10, characterized in that: The method further comprises: Obtaining transparency values corresponding to each pixel in the first image frame and the second image frame; Based on the transparency value, weighting the color brightness value corresponding to each pixel in the first image frame and the second image frame to obtain a first weighted image frame corresponding to the first image frame and a second weighted image frame corresponding to the second image frame; Obtaining a frame difference picture according to the first image frame and the second image frame, including: The frame difference picture is obtained according to the first weighted image frame and the second weighted image frame.
13. A method for playing animation data, characterized in that: include: Acquire animation data corresponding to the target animation, wherein the animation data is generated by the animation data generation method according to any one of claims 1 to 12; According to the animation data, a first image frame and a second image frame are obtained, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame next to the first image frame; At least the first image frame and the second image frame are played in sequence.
14. The method according to claim 13, characterized in that The animation data includes the first image frame, a first frame difference picture, and a second frame difference picture, wherein the first frame difference picture represents a color brightness difference between the second image frame and the first image frame; and the second frame difference picture represents a transparency difference between the second image frame and the first image frame; The step of obtaining the first image frame and the second image frame according to the animation data comprises: Obtaining the first image frame in the animation data; The second image frame is generated according to the first image frame, the first frame difference picture and the second frame difference picture.
15. An animation data generating device, characterized in that: include: An acquisition module, used for acquiring a to-be-processed image set, wherein the to-be-processed image set includes at least a first image frame and a second image frame, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame next to the first image frame; A processing module, configured to obtain a frame difference picture according to the first image frame and the second image frame, wherein the frame difference picture represents a difference content of the second image frame relative to the first image frame; A generation module is used to generate animation data corresponding to the target animation according to the first image frame and the frame difference picture.
16. An animation data playback device, characterized in that: include: An acquisition module, used for acquiring animation data corresponding to a target animation, wherein the animation data is generated by the animation data generation method according to any one of claims 1 to 12; A processing module, configured to obtain a first image frame and a second image frame according to the animation data, wherein the first image frame is an animation start frame of a target animation, and the second image frame is an image frame subsequent to the first image frame; A playing module is used to play at least the first image frame and the second image frame in sequence.
17. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 14.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 14 is implemented.
19. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 14 when being executed by a processor.
Citation Information
Cited By
Image processing method and device, equipment and medium
CN122120442A
