I have to obtain a high resolution image from a low resolution image. This can be achieved using interpolation methods. I know in matlab imresize
and interp2
functions will perform the task, but I have to write code without using any built in functions. I understand how bilinear interpolation works but i can't seem to piece it together in my code. I will be grateful for any help and suggestions.
Here is my code so far:
clear all; close all; clc;
input_im=imread('superman.png');
im=rgb2gray(input_im);
%subplot(1,2,1), imshow(input_im), title('Original Image');
%subplot(1,2,2), imshow(im), title('Gray Scale Input Image');
[m,n]=size(im); %obtain the size of gray scale image
S = input(' Now Enter Value : ');
Scale1 = floor(S);
Scale2 = floor(S);
scale = [Scale1, Scale2];
Oim=size(im);
Nim=max(floor(scale.*Oim(1:1)),1);
for i=1:Nim-1
for j=1:Nim-1
Q11=
Q21=
Q12=
Q22=
R1=((x2-x)/(x2-x1))*Q11+((x-x1)/(x2-x1))*Q21;
R2=((x2-x)/(x2-x1))*Q12+((x-x1)/(x2-x1))*Q22;
P=((y2-y)/(y2-y1))*R1+((y-y1)/(y2-y1))*R2;
end
end