A method for remapping a video and related devices
By preprocessing the original video and determining the mapping parameters, combined with background video fusion, the complexity of video remapping on mobile phones is solved, and simple and fast video special effects production is achieved.
Patent Information
- Application Number
- CN202210600243.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-05-27
AI Technical Summary
The existing video remapping methods are complex to use on mobile phones, are not friendly to ordinary users, and have a high threshold for use.
Provide a video remapping method, which preprocesses the original video, determines the mapping parameters, and merges with the preset background video to realize automatic remapping.
It simplifies the operation process and reduces the requirements for computing capabilities, allowing ordinary users to quickly realize the integration of video special effects on the mobile phone, improving the user experience.
Smart Images

Figure CN115100259B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video processing, and particularly relates to a video remapping method and related devices. Background Art
[0002] Video editing can add different flavors to the video itself and improve its attractiveness. In the past, video editing required hardware with strong computing processing capabilities and specialized processing software, such as AE and Pr, to implement. Video remapping is a video processing method for re - editing the display effect of a video. For example, accelerating the rhythm of the video or slowing down the rhythm of the video.
[0003] With the popularization of short - video usage, more and more users shoot and share videos through mobile phones. However, the computing power of mobile terminals is relatively poor, and generally only relatively simple video processing can be used. In addition, although professional video processing software has many functions, there is a certain entry threshold. Therefore, for users who have not studied the user manual or received relevant training, it has a relatively high threshold. Therefore, the current video remapping methods still have problems such as inconvenient use and being unfriendly to ordinary users. Summary of the Invention
[0004] The technical problem to be solved by the present invention is that video remapping is complex and difficult for mobile phones and ordinary users. In view of the deficiencies of the prior art, a video remapping method and related devices are provided.
[0005] To solve the above - mentioned technical problems, the technical solutions adopted by the present invention are as follows:
[0006] A video remapping method, the method comprising:
[0007] Obtain the original video to be processed;
[0008] Pre - process the original video to obtain an initial video;
[0009] Determine the mapping parameters corresponding to each initial frame in the initial video according to the preset remapping information;
[0010] Fuse the initial frame with a preset background video according to the mapping parameters to obtain a target video.
[0011] Optionally, the pre - processing includes matte extraction processing; the step of pre - processing the original video to obtain an initial video includes:
[0012] When a matte extraction instruction is detected, perform object recognition on each original frame in the original video to obtain a number of candidate item images;
[0013] When a confirmation instruction for the candidate item image is detected, the candidate item image corresponding to the confirmation instruction is used as the object for image cropping;
[0014] According to the object for image cropping, perform image cropping on the original frames in the original video to obtain an initial video.
[0015] Optionally, the determining the mapping parameters corresponding to each initial frame in the initial video according to the preset remapping information includes:
[0016] When a time selection instruction for the initial video is detected, according to the time selection instruction, determine the video to be processed in the initial video;
[0017] Display the remapping names corresponding to a plurality of preset remapping information;
[0018] When a confirmation instruction for the remapping name is detected, according to the confirmation instruction, determine the remapping data corresponding to the video to be processed;
[0019] According to the remapping data, determine the mapping parameters corresponding to each initial frame in the video to be processed.
[0020] Optionally, the background video includes a blank video composed of a blank canvas.
[0021] Optionally, the mapping parameters include an array of parameters.
[0022] Optionally, the target video includes a plurality of target frames and time stamps corresponding to each of the target frames; the fusing the initial frame with a preset background video according to the mapping parameters includes:
[0023] For each background frame, according to the time sequence number in the mapping parameters, determine the fused image in the image frame corresponding to this background frame;
[0024] Use the fused image to update the texture of this background frame to obtain a target frame;
[0025] Take the time stamp corresponding to this background frame as the time stamp corresponding to the target frame to obtain a target video.
[0026] Optionally, the target video includes a plurality of target frames and time stamps corresponding to each of the target frames, and the mapping parameters further include a remapping function; the fusing the initial frame with a preset background video according to the mapping parameters includes:
[0027] For each background frame, according to the time sequence number in the mapping parameters, determine the fused image in the image frame corresponding to this background frame;
[0028] For each of the fused images, calculate the fused position corresponding to each pixel point in the fused image according to the remapping function;
[0029] For each of the fused images, calculate the fused position corresponding to each pixel point in the fused image according to the remapping function;
[0030] According to the order of the time sequence numbers and the fused positions, use the fused image to update the texture of the background frame corresponding to the fused image to obtain a target frame.
[0031] A remapping device for a video, the device includes:
[0032] An acquisition module, configured to acquire an original video to be processed;
[0033] A preprocessing module, configured to preprocess the original video to obtain an initial video;
[0034] A determination module, configured to determine the mapping parameters corresponding to each initial frame in the initial video according to preset remapping information;
[0035] A fusion module, configured to fuse the initial frame with a preset background video according to the mapping parameters to obtain a target video.
[0036] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in any of the above-mentioned video remapping methods.
[0037] A terminal device includes: a processor, a memory, and a communication bus; a computer-readable program executable by the processor is stored on the memory;
[0038] The communication bus realizes connection communication between the processor and the memory;
[0039] When the processor executes the computer-readable program, the steps in any of the above-mentioned video remapping methods are implemented.
[0040] Beneficial effects: The present invention provides a method for remapping a video. First, the original video to be remapped is obtained, and the original video is preprocessed to obtain the initial video in the original video. According to the remapping information designed in advance for the initial video, the mapping parameters corresponding to each initial frame in the initial video can be calculated. In this way, the client can automatically perform the remapping of the initial video. Finally, according to the mapping parameters, the initial frame and the background video are fused. Since the initial frame is fused according to the mapping parameters, the fused video can have special effects that the original original video does not have. The whole process is simple and fast to operate, and does not require a large amount of calculation, so it can be implemented on the mobile client, which is convenient for users to use. Description of the Drawings
[0041] Figure 1 It is a flowchart of the method for remapping a video provided by the present invention.
[0042] Figure 2 It is a schematic diagram of four consecutive image frames in the original video in the method for remapping a video provided by the present invention (the playback order is from top to bottom).
[0043] Figure 3 It is a schematic diagram of a background frame in the background video in the method for remapping a video provided by the present invention.
[0044] Figure 4 It is a schematic diagram of four consecutive image frames in the target video in the method for remapping a video provided by the present invention (the playback order is from top to bottom).
[0045] Figure 5 It is a schematic diagram of the video remapping device provided by the present invention.
[0046] Figure 6 It is a schematic diagram of the structural principle of the terminal device provided by the present invention. Detailed Embodiments
[0047] The present invention provides a method for remapping a video. To make the purpose, technical solution and effects of the present invention clearer and more definite, the following further describes the present invention in detail with reference to the accompanying drawings and by way of examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0048] Those skilled in the art of the present technology can understand that, unless specifically stated otherwise, the singular forms "a", "an", "the", and "said" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present invention means the presence of the described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or their groups. It should be understood that when we say an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The phrase "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0049] Those skilled in the art of the present technology can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as the general understanding of those of ordinary skill in the art to which the present invention pertains. It should also be understood that terms such as those defined in a general dictionary should be understood to have a meaning consistent with the meaning in the context of the prior art, and will not be interpreted with an idealized or overly formal meaning unless specifically defined as here.
[0050] As Figure 1 shown, this embodiment provides a method for remapping a video. For the convenience of description, this embodiment describes the application program installed with the video remapping method as the execution subject. In addition, electronic devices such as computers, mobile phones, and tablets can all be used as the execution subject of this solution, and the application scope of this solution is not limited to the subject of this embodiment. The method for remapping a video includes the following steps:
[0051] S10. Obtain the original video to be processed.
[0052] Specifically, the user first uploads the video pre-shot or saved locally to the application program on the client. This embodiment refers to the video that needs to be processed by the application program as the original video. As Figure 2 shown, the original video provided in this embodiment contains a girl and a rabbit, and as time goes by (time = 1 to time = 5), the expression of the girl changes from happy to uncomfortable.
[0053] S20. Preprocess the original video to obtain an initial video.
[0054] Specifically, after obtaining the original video, there may be situations where the original video and the background video to be fused later have inconsistent sizes, inconsistent clarity, etc. Therefore, it is necessary to preprocess the original video to ensure that the initial video obtained after preprocessing can be fused into the background video.
[0055] After obtaining the original video, the application will display a preprocessing window and monitor the preprocessing window. The preprocessing window includes the names corresponding to some preprocessing methods, such as shearing, cropping, and rotating.
[0056] In one preprocessing method, the preprocessing window includes a video shearing key. The user only wants to remap a segment of the original video, so the user will click the video shearing key and can specify the start frame and end frame in the original video by sliding the progress bar, entering the start or end point of shearing, etc. According to the start frame and end frame, the original video is sheared to obtain an initial video.
[0057] In the second preprocessing method, the preprocessing window includes an image cropping key. When it is detected that the user clicks the image cropping key, a cropping frame or a cropping coordinate window, etc. can be displayed so that the user can specify the picture coordinates of the cropped image through the cropping frame, or enter the coordinate values of the cropped image in the cropping coordinate window to determine the picture coordinates of the cropped image. According to the image picture coordinates, the application crops each video frame in the original video to obtain an initial video.
[0058] In the above two processing methods, most of the image information in the original video is retained in the initial video. However, if you want to make a more interesting video, or want to save part of the information in the background video and only fuse part of the information in the original video, so in the third preprocessing method of this embodiment, the preprocessing includes matte extraction processing, and its specific steps include:
[0059] A10. When a matte extraction instruction is detected, object recognition is performed on each original frame in the original video to obtain a number of candidate item images.
[0060] Specifically, the preprocessing window includes a matte extraction key. When it is detected that the user clicks the matte extraction key, object recognition is performed on each original frame in the original video to obtain candidate item images. The recognition objects in object recognition can include human bodies, human faces, animals, tables, etc., and the recognized candidate item images refer to the images containing the recognized items.
[0061] For example, if a person is included in object recognition, after object recognition, an image containing a human figure can be displayed and used as a candidate item image. Figure 1 This is an image content in the original video uploaded for this embodiment, which contains a girl and a rabbit. After object recognition, the image containing the person and the image containing the rabbit can be extracted, and these two images are used as candidate item images.
[0062] A20. When a confirmation instruction for the candidate item image is detected, the candidate item image corresponding to the confirmation instruction is used as the matte extraction object.
[0063] Specifically, candidate item images are displayed and monitored. When a confirmation instruction for one or several candidate item images is monitored, the item in the candidate item image is taken as the object to be cropped.
[0064] In this embodiment, what the user expects to achieve is to merge the person in the original video into the background video. Therefore, the user sends a confirmation instruction for the candidate item image containing the person. The application determines the candidate item image containing the girl as the object to be cropped according to the confirmation instruction.
[0065] A30. According to the object to be cropped, perform cropping processing on the original frames in the original video to obtain an initial video.
[0066] Specifically, after obtaining the object to be cropped, that is, determining the object to be cropped in each original frame. Therefore, according to the object to be cropped, cropping processing can be performed on the objects to be cropped in all original frames to obtain an initial video.
[0067] In addition to the above three preprocessing methods, this embodiment may also include various different preprocessing methods such as rotation, color temperature adjustment, and grayscale conversion. In addition to the user clicking to select different preprocessing methods as described above, these preprocessing methods can also be saved as default processing in the application in advance. When the user uploads the original video, based on the default processing, any one of the above preprocessing methods, other common preprocessing methods, and their combinations can be automatically performed on the original video. Still taking portrait cropping as an example, when the default processing includes the processing method of cropping the portrait, after the user uploads the original video, based on the default processing, the application can automatically generate an initial video.
[0068] In addition, the initial video in this embodiment only contains multiple initial frames arranged in sequence and does not contain background music. The music can be obtained in the later processing. For example, after obtaining the target video, the user can select the background music by himself and insert it into the target video, or insert the background music of the original video itself into the target video; or each different template information has its corresponding background music, and after obtaining the target video, the background music in the target information can be automatically inserted.
[0069] S30. According to the preset remapping information, determine the mapping parameters corresponding to each initial frame in the initial video.
[0070] Specifically, the remapping information refers to the information set for each initial frame in the video again. The remapping information in this embodiment includes time remapping information and image remapping information. The remapping information can be sent from the server to the application, or can be saved by the application itself.
[0071] Taking the time remapping information as an example, the time remapping information is the information that sets the corresponding time sequence number for each initial frame in the video. Relative to the time remapping information, the mapping parameter is the time sequence number.
[0072] Generally, the time sequence number corresponding to each initial frame is consistent with its order in the initial video. For example, according to the order in the initial video, that is, the frame number sequence, the time sequence number corresponding to the first initial frame is 1, the time sequence number corresponding to the second initial frame is 2, the time sequence number corresponding to the third initial frame is 3... However, time remapping will break the time sequence number corresponding to the initial frame. For example, the time sequence number corresponding to the first image is 3, the time sequence number corresponding to the second initial frame is 4, the time sequence number corresponding to the third initial frame is 1... Therefore, in this example, the time sequence numbers corresponding to the initial frames are 3, 4, 1...
[0073] In remapping, different time sequence numbers can correspond to the same initial frame, and it is also possible that the time sequence numbers corresponding to some initial frames are empty. For example, the first frame image corresponds to the time sequence number 1, the time sequence number corresponding to the second initial frame is empty, the time sequence number corresponding to the third initial frame is 2, and the final visual effect presented is that the playback speed of the video will be accelerated; for another example, the time sequence numbers corresponding to the first initial frame are 1, 2, 3, and the final visual effect is that the playback speed of the video will be slowed down. Therefore, in this example, the time sequence numbers corresponding to the first image are (1, 2, 3).
[0074] Since the subsequent remapping of the initial frames is performed in the order of the time sequence numbers, in order to achieve fusion quickly, in this embodiment, the mapping parameter is represented in the form of a parameter array. For example, the parameter array (remap: 1, time: 1) indicates that the time sequence number (remap) is 1 and the order (time) of the initial frame in the initial video is 1, that is, the time sequence number corresponding to the first initial frame is 1. Further, fixing the structure of the parameter array, taking the first digit in the parameter array as the time sequence number and the second digit in the parameter array as the frame number sequence of the initial frame, the above parameter data can be abbreviated as (1, 1). This way can reduce the amount of data sent by the server and improve the processing efficiency. Therefore, the pseudo code of the remapping information sent by the server can be:
[0075]
[0076]
[0077] In addition to time remapping, the remapping information and remapping data may also include image remapping. Image remapping refers to mapping each pixel in a certain image to the corresponding position in another image according to certain rules to obtain a new image, such as inversion, distortion, and magnification. If the remapping information includes image remapping, the remapping information can adopt a remapping function. Correspondingly, the remapping function can be written in the parameter array, for example, written in the third position, right next to time.
[0078] In one implementation, the remapping information is the default of the application program and can only adopt a fixed remapping method to determine the time sequence number corresponding to each initial frame. This method has poor flexibility, and the display effect of the finally synthesized target video is single. Therefore, in another implementation of this embodiment, the user can select the remapping scheme corresponding to the initial video by himself. In addition, the initial video can be fused with different remapping schemes subsequently. Therefore, determining the mapping parameters corresponding to each initial frame may include the following process:
[0079] B10. When a time selection instruction for the initial video is detected, according to the time selection instruction, determine the video to be processed in the initial video.
[0080] Specifically, first, the user sends a time selection instruction for the initial video. For example, if the length of the initial video is 1 minute and the time selection instruction sent by the user is from 10 seconds to 20 seconds, then the video in the 10 - second to 20 - second time period in the initial video is used as the video to be processed. In addition, the user can also select all the content of the initial video as the video to be processed.
[0081] B20. Display the remapping names corresponding to a preset number of remapping information.
[0082] Specifically, multiple different remapping information and the names of the remappings are pre - stored in the application program. After the user selects the video to be processed in the initial video, the remapping names are displayed so that the user can select according to the needs. Taking time remapping as an example, the display name corresponding to each remapping data is "speed up", "slow down", "pause", "repeat", etc. According to the displayed names, the user can select different remapping schemes.
[0083] B30. When a confirmation instruction for the remapping name is detected, according to the confirmation instruction, determine the remapping data corresponding to the video to be processed.
[0084] Specifically, when a confirmation instruction for the remapping name is detected, it means that the user hopes to apply the remapping information corresponding to the remapping name to this segment of the video to be processed, and the corresponding remapping information here is used as the remapping data corresponding to the processed video.
[0085] B40. Determine the mapping parameters corresponding to each initial frame in the video to be processed according to the remapping data.
[0086] Specifically, finally, according to the remapping data, determine the mapping parameters corresponding to each initial frame in the video to be processed. This process is similar to the way of determining each initial frame in the initial video described above, so it will not be elaborated here.
[0087] S40. Integrate the initial frame with a preset background video according to the mapping parameters to obtain a target video.
[0088] Specifically, preset a background video, which is a preset video for subsequent integration of the initial frame onto this background video. For example, Figure 3 as shown, the background video can be a video with scene content (a cat), or a blank video composed of a blank canvas without content.
[0089] Taking time remapping as an example, after obtaining the mapping parameters of each initial frame, since remapping is equivalent to rearranging the initial frames, determine the initial frame corresponding to each background frame in the background video according to the time sequence number. The initial frame corresponding to the background frame is called the fusion image. For each background frame, determine the fusion image in the initial frames corresponding to this background frame according to the time sequence number.
[0090] For example, for the first background frame, according to the frame number sequence of the background video, it can be determined that the time sequence number corresponding to the first background frame is 1, and then according to the time sequence number, determine the initial frame corresponding to this time sequence number as the fusion image corresponding to the first background frame.
[0091] Finally, use the fusion image to update the texture of this background frame to integrate the fusion image into the background frame to obtain a target frame. According to the order of the time sequence numbers, integrate all the fusion images into the background frames to obtain multiple target frames.
[0092] The reason why a video can be played is, in addition to having multiple images, also including the time stamp corresponding to each image. Therefore, the target video includes several target frames and the time stamp corresponding to each target video. Finally, use the time stamp corresponding to the background frame as the time stamp of the target frame to obtain a target video that can be played animatedly.
[0093] Taking image remapping as an example, first, according to the time serial number, determine the fused image in the initial frame corresponding to each background frame. Then, for each background frame, according to the remapping function corresponding to this background frame, calculate the fused position corresponding to each pixel point in the fused image corresponding to this background frame. Since the time serial number corresponding to the background frame also corresponds to the frame number serial number, therefore, according to the time serial number, the remapping function corresponding to each background frame can be determined, and then, taking each pixel point in the fused image as an object, based on the remapping function, calculate the fused position. For example, the remapping function is x2 = x1 + 2, that is, for the same pixel point, if the coordinate in the fused image is (x1), then the fused position in the background frame needs to be offset 2 pixel units in the positive direction of the coordinate axis. Based on the fused position, the texture of the background frame can be updated to obtain the target frame. Finally, in the same way as the above time remapping method, use the time stamp corresponding to this background frame as the time stamp corresponding to the target frame to obtain the target video.
[0094] Figure 4 Two remapping forms are adopted. One is time remapping. The time serial number corresponding to the initial frame with frame number serial number 1 in the target video is 5, and the time serial number corresponding to the initial frame with frame number serial number 2 is 3... In this way, the expression of the girl in the target video is different from that in the original video. The other is image remapping. As the playback time goes by, the distance between the girl and the cat is getting farther and farther, changing the meaning of the video and increasing the interest.
[0095] Image remapping and time remapping can be used simultaneously. When determining the fused image according to the time serial number, the initial frame can determine the fused image corresponding to the background frame based on the mapping parameters of time remapping.
[0096] In this way, the application can quickly remap the original video uploaded by the user to obtain the reconstructed target video. Taking time remapping as an example, compared with the original original video, the target video can achieve various special effects such as acceleration, deceleration, and repetition. During this period, the user's operation is less, and the mobile terminal does not require too much computing power, so it is convenient and fast.
[0097] Based on the above video remapping method, as Figure 5 shown, the present invention also provides a video remapping device 100, and this device includes:
[0098] An acquisition module 110, configured to acquire the original video to be processed;
[0099] A preprocessing module 120, configured to preprocess the original video to obtain an initial video;
[0100] A determination module 130, configured to determine the mapping parameters corresponding to each initial frame in the initial video according to the preset remapping information;
[0101] A fusion module 140, configured to fuse the initial frame with a preset background video according to the mapping parameters to obtain a target video.
[0102] Wherein, the preprocessing includes matte extraction processing; specifically, the preprocessing module 120 is configured to:
[0103] When a matte extraction instruction is detected, perform object recognition on each original frame in the original video to obtain a plurality of candidate item images;
[0104] When a confirmation instruction for the candidate item image is detected, use the candidate item image corresponding to the confirmation instruction as the matte extraction object;
[0105] Perform matte extraction processing on the original frames in the original video according to the matte extraction object to obtain an initial video.
[0106] Wherein, the determination module 130 is specifically configured to:
[0107] When a time selection instruction for the initial video is detected, determine the video to be processed in the initial video according to the time selection instruction;
[0108] Display the remapping names corresponding to a preset plurality of remapping information;
[0109] When a confirmation instruction for the remapping name is detected, determine the remapping data corresponding to the video to be processed according to the confirmation instruction;
[0110] Determine the mapping parameters corresponding to each initial frame in the video to be processed according to the remapping data.
[0111] Wherein, the background video includes a blank video composed of a blank canvas.
[0112] Wherein, the mapping parameters include a parameter array.
[0113] Wherein, the target video includes a plurality of target frames and a time stamp corresponding to each target frame; specifically, the fusion module 140 is configured to:
[0114] For each background frame, determine a fusion image in the image frame corresponding to the background frame according to the time sequence number in the mapping parameters;
[0115] Use the fusion image to update the texture of the background frame to obtain a target frame;
[0116] Use the time stamp corresponding to the background frame as the time stamp corresponding to the target frame to obtain a target video.
[0117] Among them, the fusion module 140 can also be used for:
[0118] For each background frame, determine a fused image in the image frame corresponding to the background frame according to the time sequence number in the mapping parameters;
[0119] For each of the fused images, calculate the fused position corresponding to each pixel point in the fused image according to the remapping function;
[0120] For each of the fused images, calculate the fused position corresponding to each pixel point in the fused image according to the remapping function;
[0121] According to the order of the time sequence numbers and the fused positions, use the fused image to update the texture of the background frame corresponding to the fused image to obtain a target frame.
[0122] Based on the above video remapping method, the present invention also provides a terminal device, as Figure 6 shown, which includes at least one processor 20; a display screen 21; and a memory 22, and may further include a communication interface 23 and a bus 24. Among them, the processor 20, the display screen 21, the memory 22, and the communication interface 23 can complete mutual communication through the bus 24. The display screen 21 is set to display a user guidance interface preset in the initial setting mode. The communication interface 23 can transmit information. The processor 20 can call the logical commands in the memory 22 to execute the method in the above embodiments.
[0123] In addition, when the logical commands in the above-mentioned memory 22 are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium.
[0124] The memory 22, as a computer-readable storage medium, can be set to store software programs and computer-executable programs, such as the program commands or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, commands, or modules stored in the memory 22, that is, implements the methods in the above embodiments.
[0125] The memory 22 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, may also be a transient computer-readable storage medium.
[0126] In addition, the specific processes of loading and executing multiple commands in the above-mentioned computer-readable storage medium and the terminal device have been described in detail in the above method, and will not be elaborated here one by one.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for remapping a video, characterized in that, The method includes: Obtaining an original video to be processed; Performing preprocessing on the original video to obtain an initial video; Determining mapping parameters corresponding to each initial frame in the initial video according to preset remapping information, where the mapping parameters include a parameter array, the first digit of the parameter array is a time sequence number, the second digit is a frame number sequence number of the initial frame, and the third digit is a remapping function; Fusing the initial frame with a preset background video according to the mapping parameters to obtain a target video, where the background video includes a blank video composed of a blank canvas; The determining mapping parameters corresponding to each initial frame in the initial video according to preset remapping information includes: When a time selection instruction for the initial video is detected, determining a video to be processed in the initial video according to the time selection instruction; Displaying remapping names corresponding to a plurality of preset remapping information; When a confirmation instruction for the remapping name is detected, determining remapping data corresponding to the video to be processed according to the confirmation instruction; Determining mapping parameters corresponding to each initial frame in the video to be processed according to the remapping data; The target video includes a plurality of target frames and time stamps corresponding to each target frame; the fusing the initial frame with a preset background video according to the mapping parameters to obtain a target video includes: For each background frame, determining a time sequence number corresponding to the background frame according to the frame number sequence number of the background video, and then determining an initial frame corresponding to the time sequence number according to the time sequence number, and calling the initial frame corresponding to the background frame a fused image; For each fused image, calculating a fused position corresponding to each pixel point in the fused image according to the remapping function; Updating the texture of the background frame corresponding to the fused image with the fused image according to the order of the time sequence numbers and the fused positions to obtain a target frame; Using the time stamp corresponding to the background frame as the time stamp corresponding to the target frame to obtain a target video.
2. The method for remapping a video according to claim 1, wherein The preprocessing includes matte processing; the performing preprocessing on the original video to obtain an initial video includes: When a matte instruction is detected, performing object recognition on each original frame in the original video to obtain a plurality of candidate item images; When a confirmation instruction for the candidate item image is detected, using the candidate item image corresponding to the confirmation instruction as a matte object; Performing matte processing on the original frames in the original video according to the matte object to obtain an initial video.
3. A video remapping device, characterized in that, The video remapping device includes: An obtaining module, configured to obtain an original video to be processed; A preprocessing module, configured to perform preprocessing on the original video to obtain an initial video; A determining module, configured to determine mapping parameters corresponding to each initial frame in the initial video according to preset remapping information, where the mapping parameters include a parameter array, the first digit of the parameter array is a time sequence number, the second digit is a frame number sequence number of the initial frame, and the third digit is a remapping function; A fusion module, configured to fuse the initial frame with a preset background video according to the mapping parameters to obtain a target video, where the background video includes a blank video composed of a blank canvas; The determining module is specifically configured to: When a time selection instruction for the initial video is detected, determine a video to be processed in the initial video according to the time selection instruction; Display remapping names corresponding to a plurality of preset remapping information; When a confirmation instruction for the remapping name is detected, determine remapping data corresponding to the video to be processed according to the confirmation instruction; Determine mapping parameters corresponding to each initial frame in the video to be processed according to the remapping data; The target video includes a plurality of target frames and time stamps corresponding to each of the target frames, and the fusion module is configured to: For each background frame, determine a time sequence number corresponding to the background frame according to the frame sequence number of the background video, and then determine the initial frame corresponding to the time sequence number according to the time sequence number, and call the initial frame corresponding to the background frame the fusion image; For each of the fusion images, calculate a fusion position corresponding to each pixel point in the fusion image according to the remapping function; According to the order of the time sequence numbers and the fusion positions, use the fusion image to update the texture of the background frame corresponding to the fusion image to obtain a target frame; Use the time stamp corresponding to the background frame as the time stamp corresponding to the target frame to obtain a target video.
4. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the video remapping method according to any one of claims 1 and 2.
5. A terminal device, characterized in that, Including: A processor, a memory, and a communication bus; The memory stores a computer-readable program executable by the processor; The communication bus realizes connection communication between the processor and the memory; When the processor executes the computer-readable program, it implements the steps in the video remapping method according to any one of claims 1 and 2.
Citation Information
Patent Citations
Method of synthesizing image and electronic device
CN106803888A
Video processing method and device and storage medium
CN110290425A
Video fusion method and device, electronic equipment and storage medium
CN113989173A