CN-121985082-A - Video processing method, apparatus, storage medium, and program product
Abstract
The embodiment of the application provides a video processing method, video processing equipment, a storage medium and a program product. In the embodiment of the application, the motion amplitude of the part to be processed is determined through the position change of the part to be processed, which needs deformation processing, between the deformation areas in the current frame and the history frame, and the initial deformation area in the current frame is subjected to smooth processing based on the motion amplitude and the history frame, so that the time sequence continuity of the deformation area is enhanced, and meanwhile, the initial deformation strength is attenuated, so that the deformation action strength is reduced. Although the deformation area is updated along with the movement, the track of the smooth deformation area is more stable, and the intensity after attenuation lightens the disturbance amplitude of pixels, so that the background distortion is changed more smoothly and has higher consistency between adjacent frames, and the background jitter phenomenon in the video can be effectively relieved.
Inventors
- HAN GUANGXIN
- Ding Zhonggan
- DENG SIBIN
- CHEN YING
Assignees
- 淘宝(中国)软件有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260112
Claims (16)
- 1. A video processing method, comprising: Determining a to-be-processed part of a target object included in a current video frame, which needs deformation processing; Determining an initial deformation area of the to-be-processed part in the current video frame according to the image coordinates of the target key point of the to-be-processed part in the current video frame, wherein the initial deformation area corresponds to initial deformation strength; determining a target motion amplitude of the part to be processed according to the position change between the historical deformation area and the initial deformation area of the part to be processed in the historical video frame; smoothing the initial deformation region according to the target motion amplitude and the historical deformation region to obtain a target deformation region; according to the target motion amplitude, carrying out attenuation treatment on the initial deformation strength to obtain target deformation strength; and carrying out deformation treatment on the part to be treated in the current video frame according to the target deformation region and the target deformation strength.
- 2. The method of claim 1, wherein smoothing the initial deformation region according to the target motion amplitude and the historical deformation region comprises: Determining a target smooth amplitude corresponding to the target motion amplitude according to the target motion amplitude and a first mapping relation between the preset smooth amplitude and the motion amplitude; and carrying out fusion processing on the history deformation region and the initial deformation region according to the target smoothing amplitude so as to carry out smoothing processing on the initial deformation region.
- 3. The method of claim 2, wherein the historical deformation region is a deformation region of the portion to be processed after the smoothing process corresponding to the historical video frame; And according to the target smooth amplitude, performing fusion processing on the historical deformation region and the initial deformation region, wherein the fusion processing comprises the following steps: Determining the weight of a target historical deformation region corresponding to the previous video frame and the weight of the initial deformation region according to the target smooth amplitude, wherein the sum of the weight of the target historical deformation region and the weight of the initial deformation region is equal to a preset value; and carrying out weighted fusion on the target historical deformation region and the initial deformation region according to the weight of the target historical deformation region and the weight of the initial deformation region.
- 4. The method of claim 3, wherein determining the weight of the target historical deformation region corresponding to the previous video frame and the weight of the initial deformation region according to the target smoothing amplitude comprises: determining the target smooth amplitude as the weight of the target historical deformation region; and subtracting the target smooth amplitude from the preset value to determine the weight of the initial deformation area.
- 5. A method according to claim 3, wherein the initial deformation region and the target historical deformation region are circular; The step of carrying out weighted fusion on the target historical deformation region and the initial deformation region according to the weight of the target historical deformation region and the weight of the initial deformation region comprises the following steps: according to the weight of the target historical deformation region and the weight of the initial deformation region, carrying out weighted summation on the circle center of the target historical deformation region and the circle center of the initial deformation region to obtain the circle center of the target deformation region; and according to the weight of the target historical deformation region and the weight of the initial deformation region, carrying out weighted summation on the radius of the target historical deformation region and the radius of the initial deformation region to obtain the radius of the target deformation region.
- 6. The method according to claim 2, wherein the determining the target smooth amplitude corresponding to the target motion amplitude according to the target motion amplitude and the first mapping relationship between the preset smooth amplitude and the motion amplitude includes: And inputting the target motion amplitude into a monotonically decreasing function in the first mapping relation to calculate so as to obtain a target smooth amplitude corresponding to the target motion amplitude, wherein an independent variable of the monotonically decreasing function is the motion amplitude, and a dependent variable is the smooth amplitude.
- 7. The method of claim 1, wherein attenuating the initial deformation strength according to the target motion amplitude to obtain a target deformation strength comprises: determining a target attenuation amplitude corresponding to the target motion amplitude according to the target motion amplitude and a second mapping relation between the preset attenuation amplitude and the motion amplitude, wherein the attenuation amplitude is positively correlated with the motion amplitude in the second mapping relation; and carrying out intensity attenuation treatment on the initial deformation intensity according to the target attenuation amplitude so as to obtain the target deformation intensity.
- 8. The method of claim 7, wherein determining the target attenuation magnitude corresponding to the target motion magnitude according to the target motion magnitude and a second mapping relationship between a preset attenuation magnitude and a motion magnitude, comprises: And inputting the target motion amplitude into a monotonically increasing function in the second mapping relation to calculate so as to obtain the target attenuation amplitude, wherein the independent variable of the monotonically increasing function is the motion amplitude, and the dependent variable is the attenuation amplitude.
- 9. The method of claim 7, wherein attenuating the initial deformation strength according to the target attenuation magnitude comprises: And subtracting the target attenuation amplitude from a preset value to serve as an attenuation coefficient, and carrying out attenuation treatment on the initial deformation strength.
- 10. The method of any of claims 1-9, wherein the historical video frame comprises a previous video frame to the current video frame, wherein the historical deformation region comprises a target historical deformation region for the portion to be processed in the previous video frame, and wherein the method further comprises: calculating the position change between the target historical deformation region and the initial deformation region according to the first position information of the target historical deformation region in the previous video frame and the second position information of the initial deformation region in the current video frame; calculating a scale normalization coefficient according to the scale of the history deformation area; The determining the target motion amplitude of the to-be-processed part according to the position change between the historical deformation area and the initial deformation area of the to-be-processed part in the historical video frame comprises the following steps: And carrying out scale normalization on the position change by using the scale normalization coefficient to obtain the target motion amplitude.
- 11. The method of claim 10, wherein the initial deformation region and the target historical deformation region are circular, the first location information comprises center coordinates of the target historical deformation region, the second location information comprises center coordinates of the initial deformation region, a scale of the target historical deformation region is a radius of the target historical deformation region, and a scale of the initial deformation region is a radius of the initial deformation region; The calculating the position change between the target historical deformation region and the initial deformation region according to the first position information of the historical deformation region in the historical video frame and the second position information of the initial deformation region in the current video frame comprises the following steps: Calculating the distance between the circle center of the initial deformation region and the circle center of the historical deformation region according to the circle center coordinates of the initial deformation region and the circle center coordinates of the historical deformation region, and taking the distance as the position change; Determining a scale normalization coefficient according to the scale of the history deformation area, including: and calculating the average value of the radius of the history deformation area to obtain the scale normalization coefficient.
- 12. The method according to any one of claims 1-9, wherein determining an initial deformation region and an initial deformation strength of a portion of the target object to be processed from a current video frame of the target object comprises: detecting key points of the target object on a current video frame of the target object to determine first image coordinates of the target key points of the to-be-processed part on the current video frame; And calculating the initial deformation region and the initial deformation strength according to the first image coordinates and the shape of the target deformation region matched with the to-be-processed part.
- 13. A video processing method, comprising: receiving a video stream uploaded by live broadcast equipment, wherein the video stream comprises an image of a host broadcast in a live broadcast room; Performing deformation processing on a part to be processed, which is required to be deformed by a host in the video stream, by using the video processing method according to any one of claims 1 to 12 to obtain a target video stream; and transmitting the target video stream to the terminal equipment corresponding to the live broadcasting room.
- 14. The electronic device is characterized by comprising a memory and a processor, wherein the memory is used for storing a computer program; The processor is coupled to the memory for executing the computer program for performing the steps in the method of any of claims 1-13.
- 15. A computer-readable storage medium storing computer instructions that, when executed by one or more processors, cause the one or more processors to perform the steps in the method of any of claims 1-13.
- 16. A computer program product comprising a computer program which, when executed by one or more processors, causes the one or more processors to perform the steps in the method of any of claims 1-13.
Description
Video processing method, apparatus, storage medium, and program product Technical Field The present application relates to the field of image processing technologies, and in particular, to a video processing method, apparatus, storage medium, and program product. Background In application scenes such as live broadcasting, short video, film and television special effects, the method has the advantages that the appearance adjustment processing is carried out on target objects such as characters in the video, the visual effects of attractive and coordination can be presented, perspective distortion caused by shooting distance can be compensated, the spatial proportion relation which is closer to the natural observation of human eyes is recovered, and the geometric reality of pictures is improved. Among other things, deformation technology is one of the key means to achieve this goal, which enables adjustments to be made to the structure of the object, either in whole or in part, including changing its size, position, angle, etc. The nature of the deformation is an image distortion technique, with which the background is deformed when the target object in the foreground of the image is distorted. However, in video, the motion amplitude of the target object is large, and the background distortion area, size and direction of adjacent frames may be inconsistent, which may cause background shake, and cause a visual dizziness. Disclosure of Invention The embodiment of the application provides a video processing method, video processing equipment, a storage medium and a program product, which are used for relieving background jitter when deformation processing is carried out on a target object in video. In a first aspect, an embodiment of the present application provides a video processing method, including: Determining a to-be-processed part of a target object included in a current video frame, which needs deformation processing; Determining an initial deformation area of the part to be processed in the current video frame from the current video frame, wherein the initial deformation area corresponds to initial deformation strength; determining a target motion amplitude of the part to be processed according to the position change between the historical deformation area and the initial deformation area of the part to be processed in the historical video frame; smoothing the initial deformation region according to the target motion amplitude and the historical deformation region to obtain a target deformation region; according to the target motion amplitude, carrying out attenuation treatment on the initial deformation strength to obtain target deformation strength; and carrying out deformation treatment on the part to be treated in the current video frame according to the target deformation region and the target deformation strength. In a second aspect, an embodiment of the present application further provides a video processing method, including: receiving a video stream uploaded by live broadcast equipment, wherein the video stream comprises an image of a host broadcast in a live broadcast room; by using the video processing method provided in the first aspect, the part to be processed, which needs to be processed by deformation, of the anchor in the video stream is subjected to deformation processing, so as to obtain a target video stream; and transmitting the target video stream to the terminal equipment corresponding to the live broadcasting room. In a third aspect, an embodiment of the present application further provides an electronic device, including a memory and a processor, where the memory is configured to store a computer program; The processor is coupled to the memory for executing the computer program for performing the steps of the video processing method provided in the first and/or second aspect above. In a fourth aspect, embodiments of the present application also provide a computer-readable storage medium storing computer instructions that, when executed by one or more processors, cause the one or more processors to perform the steps in the video processing method provided in the first and/or second aspects above. In a fifth aspect, embodiments of the present application also provide a computer program product comprising a computer program which, when executed by one or more processors, causes the one or more processors to perform the steps in the video processing method provided in the first and/or second aspects above. In the embodiment of the application, the motion amplitude of the part to be processed is determined through the position change of the part to be processed, which needs deformation processing, between the deformation areas in the current frame and the history frame, and the initial deformation area in the current frame is subjected to smooth processing based on the motion amplitude and the history frame, so that the time sequence continuity of the deformation area is enhanced, an