Enlarging an image with spline interpolation

11 views (last 30 days)
I want to enlarge the number of pixels of the input image using spline interpolation. Please tell me how.

Accepted Answer

KSSV on 28 Oct 2020
I = imread("image.jpeg") ; % assuming image to m*n
[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) ;
Inew = zeros(2*m,2*n) ;
% Column wise interpolation
for j = 1:2*n
Inew(:,j) = spline(y,I1(:,j),yi) ;
Inew = uint8(Inew) ;
Mehri Mehrnia
Mehri Mehrnia on 13 Jun 2022
Edited: Mehri Mehrnia on 13 Jun 2022
main problem of this is it does not preserve image size, I mean the size of primary matrix

Sign in to comment.

More Answers (1)

Mehri Mehrnia
Mehri Mehrnia on 13 Jun 2022
I really appreciate this Q/A, helped me.
I have a countour which is a complex shape(left atrial of heart). I want to select some points(control ones) to dilate or erode the shape? any idead?


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by