MATLAB: Enlarging an image with spline interpolation

spline

I want to enlarge the number of pixels of the input image using spline interpolation. Please tell me how.

Best Answer

I = imread("image.jpeg") ; % assuming image to m*n
I=rgb2gray(I);
[m,n] = size(I) ;
x = 1:n ;
y = 1:m ;
% Inteprolate to double
xi = linspace(1,n,2*n) ;
yi = linspace(1,m,2*m) ;
I = double(I) ;
I1 = zeros(m,2*n) ;
% Row wise inteprolation
for i = 1:m
I1(i,:) = spline(x,I(i,:),xi) ;
end
Inew = zeros(2*m,2*n) ;
% Column wise interpolation
for j = 1:2*n
Inew(:,j) = spline(y,I1(:,j),yi) ;
end
Inew = uint8(Inew) ;
figure
imshow(Inew)