CPC G06T 3/4007 (2013.01) [H04N 19/132 (2014.11); H04N 19/182 (2014.11); H04N 19/46 (2014.11); H04N 19/513 (2014.11)] | 17 Claims |
1. A method for processing an image, comprising:
obtaining, based on a motion vector of a corresponding position of a pixel to be interpolated in a previous image and a motion vector of a corresponding position of the pixel to be interpolated in a current image, a first aim-to-mask flag of the pixel to be interpolated, the mask being an object that is static for a duration in a video stream, the first aim-to-mask flag of the pixel to be interpolated indicating that the motion vector of the corresponding position of the pixel to be interpolated in the previous image aims to a background image or a mask, and indicating that the motion vector of the corresponding position of the pixel to be interpolated in the current image aims to a background image or a mask;
obtaining second aim-to-mask flags of pixels in a preset neighborhood of the pixel to be interpolated, the second aim-to-mask flag of the pixel in the preset neighborhood indicating that the motion vector of the corresponding position of the pixel in the previous image aims to a background image or a mask, and indicating that the motion vector of the corresponding position of the pixel in the current image aims to a background image or a mask;
determining flag categories and a number of pixels of each of the flag categories, in the first aim-to-mask flag and the second aim-to-mask flags, the flag category being defined based on directivity of a motion vector of a corresponding position of a corresponding pixel in a previous image and directivity of a motion vector of a corresponding position of the corresponding pixel in a current image, combinations of directivity of the motion vector of the corresponding position of the corresponding pixel in the previous image and directivity of the motion vector of the corresponding position of the corresponding pixel in the current image are different among different flag categories;
obtaining a third aim-to-mask flag of the pixel to be interpolated based on the flag categories and the number of pixels of to each of the flag categories, comprising:
removing an aim-to-mask flag aiming to a mask from the flag categories;
determining a flag category with a largest number among the flag categories;
using the flag category with the largest number as a third aim-to-mask flag of the pixel to be interpolated; and
updating the first aim-to-mask flag of the pixel to be interpolated to the third aim-to-mask flag;
obtaining interpolation data of the pixel to be interpolated based on the third aim-to-mask flag of the pixel to be interpolated; and
performing motion compensation on the pixel to be interpolated based on the interpolation data.
|