The first method we will implement will be deinterlacing with line repetition. This method is based on repeating the odd (or even) rows of the image to fill the blank even (or odd) ones, respectively. In this example, we will replace each even line in the image with the previous odd one. Let's start:
First, we load our original, interlaced image:
>> A = imread('interlaced.bmp'); % Load interlaced image
Then, we initialize with zero values a matrix of equal size to
A
, so that we can store the deinterlaced image, which is as follows:>> B = uint8(zeros(size(A))); % Pre-allocate space for the result
Next, we must perform the line repetition process, using a
for
loop for all rows of the image. The even rows of matrixB
will be replaced by the previous odd row of matrixA
, while the odd rows of both images will be equal:>> for i = 1:size(A,1), % For all rows in A if mod(i,2) == 0, % if i is even B(i,:,:) = A(i-1,:,:)...