How to enlarge an image using spline interpolation

조회 수: 14 (최근 30일)
T.K
T.K 2020년 8월 28일
댓글: T.K 2020년 10월 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.
T.K
T.K 2020년 10월 30일
Thank you for your replying!
I understood!

댓글을 달려면 로그인하십시오.

추가 답변 (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