Animation generation method and apparatus, and electronic device and computer-readable storage medium
By generating animation frame images through pixel blending, the complexity of animation production is solved, and the efficiency of animation production and gradient effect generation is improved.
Patent Information
- Application Number
- PCT/CN2025/114151
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-15
- Filing Date
- 2025-08-12
- Publication Date
- 2026-02-19
AI Technical Summary
Current animation production techniques are complex and inefficient, mainly because each image in a sequence of frames needs to be manually edited and its content adjusted.
By acquiring the image to be processed and the target description information, multiple frame images are generated using pixel blending processing to achieve an animation gradient effect.
It simplifies the animation production process, improves animation production efficiency, and generates animations with different gradient effects by changing the target description information.
Smart Images

Figure CN2025114151_19022026_PF_FP_ABST
Abstract
Description
Animation generation method and device, electronic equipment and computer readable storage medium
[0001] The present application claims priority to the Chinese patent application No. 202411120064.5, filed on August 15, 2024, entitled "Animation generation method, device, electronic equipment and computer readable storage medium", the entire content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] Embodiments of the present application relate to the field of image processing, in particular to an animation generation method, device, electronic equipment and computer readable storage medium. BACKGROUND
[0003] Animation effects are very common in mobile phones and other devices. Animation usually has a large overhead, and the use of cpu / gpu is also high, which can also cause an increase in power consumption.
[0004] Currently, the most commonly used method for animation production is image sequence frames, that is, directly making the animation into a series of images and configuring the playback order of each image. TECHNICAL PROBLEM
[0005] Currently, each image in the image sequence frame is usually obtained by copying the first frame image of the animation and manually editing the image to adjust the content displayed by the image, which makes the animation production complex and inefficient. TECHNICAL SOLUTION
[0006] Embodiments of the present application provide an animation generation method, device, electronic equipment and computer readable storage medium, which can simplify the production of animation and improve the efficiency of animation production.
[0007] In a first aspect, embodiments of the present application provide an animation generation method, which comprises:
[0008] obtaining a first to-be-processed image and target description information for controlling an animation gradient effect;
[0009] performing pixel blending processing on the first to-be-processed image according to the target description information to obtain one or more frame images, the one or more frame images being used to generate a target animation corresponding to the first to-be-processed image.
[0010] In a second aspect, embodiments of the present application also provide an animation generation device, which comprises:
[0011] an obtaining module configured to obtain a first to-be-processed image and target description information for controlling an animation gradient effect;
[0012] generating one or more frame images by performing pixel blending on the first to-be-processed image according to the target description information, the one or more frame images being used to generate a target animation corresponding to the first to-be-processed image. Optionally, in some embodiments of the present application, the target description information includes a target frame sequence, the target frame sequence including N frame description images, each of the frame description images containing first blending ratio information used to perform pixel blending on the first to-be-processed image, the N being an integer greater than 0, and the generating module includes:
[0013] obtaining an i-th frame description image;
[0014] performing pixel blending on the first to-be-processed image according to the first blending ratio information contained in the i-th frame description image to obtain an i-th frame image, the i-th frame image belonging to the one or more frame images, the i being an integer greater than 0 and less than or equal to N;
[0015] determining whether at least one to-be-processed image in the first to-be-processed image is updated;
[0016] if yes, obtaining an updated second to-be-processed image and an (i+1)-th frame description image;
[0017] performing pixel blending on the second to-be-processed image according to the first blending ratio information contained in the (i+1)-th frame description image to obtain an (i+1)-th frame image, the (i+1)-th frame image belonging to the one or more frame images.
[0018] In some embodiments of the present application, the target description information includes a target description image, and the generating module includes:
[0019] an extracting unit configured to extract pixel blending parameter information from the target description image, the pixel blending parameter information corresponding to a value of a pixel in the target description image;
[0020] a first determining unit configured to determine a frame image depth offset based on a preset display depth and a preset number of frame images, and obtain a frame image depth of each frame image based on the preset display depth and the frame image depth offset;
[0021] a second determining unit configured to determine second blending ratio information based on the frame image depth and the pixel blending parameter information for each frame image depth;
[0022] a blending unit configured to perform pixel blending on the first to-be-processed image according to the second blending ratio information corresponding to each frame image depth to obtain the one or more frame images.
[0023] In some embodiments of the present application, the apparatus further comprises a first configuration module, which comprises:
[0024] an acquisition unit configured to acquire a target frame sequence, the target frame sequence comprising at least one frame description image for describing a gradual change degree of an image;
[0025] a third determination unit configured to determine target pixel position information and pixel value information corresponding to each frame description image based on an order of the frame description images in the target frame sequence and the first blending ratio information recorded in each frame description image;
[0026] a generation unit configured to generate a target description image according to the target pixel position information and the pixel value information of each frame description image, wherein the pixel value information of each pixel point in the target description image is taken as pixel blending parameter information.
[0027] In some embodiments of the present application, the third determination unit comprises:
[0028] an extraction subunit configured to extract frame description images in sequence based on the order of the frame description images in the target frame sequence;
[0029] a first determination subunit configured to take the position information of a target description pixel point in the frame description image whose first blending ratio information satisfies a preset condition as candidate pixel position information;
[0030] a filtering subunit configured to filter out repeated candidate pixel position information identical to a previous frame description image from the candidate pixel position information to obtain target pixel position information;
[0031] a second determination subunit configured to determine pixel value information of the target pixel position information according to preset value information and the order of the frame description image in the target frame sequence.
[0032] In some embodiments of the present application, the second determination subunit is specifically configured to:
[0033] determine a value offset according to the order of the frame description image in the target frame sequence;
[0034] obtain the pixel value information of the target pixel position information according to the preset value information and the value offset.
[0035] In some embodiments of the present application, the generation unit comprises:
[0036] a first generation subunit configured to perform image generation processing based on each target pixel position information and the pixel value information of each target pixel position information to obtain a target description image.
[0037] In some embodiments of the present application, the device further comprises a screening unit, which comprises:
[0038] a response subunit configured to, in response to the animation selection operation, screen a reference animation, the reference animation comprising a first frame image, a last frame image and one or more intermediate frame images, the reference animation being consistent with the animation transition effect of the target animation;
[0039] a second generation subunit configured to obtain a frame description image corresponding to each intermediate frame image according to the first frame image, the last frame image and each intermediate frame image;
[0040] a third generation subunit configured to obtain a target frame sequence according to the order of each intermediate frame image and the frame description image.
[0041] In some embodiments of the present application, the second generation subunit is specifically configured to:
[0042] for each intermediate frame image, obtain first blending ratio information according to a first pixel value of the intermediate frame image, a second pixel value of the first frame image and a third pixel value of the last frame image, the first blending ratio information comprising a pixel blending ratio corresponding to each pixel point of the intermediate frame image;
[0043] obtain the frame description image corresponding to the intermediate frame image according to the first blending ratio information.
[0044] In some embodiments of the present application, the device further comprises a second configuration module, which comprises:
[0045] an image determination unit configured to determine a target image of the animation transition direction from the first to-be-processed image;
[0046] a gray scale extraction unit configured to extract a gray scale value of each pixel point in a luminance channel from the target image to obtain reference luminance information;
[0047] an image generation unit configured to generate a target description image based on the reference luminance information, wherein the reference luminance information in the target description image is used as pixel blending parameter information.
[0048] In a third aspect, the embodiments of the present application further provide an electronic device, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the computer program is executed by the processor to implement the steps in the above-mentioned animation generation method.
[0049] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the steps of the animation generation method.
[0050] In a fifth aspect, the embodiments of the present application further provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the method provided in various optional implementation manners of the embodiments of the present application. Advantages
[0051] To sum up, the embodiments of the present application obtain a first to-be-processed image and target description information for controlling an animation gradient effect, perform pixel mixing processing on the to-be-processed image according to the target description information to obtain one or more frame images, and generate a target animation corresponding to the first to-be-processed image according to the one or more frame images. The pixel mixing processing on the first to-be-processed image by the target description information for controlling the animation gradient effect enables the animation with the gradient effect to be quickly generated in the manner of pixel mixing. The embodiments of the present application replace the manual editing and production manner of multiple frame images in the related art with the manner of pixel mixing, thereby reducing the complexity of animation production, improving the animation production efficiency, and enabling a new animation with the gradient effect to be generated by only replacing the target description information, thereby improving the generation efficiency of animations with different gradient effects. BRIEF DESCRIPTION OF DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.
[0053] FIG. 1 is a schematic diagram of a scene in which a terminal device executes the animation generation method according to an embodiment of the present application;
[0054] FIG. 2 is a flowchart of the animation generation method according to an embodiment of the present application;
[0055] FIG. 3 is a guide diagram for generating a frame image according to an embodiment of the present application;
[0056] FIG. 4 is a flowchart of a second animation generation method according to an embodiment of the present application;
[0057] FIG. 5 is a first schematic diagram of pixel mixing processing to obtain a frame image according to an embodiment of the present application;
[0058] FIG. 6 is a flow diagram of a third animation generation method according to an embodiment of the present application;
[0059] FIG. 7 is a side view of an uneven ground and a water level according to an embodiment of the present application;
[0060] FIG. 8 is a second diagram of a frame image obtained by pixel mixing according to an embodiment of the present application;
[0061] FIG. 9 is a diagram of generating a single target description image from a plurality of frame description images according to an embodiment of the present application;
[0062] FIG. 10 is a diagram of an animation fade effect according to an embodiment of the present application;
[0063] FIG. 11 is a diagram of pixel value information of a target description image according to an embodiment of the present application;
[0064] FIG. 12 is a diagram of generating a target description image based on a target frame sequence according to an embodiment of the present application;
[0065] FIG. 13 is a diagram of a structure of an animation generation apparatus according to an embodiment of the present application;
[0066] FIG. 14 is a diagram of a structure of an electronic device according to an embodiment of the present application. Embodiments of the present application
[0067] The technical solutions in the present application will be described clearly and completely below in conjunction with the drawings in the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0068] The embodiment of the present application provides an animation generation method, device, electronic equipment and computer readable storage medium. Specifically, the embodiment of the present application provides an animation generation device suitable for an electronic equipment, the electronic equipment includes a terminal equipment or a server, the terminal equipment includes but is not limited to a mobile phone, a tablet computer, a notebook computer or a television and the like; the server can be an independent physical server, can be a server cluster or a distributed system formed by multiple physical servers, can also be a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content distribution network (CDN, Content Delivery Network), and big data and artificial intelligence platform, etc., the server can be directly or indirectly connected through wired or wireless communication mode. Specifically, the animation generation method of the embodiment of the present application can be executed by the terminal equipment alone, or executed by the server alone, or executed by the terminal equipment and the server together, please refer to Fig. 1, Fig. 1 is a scene schematic diagram of the terminal equipment executing the animation generation method provided by the embodiment of the present application, wherein the specific execution process of the terminal equipment executing the animation generation method is as follows: the terminal equipment 10 receives interface input to obtain a first to-be-processed image, and obtains target description information for controlling animation gradient effect in response to gradient effect selection operation, and then triggers the generation of a target animation based on the first to-be-processed image and the target description information in response to button trigger operation, specifically: performing pixel mixing processing on the first to-be-processed image according to the target description information to obtain one or more frame images, and generating a target animation through the to-be-processed image and the frame image.
[0069] It can be understood that, by the pixel mixing processing of the first to-be-processed image through the target description information for controlling animation gradient effect, the embodiment of the present application realizes the quick generation of the animation with gradient effect through the pixel mixing. By replacing the manual editing and manufacturing mode of multiple frame images in the related art with the pixel mixing mode, the embodiment of the present application reduces the complexity of animation production, improves the animation production efficiency, and in the embodiment of the present application, only the target description information needs to be replaced to generate a new animation with gradient effect, thereby improving the generation efficiency of animations with different gradient effects.
[0070] The following will be described in detail. It should be noted that the description order of the following embodiments is not limited as the priority order of the embodiments.
[0071] Please refer to Fig. 2, which is a flowchart of the first animation generation method provided by the embodiment of the present application. Although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown in the figure. Specifically, the specific flow of the animation generation method is as follows:
[0072] 201、obtain a first to-be-processed image and target description information for controlling an animation fade effect.
[0073] An animation is realized by playing each frame image contained in a corresponding image sequence frame in time sequence. Each frame image in the image sequence frame is a main element or main content of the animation. In the embodiments of the present application, the first to-be-processed image is also a main element or main content of the animation, and the first to-be-processed image contains one or more to-be-processed images that need to add a fade effect. In an optional implementation, the first to-be-processed image can include a first frame image that constitutes the animation, can include a last frame image that constitutes the animation, and can also include other intermediate frame images that constitute the animation. The first frame image is also called a foreground image sometimes, and the last frame image is also called a background image sometimes.
[0074] The first to-be-processed image can be obtained through user input or in response to a search instruction, from the local or from a server. For example, when a user wants to generate an animation containing specific scene content, a first to-be-processed image containing the specific scene content can be selected, and then an animation meeting the specific scene content requirement can be generated through the first to-be-processed image.
[0075] The animation fade effect specifically refers to a content display effect in which specific picture content is gradually displayed in a preset display manner. For example, taking a first to-be-processed image including a foreground image and a background image as an example, the animation fade effect can refer to a fade from the foreground image to the background image, that is, the content of the foreground image is gradually faded out, and the content of the background image is gradually displayed. The animation fade effect in the embodiments of the present application also includes various effects, for example, different regions have the same or different fade speeds during the fade from the foreground image to the background image, or fade according to a specific pattern, such as a diamond, a rectangle, or a circle.
[0076] In the embodiments of the present application, for an animation with a fade effect, each frame image constituting the animation can be obtained by continuously superimposing the content of the background image on the foreground image (that is, continuously increasing the mixing ratio of the background image). Then, by controlling the playing order of each frame image, the trend of the content of the background image increasing is presented, and the fade effect of the background content gradually displaying is achieved. Therefore, the target description information for a certain animation fade effect in the embodiments of the present application can describe the animation fade effect, record information that can directly or indirectly indicate the mutual superimposition ratio of the foreground image and the background image in each frame image forming the animation, and based on the control of the target description information, the first to-be-processed image can be used to generate an animation with the corresponding animation fade effect.
[0077] The target description information can be preconfigured, and then obtained by user selection when generating the animation. Alternatively, the target description information can also be obtained by extracting a previous animation of the same gradient effect, for example, based on the previous animation, the target description information of the previous animation is triggered to be extracted by a "take the same" control, and the target animation is generated based on the target description information.
[0078] 202. Perform pixel mixing processing on the to-be-processed image according to the target description information to obtain one or more frame images, and the one or more frame images are used to generate a target animation corresponding to the first to-be-processed image.
[0079] In the embodiment of the present application, after obtaining the first to-be-processed image and the target description information for controlling the animation gradient effect, the to-be-processed image is subjected to pixel mixing processing based on the control of the target description information. The pixel mixing processing refers to the fusion of pixel values in the to-be-processed image. For example, taking a first to-be-processed image including a foreground image and a background image as an example, the values of the pixels in the foreground image and the values of the pixels in the background image are fused according to a certain proportion to obtain new pixel values. After the pixels at corresponding positions in the foreground image and the background image are fused, one or more frame images with new pixel values are obtained, and the image size of the to-be-processed image and the frame image is the same.
[0080] For example, for the second frame image or the first few frame images of the target animation to be generated, the mixing proportion of the background image can be set to be small, and for the 10th frame image or the 20th frame image or other later frame images of the target animation to be generated, the corresponding mixing proportion can be continuously increased, that is, according to the order of the frame images in the animation, the proportion of the content of the background image in the frame image obtained by final mixing is continuously increased, so that the content of the background image is continuously increased during the animation playing process, and the effect of gradually displaying the background image is achieved.
[0081] For example, please refer to FIG. 3, which is a guide diagram for generating frame images provided by the embodiment of the present application. Taking pixel mixing processing of a foreground image and a background image based on target description information as an example, specifically, the foreground image F and the background image B are subjected to pixel mixing processing by an image processor (gpu) based on the target description information D to obtain a plurality of frame images (i.e. mixed images 1-n).
[0082] It can be understood that in the embodiment of the present application, after obtaining each frame image, each frame image can be used as an intermediate frame image, and the target animation is obtained by sequentially playing the to-be-processed image and each frame image.
[0083] To sum up, the embodiment of the present application realizes the generation of the animation with the gradient effect by the pixel mixing manner through the pixel mixing processing of the first to-be-processed image by using the target description information for controlling the animation gradient effect. By using the pixel mixing manner instead of the manual editing and manufacturing manner of the multiple frame images in the related art, the embodiment of the present application reduces the complexity of the animation production, improves the animation production efficiency, and in the embodiment of the present application, only the target description information needs to be replaced to generate the new animation with the gradient effect, thereby improving the generation efficiency of the animations with different gradient effects.
[0084] It should be noted that in the embodiment of the present application, the target description information for indicating the animation gradient effect can be presented in multiple different forms of information and be utilized. In an optional manner, based on the embodiment of FIG. 2, the target description information is presented in the form of the target frame sequence, as shown in FIG. 4, the present application further provides a flowchart of a second animation generation method. Please refer to FIG. 4, the flowchart of the second animation generation method provided by the embodiment of the present application includes the contents of steps 401-406.
[0085] 401. Obtain a first to-be-processed image and target description information for controlling an animation gradient effect.
[0086] The first to-be-processed image includes a foreground image and a background image, the target description information includes a target frame sequence, the target frame sequence includes N frame description images, each frame description image contains first mixing ratio information for pixel mixing processing of the first to-be-processed image, and N is an integer greater than 0.
[0087] In the embodiment of the present application, part of the contents can be understood by referring to step 201 of FIG. 2.
[0088] The first to-be-processed image includes a foreground image and a background image, and in the process of generating the target animation, the foreground image and the background image are first obtained. Taking the foreground image and the background image containing the image contents corresponding to 3*3 pixel points as an example, as shown in FIG. 5, FIG. 5(a) is the foreground image, which contains the image contents corresponding to F1-F9, a total of 9 pixel points, and FIG. 5(b) is the background image, which contains the image contents corresponding to B1-B9, a total of 9 pixel points.
[0089] It should be noted that the target description information in the embodiments of the present application includes a target frame sequence, and the target frame sequence includes N frame description images, and each frame description image records first blending ratio information of a frame image. For example, as shown in FIG. 5(c), the i th frame description image in the N frame description images is shown, i is an integer greater than 0 and less than or equal to N. The first blending ratio information of the i th frame description image records a pixel blending ratio condition of the foreground image and the background image when blending, and the pixel blending ratio condition can be recorded or represented by the values of each pixel in the frame description image, and each pixel in the frame description image corresponds to a pixel blending ratio. As shown in FIG. 5(c), the first blending ratio information recorded in the i th frame description image is that the pixel blending ratio of the first pixel point Di, 1 is 10%, the pixel blending ratio of the second pixel point Di, 2 is 10%, the pixel blending ratio of Di, 3 is 15%, the pixel blending ratio of Di, 4 is 20%, the pixel blending ratio of Di, 5 is 20%, the pixel blending ratio of Di, 6 is 20%, the pixel blending ratio of Di, 7 is 15%, the pixel blending ratio of Di, 8 is 10%, and the pixel blending ratio of Di, 9 is 10%. The pixel blending ratio is used to represent the blending ratio of the corresponding two pixel points in the foreground image and the background image, that is, each first pixel blending ratio information includes the pixel blending ratios of multiple pixel points. For example, Di, 1 represents that the pixel blending ratio of F1 and B1 is 10%, Di, 2 represents that the pixel blending ratio of F2 and B2 is 10%, Di, 3 represents that the pixel blending ratio of F3 and B3 is 15%, Di, 4 represents that the pixel blending ratio of F4 and B4 is 20%, Di, 5 represents that the pixel blending ratio of F5 and B5 is 20%, Di, 6 represents that the pixel blending ratio of F6 and B6 is 20%, Di, 7 represents that the pixel blending ratio of F7 and B7 is 15%, Di, 8 represents that the pixel blending ratio of F8 and B8 is 10%, and Di, 9 represents that the pixel blending ratio of F9 and B9 is 10%. At least two frame description images in the multiple frame description images record different first blending ratio information. For example, the first blending ratio information recorded in the i+1 th frame description image is that the pixel blending ratio of the first pixel point Di+1, 1 is 10%, the pixel blending ratio of the second pixel point Di+1, 2 is 15%, the pixel blending ratio of Di+1, 3 is 20% Di+1, 7 is 15%, the pixel blending ratio of Di+1, 8 is 15%, and the pixel blending ratio of Di+1, 9 is 10%.
[0090] In step 402, the i th frame description image is acquired.
[0091] In the embodiments of the present application, after the first to-be-processed image and the target description information are acquired, when the i-th frame image is to be generated, the i-th frame description image needs to be acquired from the target description information. Similarly, when the i+1-th frame image is to be generated, the i+1-th frame description image needs to be acquired from the target description information.
[0092] In step 403, pixel mixing processing is performed on the first to-be-processed image according to the first mixing ratio information contained in the i-th frame description image, to obtain the i-th frame image, the i-th frame image belonging to the one or more frame images, i being an integer greater than 0 and less than or equal to N.
[0093] In the embodiments of the present application, the pixel mixing ratio in the first mixing ratio information can represent the mixing ratio of the pixel points in the foreground image, or the mixing ratio of the pixel points in the background image. For example, the pixel mixing ratio represents the mixing ratio of the pixel points in the foreground image, which is taken as an example for description in the embodiments of the present application. That is, the pixel mixing ratio represents the mixing proportion of the pixel points in the foreground image when the pixel points in the foreground image and the background image are mixed.
[0094] Correspondingly, after each pixel point in the foreground image and the background image is mixed according to the corresponding pixel mixing ratio, each pixel point used to compose the frame image is obtained, and the combination of each pixel point obtains the frame image. For example, the calculation of the final pixel point T i,j of the i-th frame image, which is obtained by mixing the pixel point F j of the foreground image and the pixel point B j of the background image based on the pixel point D i,j of the i-th frame description image, can refer to the following formula:
[0095] T i,j = F j * D i,j + B j * (1-D i,j ).
[0096] Wherein, i is an integer greater than 0 and less than or equal to N, j is an integer greater than 0 and less than or equal to M, and M is the number of pixel points contained in the foreground image or the background image. Wherein, the subscript i is for image, and the subscript j is for pixel. For example, when i is 1 and j is 2, T i,j = T 1,2, which means the second pixel point of the first frame image.
[0097] The pixel point F in the foreground image and the pixel point B in the background image are mixed based on the i-th frame description image to obtain the i-th frame image. For example, as shown in FIG. 5(c), when j = 1, the pixel mixing ratio of the first pixel point Di,1 is 10%, and the first pixel point Ti,1 of the i-th frame image is Ti,1 = F1*10% + B1*(1-10%), where the pixel point F1 is the pixel point corresponding to the first pixel point Di,1 in the foreground image, the pixel point B1 is the pixel point corresponding to the first pixel point Di,1 in the background image, and (1-10%) is the pixel mixing ratio of the pixel point B1 when the pixel point F1 and the pixel point B1 are mixed. Similarly, the pixel points Ti,2-Ti,9 used to compose the i-th frame image are obtained. Correspondingly, the pixel points Ti,1-Ti,9 are combined to obtain the i-th frame image.
[0098] In step 404, it is determined whether at least one of the first to-be-processed images is updated.
[0099] The at least one of the first to-be-processed images includes a foreground image or a background image.
[0100] In order to improve the diversity of image content and improve the animation effect, the foreground image and the background image used for generating the frame image can also be updated and changed. For example, for the second frame image, the foreground image and the updated background image can be mixed according to the second frame description image. Therefore, in the embodiment of the present application, before the next frame image is generated, it is determined whether the foreground image and the background image are updated and changed, that is, whether the first to-be-processed image is updated and changed, so that the mixed generation processing is performed based on the updated first to-be-processed image.
[0101] In step 405, if yes, the updated second to-be-processed image and the i+1-th frame description image are obtained.
[0102] The second to-be-processed image includes an updated foreground image and an un-updated background image, or an un-updated foreground image and an updated background image, or an updated foreground image and an updated background image.
[0103] In step 406, the pixel mixing processing is performed on the second to-be-processed image according to the first mixing ratio information contained in the i+1-th frame description image to obtain the i+1-th frame image, and the i+1-th frame image belongs to the one or more frame images.
[0104] That is, the pixel mixing processing of the second to-be-processed image is performed according to the pixel mixing ratio in the first mixing ratio information corresponding to the next frame description image, to generate the next frame image. For example, when i = 1, the second frame image is generated by mixing the second to-be-processed image according to the second frame description image, and the process of generating the frame image according to the pixel mixing ratio is the same as described above, which will not be repeated here.
[0105] Optionally, if each to-be-processed image in the first to-be-processed image is not updated in step 404, the (i+1)th frame image is generated according to the first to-be-processed image and the (i+1)th frame description image.
[0106] Specifically, in the embodiment of the present application, the principle of generating the (i+1)th frame image based on the second to-be-processed image or the first to-be-processed image and the (i+1)th frame description image can be understood by referring to the principle of generating the ith frame image based on the ith frame description image in step 403, which will not be repeated here.
[0107] In summary, the target description information is described in the form of the target frame sequence, the first mixing ratio information corresponding to each frame image is recorded or indicated by each frame description image, and for the generation of each frame image, the corresponding frame description image is read from the target frame sequence, and the first mixing ratio information recorded by the frame description image is used to quickly generate the frame image, thereby improving the image generation efficiency.
[0108] In the animation generation process of the embodiment of FIG. 4, multiple frame description images are needed, so that the mixing generation of each frame image needs to read another frame description image. In an optional manner, based on the embodiment of FIG. 2, the target description information is presented in the form of a target description image, as shown in FIG. 6, and the present application further provides a flowchart of a third animation generation method.
[0109] The flowchart of the third animation generation method provided in FIG. 6 includes:
[0110] 601, obtaining a first to-be-processed image and target description information for controlling an animation fade effect;
[0111] The first to-be-processed image includes a foreground image and a background image, the target description information includes a target description image, each pixel point in the target description image corresponds to a pixel mixing parameter information, and the mixing processing of the first to-be-processed image is controlled based on the pixel mixing parameter.
[0112] Specifically, each pixel mixing parameter information corresponds to a numerical value, and the numerical values corresponding to the pixel points in the target description image can be the same or different.
[0113] To more clearly illustrate the target description image and the pixel mixing parameter in the embodiments of the present application, the relationship between the ground and the water surface (corresponding to one water level) will be described below. Please refer to FIG. 7, which is a side view of uneven ground and water level provided by the embodiments of the present application, wherein the water level A and the ground C are included. The water surface is regarded as the foreground image, and the ground is regarded as the background image. If the water surface is higher than all the ground, the foreground image can be seen at this time. Since the water has a certain transparency, a part of the background image under the water surface can also be seen (it can be understood that the higher the ground under the water surface, the clearer it is). This part of the background image that can be seen is the result of the mixing of the foreground image and the background image. With the decrease of the water level, the clarity of the part under the water surface will gradually increase, that is, the proportion of the background image in the mixing will be more and more, and when the water level decreases to the lowest, only the second image can be seen, and there is no content of the first image.
[0114] Therefore, whether the ground can be seen clearly is related to the height of the ground and the water level. To be more accurate, whether the ground can be seen clearly is related to the distance between the ground and the water surface. When the distance is greater, it is more difficult to see the ground through the water surface. When the distance is smaller, it is easier to see the ground through the water surface.
[0115] It should be understood that with each decrease of the water level, a ground image through the water surface is generated based on the effect of the water surface, that is, different water levels can see different clarity of the ground through the water surface. Therefore, the embodiments of the present application expect to represent the ground by the target description image, that is, the value of each pixel in the target description image (the pixel mixing parameter information corresponding to the pixel) corresponds to the height of each point in the ground (that is, the target description image forms a three-dimensional model based on the value of each pixel point), and then the distance between the ground and the water surface is represented by the difference between the water level and the value of each pixel mixing parameter in the target description image.
[0116] 602. When the i-th frame image is generated, the pixel mixing parameter information corresponding to the value of the pixel in the target description image is extracted from the target description image;
[0117] In the embodiments of the present application, after the first to-be-processed image and the target description information are obtained, when the first frame image is to be generated, the target description image corresponding to the target description information is obtained, and the pixel mixing processing is performed by using the target description image. In particular, when the second, third, and the like frame images are to be generated, the pixel mixing processing is still performed by using the previously obtained target description image, and a new target description image does not need to be reacquired.
[0118] 603、determine a frame image depth offset based on the preset display depth and the preset frame image quantity, and obtain a frame image depth of the i-th frame image based on the preset display depth and the frame image depth offset;
[0119] wherein the preset display depth is the height of the initial water level, and the frame image depth offset reflects the magnitude of the water level drop, i.e. the height of the water surface each time it drops. Wherein the frame image depth information of each frame image can be calculated based on the order of the frame image and the preset display depth and the frame image depth offset.
[0120] That is, the frame image depth hi of the i-th frame image is represented as:
[0121] hi = L - k*i.
[0122] Wherein hi is the frame image depth of the i-th frame image, wherein the frame image depth hi of each pixel point j in the i-th frame image is the frame image depth hi of the i-th frame image. L is the preset display depth, and k is the frame image depth offset. Wherein i also represents the order of the frame image.
[0123] For example, the preset display depth is 100, the preset frame image quantity is 100, and the frame image depth offset is 1. For the 5th frame image, the frame image depth of the 5th frame image is preset display depth - frame image depth offset * order of frame image = 100 - 1 * 5 = 95. For the 20th frame image, the frame image depth of the 20th frame image is 100 - 1 * 20 = 80.
[0124] For example, when the preset display depth is 200 and the preset frame image quantity is 100, the frame image depth offset is 200 / 100 = 2. For the 5th frame image, the frame image depth of the 5th frame image is preset display depth - frame image depth offset * order of frame image = 200 - 2 * 5 = 190. For the 10th frame image, the frame image depth of the 10th frame image is 200 - 2 * 10 = 180. For the 20th frame image, the frame image depth of the 20th frame image is 200 - 2 * 20 = 160.
[0125] For example, when the preset display depth is 500 and the preset frame image quantity is 200, the frame image depth offset is 500 / 200 = 2.5. For the 5th frame image, the frame image depth of the 5th frame image is preset display depth - frame image depth offset * order of frame image = 500 - 2.5 * 5 = 487.5. For the 10th frame image, the frame image depth of the 10th frame image is 500 - 2.5 * 10 = 475. For the 20th frame image, the frame image depth of the 20th frame image is 500 - 2.5 * 20 = 450.
[0126] For example, when the preset display depth is 200 and the preset frame image quantity is 400, the frame image depth offset is 200 / 400=0.5, for the 5th frame image, the frame image depth of the 5th frame image is 200-0.5*5=197.5, for the 10th frame image, the frame image depth of the 10th frame image is 200-0.5*10=195, for the 20th frame image, the frame image depth of the 20th frame image is 200-0.5*20=190.
[0127] 604、determine the second blending ratio information of the first to-be-processed image according to the frame image depth of the i-th frame image and the pixel blending parameter information;
[0128] The second blending ratio information includes the pixel blending ratio of each pixel point in the first to-be-processed image in the blending process, and the pixel blending ratio is obtained by calculating the difference between the frame image depth and the value corresponding to the pixel blending parameter information of each pixel point and by multiplying the difference by an adjustment coefficient (transparency coefficient).
[0129] For example, for a pixel point Tij in the i-th frame image, the difference between the frame image depth and the value corresponding to the pixel blending parameter information of the pixel point is calculated, the product of the difference and the transparency coefficient is calculated, and the pixel blending ratio of the pixel point is obtained. Similarly, the pixel blending ratios of each pixel point in the i-th frame image are obtained by the calculation, and the second blending ratio information is obtained by combining the pixel blending ratios of each pixel point.
[0130] That is, the pixel blending ratio di,j of the j-th pixel point in the i-th frame image is represented as: di,j=(hi,j-ai,j)*AP.
[0131] di,j is the pixel blending ratio of the j-th pixel point in the i-th frame image, hi,j is the frame image depth corresponding to the j-th pixel point in the i-th frame image, wherein the frame image depth of each pixel point in the i-th frame image is the frame image depth hi corresponding to the i-th frame image, wherein the frame image depth information of the i-th frame image is obtained according to the principle of step 603, which is not described here, ai,j is the pixel blending parameter information corresponding to the j-th pixel point in the i-th frame image, AP is used to represent the transparency, and the smaller the AP is, the more transparent it is, wherein the AP is usually an empirical value, that is, a predetermined value in each calculation process. i is an integer greater than 0 and less than or equal to N, N is the number of frame images; j is an integer greater than 0 and less than or equal to M, M is the number of pixel points in the foreground image or the background image.
[0132] Wherein, since the target description image is only one, a1, j = a2, j =... = ai, j = aj.
[0133] In summary, di, j = (hi, j - ai, j) * AP = (hi - aj) * AP.
[0134] For example, please refer to Fig. 8, the foreground image is 3*3 pixel point image content (F1-F9), the background image is 3*3 pixel point image content (B1-B9), the target description image is 3*3 pixel point corresponding image content, respectively D1-D9, the pixel mixing parameter information of D1-D9 is respectively a1-a9, the value is 1-9, assuming the preset display depth (initial water level) is 10, the frame image depth offset is 1, then the first frame image T1.1-T1.9 corresponding frame image depth h1 is preset display depth-frame image depth offset*1=10-1*1=9, then the first frame image T1.1-T1.9 pixel mixing ratio d1,1-d1,9 is respectively: d1,1=(h1,1-a1,1)*AP=(h1-a1)*AP=(9-1)*AP; d1,2=(h1,2-a1,2)*AP=(h1-a2)*AP=(9-2)*AP; d1,3=(h1,3-a1,3)*AP=(h1-a3)*AP=(9-3)*AP;
[0135] ... d1,9=(h1,9-a1,9)*AP=(h1-a9)*AP=(9-9)*AP.
[0136] Similarly, the second frame image T2.1-T2.9 frame image depth h=8, the second frame image T2.1-T2.9 pixel mixing ratio d2,1-d2,9 is respectively: d2,1=(h2,1-a2,1)*AP=(h2-a1)*AP=(8-1)*AP; d2,2=(h2,2-a2,2)*AP=(h2-a2)*AP=(8-2)*AP; d2,3=(h2,3-a2,3)*AP=(h2-a3)*AP=(8-3)*AP;
[0137] ... d2,9=(h2,9-a2,9)*AP=(h2-a9)*AP=(8-9)*AP.
[0138] 605、According to the second mixing ratio information described above, the first to-be-processed image is pixel mixed to obtain the i-th frame image;
[0139] As shown in Figure 8, the pixel mixing ratios in the second mixing ratio information control the pixel mixing processing of each pixel in the first image to be processed. For example, the pixel Ti,j in the frame image is Fj*di,j+Bj(1-di,j). Specifically, taking the second mixing ratio information of the first frame image as an example, the mixing results T1,1-T1,9 of each pixel in the first frame image are T1,1=F1*d1,1+B1*(1-d1,1); T1,2=F2*d1,2+B2*(1-d1,2); T1,3=F3*d1,3+B3*(1-d1,3).
[0140] ... T1,9=F9*d1,9+B9*(1-d1,9).
[0141] 606. When generating the (i+1)th frame image, determine whether at least one of the first images to be processed has been updated;
[0142] 607. If so, obtain the updated second image to be processed;
[0143] 608. Extract pixel blending parameter information from the target description image;
[0144] 609. Based on the preset display depth and the frame image depth offset, obtain the frame image depth of the (i+1)th frame image;
[0145] 610. Determine the second mixing ratio information of the second image to be processed based on the frame image depth of the (i+1)th frame image and the pixel mixing parameter information;
[0146] 611. Perform pixel mixing processing on the second image to be processed according to the above-mentioned second mixing ratio information to obtain the (i+1)th frame image.
[0147] For example, the second frame image corresponding to the second image to be processed is generated using the second mixing ratio information of the second frame image.
[0148] Optionally, if each of the first images to be processed in step 606 has not been updated, then the (i+1)th frame image is generated based on the frame image depth of the first image to be processed, the target description image, and the (i+1)th frame image.
[0149] Specifically, in the embodiments of the present application, the principle of generating the i+1th frame image based on the second to-be-processed image or the first to-be-processed image, the target description image and the frame image depth of the i+1th frame image can be understood by referring to the principle of generating the i th frame image based on the target description image and the frame image depth of the i th frame image in step 605, which will not be described here. In the embodiments of the present application, the change of the preset display depth is used in combination with the difference relationship of the pixel mixing parameter information of each pixel in the target description image to dynamically determine the second mixing ratio information corresponding to different frame images, so that the target description information needs to be obtained only once in the generation process of each frame image, that is, the target description image needs to be obtained only once, thereby reducing the amount of information read in the frame image generation process and reducing system overhead.
[0150] In the embodiments of the present application, in order to make the frame image or target animation generated based on the target description image consistent with the effect of the frame image or target action generated based on the target frame sequence, the embodiments of the present application can control the generation of the target description image based on each frame description image in the target frame sequence. That is, in some embodiments of the present application, before the step of "extracting pixel mixing parameter information from the target description image", the method further includes:
[0151] obtaining a target frame sequence, the target frame sequence including at least one frame description image for describing image gradient degree; determining target pixel position information and pixel value information corresponding to each frame description image based on the order of each frame description image in the target frame sequence and the first mixing ratio information recorded by each frame description image;
[0152] generating the target description image according to the target pixel position information and the pixel value information of each frame description image;
[0153] wherein the pixel value information of each pixel point in the target description image is taken as the pixel mixing parameter information.
[0154] For example, please refer to FIG. 9, which is a schematic diagram of generating a single target description image from multiple frame description images according to the embodiments of the present application. The target description image H is generated by the first pixel mixing ratio recorded in each frame description image G, which realizes the representation of multiple frame description images by a single target description image. In the animation generation process, the target description image needs to be obtained only once to control the entire animation gradient, thereby reducing system overhead, reducing power consumption and performance lag, and the like.
[0155] Specifically, in the embodiments of the present application, for the gradual animation, the target description image can be determined based on the content newly displayed in each frame image. That is, in some embodiments of the present application, the step of “determining the target pixel position information and pixel value information corresponding to each frame description image based on the order of the frame description images in the target frame sequence and the first mixing ratio information recorded in each frame description image” comprises:
[0156] extracting the frame description images in turn based on the order of the frame description images in the target frame sequence;
[0157] taking the position information of the target description pixel point in the frame description image whose first mixing ratio information meets the preset condition as the candidate pixel position information;
[0158] filtering out the repeated candidate pixel position information same as the previous frame description image from the candidate pixel position information to obtain the target pixel position information;
[0159] determining the pixel value information of the target pixel position information according to the preset value information and the order of the frame description image in the target frame sequence.
[0160] In the above embodiments, the first pixel mixing ratio in the frame description image meeting the preset condition means that the pixel mixing ratio in the first mixing ratio information reaches a preset threshold, that is, the pixel mixing ratio corresponding to the frame description image represents that the mixing proportion of the background image reaches a certain proportion. For example, taking the case of full transparent mixing of pixels in the frame description image as an example, that is, the mixing ratio of the pixel point of the foreground image is 0%, and the mixing ratio of the pixel point of the background image is 100%, that is, the value of the pixel corresponding to the frame description image in the frame image is the value of the pixel at the corresponding position in the background image, that is, the target description pixel point representing full transparent mixing is selected from the frame description image.
[0161] In the above embodiments, since the gradual change is usually a process of gradually displaying the content of the next image, there is basically no case of first displaying and then hiding, and therefore, in general cases, the fully transparent target description pixel point in the next frame description image contains the fully transparent pixel point in the previous frame description image. For example, please refer to FIG. 10, which is an animation gradual change effect diagram provided by the embodiments of the present application. As shown in FIG. 10, the effect diagram contains a frame image, wherein the previous frame image of the frame image displays content S2, and the frame image newly displays S1 based on S2, that is, the content S1 to be gradually displayed in the frame image contains the content S2 to be gradually displayed in the previous frame image, and therefore, in order to more clearly determine the display content of each frame image, the content S2 displayed in the previous frame image needs to be filtered out to obtain S1-S2, that is, the repeated candidate pixel position information same as the previous frame description image is filtered out to obtain the target pixel position information.
[0162] In the embodiments of the present application, the pixel value information corresponding to each target pixel position information is set to show a downward trend based on the characteristics of water level drop. For example, the pixel value information corresponding to the target pixel position information determined by the first several frame description images is large, and the pixel value information corresponding to the target pixel position information corresponding to the latter several frame description images gradually decreases. That is, in some embodiments of the present application, the step of "determining the pixel value information of the target pixel position information according to the preset value information and the order of the frame description images in the target frame sequence" comprises:
[0163] determining a value offset according to the order of the frame description images in the target frame sequence;
[0164] obtaining the pixel value information of the target pixel position information according to the preset value information and the value offset.
[0165] For example, refer to FIG. 11, which is a schematic diagram of generating pixel value information of a target description image according to an embodiment of the present application. Taking a downward trend as an example, the specific process is as follows:
[0166] 141, calculating the total number N of frame description images;
[0167] 142, reading a frame description image Pi;
[0168] wherein i is an image subscript, representing the i-th image;
[0169] 143, determining whether reading is complete, if not, executing step 144;
[0170] 144, recording the pixels in the corresponding position of the target description image in which the full transparent pixel points in Pi are located;
[0171] that is, obtaining alternative pixel position information;
[0172] 145, removing the repeated alternative pixel position information which is the same as the previous frame description information, that is, determining the target pixel position information;
[0173] 146, determining whether the pixel mixing parameter information a of the target pixel position information is less than N, if yes, executing step
[0174] 147;
[0175] that is, determining whether the pixel mixing parameter information a of the pixel point corresponding to the target pixel position information is less than N, wherein the a value of the pixel point corresponding to the target pixel position information is 0 in the initial condition.
[0176] 147、the value of a is N;
[0177] 148、N is updated by N-1, and step 142 is returned to execute.
[0178] Wherein, N is updated by N-1, that is, N=N-1 in programming, that is, the value of N is gradually decreased by 1 in each cycle of reading the picture and assigning value by N.
[0179] As shown in FIG. 12, the target frame sequence includes 9 frames to describe the image (for example, the image content of 3*3 pixel points D1-D9), and based on the order of the frame description image, each frame description image sequentially increases a fully transparent target description pixel point, which is D9 in the first frame description image, D8 in the second frame description image, D7 in the third frame description image,..., and D1 in the ninth frame description image. Among them, such a target frame sequence forms the effect of gradually displaying D9-D1 in turn when fusing the foreground image and the background image.
[0180] Specifically, based on the generation process of the pixel value information in the target description image of FIG. 11, when the first cycle reads the first frame description image, it is detected that D9 is a fully transparent target description pixel point, and accordingly, the pixel value information (i.e., pixel mixing parameter information) of D9 is the number of frame description images N, that is, the pixel value information of D9 is 9; when the second cycle reads the second frame description image (at this time, N is decreased by 1, and N=8), it is detected that D8 is a fully transparent target description pixel point, and accordingly, the pixel value information (i.e., pixel mixing parameter information) of D8 is N, that is, the pixel value information of D8 is 8. By analogy, when all the frame description images are cycled, the pixel value information of D9-D1 is 9-1 respectively.
[0181] It can be understood that based on the condition of depth adjustment, there is not only one kind of water level drop, so when the depth such as water level is adjusted in the form of rising, the pixel value information can also show a growing trend along with the order of frame description information, that is, it can mainly reflect the definition through the distance between water surface and ground, that is, reflect the mixing ratio, and can achieve the effect of animation gradient.
[0182] In the embodiments of the present application, by gradually reducing the value of N, the pixel value information corresponding to the fully transparent pixel points in each frame description image on the target pixel position information gradually decreases, forming uneven "ground" or "sand table". Further, by continuously adjusting the water level, the second pixel mixing ratio of each pixel point corresponding to each water level is controlled, and then the target animation with gradual change effect changing with the water level is obtained. That is, the embodiments of the present application emphasize the control of the gradual change effect of the animation based on the mixing ratio of the pixels, and in the embodiments, the difference between the water level and the pixel brightness information of each pixel in the target description image is used to calculate the second pixel mixing ratio corresponding to each pixel.
[0183] In the embodiments of the present application, after determining each target pixel position information, the target description image can be generated based on each target pixel position information and the pixel value information corresponding to the target pixel position information, that is, in some embodiments of the present application, the step of "generating a target description image according to the target pixel position information and the pixel value information of each frame description image" comprises:
[0184] Based on each target pixel position information and the pixel value information of each target pixel position information, the image generation processing is performed to obtain the target description image.
[0185] For example, based on the pixel value information and the corresponding target pixel position information, the target description image is filled in the blank image. As shown in the embodiment of FIG. 11, the 3*3 pixel values of D1-D9 are 1-9, respectively, and the target description image is formed according to the positions of D1-D9, for example, the target description image in FIG. 8 is obtained.
[0186] In the embodiments of the present application, the target frame sequence can also be generated based on the selected reference animation, that is, in some embodiments of the present application, before the step of "obtaining a target frame sequence", the method further comprises:
[0187] In response to the animation selection operation, the reference animation is screened to obtain the reference animation, the reference animation comprises a first frame image, a last frame image and one or more intermediate frame images, and the reference animation is consistent with the animation gradient style of the target animation;
[0188] According to the first frame image, the last frame image and each intermediate frame image, the frame description image corresponding to each intermediate frame image is obtained, and according to the order of each intermediate frame image and the frame description image, the target frame sequence is obtained.
[0189] For example, for each intermediate frame image, first pixel mixing ratio information is obtained according to first pixel values of the intermediate frame image, second pixel values of the first frame image, and third pixel values of the last frame image, the first pixel mixing ratio information including pixel mixing ratios corresponding to respective pixel points of the intermediate frame image; and a frame description image corresponding to the intermediate frame image is obtained according to the first pixel mixing ratios.
[0190] Correspondingly, the pixel mixing ratios corresponding to respective pixel points in each intermediate frame image are calculated by comparing the pixel values of the intermediate frame image with the first frame image and the last frame image (the pixel mixing ratios of respective pixels in the intermediate frame image are the first pixel mixing ratio information of the frame description image corresponding to the intermediate frame image), and then each frame description image is obtained, and the target frame sequence can be obtained by arranging the frame description images according to the order of respective frame images in the reference animation.
[0191] In the embodiments of the present application, the first pixel mixing ratio of a pixel in a certain intermediate frame image can also be predicted or corrected based on the overall change trend of the pixel in the animation, for example, the first pixel mixing ratio of the pixel in the current intermediate frame image is predicted or corrected based on a pixel mixing ratio change curve of the pixel in the animation presentation process.
[0192] In the embodiments of the present application, the above animation generation is generally completed based on a specific style selected, for example, a target description image is selected in advance, or a reference animation of a specific style is selected, and the target frame sequence is generated based on the reference animation, and then the animation is generated based on the target frame sequence or the target description image is generated first and then the animation is generated based on the target description image.
[0193] In summary, the embodiments of the present application realize the quick generation of the animation with the gradual change effect by the pixel mixing method through the pixel mixing processing of the first to-be-processed image based on the target description information for controlling the gradual change effect of the animation. By replacing the pixel mixing method with the manual editing and manufacturing method of multiple frame images in the related art, the embodiments of the present application reduce the complexity of the animation production, improve the animation production efficiency, and in the embodiments of the present application, only the target description information needs to be replaced to generate a new animation with the gradual change effect, thereby improving the generation efficiency of animations with different gradual change effects.
[0194] In addition, the target description information is represented in the form of the target frame sequence and the target description image, thereby improving the diversity of the animation generation method.
[0195] To better implement the animation generation method of the present application, the present application further provides an animation generation device based on the above animation generation method. The meanings of the terms are the same as those in the above animation generation method, and the specific implementation details can be referred to the description in the method embodiment.
[0196] Please refer to FIG. 13, which is a structural schematic diagram of an animation generation apparatus provided in embodiments of the present application. The animation generation apparatus can be specifically as follows:
[0197] The obtaining module 1301 is configured to obtain a first to-be-processed image and target description information used for controlling an animation fade effect.
[0198] The generating module 1302 is configured to perform pixel blending processing on the first to-be-processed image according to the target description information, to obtain one or more frame images, which are used to generate a target animation corresponding to the first to-be-processed image.
[0199] Optionally, in some embodiments of the present application, the target description information includes a target frame sequence, the target frame sequence includes N frame description images, each of the frame description images contains first blending ratio information used for performing pixel blending processing on the first to-be-processed image, and N is an integer greater than 0. The generating module 1302 includes:
[0200] obtaining an i-th frame description image;
[0201] performing pixel blending processing on the first to-be-processed image according to the first blending ratio information contained in the i-th frame description image, to obtain an i-th frame image, the i-th frame image belongs to the one or more frame images, and i is an integer greater than 0 and less than or equal to N;
[0202] determining whether at least one to-be-processed image in the first to-be-processed image is updated;
[0203] if yes, obtaining an updated second to-be-processed image and an (i+1)-th frame description image;
[0204] performing pixel blending processing on the second to-be-processed image according to the first blending ratio information contained in the (i+1)-th frame description image, to obtain an (i+1)-th frame image, the (i+1)-th frame image belongs to the one or more frame images. In some embodiments of the present application, the target description information includes a target description image, and the generating module 1302 includes an extracting unit configured to extract pixel blending parameter information from the target description image, the pixel blending parameter information corresponding to the values of pixels in the target description image.
[0205] The first determining unit is configured to determine a frame image depth offset based on a preset display depth and a preset number of frame images, and obtain a frame image depth of each frame image based on the preset display depth and the frame image depth offset.
[0206] The second determining unit is configured to determine, for each frame image depth, second blending ratio information based on the frame image depth and the pixel blending parameter information.
[0207] The blending unit is configured to perform pixel blending processing on the first to-be-processed image according to the second blending ratio information corresponding to each frame image depth, to obtain the one or more frame images.
[0208] In some embodiments of the present application, the apparatus further includes a first configuration module, which includes:
[0209] The acquisition unit is configured to acquire a target frame sequence, the target frame sequence including at least one frame description image used to describe image gradual change degree.
[0210] The third determining unit is configured to determine target pixel position information and pixel value information corresponding to each frame description image based on the order of the frame description images in the target frame sequence and the first blending ratio information recorded by each frame description image.
[0211] The generation unit is configured to generate a target description image according to the target pixel position information and the pixel value information of each frame description image; and the pixel value information of each pixel point in the target description image is used as the pixel blending parameter information.
[0212] In some embodiments of the present application, the third determining unit includes:
[0213] The extraction subunit is configured to extract frame description images in sequence based on the order of the frame description images in the target frame sequence.
[0214] The first determining subunit is configured to use the position information of a target description pixel point in the frame description image, for which the first blending ratio information meets a preset condition, as candidate pixel position information.
[0215] The filtering subunit is configured to filter out repeated candidate pixel position information that is the same as a previous frame description image from the candidate pixel position information, to obtain target pixel position information.
[0216] The second determining subunit is configured to determine pixel value information of the target pixel position information according to preset value information and the order of the frame description image in the target frame sequence.
[0217] In some embodiments of the present application, the second determining subunit is specifically configured to:
[0218] determine a value offset according to the order of the frame description image in the target frame sequence.
[0219] The pixel value information of the target pixel position information is obtained according to the preset value information and the value offset.
[0220] In some embodiments of the present application, the generating unit comprises:
[0221] The first generating subunit is configured to perform image generation processing based on each target pixel position information and the pixel value information of each target pixel position information, to obtain a target description image.
[0222] In some embodiments of the present application, the device further comprises a screening unit, and the screening unit comprises:
[0223] The response subunit is configured to screen a reference animation in response to an animation selection operation, the reference animation comprising a first frame image, a last frame image and one or more intermediate frame images, and the reference animation being consistent with the animation fade effect of the target animation.
[0224] The second generating subunit is configured to obtain a frame description image corresponding to each intermediate frame image according to the first frame image, the last frame image and each intermediate frame image.
[0225] The third generating subunit is configured to obtain a target frame sequence according to the order of each intermediate frame image and the frame description image.
[0226] In some embodiments of the present application, the second generating subunit is specifically configured to:
[0227] For each intermediate frame image, first mixing ratio information is obtained according to a first pixel value of the intermediate frame image, a second pixel value of the first frame image and a third pixel value of the last frame image, the first mixing ratio information comprising a pixel mixing ratio corresponding to each pixel point of the intermediate frame image.
[0228] The frame description image corresponding to the intermediate frame image is obtained according to the first mixing ratio information.
[0229] In some embodiments of the present application, the device further comprises a second configuration module, and the second configuration module comprises:
[0230] The image determination unit is configured to determine a target image of an animation fade direction from the first to-be-processed image.
[0231] The grayscale extraction unit is configured to extract a grayscale value of each pixel point in a luminance channel from the target image to obtain reference luminance information.
[0232] The image generation unit is configured to generate a target description image based on the reference luminance information, wherein the reference luminance information in the target description image is used as pixel mixing parameter information.
[0233] The embodiment of the present application first acquires a first to-be-processed image and target description information for controlling an animation gradient effect by an acquisition module 1301, and then performs pixel mixing processing on the first to-be-processed image according to the target description information by a generation module 1302 to obtain one or more frame images, which are used to generate a target animation corresponding to the first to-be-processed image.
[0234] In the embodiment of the present application, the pixel mixing processing of the first to-be-processed image by the target description information for controlling the animation gradient effect realizes the generation of the animation with the gradient effect in a pixel mixing manner. By using the pixel mixing manner instead of the manual editing and production of the multiple frame images in the related art, the embodiment of the present application reduces the complexity of the animation production, improves the animation production efficiency, and in the embodiment of the present application, only the target description information needs to be replaced to generate a new animation with the gradient effect, thereby improving the generation efficiency of the animations with different gradient effects.
[0235] In addition, the present application also provides an electronic device, as shown in FIG. 14, which shows a structural schematic diagram of the electronic device related to the present application. Specifically:
[0236] The electronic device can include a processor 1401 with one or more processing cores, a memory 1402 with one or more computer readable storage media, a power supply 1403, and an input unit 1404, and the like. Those skilled in the art can understand that the structure of the electronic device shown in FIG. 14 does not constitute a limitation on the electronic device, and can include more or fewer components than those shown, or combine certain components, or different component arrangements. Among them:
[0237] The processor 1401 is the control center of the electronic device, connects all parts of the electronic device through various interfaces and lines, executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 1402 and calling data stored in the memory 1402, thereby overall monitoring the electronic device. Optionally, the processor 1401 can include one or more processing cores; preferably, the processor 1401 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1401. The memory 1402 can be used to store software programs and modules, and the processor 1401 executes various function applications and data processing by running the software programs and modules stored in the memory 1402. The memory 1402 can mainly include a program storage area and a data storage area, wherein the program storage area can store the operating system, at least one application program required by the function (such as sound playing function, image playing function, etc.) and the like; the data storage area can store data created according to the use of the electronic device and the like. In addition, the memory 1402 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 1402 can also include a memory controller to provide access for the processor 1401 to the memory 1402.
[0238] The electronic device also includes a power supply 1403 for supplying power to various components, and preferably the power supply 1403 can be logically connected to the processor 1401 through a power management system, so as to realize functions such as management of charging, discharging and power consumption management through the power management system. The power supply 1403 can also include one or more than one direct current or alternating current power supply, a recharging system, a power supply device debugging circuit, a power supply converter or inverter, a power supply state indicator and any other components.
[0239] The electronic device can also include an input unit 1404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Although not shown, the electronic device can also include a display unit, etc., which will not be described here. Specifically in the embodiment, the processor 1401 in the electronic device will load the executable file corresponding to the process of one or more than one application program into the memory 1402 according to the following instructions, and run the application program stored in the memory 1402 by the processor 1401, thereby realizing the steps in any of the animation generation methods provided in the embodiments of the application.
[0240] The embodiment of the present application obtains a first to-be-processed image and target description information for controlling an animation gradient effect, performs pixel mixing processing on the to-be-processed image according to the target description information to obtain one or more frame images, and generates a target animation corresponding to the first to-be-processed image according to the one or more frame images.
[0241] The pixel mixing processing of the first to-be-processed image by the target description information for controlling the animation gradient effect realizes the generation of the animation with the gradient effect in a quick manner by pixel mixing. The pixel mixing processing replaces the manual editing and production of the multiple frame images in the related art, thereby reducing the complexity of animation production, improving the animation production efficiency, and generating a new animation with a gradient effect by only changing the target description information in the embodiment of the present application, thereby improving the generation efficiency of animations with different gradient effects.
[0242] The specific implementation of the above operations can be referred to the foregoing embodiments, which will not be described herein.
[0243] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by related hardware controlled by the instructions, which can be stored in a computer readable storage medium and loaded and executed by a processor.
[0244] Therefore, the present application provides a computer readable storage medium, which stores a computer program capable of being loaded by a processor to execute the steps in any animation generation method provided by the present application. The specific implementation of the above operations can be referred to the foregoing embodiments, which will not be described herein.
[0245] The computer readable storage medium can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0246] Since the instructions stored in the computer readable storage medium can execute the steps in any animation generation method provided by the present application, the beneficial effects of any animation generation method provided by the present application can be achieved, which will not be described herein in detail.
[0247] The above describes in detail the animation generation method, device, electronic device, and computer readable storage medium provided by the present application. The principles and implementation manners of the present application are described by using specific examples. The above example is only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, the specific implementation manners and application ranges can be changed according to the idea of the present application. In conclusion, the content of the specification should not be understood as a limitation of the present application.
[0248] It should be noted that in the specific embodiments of the present application, the data related to the to-be-processed image, the target description information, the reference animation, the first frame image, the last frame image and the intermediate frame image of the reference animation, the frame description image, the target frame sequence, and the target description image are involved. When the above embodiments of the present application are applied to specific products or technologies, the user's permission or consent needs to be obtained, and the collection, use, and processing of the related data need to comply with the relevant laws, regulations, and standards of the country and region.
Claims
1. A method of animation generation, wherein, The method comprises: obtaining a first to-be-processed image and target description information for controlling an animation gradient effect; performing pixel blending processing on the first to-be-processed image according to the target description information to obtain one or more frame images, the one or more frame images being used to generate a target animation corresponding to the first to-be-processed image.
2. The animation generation method of claim 1, wherein, The target description information comprises a target frame sequence, the target frame sequence comprising N frame description images, each of the frame description images containing first blending ratio information for performing pixel blending processing on the first to-be-processed image, N being an integer greater than 0, and the performing pixel blending processing on the first to-be-processed image according to the target description information to obtain one or more frame images comprising: obtaining an i-th frame description image; performing pixel blending processing on the first to-be-processed image according to the first blending ratio information contained in the i-th frame description image to obtain an i-th frame image, the i-th frame image belonging to the one or more frame images, i being an integer greater than 0 and less than or equal to N.
3. The method of claim 2, wherein, After the performing pixel blending processing on the first to-be-processed image according to the first blending ratio information contained in the i-th frame description image to obtain an i-th frame image, the method further comprises: determining whether at least one to-be-processed image in the first to-be-processed image is updated; if yes, obtaining an updated second to-be-processed image and an i+1-th frame description image; performing pixel blending processing on the second to-be-processed image according to the first blending ratio information contained in the i+1-th frame description image to obtain an i+1-th frame image, the i+1-th frame image belonging to the one or more frame images.
4. The animation generation method of claim 1, wherein, The target description information comprises a target description image, and the performing pixel blending processing on the first to-be-processed image according to the target description information to obtain one or more frame images comprises: extracting pixel blending parameter information from the target description image, the pixel blending parameter information corresponding to the values of pixels in the target description image; determining a frame image depth offset based on a preset display depth and a preset number of frame images, and obtaining a frame image depth of each frame image based on the preset display depth and the frame image depth offset; determining second blending ratio information based on the frame image depth and the pixel blending parameter information for each frame image depth; performing pixel blending processing on the first to-be-processed image according to the second blending ratio information corresponding to each frame image depth to obtain the one or more frame images.
5. The animation generation method according to claim 4, wherein Before the extracting pixel blending parameter information from the target description image, the method further comprises: obtaining a target frame sequence, the target frame sequence comprising at least one frame description image for describing an image gradient degree; determining target pixel position information and pixel value information corresponding to each frame description image based on the order of each frame description image in the target frame sequence and the first blending ratio information recorded by each frame description image; generating the target description image according to the target pixel position information and the pixel value information of each frame description image; The pixel value information of each pixel point in the target description image is taken as the pixel mixing parameter information.
6. The animation generation method of claim 5, wherein, The target pixel position information and the pixel value information corresponding to each frame description image are determined based on the order of each frame description image in the target frame sequence and the first mixing ratio information recorded by each frame description image, and the method comprises the steps of: extracting frame description images in sequence based on the order of each frame description image in the target frame sequence; taking the position information of a target description pixel point in the frame description image, for which the first mixing ratio information meets a preset condition, as candidate pixel position information; filtering out repeated candidate pixel position information that is the same as a previous frame description image from the candidate pixel position information to obtain target pixel position information; determining pixel value information of the target pixel position information according to preset value information and the order of the frame description image in the target frame sequence.
7. The animation generation method of claim 6, wherein, The method comprises the steps of: determining a value offset according to the order of the frame description image in the target frame sequence; obtaining pixel value information of the target pixel position information according to preset value information and the value offset.
8. The animation generation method of claim 5, wherein, The method comprises the steps of: generating a target description image based on the target pixel position information and the pixel value information of each frame description image.
9. The animation generation method of claim 5, wherein, Before the target frame sequence is obtained, the method further comprises the steps of: in response to an animation selection operation, filtering to obtain a reference animation, the reference animation comprising a first frame image, a last frame image and one or more intermediate frame images, the reference animation being consistent with the animation fade effect of the target animation; obtaining a frame description image corresponding to each intermediate frame image according to the first frame image, the last frame image and each intermediate frame image; obtaining a target frame sequence according to the order of each intermediate frame image and the frame description image.
10. The animation generation method of claim 9, wherein, The method comprises the steps of: for each intermediate frame image, obtaining first mixing ratio information according to a first pixel value of the intermediate frame image, a second pixel value of the first frame image and a third pixel value of the last frame image, the first mixing ratio information comprising pixel mixing ratios corresponding to each pixel point of the intermediate frame image; obtaining a frame description image corresponding to the intermediate frame image according to the first mixing ratio information.
11. An animation generation apparatus, wherein, The device comprises: an acquisition module configured to acquire a first to-be-processed image and target description information for controlling an animation fade effect; a generation module configured to perform pixel mixing processing on the first to-be-processed image according to the target description information to obtain one or more frame images, the one or more frame images being used to generate a target animation corresponding to the first to-be-processed image.
12. The animation generation apparatus according to claim 11, wherein The target description information includes a target frame sequence, the target frame sequence includes N frame description images, each frame description image contains first blending ratio information for pixel blending processing of the first to-be-processed image, N is an integer greater than 0, and the pixel blending processing of the first to-be-processed image according to the target description information to obtain one or more frame images includes the following steps. An i-th frame description image is acquired. The first to-be-processed image is subjected to pixel blending processing according to the first blending ratio information contained in the i-th frame description image to obtain an i-th frame image, the i-th frame image belongs to the one or more frame images, and i is an integer greater than 0 and less than or equal to N.
13. The animation generation apparatus according to claim 12, wherein After the pixel blending processing of the first to-be-processed image according to the first blending ratio information contained in the i-th frame description image to obtain the i-th frame image, the following steps are further included. It is judged whether at least one to-be-processed image in the first to-be-processed image is updated. If yes, an updated second to-be-processed image and an i+1-th frame description image are acquired. The second to-be-processed image is subjected to pixel blending processing according to the first blending ratio information contained in the i+1-th frame description image to obtain an i+1-th frame image, and the i+1-th frame image belongs to the one or more frame images.
14. The animation generation apparatus according to claim 11, wherein The target description information includes a target description image, and the pixel blending processing of the first to-be-processed image according to the target description information to obtain one or more frame images includes the following steps. Pixel blending parameter information corresponding to the value of a pixel in the target description image is extracted from the target description image. A frame image depth offset is determined based on a preset display depth and a preset frame image quantity, and a frame image depth of each frame image is obtained based on the preset display depth and the frame image depth offset. Second blending ratio information is determined based on the frame image depth and the pixel blending parameter information for each frame image depth. The first to-be-processed image is subjected to pixel blending processing according to the second blending ratio information corresponding to each frame image depth to obtain the one or more frame images.
15. The animation generation apparatus according to claim 14, wherein Before the pixel blending parameter information is extracted from the target description image, the apparatus further includes the following steps. A target frame sequence is acquired, the target frame sequence includes at least one frame description image for describing an image gradual change degree. Target pixel position information and pixel value information corresponding to each frame description image are determined based on the order of each frame description image in the target frame sequence and the first blending ratio information recorded by each frame description image. The target description image is generated according to the target pixel position information and the pixel value information of each frame description image. The pixel value information of each pixel point in the target description image is taken as the pixel blending parameter information.
16. The animation generation apparatus according to claim 15, wherein The target pixel position information and the pixel value information corresponding to each frame description image are determined based on the order of each frame description image in the target frame sequence and the first blending ratio information recorded by each frame description image. extracting frame description images in sequence based on orders of the frame description images in the target frame sequence; taking position information of a target description pixel point in the frame description image, which satisfies a preset condition of first mixing ratio information, as candidate pixel position information; filtering out repeated candidate pixel position information same as a previous frame description image from the candidate pixel position information to obtain target pixel position information; determining pixel value information of the target pixel position information according to preset value information and orders of the frame description images in the target frame sequence.
17. The apparatus of claim 16, wherein, The determining of the pixel value information of the target pixel position information according to the preset value information and the orders of the frame description images in the target frame sequence comprises: determining a value offset according to the orders of the frame description images in the target frame sequence; obtaining the pixel value information of the target pixel position information according to the preset value information and the value offset.
18. The animation generation apparatus according to claim 15, wherein The generating of the target description image according to the target pixel position information and the pixel value information of each frame description image comprises: performing image generation processing based on the target pixel position information and the pixel value information of each target pixel position information to obtain the target description image.
19. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps in the animation generation method according to any one of claims 1-10.
20. A computer readable storage medium, wherein, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps in the animation generation method according to any one of claims 1-10.
Citation Information
Patent Citations
Frame insertion image processing method and device
CN112184779A
Fixed scene monitoring video target detection method
CN117456426A
Adaptive video frame mixing
CN117880561A
Animation generation method and device, electronic equipment and computer readable storage medium
CN119068087A
Moving image processor, moving image information processing program and moving image processing method
JP2016024743A