Method and device for generating video and electronic equipment
By acquiring the first image and preset parameters, performing stylized mirror processing, generating multiple frames of second images and generating target videos, the problem of low efficiency in generating mirror videos in the prior art is solved, and high efficiency and good results are achieved video generation.
Patent Information
- Application Number
- CN202310953770.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, generating a mirror video requires manually generating image frames one frame after another, which is inefficient and time-consuming.
By acquiring the first image and the preset parameters, a stylized mirror processing is performed based on the images and parameters, a multi-frame second image is generated, and a target video is generated based on the images.
It is realized efficiently generating a stylized video with a spatial mirror based on one frame of existing images, which improves the video generation efficiency and effect and improves the user experience.
Smart Images

Figure CN119450161A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video processing technology, and in particular to a method, device and electronic device for generating a video. Background Art
[0002] With the continuous development of network technology and streaming media technology, videos are increasingly used in people's lives, providing entertainment services for people's lives and bringing many conveniences. At present, in order to improve the fun, a video can be made by camera movement techniques. However, in related technologies, it is usually necessary to manually generate video image frames one by one. Therefore, an efficient method for generating camera movement videos is needed. Summary of the invention
[0003] The present disclosure provides a method, device and electronic device for generating a video.
[0004] According to a first aspect, a method for generating a video is provided, the method comprising:
[0005] Acquire a first image, and acquire preset parameters;
[0006] Based on the first image and the preset parameters, performing stylized camera movement processing to obtain multiple frames of second images;
[0007] A target video is generated based on the multiple frames of second images.
[0008] According to a second aspect, a device for generating a video is provided, the device comprising:
[0009] An acquisition module, used to acquire a first image and acquire preset parameters;
[0010] A processing module, configured to perform stylized camera movement processing based on the first image and the preset parameters to obtain a plurality of frames of second images;
[0011] A generating module is used to generate a target video based on the multiple frames of second images.
[0012] According to a third aspect, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of the above-mentioned first aspects is implemented.
[0013] According to a fourth aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of the first aspects is implemented.
[0014] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0015] The embodiments of the present disclosure provide a method and device for generating a video, which obtains a first image and preset parameters, performs stylized camera movement processing based on the first image and the preset parameters, obtains multiple frames of second images, and generates a target video based on the multiple frames of second images. Thus, it is possible to efficiently generate a stylized video containing spatial camera movement based on a frame of existing images, which not only improves the generation efficiency of the target video, but also improves the video effect and user experience.
[0016] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 A schematic diagram of an exemplary system architecture for applying an embodiment of the present disclosure;
[0019] Figure 2 is a schematic diagram of a link scenario for generating a video according to an exemplary embodiment of the present disclosure;
[0020] Figure 3 is a schematic diagram of a scene for generating a video according to an exemplary embodiment of the present disclosure;
[0021] Figure 4 is a flowchart of a method for generating a video according to an exemplary embodiment of the present disclosure;
[0022] Figure 5 is a flowchart of another method for generating a video according to an exemplary embodiment of the present disclosure;
[0023] Figure 6 is a block diagram of a device for generating a video according to an exemplary embodiment of the present disclosure;
[0024] Figure 7 is a schematic block diagram of an electronic device provided by some embodiments of the present disclosure;
[0025] Figure 8 is a schematic block diagram of another electronic device provided by some embodiments of the present disclosure;
[0026] Fig. 9 It is a schematic diagram of a storage medium provided by some embodiments of the present disclosure. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0028] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are only examples of devices and methods consistent with some aspects of the present disclosure as detailed in the attached claims.
[0029] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms of "a", "the" and "the" used in this disclosure are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0030] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0031] See also Figure 1 , is a schematic diagram of an exemplary system architecture for applying an embodiment of the present disclosure.
[0032] like Figure 1 As shown, the system architecture 100 may include a terminal device 102, a network 103 and a server 104. It should be understood that Figure 1 The number or type of terminal devices, networks, and servers in the embodiment are merely illustrative. Any number or type of terminal devices, networks, and servers may be provided as required.
[0033] The network 103 is used to provide a medium for communication links between terminal devices and servers. The network 103 may include various connection types, such as wired or wireless communication links or optical fiber cables.
[0034] The terminal device 102 can interact with the server through the network 103 to receive or send requests or information, etc. The terminal device 102 can be various electronic devices, including but not limited to smart phones, tablet computers, smart wearable devices, personal digital assistants, etc.
[0035] The server 104 can store, analyze, and process the received data, and can also send control commands or requests to terminal devices or other servers. The server can provide services in response to user service requests. It is understood that a server can provide one or more services, and the same service can also be provided by multiple servers.
[0036] based on Figure 1 In the system architecture shown, in the embodiment of the present disclosure, the user 101 can input the first image and preset parameters through the terminal device 102, and the terminal device 102 sends the first image and preset parameters to the server 104 through the network 103. After receiving the first image and the preset parameters, the server 104 can perform stylized camera movement processing based on the first image and the preset parameters to obtain multiple frames of second images, and then generate a target video based on the multiple frames of second images. Finally, the server 104 can return the target video to the terminal device 102 through the network 103, so that the user 101 can watch the effect of the target video through the terminal device 102.
[0037] See also Figure 2 , is a schematic diagram of a link scenario for generating a video according to an exemplary embodiment.
[0038] like Figure 2 As shown, first, the user can input image A and preset parameters through a third-party application installed on the terminal device. Then, the terminal device can send a request Q to the cloud editing platform of the video, wherein the request Q carries image A and preset parameters to upload image A and preset parameters to the cloud editing platform of the video. The cloud editing platform of the video can transmit image A and preset parameters to the algorithm server under the instruction of request Q. The algorithm server can generate multi-frame video frame images frame by frame based on image A and preset parameters through mirror processing and stylization processing, and generate video C based on the generated multi-frame video frame images, and return video C to the cloud editing platform. The cloud editing platform can then reprocess video C based on a preset video template (for example, adding special effects, etc.) to obtain video D. Finally, the cloud editing platform can return video D to the terminal device, and the terminal device plays video D for the user to watch.
[0039] See also Figure 3 , is a schematic diagram of a scene for generating a video according to an exemplary embodiment.
[0040] like Figure 3 As shown, first, obtain the reference image T and the preset parameters, and determine the total number of frames of the target video as n by parsing the preset parameters. Take the reference image T as the first frame to be processed, and perform a loop operation to generate multiple video frame images. In the first loop operation, the reference image T is first stylized to obtain the stylized image T1. Then, the stylized image T1 is processed by moving the camera to obtain the moving camera image T2. Then, the moving camera image T2 is processed by moving the camera to obtain the moving camera image T3, and the stylized image T1 and the moving camera image T2 are used as video frames. Next, it is determined that the generated video frame is 2, which is less than the total number of frames of the target video n, so the second loop operation is entered... Until in the mth loop operation, after obtaining the generated video frame, it is determined that the generated video frame is greater than or equal to the total number of frames of the target video n, then the loop operation can be stopped. And based on the generated video frame, the target video is generated.
[0041] The present disclosure will be described in detail below in conjunction with specific embodiments.
[0042] Figure 4 The flowchart of a method for generating a video according to an exemplary embodiment is shown. The execution subject of the method can be implemented as any device, platform, server or device cluster with computing and processing capabilities. The method includes the following steps:
[0043] like Figure 4 As shown, in step 401, a first image and preset parameters are obtained.
[0044] In this embodiment, the first image is a first frame reference image used to generate a target video. In one implementation, a frame of image directly input by a user can be used as the first image. In another implementation, a frame of image directly shot by a user can be used as the first image. In yet another implementation, a frame of image selected by a user from an existing video can be used as the first image. It can be understood that this embodiment does not limit the specific method for obtaining the first image.
[0045] In this embodiment, the preset parameters may be system defaults or user settings. The preset parameters may include, but are not limited to, camera movement parameters for camera movement processing, stylized parameters for stylized processing, and image parameters for determining the duration and size of the target video. Among them, the camera movement parameters may include, but are not limited to, image translation coefficients, rotation coefficients, scaling coefficients, lens zoom coefficients, etc. The user can control the camera movement effect of the generated video by setting the camera movement parameters. The stylized parameters may include, but are not limited to, stylized guide words, the identifier of the selected stylized model, etc. The user can guide the stylized effect of the generated video by setting the stylized parameters. The image parameters may include, but are not limited to, the duration of the target video (used to determine the number of video frames included in the target video), the size of the target video, the image resolution of the target video, etc.
[0046] In step 402, stylized camera movement processing is performed based on the first image and preset parameters to obtain multiple frames of second images.
[0047] In this embodiment, the first image can be used as the first frame of the image to be processed, and the camera movement processing and stylization processing can be performed alternately according to preset parameters to generate multiple frames of the second image frame by frame. For example, image a1 is the first image, and image a1 can be processed to generate image a2, and then image a2 can be processed to generate image a3, and then image a3 can be processed to generate image a4, and then image a4 can be processed to generate image a5... and so on, and finally, part or all of the generated images are used as the second image.
[0048] Specifically, first, the number of video frames of the target video and the image size and resolution of the target video can be determined according to the image parameters included in the preset parameters. Then, the first image is used as the first frame to be processed, and stylization processing and camera movement processing are alternately performed according to the stylization parameters and camera movement parameters included in the preset parameters, and multiple frames of second images are generated frame by frame according to the number of video frames of the target video and the image size and resolution of the target video.
[0049] In this embodiment, the target operation can be performed multiple times to alternately perform stylization processing and camera movement processing. Among them, one target operation can include: first, obtaining the current image to be processed, when the target operation is performed for the first time, the current image to be processed is the first image, and when the target operation is not performed for the first time, the current image to be processed is obtained based on the image generated in the last target operation. Then, according to preset parameters, the current image to be processed can be stylized to obtain a stylized image, and based on the stylized image, at least one camera movement processing can be performed to obtain at least one frame of camera movement image, and the stylized image and at least part of the camera movement image are used as the second image.
[0050] In one implementation, the stylized image may be subjected to a camera movement process to obtain a frame of camera movement image. The frame of camera movement image is used as the image to be processed for the next target operation. For example, in the nth target operation, image b1 is the current image to be processed, and image b1 may be first subjected to a stylized process to generate a stylized image b2, and then subjected to a camera movement process to generate a camera movement image b3, and the stylized image b2 and the camera movement image b3 are used as the second image. In the n+1th target operation, the camera movement image b3 may be used as the current image to be processed, and the camera movement image b3 may be subjected to a stylized process.
[0051] In another implementation, the stylized image may be subjected to multiple camera movement processing to obtain multiple frames of camera movement images, and the stylized image and one of the multiple frames of camera movement images are obtained as the second image. For example, in the nth target operation, image c1 is the current image to be processed, and image c1 may be first subjected to stylized processing to generate stylized image c2, and then subjected to camera movement processing to generate camera movement image c3, and then subjected to camera movement processing to generate camera movement image c4, and the stylized image c2 and the camera movement image c3 are used as the second image. In the n+1th target operation, the camera movement image c4 may be used as the current image to be processed, and the camera movement image c4 may be subjected to stylized processing.
[0052] In another implementation, the stylized image may be subjected to multiple camera movement processing to obtain multiple frames of camera movement images, and the stylized image and all the multiple frames of camera movement images are obtained as the second image. For example, in the nth target operation, image d1 is the current image to be processed, and image d1 may be first subjected to stylized processing to generate stylized image d2, and then stylized image d2 is subjected to camera movement processing to generate camera movement image d3, and then camera movement image d3 is subjected to camera movement processing to generate camera movement image d4, and then camera movement image d4 is subjected to camera movement processing to generate camera movement image d5, and camera movement image d3, camera movement image d4, camera movement image d5 and stylized image d2 are used as the second image. In the n+1th target operation, camera movement image d5 may be used as the current image to be processed, and camera movement image d5 may be subjected to stylized processing.
[0053] It should be noted that the camera movement processing may be any reasonable camera movement algorithm. Any camera movement algorithm known in the art or that may appear in the future may be applied to the present disclosure. The present disclosure does not limit the specific method of the camera movement algorithm.
[0054] In addition, the image may be stylized based on the stylized parameters included in the preset parameters. For example, the stylized parameters may include the corresponding relationship between the number of video frames and the stylized model. For example, the nmth frame image may be stylized using the model M1, the stth frame image may be stylized using the model M2, and so on.
[0055] In step 403, a target video is generated based on the multiple frames of second images.
[0056] In this embodiment, after generating multiple frames of second images, a target video can be generated based on the multiple frames of second images. In one implementation, if the first image is a frame of image uploaded separately, the first image can be used as the first frame of image, and the multiple frames of second images can be synthesized into the target video.
[0057] In another implementation, if the first image is a frame of image selected from an existing video, the existing video and multiple frames of second images may be combined to form a target video.
[0058] In another implementation, after the first image and multiple frames of the second image are synthesized into a video, special effects may be added to the synthesized video to obtain a target video.
[0059] It is understandable that the target video may be synthesized in any other reasonable manner, and this embodiment does not limit the specific manner of synthesizing the target video.
[0060] The present disclosure provides a method for generating a video, which obtains a first image and preset parameters, performs stylized camera movement processing based on the first image and the preset parameters, obtains multiple frames of second images, and generates a target video based on the multiple frames of second images. Thus, it is possible to efficiently generate a stylized video containing spatial camera movement based on a frame of existing image, which not only improves the generation efficiency of the target video, but also improves the video effect and user experience.
[0061] Figure 5 FIG. 1 is a flowchart of another method for generating a video according to an exemplary embodiment. The embodiment describes a process of generating a target video, including the following steps:
[0062] like Figure 5 As shown, in step 501, a first video is obtained, and preset parameters are obtained, and in step 502, a frame of image is obtained from the first video as a first image.
[0063] In this embodiment, a user may upload a video as the first video, and any frame of image may be obtained from the first video as the first image. In one implementation, a user may select any frame of image from the video as the first image. In another implementation, a frame of image that meets the conditions may be selected as the first image based on a preset rule. For example, the image that meets the conditions may be an image with specified features, etc. It is understood that the first image may also be obtained from the first video in any other reasonable manner, and this embodiment does not limit this aspect.
[0064] In step 503, stylized camera movement processing is performed based on the first image and preset parameters to obtain multiple frames of second images.
[0065] In step 504, a target video segment in the first video is obtained, and in step 505, the target video segment is spliced with multiple frames of second images to obtain a target video.
[0066] In this embodiment, a target video segment can be obtained from the first video, and the target video segment can include the first image and at least part of the video frame image before the first image. Then, multiple frames of the second image are sequentially spliced with the target video segment to obtain the target video.
[0067] It should be noted that Figure 4 The same steps as in the embodiment, in the above Figure 5 The embodiments will not be described in detail. For related contents, please refer to Figure 4 Example.
[0068] This embodiment obtains a first image from an existing video, performs stylized camera movement processing based on the first image and preset parameters to obtain multiple frames of second images, obtains a target video segment from the existing video, and splices the target video segment with the multiple frames of second images to obtain the target video. Thus, a stylized video with spatial camera movement can be generated based on a frame of an existing video, further improving the video effect and user experience.
[0069] It should be noted that although the operations of the method of the disclosed embodiment are described in a specific order in the above embodiments, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flowchart can change the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.
[0070] Corresponding to the aforementioned method embodiment for generating a video, the present disclosure also provides an embodiment of an apparatus for generating a video.
[0071] like Figure 6 As shown, Figure 6 6 is a block diagram of a device for generating a video according to an exemplary embodiment of the present disclosure. The device may include: an acquisition module 601, a processing module 602 and a generation module 603.
[0072] The acquisition module 601 is used to acquire a first image and acquire preset parameters.
[0073] The processing module 602 is used to perform stylized camera movement processing based on the first image and preset parameters to obtain multiple frames of second images.
[0074] The generating module 603 is used to generate a target video based on multiple frames of second images.
[0075] In some implementations, the processing module 602 may include: a processing submodule (not shown in the figure).
[0076] The processing submodule is used to take the first image as the first frame to be processed according to the preset parameters, perform stylization processing and camera movement processing alternately, and generate multiple frames of second images frame by frame.
[0077] In other embodiments, the processing submodule may generate multiple frames of the second image frame by frame by performing the following target operation multiple times: obtaining the current image to be processed, wherein when the target operation is performed for the first time, the current image to be processed is the first image, and when the target operation is not performed for the first time, the current image to be processed is obtained based on the image generated in the last target operation. According to preset parameters, the current image to be processed is stylized to obtain a stylized image, and based on the stylized image, at least one camera movement process is performed to obtain at least one camera movement image. The stylized image and at least part of the camera movement image are obtained as the second image.
[0078] In some other embodiments, the processing submodule obtains the stylized image and at least part of the camera movement image as the second image in the following manner: obtain the stylized image and the camera movement image obtained by performing camera movement processing on the stylized image as the second image.
[0079] In some other implementations, the acquisition module 601 is configured to: acquire a first video, and acquire a frame of image from the first video as the first image.
[0080] In other embodiments, the generation module 603 is configured to: obtain a target video segment in the first video, the target video segment including the first image and at least part of the video frame image before the first image, and splice the target video segment with multiple frames of second images to obtain the target video.
[0081] In other embodiments, the preset parameters may include one or more of the following: camera movement parameters for camera movement processing; stylization parameters for stylization processing; and image parameters for determining the duration and size of the target video.
[0082] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiment scheme of the present disclosure. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0083] Figure 7 A schematic block diagram of an electronic device provided in some embodiments of the present disclosure. Figure 7 As shown, the electronic device 910 includes a processor 911 and a memory 912, which can be used to implement a client or a server. The memory 912 is used to store computer executable instructions (e.g., one or more computer program modules) non-transiently. The processor 911 is used to run the computer executable instructions, and when the computer executable instructions are run by the processor 911, one or more steps in the method for generating a video described above can be executed, thereby implementing the method for generating a video described above. The memory 912 and the processor 911 can be interconnected through a bus system and / or other forms of connection mechanisms (not shown).
[0084] For example, the processor 911 may be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units having data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) may be an X86 or ARM architecture, etc. The processor 911 may be a general-purpose processor or a dedicated processor, and may control other components in the electronic device 910 to perform desired functions.
[0085] For example, the memory 912 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 911 may run one or more computer program modules to implement various functions of the electronic device 910. Various applications and various data, as well as various data used and / or generated by the application, etc. may also be stored in the computer-readable storage medium.
[0086] It should be noted that, in the embodiment of the present disclosure, the specific functions and technical effects of the electronic device 910 can refer to the description of the method for generating a video in the above text, and will not be repeated here.
[0087] Figure 8 A schematic block diagram of another electronic device provided for some embodiments of the present disclosure. The electronic device 920 is, for example, suitable for implementing the method for generating a video provided in an embodiment of the present disclosure. The electronic device 920 may be a terminal device, etc., and may be used to implement a client or a server. The electronic device 920 may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. It should be noted that Figure 8 The electronic device 920 shown is only an example and does not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0088] like Figure 8 As shown, the electronic device 920 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 921, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 922 or a program loaded from a storage device 928 into a random access memory (RAM) 923. In the RAM 923, various programs and data required for the operation of the electronic device 920 are also stored. The processing device 921, the ROM 922, and the RAM 923 are connected to each other via a bus 924. An input / output (I / O) interface 925 is also connected to the bus 924.
[0089] Typically, the following devices may be connected to the I / O interface 925: an input device 926 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 927 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 928 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 929. The communication device 929 may allow the electronic device 920 to communicate with other electronic devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 920 is shown to have various devices, but it should be understood that it is not required to implement or possess all of the devices shown, and the electronic device 920 may alternatively implement or possess more or fewer devices.
[0090] For example, according to an embodiment of the present disclosure, the above-mentioned method for generating a video can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned method for generating a video. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 929, or installed from a storage device 928, or installed from a ROM 922. When the computer program is executed by the processing device 921, the functions defined in the method for generating a video provided in an embodiment of the present disclosure can be implemented.
[0091] Fig. 9 A schematic diagram of a storage medium provided in some embodiments of the present disclosure. Fig. 9 As shown, the storage medium 930 may be a non-transitory computer-readable storage medium for storing non-transitory computer-executable instructions 931. When the non-transitory computer-executable instructions 931 are executed by a processor, the method for generating a video described in the embodiment of the present disclosure may be implemented. For example, when the non-transitory computer-executable instructions 931 are executed by a processor, one or more steps in the method for generating a video described above may be performed.
[0092] For example, the storage medium 930 may be applied to the above-mentioned electronic device. For example, the storage medium 930 may include a memory in the electronic device.
[0093] For example, the storage medium may include a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), flash memory, or any combination of the above storage media, or other applicable storage media.
[0094] For example, the description of the storage medium 930 can refer to the description of the memory in the embodiment of the electronic device, and the repeated parts are not repeated. The specific functions and technical effects of the storage medium 930 can refer to the description of the method for generating a video above, and are not repeated here.
[0095] It should be noted that in the context of the present disclosure, a computer-readable medium may be a tangible medium that may contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. A computer-readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by an instruction execution system, device or device or used in combination with it. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0096] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0097] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for generating a video, the method comprising: Acquire a first image, and acquire preset parameters; Based on the first image and the preset parameters, performing stylized camera movement processing to obtain multiple frames of second images; A target video is generated based on the multiple frames of second images.
2. The method according to claim 1, wherein: The step of performing stylized camera movement processing based on the first image and the preset parameters to obtain a plurality of frames of second images includes: According to the preset parameters, the first image is taken as the first frame of the image to be processed, and stylization processing and camera movement processing are performed alternately to generate multiple frames of second images frame by frame.
3. The method according to claim 2, wherein: According to the preset parameters, the first image is used as the first frame to be processed, and stylization processing and camera movement processing are performed alternately, including performing the following target operations multiple times: Acquire a current image to be processed; wherein, when the target operation is performed for the first time, the current image to be processed is the first image; when the target operation is not performed for the first time, the current image to be processed is obtained based on the image generated in the last target operation; According to the preset parameters, stylized processing is performed on the current image to be processed to obtain a stylized image, and based on the stylized image, at least one camera movement processing is performed to obtain at least one frame of camera movement image; The stylized image and at least a portion of the camera movement image are acquired as a second image.
4. The method according to claim 3, wherein: The step of acquiring the stylized image and at least a portion of the camera movement image as a second image includes: The stylized image and a camera movement image obtained by performing camera movement processing on the stylized image are acquired as a second image.
5. The method according to claim 1, wherein: The acquiring of the first image comprises: Get the first video; A frame of image is acquired from the first video as the first image.
6. The method according to claim 5, wherein generating a target video based on the plurality of frames of second images comprises: Obtaining a target video segment in the first video; The target video segment includes the first image and at least a portion of video frame images before the first image; The target video segment is spliced with the multiple frames of second images to obtain the target video.
7. The method according to any one of claims 1 to 6, wherein: The preset parameters include one or more of the following: Camera movement parameters used for camera movement processing; Stylization parameters for stylization processing; Image parameters used to determine the target video length and size.
8. A device for generating a video, the device comprising: An acquisition module, used to acquire a first image and acquire preset parameters; A processing module, configured to perform stylized camera movement processing based on the first image and the preset parameters to obtain a plurality of frames of second images; A generating module is used to generate a target video based on the multiple frames of second images.
9. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.