Method, system and related equipment for generating stretch rebound video transition special effects
Stretch and rebound video frames are generated through nonlinear radial offset processing, which solves the problem of abrupt video transitions in the existing technology and achieves a natural and visually appealing stretch and rebound video transition effect.
Patent Information
- Application Number
- CN202310682473.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-08
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-06-08
AI Technical Summary
Existing video transition effects are stiff at the junction of images and fail to fully consider the visual sensory experience, resulting in a poor user experience.
Use nonlinear radial offset processing based on frame intervals to generate stretch and rebound video frames. By combining these frames, a natural stretch and rebound video transition effect is generated, simulating the panel pulling from far to near and then from near to far. Stretch and rebound effect.
It achieves a more natural video transition, improves the visual perception, and provides a more interesting stretch and rebound video transition effect.
Smart Images

Figure CN116781844B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of transition special effects, and in particular to a method and system for generating a stretch rebound video transition special effect and related equipment. Background Art
[0002] Currently in the field of video editing, when multiple video clips or multiple pictures are spliced together, transition processing is required at the connection between the video clips or images. The process of transition processing can be to first generate multiple transition images, splice the multiple transition images into a transition video, and set the transition video between two video clips or two images. There are many types of transition special effects in the prior art, which are very interesting. However, most of the existing transition special effects are simple switching of images, and do not take into account the perception of visual senses, resulting in a stiff transition and a poor user experience.
[0003] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0004] The main purpose of the present invention is to solve the technical problems mentioned in the background technology of the prior art.
[0005] A first aspect of the present invention provides a method for generating a stretch rebound video transition special effect, comprising the following steps:
[0006] Based on the time point when the stretch-rebound video transition special effect takes effect in the entire video, a stretch target video frame and a rebound target video frame are obtained;
[0007] Performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blurred video frame set;
[0008] Performing nonlinear radial offset processing based on frame interval on each pixel point of the rebound target video frame to obtain a second radial blurred video frame set;
[0009] Reverse processing is performed on the second radial blurred video frame set to obtain a radial blurred restored video frame set;
[0010] The first radially blurred video frame set and the radially blurred restored video frame set are combined to generate a stretch rebound video transition special effect.
[0011] In an optional implementation of the first aspect of the present invention, performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blurred video frame set includes:
[0012] Taking the stretch target video frame as the stretch start frame;
[0013] Performing texture coordinate calculation of each subsequent stretched video frame based on the stretched start frame;
[0014] The distance between each non-central pixel point and the central pixel point in the stretching start frame is acquired and a power operation is performed to obtain the power distance between each non-central pixel point and the central pixel point in the stretching start frame;
[0015] Obtaining a stretching strength coefficient of the stretched video frame based on a frame interval between the stretched video frame and the stretching start frame;
[0016] The texture coordinates of each pixel in the stretched video frame are calculated based on the stretching strength coefficient of the stretched video frame, the power distance between each non-central pixel and the central pixel in the stretching start frame, and the coordinates of each non-central pixel relative to the central pixel in the stretching start frame;
[0017] Generate the stretched video frame based on the texture coordinates of each pixel point in the stretched video frame;
[0018] The stretch target video frame and all the stretch video frames within the stretch time interval are collected to obtain the first radial blurred video frame set.
[0019] In an optional implementation of the first aspect of the present invention, the texture coordinates of each pixel in the stretched video frame are calculated based on the stretching strength coefficient of the stretched video frame, the power distance between each non-central pixel and the central pixel in the stretching start frame, and the coordinates of each non-central pixel relative to the central pixel in the stretching start frame, and include:
[0020] Substituting the stretching strength coefficient of the stretched video frame, the power distance between each of the non-central pixel points and the central pixel point in the stretching start frame, and the coordinates of each of the non-central pixel points in the stretching start frame relative to the central pixel point into a preset pixel point offset vector calculation formula to obtain an offset vector of each of the non-central pixel points in the stretching start frame;
[0021] Performing a modulus operation on the offset vector of each of the non-central pixel points in the stretching start frame to obtain the modulus of the offset vector of each of the non-central pixel points in the stretching start frame;
[0022] The modulus of the offset vector of each non-central pixel point in the stretching start frame and the stretching strength coefficient of the stretched video frame are substituted into a preset coordinate remapping formula to calculate the texture coordinates of each pixel point in the stretched video frame.
[0023] In an optional implementation of the first aspect of the present invention, generating the stretched video frame based on the texture coordinates of each pixel point in the stretched video frame includes:
[0024] Filtering the texture coordinates of several pixel points that meet the requirements from the texture coordinates of each pixel point in the stretched video frame based on the original size of the stretched target video frame;
[0025] A new blank frame is created, the texture coordinates of a required number of pixel points are staggered and filled into the blank frame, and a linear interpolation process is performed on the missing pixel points in the blank frame to obtain the stretched video frame.
[0026] In an optional implementation manner of the first aspect of the present invention, before obtaining the stretching strength coefficient of the stretched video frame based on the frame interval between the stretched video frame and the stretching start frame, the method includes:
[0027] Get the duration of the stretch video effect;
[0028] Obtaining the value range of the variable factor of the tensile strength coefficient;
[0029] Obtaining the number of divisions of the value range through the duration and frame interval of the stretching video special effect;
[0030] Divide the value range of the variable factor of the tensile strength coefficient into the respective values of the divided number;
[0031] A mapping relationship between each of the numerical values and a corresponding time of each of the frame intervals is established.
[0032] In an optional implementation of the first aspect of the present invention, performing nonlinear radial offset processing based on frame interval on each pixel point of the rebound target video frame to obtain a second radial blurred video frame set includes:
[0033] Using the rebound target video frame as the rebound start frame;
[0034] Performing texture coordinate calculation of each subsequent rebound video frame based on the rebound start frame;
[0035] The distance between each non-central pixel point and the central pixel point in the rebound start frame is obtained and then subjected to power operation to obtain the power distance between each non-central pixel point and the central pixel point in the rebound start frame;
[0036] Obtaining a tensile strength coefficient of the rebound video frame based on a frame interval between the rebound video frame and the rebound start frame;
[0037] The texture coordinates of each pixel in the rebound video frame are calculated based on the stretch strength coefficient of the rebound video frame, the power distance between each non-central pixel and the central pixel in the rebound start frame, and the coordinates of each non-central pixel in the rebound start frame relative to the central pixel;
[0038] Generate the rebound video frame based on the texture coordinates of each pixel point in the rebound video frame;
[0039] The rebound target video frame and all the rebound video frames in the stretching time interval are collected to obtain the second radial blurred video frame set.
[0040] In an optional implementation of the first aspect of the present invention, obtaining a stretch target video frame and a rebound target video frame based on the action time point of the stretch rebound video transition special effect in the entire video includes:
[0041] The time point at which the stretch-rebound video transition effect works in the entire video;
[0042] The stretch target video frame is obtained from the previous moment of the action time point, and the rebound target video frame is obtained from the next moment of the action time point.
[0043] A second aspect of the present invention provides a system for generating a stretch-rebound video transition special effect, the system comprising:
[0044] A target video frame acquisition module is used to obtain a stretch target video frame and a rebound target video frame based on the time point when the stretch rebound video transition special effect acts on the entire video;
[0045] A first radial blur processing module, used for performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blur video frame set;
[0046] A second radial blur processing module, used for performing nonlinear radial offset processing based on frame interval on each pixel point of the rebound target video frame to obtain a second radial blur video frame set;
[0047] A reverse processing module, used for performing reverse processing on the second radial blurred video frame set to obtain a radial blurred restored video frame set;
[0048] The video combination module is used to combine the first radially blurred video frame set and the radially blurred restored video frame set to generate a stretch rebound video transition special effect.
[0049] A third aspect of the present invention provides a device for generating a stretch-rebound video transition special effect, the device comprising: a memory and at least one processor, the memory storing instructions, the memory and the at least one processor being interconnected via a line;
[0050] The at least one processor calls the instruction in the memory to enable the stretch-rebound video transition special effect generation device to execute the stretch-rebound video transition special effect generation method as described in any one of the above items.
[0051] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for generating a stretch-rebound video transition special effect as described in any one of the above items is implemented.
[0052] Beneficial effects: The present invention provides a method, system and related equipment for generating a stretch-rebound video transition special effect. The method includes obtaining a stretch target video frame and a rebound target video frame based on the time point of the stretch-rebound video transition special effect in the entire video; performing nonlinear radial offset processing based on the frame interval on each pixel point of the stretch target video frame to obtain a first radial blurred video frame set; performing nonlinear radial offset processing based on the frame interval on each pixel point of the rebound target video frame to obtain a second radial blurred video frame set; performing reverse processing on the second radial blurred video frame set to obtain a radial blurred restored video frame set; combining the first radial blurred video frame set and the radial blurred restored video frame set to generate a stretch-rebound video transition special effect. The present invention utilizes nonlinear radial blur and radial blur restoration to simulate the panel stretch rebound effect from far to near and then from near to far for transition, and the transition is natural with better visual perception. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A schematic diagram of an embodiment of a method for generating a stretch rebound video transition special effect according to the present invention;
[0054] Figure 2 A schematic diagram of an embodiment of a system for generating a stretch-rebound video transition special effect according to the present invention;
[0055] Figure 3 The present invention is a schematic diagram of an embodiment of a device for generating a stretch-rebound video transition special effect. DETAILED DESCRIPTION
[0056] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0057] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 The first aspect of the present invention provides a method for generating a stretch rebound video transition special effect, comprising the following steps:
[0058] S100. Based on the effective time point of the stretch-rebound video transition effect in the entire video, a stretch target video frame and a rebound target video frame are obtained; in the present invention, the effective time point of the stretch-rebound video transition effect in the entire video is the effective position of the stretch-rebound video transition effect in the video. For example, the total length of a video is 50 minutes, and the user chooses to add the stretch-rebound video transition effect at the 10th minute position.
[0059] In step S100 of the present invention, the obtaining of the stretch target video frame and the rebound target video frame based on the action time point of the stretch rebound video transition special effect in the entire video specifically includes: based on the action time point of the stretch rebound video transition special effect in the entire video; obtaining the stretch target video frame from the previous moment of the action time point, and obtaining the rebound target video frame from the next moment of the action time point. In the present invention, the stretch target video frame and the rebound target video frame are obtained in parallel, and the interval between the previous moment of the action time point and the action time point and the interval between the next moment of the action time point and the action time point can be different. The purpose of the present invention is to obtain two different video frames on both sides of the action time point as the stretch target video frame and the rebound target video frame respectively.
[0060] S200, performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blurred video frame set; in the present invention, the nonlinear radial offset processing based on frame interval can be understood as that each stretched video frame in the stretching special effect processing process is obtained based on the stretched target video frame (starting frame), and each stretched video frame has different pixel points and positions of each pixel point based on its different frame interval with the stretched target video frame (the purpose of nonlinear radial offset is to make the pixel point farther away from the center of the stretched video frame in the radial direction, the smaller the pixel point density), so as to simulate the elastic panel effect of applying a vertical screen pulling force to the four corners of the image, and the pixel density gradually increases from the four corners of the image to the center of the image.
[0061] In an optional implementation of step S200 of the present invention, performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blurred video frame set includes:
[0062] The stretch target video frame is used as the stretch start frame.
[0063] Texture coordinate calculations are performed on subsequent stretched video frames based on the stretching start frame; in the present invention, pixels and pixel positions in subsequent stretched video frames are controlled by frame intervals of the remaining stretched start frames. For example, the duration of a stretched special effect video frame is 10 seconds, and the number of playback frames is 1 frame per second. There are 10 subsequent stretched video frames after the stretching start frame, and the frame interval of the frame closest to the stretching start frame is 1 second. The frame interval of the next frame from the stretching start frame is 2 seconds, and so on. It should be noted that the default first frame time is 0 seconds.
[0064] In the present invention, when calculating each of the stretched video frames after the stretched target video frame, since they are all based on the stretched target video frame, it is necessary to first obtain the distance between each non-center pixel point and the center pixel point in the stretched starting frame and perform a power operation to obtain the power distance between each non-center pixel point and the center pixel point in the stretched starting frame; in the present invention, the purpose of the power operation is to cause a nonlinear change in the distance between each non-center pixel point and the center pixel point of the stretched target video frame, so that subsequent calculations can make the density between pixels smaller the farther the center of the image in the pixel point is, and the effect of the elastic panel can be more realistically simulated.
[0065] Based on the frame interval between the stretched video frame and the stretched start frame, the stretching strength coefficient of the stretched video frame is obtained; of course, before this step: it is necessary to first obtain the duration of the stretched video special effect, for example, the total duration of the stretched video special effect is 10s; obtain the value range of the variable factor of the stretching strength coefficient, for example, 0-1; obtain the number of divisions of the value range through the duration and frame interval of the stretched video special effect, for example, the total number of frames of the stretched video special effect is 11 frames; divide the value range of the variable factor of the stretching strength coefficient into each value of the number of divisions, and each value is 0.0, 0.1, 0.2, 0.3, ..., 0.9 and 1.0; establish a mapping relationship between each of the values and the corresponding moments of each frame interval, for example, for the 0th second of the duration, the value corresponds to 0.0; for the 1st second of the duration, the value corresponds to 0.1, and finally the stretching strength coefficient is obtained equal to the value corresponding to the variable factor multiplied by the preset maximum stretching strength coefficient.
[0066] Based on the stretching strength coefficient of the stretched video frame, the power distance between each of the non-central pixels and the central pixel in the stretching start frame, and the coordinates of each of the non-central pixels in the stretching start frame relative to the central pixel, the texture coordinates of each pixel in the stretched video frame are calculated; more specifically, the calculation process of this step is: substituting the stretching strength coefficient of the stretched video frame, the power distance between each of the non-central pixels and the central pixel in the stretching start frame, and the coordinates of each of the non-central pixels in the stretching start frame relative to the central pixel into a preset pixel offset vector calculation formula to obtain the offset vector of each of the non-central pixels in the stretching start frame; performing a modulus operation on the offset vector of each of the non-central pixels in the stretching start frame to obtain the modulus of the offset vector of each of the non-central pixels in the stretching start frame; substituting the modulus of the offset vector of each of the non-central pixels in the stretching start frame and the stretching strength coefficient of the stretched video frame into a preset coordinate remapping formula to calculate the texture coordinates of each pixel in the stretched video frame.
[0067] The stretched video frame is generated based on the texture coordinates of each pixel point in the stretched video frame; it should be noted that since the texture coordinates of each pixel point in the stretched video frame are radially offset compared to the stretched target video frame, the overall size of the stretched video frame is larger than the stretched target video frame, and the size of the display screen is fixed, so the texture coordinates of each pixel point in the stretched video frame cannot all be displayed and must be screened.
[0068] In an optional implementation of the first aspect of the present invention, generating the stretched video frame based on the texture coordinates of each pixel point in the stretched video frame includes: filtering the texture coordinates of several pixel points that meet the requirements from the texture coordinates of each pixel point in the stretched video frame based on the original size of the stretched target video frame; creating a new blank frame, filling the required number of texture coordinates of several pixel points into the blank frame in an offset manner, and performing linear interpolation processing on the missing pixel points in the blank frame to obtain the stretched video frame.
[0069] The stretch target video frame and all the stretch video frames within the stretch time interval are collected to obtain the first radial blurred video frame set.
[0070] S300, performing nonlinear radial offset processing based on frame interval on each pixel point of the rebound target video frame to obtain a second radial blurred video frame set; in the present invention, the process of performing nonlinear radial offset processing based on frame interval on each pixel point of the rebound target video frame and the process of performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame are the same, except that the input pictures are different.
[0071] Analogously to the video frame processing process of step S200, the processing process of step S300 of the present invention includes: taking the rebound target video frame as the rebound start frame; performing texture coordinate calculations on subsequent rebound video frames based on the rebound start frame; obtaining the distance between each non-center pixel point and the center pixel point in the rebound start frame and performing a power calculation to obtain the power distance between each non-center pixel point and the center pixel point in the rebound start frame; obtaining the stretching strength coefficient of the rebound video frame based on the stretching strength coefficient of the rebound video frame, the power distance between each non-center pixel point and the center pixel point in the rebound start frame, and the coordinates of each non-center pixel point in the rebound start frame relative to the center pixel point; generating the rebound video frame based on the texture coordinates of each pixel point in the rebound video frame; collecting the rebound target video frame and all the rebound video frames in the stretching time interval to obtain the second radial blurred video frame set. The specific details of each step in the processing process of step S300 in the present invention can refer to the specific details of each step in the processing process of step S200, and the present invention will not be described in detail here.
[0072] S400. Process the second radial blurred video frame set in reverse order to obtain a radial blurred restored video frame set. In the present invention, if the second radial blurred video frame is also played in normal order, then the transition animation will become a nonlinear radial blur of the picture repeated twice, which will not form a visual effect of the focal length changing from far to near and then from near to far. Therefore, the second radial blurred video frame set needs to be played in reverse order. The reverse order processing process is to exchange the first video frame and the last video frame in the second radial blurred video frame set, and the second video frame and the second to last video frame, and so on.
[0073] S500, combining the first radially blurred video frame set and the radially blurred restored video frame set to generate a stretch-rebound video transition special effect. In the present invention, the stretch-rebound video transition special effect is composed of the first radially blurred video frame set and the radially blurred restored video frame set. When the video is played at the transition special effect position, the image stretching effect of the stretch target video frame gradually blurring radially from the pixel point in the corner to the center of the image, and the image rebound effect of the radially blurred rebound target video frame gradually blurring radially from the pixel point in the corner to the center of the image can be viewed in sequence.
[0074] To put it simply, the principle of the stretch rebound transition special effect of the elastic panel effect used in the present invention is as follows:
[0075] The present invention is based on real physical phenomena. The principle is that when an elastic object is stretched, the pattern on the object is also stretched and deformed. It can be generally understood that when the object is stretched, the material unit becomes sparse (in the direction of stretching, the density is reduced). Based on this analysis, returning to the perspective of graphics, in fact, the mapping relationship between the image texture and the real display device (screen) is changed. For example, in the stretched state, the mapping relationship may be as follows: from the range (0, 1) to the range (0, 2). In this way, the phenomenon of physical stretching is perfectly restored.
[0076] Imagine an elastic panel. If you use the four corners as force points and stretch it perpendicular to the top of the panel, it will extend from the center of the panel to the surrounding areas with varying degrees of stretching. The further away from the center point, the greater the degree of stretching. From this relationship, it can be deduced that a circular SDF (signed distance field) can be simulated, and then combined with some factor parameters, the functional relationship between stretching strength and distance can be synthesized.
[0077] More specifically, the codes of several core algorithms used in the stretch rebound transition special effect of the present invention are as follows:
[0078] float r=pow(coord.x, 2.0)+pow(coord.y, 2.0);
[0079] vec2 offset=coord*(1.5+(-strength*0.0021)*r);
[0080] vec2 uv=(coord*(1.0+(-strength*0.0021)*(pow(offset.x, 2.0)+pow(offset.y, 2.0))))*0.5+0.5;
[0081] Among them, r = pow (coord.x, 2.0) + pow (coord.y, 2.0) is used to calculate the square of the radius of the circle, which is equivalent to first obtaining the distance (radius) from the current pixel to the center point, and then squaring it, which is equivalent to performing a power function conversion. The function is to make the distance and radius results form a nonlinear relationship (as the independent variable increases, the slope also tends to increase). The simulated phenomenon is that the degree of stretching of the object gradually increases from the center to the surroundings (increasing distance).
[0082] offset=coord*(1.5+(-strength*0.0021)*r) is used to determine the pixel misalignment offset vector. The base is the current pixel position vector. The number 1.5 is a custom preset based on the needs of the stretching deformation severity. The larger the value, the greater the stretching severity, and vice versa. strength is the stretching strength coefficient. This factor is an open parameter and can be dynamically configured by the user. 0.0021 is a secondary influencing factor. This parameter has no practical significance. It is mainly used to adapt the strength parameter to the relevant export parameters in the image processing software.
[0083] uv=(coord*(1.0+(-strength*0.0021)*(pow(offset.x,2.0)+pow(offset.y,2.0))))*0.5+0.5 is mainly used to determine the position vector after pixel offset. The final offset coefficient is determined by calculating the modulus of the offset vector (pow(offset.x,2.0)+pow(offset.y,2.0)); finally, there is a remapping process of the offset position vector (x∈[-1,1], then (x*0.5+0.5)∈[0,1], which is consistent with the image texture coordinates).
[0084] In the real-time rendering process of transition effects, the position of each pixel on the image at each moment is controlled by the variable of the stretching strength coefficient strength, which involves a linear mapping relationship with time. Its pre-transformation is: strength = maxstrength (maximum stretching strength coefficient) * completion, where completion is a variable factor from 0 to 1. Different moments correspond to different completion values. Through different variable factors, the texture UV coordinates are changed, thereby realizing the transition effects of radial blur and radial blur recovery of pixels on the image.
[0085] The scheme of the present invention can make the video transition effect have a real stretching and offset effect, and a visual phenomenon of focal length from normal to infinitely close can be seen. It has a real shrinking and offset effect, and a visual phenomenon of focal length from infinitely far to normal can be seen. When the elastic panel is nonlinearly and gradually stretched and deformed, it highly simulates the stretching in the real physical environment, and then rebounds to the original non-stretched state after a certain degree, and the principle of focal length transformation is used in the process (only when the focal length is normal, the scene is the clearest state, and in other cases, the clarity and focal length will show a certain curve mapping relationship).
[0086] See also Figure 2 The second aspect of the present invention provides a system for generating a stretch-rebound video transition special effect, and the system for generating a stretch-rebound video transition special effect comprises:
[0087] The target video frame acquisition module 10 is used to obtain a stretch target video frame and a rebound target video frame based on the time point of the stretch rebound video transition special effect in the entire video;
[0088] A first radial blur processing module 20 is used to perform nonlinear radial offset processing based on frame intervals on each pixel point of the stretched target video frame to obtain a first radial blur video frame set;
[0089] A second radial blur processing module 30 is used to perform nonlinear radial offset processing based on frame intervals on each pixel point of the rebound target video frame to obtain a second radial blur video frame set;
[0090] A reverse processing module 40, configured to perform reverse processing on the second radial blurred video frame set to obtain a radial blurred restored video frame set;
[0091] The video combination module 50 is used to combine the first radially blurred video frame set and the radially blurred restored video frame set to generate a stretch rebound video transition special effect.
[0092] In an optional implementation of the second aspect of the present invention, the first radial blur processing module includes:
[0093] A stretching start frame definition unit, used to use the stretching target video frame as the stretching start frame;
[0094] A first texture coordinate calculation starting unit, used for performing texture coordinate calculations of subsequent stretched video frames based on the stretched start frame;
[0095] A first pixel distance nonlinear processing unit is used to obtain the distance between each non-central pixel point and the central pixel point in the stretching start frame and perform a power operation to obtain the power distance between each non-central pixel point and the central pixel point in the stretching start frame;
[0096] A first stretching strength coefficient obtaining unit, configured to obtain a stretching strength coefficient of the stretched video frame based on a frame interval between the stretched video frame and the stretching start frame;
[0097] A first texture coordinate calculation unit is used to calculate the texture coordinates of each pixel in the stretched video frame based on the stretching strength coefficient of the stretched video frame, the power distance between each non-central pixel and the central pixel in the stretching start frame, and the coordinates of each non-central pixel in the stretching start frame relative to the central pixel.
[0098] A stretched video frame generating unit, configured to generate the stretched video frame based on the texture coordinates of each pixel point in the stretched video frame;
[0099] The first radial blurred video frame set collecting unit is used to collect the stretched target video frame and all the stretched video frames in the stretched time interval to obtain the first radial blurred video frame set.
[0100] In an optional implementation of the second aspect of the present invention, the first texture coordinate calculation unit includes:
[0101] an offset vector quantum calculation unit, used to substitute the stretching strength coefficient of the stretched video frame, the power distance between each of the non-central pixel points and the central pixel point in the stretching start frame, and the coordinates of each of the non-central pixel points in the stretching start frame relative to the central pixel point into a preset pixel offset vector calculation formula to obtain an offset vector of each of the non-central pixel points in the stretching start frame;
[0102] a modulus calculation subunit, configured to perform a modulus operation on the offset vector of each of the non-central pixel points in the stretching start frame to obtain the modulus of the offset vector of each of the non-central pixel points in the stretching start frame;
[0103] The coordinate remapping subunit is used to substitute the modulus of the offset vector of each non-central pixel point in the stretching start frame and the stretching strength coefficient of the stretched video frame into a preset coordinate remapping formula to calculate the texture coordinates of each pixel point in the stretched video frame.
[0104] In an optional implementation of the second aspect of the present invention, the stretched video frame generation unit includes:
[0105] A coordinate misalignment sampling subunit, configured to filter the texture coordinates of a plurality of pixels meeting the requirements from the texture coordinates of each pixel in the stretched video frame based on the original size of the stretched target video frame;
[0106] The coordinate filling unit is used to create a new blank frame, fill the texture coordinates of a required number of pixel points into the blank frame in an offset manner, and perform linear difference processing on the missing pixel points in the blank frame to obtain the stretched video frame.
[0107] In an optional implementation of the second aspect of the present invention, the first radial blur processing module further includes:
[0108] A stretching special effect duration acquisition unit, used to acquire the duration of the stretching video special effect;
[0109] A tensile strength coefficient value range acquisition unit, used to acquire the value range of the tensile strength coefficient;
[0110] A division number acquisition unit, used to obtain the division number within the value range according to the duration and frame interval of the stretching video special effect;
[0111] A separation value calculation unit, used for dividing the value range of the tensile strength coefficient into the separation number of values;
[0112] The separated value mapping unit is used to establish a mapping relationship between each of the values and the corresponding time of each of the frame intervals.
[0113] In an optional implementation of the second aspect of the present invention, the second radial fuzzy processing module includes:
[0114] A rebound start frame definition unit, used to use the rebound target video frame as the rebound start frame;
[0115] A second texture coordinate calculation starting unit, used for performing texture coordinate calculation of each subsequent rebound video frame based on the rebound start frame;
[0116] A second pixel distance nonlinear processing unit is used to obtain the distance between each non-central pixel point and the central pixel point in the rebound start frame and perform a power operation to obtain the power distance between each non-central pixel point and the central pixel point in the rebound start frame;
[0117] A second stretch strength coefficient obtaining unit, configured to obtain a stretch strength coefficient of the rebound video frame based on a frame interval between the rebound video frame and the rebound start frame;
[0118] A second texture coordinate calculation unit is used to calculate the texture coordinates of each pixel in the rebound video frame based on the stretch strength coefficient of the rebound video frame, the power distance between each non-central pixel and the central pixel in the rebound start frame, and the coordinates of each non-central pixel in the rebound start frame relative to the central pixel;
[0119] A rebound video frame generating unit, configured to generate the rebound video frame based on the texture coordinates of each pixel point in the rebound video frame;
[0120] The second radial blurred video frame set collecting unit is used to collect the rebound target video frame and all the rebound video frames in the stretching time interval to obtain the second radial blurred video frame set.
[0121] In an optional implementation of the second aspect of the present invention, the target video frame acquisition module includes:
[0122] A stretch target video frame acquisition unit, configured to obtain a stretch target video frame from a previous moment of the stretch rebound video transition special effect based on the action time point of the stretch rebound video transition special effect in the entire video;
[0123] The rebound target video frame acquisition unit is used to obtain the rebound target video frame from the next moment of the action time point.
[0124] Figure 3It is a structural schematic diagram of a device for generating a stretch-rebound video transition special effect provided by an embodiment of the present invention. The device for generating the stretch-rebound video transition special effect may have relatively large differences due to different configurations or performances, and may include one or more processors 60 (central processing units, CPU) (for example, one or more processors) and a memory 70, and one or more storage media 80 for storing application programs or data (for example, one or more massive storage devices). Among them, the memory and the storage medium may be short-term storage or permanent storage. The program stored in the storage medium may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the device for generating the stretch-rebound video transition special effect. Furthermore, the processor may be configured to communicate with the storage medium and execute a series of instruction operations in the storage medium on the device for generating the stretch-rebound video transition special effect.
[0125] The stretch rebound video transition special effect generating device of the present invention may also include one or more power supplies 90, one or more wired or wireless network interfaces 100, one or more input and output interfaces 110, and / or one or more operating systems, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It can be understood by those skilled in the art that Figure 3 The structure of the device for generating the stretch-rebound video transition special effect shown does not constitute a limitation on all devices for generating the stretch-rebound video transition special effects of the present invention, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0126] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the method for generating the stretch-rebound video transition special effects.
[0127] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system or system or unit described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0128] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0129] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating a stretch rebound video transition special effect, characterized in that: The following steps are involved: Based on the time point of the stretch-rebound video transition special effect in the entire video, a stretch target video frame and a rebound target video frame are obtained; Performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blurred video frame set; Performing nonlinear radial offset processing based on frame interval on each pixel point of the rebound target video frame to obtain a second radial blurred video frame set; Reverse processing is performed on the second radial blurred video frame set to obtain a radial blurred restored video frame set; Combining the first radially blurred video frame set and the radially blurred restored video frame set to generate a stretch rebound video transition special effect; The step of performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blurred video frame set includes: Taking the stretch target video frame as the stretch start frame; Performing texture coordinate calculations on subsequent stretched video frames based on the stretched start frame; The distance between each non-central pixel point and the central pixel point in the stretching start frame is acquired and a power operation is performed to obtain the power distance between each non-central pixel point and the central pixel point in the stretching start frame; Obtaining a stretching strength coefficient of the stretched video frame based on a frame interval between the stretched video frame and the stretching start frame; The texture coordinates of each pixel in the stretched video frame are calculated based on the stretching strength coefficient of the stretched video frame, the power distance between each non-central pixel and the central pixel in the stretching start frame, and the coordinates of each non-central pixel relative to the central pixel in the stretching start frame; Generate the stretched video frame based on the texture coordinates of each pixel point in the stretched video frame; Collecting the stretch target video frame and all the stretch video frames within the stretch time interval to obtain the first radial blurred video frame set; The step of obtaining the stretching strength coefficient of the stretched video frame based on the frame interval between the stretched video frame and the stretching start frame includes: Get the duration of the stretch video effect; Obtaining the value range of the variable factor of the tensile strength coefficient; Obtaining the number of divisions of the value range through the duration and frame interval of the stretching video special effect; Divide the value range of the variable factor of the tensile strength coefficient into the respective values of the divided number; Establishing a mapping relationship between each of the numerical values and a corresponding time of each of the frame intervals; The step of performing nonlinear radial offset processing based on frame interval on each pixel point of the rebound target video frame to obtain a second radial blurred video frame set comprises: Using the rebound target video frame as the rebound start frame; Performing texture coordinate calculation of subsequent rebound video frames based on the rebound start frame; The distance between each non-central pixel point and the central pixel point in the rebound start frame is obtained and then subjected to power operation to obtain the power distance between each non-central pixel point and the central pixel point in the rebound start frame; Obtaining a tensile strength coefficient of the rebound video frame based on a frame interval between the rebound video frame and the rebound start frame; The texture coordinates of each pixel in the rebound video frame are calculated based on the stretch strength coefficient of the rebound video frame, the power distance between each non-central pixel and the central pixel in the rebound start frame, and the coordinates of each non-central pixel in the rebound start frame relative to the central pixel; Generate the rebound video frame based on the texture coordinates of each pixel point in the rebound video frame; The rebound target video frame and all the rebound video frames in the stretching time interval are collected to obtain the second radial blurred video frame set.
2. The method for generating the stretch rebound video transition special effect according to claim 1, characterized in that: The texture coordinates of each pixel in the stretched video frame are calculated based on the stretching strength coefficient of the stretched video frame, the power distance between each non-central pixel and the central pixel in the stretching start frame, and the coordinates of each non-central pixel relative to the central pixel in the stretching start frame, and include: Substituting the stretching strength coefficient of the stretched video frame, the power distance between each of the non-central pixel points and the central pixel point in the stretching start frame, and the coordinates of each of the non-central pixel points in the stretching start frame relative to the central pixel point into a preset pixel point offset vector calculation formula to obtain an offset vector of each of the non-central pixel points in the stretching start frame; Performing a modulus operation on the offset vector of each of the non-central pixel points in the stretching start frame to obtain the modulus of the offset vector of each of the non-central pixel points in the stretching start frame; The modulus of the offset vector of each non-central pixel point in the stretching start frame and the stretching strength coefficient of the stretched video frame are substituted into a preset coordinate remapping formula to calculate the texture coordinates of each pixel point in the stretched video frame.
3. The method for generating the stretch rebound video transition special effect according to claim 2, characterized in that: Generating the stretched video frame based on the texture coordinates of each pixel point in the stretched video frame comprises: Filtering the texture coordinates of several pixel points that meet the requirements from the texture coordinates of each pixel point in the stretched video frame based on the original size of the stretched target video frame; A new blank frame is created, the texture coordinates of a required number of pixel points are staggered and filled into the blank frame, and a linear interpolation process is performed on the missing pixel points in the blank frame to obtain the stretched video frame.
4. The method for generating the stretch rebound video transition special effect according to claim 1, characterized in that: The obtaining of the stretch target video frame and the rebound target video frame based on the action time point of the stretch rebound video transition special effect in the whole video includes: The time point at which the stretch-rebound video transition effect works in the entire video; The stretch target video frame is obtained from the previous moment of the action time point, and the rebound target video frame is obtained from the next moment of the action time point.
5. A system for generating stretch rebound video transition special effects, characterized in that: The generation system of the stretch rebound video transition special effect includes: A target video frame acquisition module is used to obtain a stretch target video frame and a rebound target video frame based on the time point when the stretch rebound video transition special effect acts on the entire video; A first radial blur processing module, used for performing nonlinear radial offset processing based on frame interval on each pixel point of the stretched target video frame to obtain a first radial blur video frame set; A second radial blur processing module, used for performing a nonlinear radial offset process based on a frame interval on each pixel point of the rebound target video frame to obtain a second radial blur video frame set; A reverse processing module, used for performing reverse processing on the second radial blurred video frame set to obtain a radial blurred restored video frame set; A video combination module, used for combining the first radially blurred video frame set and the radially blurred restored video frame set to generate a stretch rebound video transition special effect; The first radial blur processing module comprises: A stretching start frame definition unit, used to use the stretching target video frame as the stretching start frame; A first texture coordinate calculation starting unit, used for performing texture coordinate calculations of subsequent stretched video frames based on the stretched start frame; A first pixel distance nonlinear processing unit is used to obtain the distance between each non-central pixel point and the central pixel point in the stretching start frame and perform a power operation to obtain the power distance between each non-central pixel point and the central pixel point in the stretching start frame; A first stretching strength coefficient obtaining unit, configured to obtain a stretching strength coefficient of the stretched video frame based on a frame interval between the stretched video frame and the stretching start frame; A first texture coordinate calculation unit is used to calculate the texture coordinates of each pixel in the stretched video frame based on the stretching strength coefficient of the stretched video frame, the power distance between each non-central pixel and the central pixel in the stretching start frame, and the coordinates of each non-central pixel in the stretching start frame relative to the central pixel. A stretched video frame generating unit, configured to generate the stretched video frame based on the texture coordinates of each pixel point in the stretched video frame; A first radial blurred video frame set collecting unit, configured to collect the stretched target video frame and all the stretched video frames within a stretched time interval to obtain the first radial blurred video frame set; The first radial blur processing module also includes: A stretching special effect duration acquisition unit, used to acquire the duration of the stretching video special effect; A tensile strength coefficient value range acquisition unit, used to acquire the value range of the tensile strength coefficient; A division number acquisition unit, used to obtain the division number within the value range according to the duration and frame interval of the stretching video special effect; A separation value calculation unit, used for dividing the value range of the tensile strength coefficient into the values of the separation number; A separation value mapping unit, used to establish a mapping relationship between each of the values and a corresponding time of each of the frame intervals; The second radial blur processing module comprises: A rebound start frame definition unit, used to use the rebound target video frame as the rebound start frame; A second texture coordinate calculation starting unit, used for performing texture coordinate calculation of subsequent rebound video frames based on the rebound start frame; A second pixel distance nonlinear processing unit is used to obtain the distance between each non-central pixel point and the central pixel point in the rebound start frame and perform a power operation to obtain the power distance between each non-central pixel point and the central pixel point in the rebound start frame; A second stretch strength coefficient obtaining unit, configured to obtain a stretch strength coefficient of the rebound video frame based on a frame interval between the rebound video frame and the rebound start frame; A second texture coordinate calculation unit is used to calculate the texture coordinates of each pixel in the rebound video frame based on the stretch strength coefficient of the rebound video frame, the power distance between each non-central pixel and the central pixel in the rebound start frame, and the coordinates of each non-central pixel in the rebound start frame relative to the central pixel; A rebound video frame generating unit, configured to generate the rebound video frame based on the texture coordinates of each pixel point in the rebound video frame; The second radial blurred video frame set collecting unit is used to collect the rebound target video frame and all the rebound video frames in the stretching time interval to obtain the second radial blurred video frame set.
6. A device for generating stretch rebound video transition special effects, characterized in that: The stretch rebound video transition special effect generating device comprises: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instruction in the memory to enable the stretch-rebound video transition special effect generation device to execute the stretch-rebound video transition special effect generation method according to any one of claims 1-4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating the stretch rebound video transition special effect as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Image processing method and device, computer equipment and storage medium
CN114626978A
Method for realizing special effect of rotating and twisting video transition and related equipment
CN115334254A
