The process shown here should seem very familiar. Each of the frames in the video will be filtered using a disk filtering element and saved in a new video file, which hopefully will appear less distorted by the blocking effect:
Let's start by importing the video file in our Workspace window:
>> vIn = VideoReader('testCar.avi')
Now, we have to make a new video file and set its frame rate equal to the one we opened:
>> vOut = VideoWriter('carSmooth.avi'); % Create output file >> vOut.FrameRate = vIn.FrameRate; % Equal frame rates >> open(vOut); % Open output
We should also get the number of total frames of the original video, so that we can use it in a
for
loop:>> numF = get(vIn, 'NumberOfFrames'); % Get size in frames
Finally, we will write a
for
loop, for smoothing and writing the frames:>> for i = 1:numF % For all frames in video frame = read(vIn,i); % read i-th frame fKernel = fspecial...