Enlarging an image with spline interpolation

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

 채택된 답변

KSSV
KSSV 2020년 10월 28일

1 개 추천

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)

댓글 수: 2

T.K
T.K 2020년 10월 30일
Thank you for your replying!
I understood!
Mehri Mehrnia
Mehri Mehrnia 2022년 6월 13일
편집: Mehri Mehrnia 2022년 6월 13일
main problem of this is it does not preserve image size, I mean the size of primary matrix

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

추가 답변 (1개)

Mehri Mehrnia
Mehri Mehrnia 2022년 6월 13일

0 개 추천

Hi,
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?

카테고리

도움말 센터File Exchange에서 Splines에 대해 자세히 알아보기

태그

질문:

T.K
2020년 10월 28일

편집:

2022년 6월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by