The Computer Vision System Toolbox has an object that can handle three common methods of deinterlacing. The object is intuitively called Deinterlacer
. Let's see its usage on our example interlaced image.
>> A = imread('interlaced.bmp'), % Load interlaced image
Deinterlacer
object. Let's use the default settings:>> deintObj = vision.Deinterlacer; % create deinterlacing System object
>> A2 = step(deintObj, A); % Apply de-interlacing method
>> B = imcrop(A,[480 400 200 100]); % Crop interlaced detail >> B2 = imcrop(B,[480 400 200 100]); % Crop deinterlaced detail >> subplot(2,2,1),imshow(A);title('Entire Interlaced Frame') >> subplot(2,2,2),imshow(A2);title('EntireDe-Interlaced Frame') >> subplot(2,2,3),imshow(B);title('Cropped Interlaced Area') >> subplot(2,2,4),imshow(B2);title('Cropped De-Interlaced Area')
This example demonstrated the usage of the Deinterlacer
object of the Computer Vision System Toolbox, with the default method setting, which is the line repetition. As the name implies, this method deinterlaces an image by repeating the odd (or even) lines to replace the even (or odd) lines, keeping the overall image size the same. The effect was obviously positive, as the jagged artifacts on the edges of the car have been significantly reduced. The repetition of lines was probably the simplest way to solve the problem. The process, as shown in the example, was quite simple; first we loaded our interlaced image, then we initialized a deinterlacing System
object, and we called the step
method to apply the process (deinterlacing) to our target input (the interlaced image). The final step was useful for a qualitative evaluation of the success of our method. From its results, we can see that even with the simplest method the deinterlaced result looks better than the interlaced input.
Now it is time for you to tweak the settings of the Deinterlacer
object. You should try to initialize three different objects, one for each method (line repetition, linear interpolation, and vertical temporal median filtering). Apply all of them to the interlaced image and compare the same cropped area as before. If you implement the described process successfully, you should get an image like the one that follows:
You should also try to experiment with other areas of the image, so that you get a better idea of the pros and cons of each method depending on the content of the image.