IP Library › Granted Patent US 11,538,141
Granted Patent B2
US 11,538,141 · App. 17/742,466 · Granted Dec 27, 2022

Method and apparatus for processing video

Inventors: Mingda Wu (Beijing, CN); Xin Tao (Beijing, CN); Yucong Chen (Beijing, CN); Fanbo Deng (Beijing, CN); Fulin Li (Beijing, CN); Yurong Dai (Beijing, CN); Bing Yu (Beijing, CN)
Assignee: Beijing Dajia Internet Information Technology Co., Ltd.
G06T5/005G06T7/30G06V20/46
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,538,141
App. No.
17/742,466
Granted
Dec 27, 2022
Kind
B2
Abstract

A method and apparatus for processing a video is provided. A current image frame of a video and a mask for a first area are obtained. The Image included in the first area is to be removed from the current image frame. A first resultant image of the current image frame is obtained with an image processing network based on the current image frame and the mask. The first resultant image is an image from which the image included in the first area is removed from the current image frame. A second resultant image of a previous image frame of the current image frame is obtained. The second resultant image is an image from which the image included in the second area is removed from the previous image frame. A final resultant image of the current image frame is obtained by fusing the first resultant image and the second resultant image.

Claims (76)

1. An method for processing a video, comprising:

obtaining a current image frame of a video and a mask for a first area, wherein image included in the first area is to be removed from the current image frame;

obtaining a first resultant image of the current image frame with an image processing network based on the current image frame and the, wherein the first resultant image is an image from which the image included in the first area is removed from the current image frame;

obtaining a second resultant image of a previous image frame of the current image frame, wherein the second resultant image is an image from which the image included in the first area is removed from the previous image frame; and

obtaining a final resultant image of the current image frame by fusing the first resultant image and the second resultant image;

wherein the second resultant image of the previous image frame comprises a third resultant image of the previous image frame and a fourth resultant image of the previous image frame, the third resultant image is obtained through the image processing network based on the previous image frame and the mask, and the fourth resultant image is obtained by fusing the third resultant image and a resultant result of a further previous image frame of the previous image frame.

2. The method of claim 1 , wherein the first area is a specified rectangular area, a center of a pattern contained in the current image frame is determined as a center point of the specified rectangular area, and a length of the specified rectangular area is twice a longest characteristic length of the pattern.

3. The method of claim 1 , wherein said fusing the first resultant image and the second resultant image comprises:

obtaining an optical flow between the first resultant image and the second resultant image;

obtaining an alignment image of adjacent image frames by sampling the first resultant image and the second resultant image based on the optical flow; and

fusing pixels in the first area of the first resultant image and the first area of the alignment image.

4. The method of claim 3 , wherein said fusing pixels in the first area of the first resultant image and the first area of the alignment image comprises:

for each pixel in the first area, determining a pixel value of the pixel based on a statistical value of a pixel value of the pixel of the first resultant image and a pixel value of a corresponding pixel of the alignment image.

5. The method of claim 1 , wherein in a case where the second resultant image comprises the third resultant image and the fourth resultant image, said obtaining the optical flow comprises:

obtaining a first adjacent optical flow between the first resultant image and the third resultant image;

obtaining a second adjacent optical flow between the first resultant image and the fourth resultant image;

said obtaining the alignment image comprises:

obtaining a first alignment image of adjacent image frames by sampling the first resultant image and the third resultant image based on the first adjacent optical flow;

obtaining a second alignment image of adjacent image frames by sampling the first resultant image and the fourth resultant image based on the second adjacent optical flow; and

said fusing pixels in the first area of the first resultant image and the first area of the alignment image comprises:

fusing pixels in the first area of the first resultant image, the first area of the first alignment image, and the first area of the second alignment image.

6. The method of claim 5 , wherein for each pixel in the first area, determining a pixel value of the pixel based on the statistical value of the pixel value of the pixel of the first resultant image and a pixel value of a corresponding pixel of the alignment image comprises:

for each pixel in the first area, determining the pixel value of the pixel based on a median of the pixel value of the pixel of the first resultant image, a pixel value of a corresponding pixel of the first alignment image, and a pixel value of a corresponding pixel of the second alignment image.

7. The method of claim 1 , further comprising:

determining the final resultant image based on the first resultant image without obtaining the second resultant image and fusing the first resultant image and the second resultant image, in response to the current image frame being a first image frame of the video or a scene switch occurring between the current image frame and the previous image frame.

8. The method of claim 7 , further comprising:

obtaining a L2-norm distance based on image blocks between a pixel of the current image frame and a corresponding pixel of the previous image frame;

determining an average value of the L2-norm distances as a difference between the current image frame and the previous image frame; and

determining that the scene switch occurs in response to the difference being greater than a threshold.

9. The method of claim 1 , further comprising:

obtaining a sixth resultant image of the current image frame with a Poisson fusion algorithm based on the current image frame, the final resultant image, and the mask; determining the final resultant based on the sixth resultant image.

10. The method of claim 9 , wherein said obtaining the sixth resultant image comprises:

obtaining a gradient between a pixel value of the current image frame at a boundary of the first area and a corresponding pixel value of the final resultant image at the boundary of the first area;

adjusting a pixel value of a pixel of the final resultant image at the boundary of the first area until the gradient is minimized; and

determining the sixth resultant image based on an adjusted final resultant image corresponding to the minimized gradient.

11. An electronic device, comprising:

at least one processor; and

at least one memory storing computer-executable instructions; wherein, when the computer-executable instructions are executed by the at least one processor, the at least one processor is caused to:

obtain a current image frame of a video and a mask for a first area, wherein image included in the first area is to be removed from the current image frame;

obtain a first resultant image of the current image frame with an image processing network based on the current image frame and the mask, wherein the first resultant image is an image from which the image included in the first area is removed from the current image frame;

obtain a second resultant image of a previous image frame of the current image frame, wherein the second resultant image of is an image from which the image included in the first area is removed from the previous image frame; and

obtain a final resultant image of the current image frame by fusing the first resultant image and the second resultant image;

wherein the second resultant image of the previous image frame comprises a third resultant image of the previous image frame and a fourth resultant image of the previous image frame, the third resultant image is obtained through the image-processing network based on the previous image frame and the mask, and the fourth resultant image is obtained by fusing the third resultant image and a resultant result of a further previous image frame of the previous image frame.

12. The electronic device of claim 11 , wherein the at least one processor is further configured to:

obtain an optical flow between the first resultant image and the second resultant image;

obtain an alignment image of adjacent image frames by sampling the first and the second resultant image based on the optical flow; and

fuse pixels in the first area of the first resultant image and the first area of the alignment image.

13. The electronic device of claim 12 , wherein the at least one processor is further configured to:

for each pixel in the first area, determine a pixel value of the pixel based on a statistical value of a pixel value of the pixel of the first resultant image and a pixel value of a corresponding pixel of the alignment image.

14. The electronic device of claim 11 , wherein in a case where the second resultant image comprises the third resultant image and the fourth resultant image, the at least one processor is configured to:

obtain a first adjacent optical flow between the first resultant image and the third resultant image;

obtain a second adjacent optical flow between the first resultant image and the fourth resultant image;

obtain a first alignment image of adjacent image frames by sampling the first resultant image and the third resultant image based on the first adjacent optical flow;

obtain a second alignment image of adjacent image frames by sampling the first resultant image and the fourth resultant image based on the second adjacent optical flow; and

fuse pixels in the first area of the first resultant image, the image removal, the first area of the first alignment image, and the first area of the second alignment image.

15. The electronic device of claim 14 , wherein the at least one processor is further configured to:

for each pixel in the first area, determine the pixel value of the pixel based on a median of the pixel value of the pixel of the first resultant image, a pixel value of a corresponding pixel of the first alignment image, and a pixel value of a corresponding pixel of the second alignment image.

16. The electronic device of claim 11 , wherein the at least one processor is further configured to:

determine the final resultant image based on the first resultant image without obtaining the second resultant image and fusing the first resultant image and the second resultant image, in response to the current image frame being a first image frame of the video or a scene switch occurring between the current image frame and the previous image frame.

17. The electronic device of claim 16 , wherein the at least one processor is further configured to

obtain a L2-norm distance based on image blocks between a pixel of the current image frame and a corresponding pixel of the previous image frame;

determine an average value of the L2-norm distances as a difference between the current image frame and the previous image frame; and

determine that the scene switch occurs in response to the difference being greater than a threshold.

18. The electronic device of claim 11 , wherein the at least one processor is further configured to:

obtain a sixth resultant image of the current image frame with a Poisson fusion algorithm based on the current image frame, the final resultant image, and the mask; and

determine the final resultant image based on the sixth resultant image.

19. The electronic device of claim 18 , wherein the at least one processor is configured to:

obtain a gradient between a pixel value of the current image frame at a boundary of the first area and a corresponding pixel value of the final resultant image at the boundary of the first area;

adjust a pixel value of a pixel of the final resultant image at the boundary of the first area until the gradient is minimized; and

determine the sixth resultant image based on an adjusted final resultant image corresponding to the minimized gradient.

20. A non-transitory computer-readable storage medium, having instructions stored, wherein when the instructions are executed by at least one processor, the at least one processor is caused to:

obtain a current image frame of a video and a mask for a first area, wherein image included in the first area is to be removed from the current image frame;

obtain a first resultant image of the current image frame with an image processing network based on the current image frame and the mask, wherein the first resultant image;

is an image from which the image included in the first area is removed from the current image frame;

obtain a second resultant image of a previous image frame of the current image frame, wherein the second resultant image is an image from which the image included in the first area is removed from the previous image frame; and

obtain a final resultant image of the current image frame by fusing the first resultant image.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 12, 2022
From: WU, MINGDA; TAO, XIN; CHEN, YUCONG; DENG, FANBO; LI, FULIN; DAI, YURONG; YU, BING
To: BEIJING DAJIA INTERNET INFORMATION TECHNOLOGY CO., LTD.
Reel/Frame 059967/0646 →
Priority Claims (1)
CN 202011104678.6 · Oct 15, 2020 · national
Continuity (2)
Continuation PCTCN2021106339 · Jul 14, 2021
Related Publication 20220309623A1 · Sep 29, 2022