How to enlarge an image using spline interpolation

4 次查看(过去 30 天)
I want to double the size of the input image using "spline". Please tell me how

采纳的回答

KSSV
KSSV 2020-8-28
编辑:KSSV 2020-8-28
I = imread("image.jpeg") ; % assuming image to m*n
[m,n,p] = size(I) ;
x = 1:n ;
y = 1:m ;
% Inteprolate to double
xi = 1:2*n ;
yi = 1:2*m ;
I = double(I) ;
Inew = zeros(2*m,2*n) ;
% Row wise inteprolation
for i = 1:m
Inew(i,:) = spline(x,I(i,:),xi) ;
end
% Column wise interpolation
for j = 1:n
Inew(:,j) = spline(y,I(:,j),yi) ;
end
Change the class if Inew to the original I. Also read about imresize.
  5 个评论
KSSV
KSSV 2020-10-29
编辑:KSSV 2020-10-29
You can see both the codes given..there are few mistakes int he first code which have been rectiffied. Especially generating the new grid fot enlarging the image.
Thanks is accepting/ voting the answer.

请先登录,再进行评论。

更多回答(1 个)

Bruno Luong
Bruno Luong 2020-8-28
编辑:Bruno Luong 2020-8-28
A=peaks(10);
B=interp2(A,1,'spline');
subplot(1,2,1)
imagesc(A)
subplot(1,2,2)
imagesc(B)

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by