Hello
I want to resample an image in matlab. I use imresample code of by Omer Demirkaya. but I have bellow error.
  • | |Error using griddedInterpolantSample values must be a single or double array.
Error in interp2/makegriddedinterp (line 214) F = griddedInterpolant(varargin{:});
Error in interp2 (line 135) F = makegriddedinterp(X, Y, V, method,extrap);
Error in imresample (line 49) nimg(:,:,i) = interp2(Ox,Oy,img(:,:,i),Nx,Ny,intmethod);| | *
Could you help me how can I resample an image?
Thanks for your help.

 채택된 답변

Walter Roberson
Walter Roberson 2013년 11월 15일

2 개 추천

Before you start the interpolation, do
img = im2double(img);

댓글 수: 3

bkshn
bkshn 2013년 11월 15일
Hello Walter Roberson
Thanks for your answer I have another question, Could you answer me, I'll appreciate your help. I do resampling and done an algorithm on my Image, right now I want to return resampled image to first image(I want to undo resampling), what can I d0? I resample my image by this
NI = imresample([0.2,0.2],I,[1,1],'linear');
I want to undo resampling by this
NI2 = imresample([1,1],NI,[0.2,0.2],'linear');
but It didn't work!
Walter Roberson
Walter Roberson 2013년 11월 15일
What happens instead of it "working" ?
bkshn
bkshn 2013년 11월 16일
편집: bkshn 2013년 11월 16일
I found my answer thanks alot for your help

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

추가 답변 (2개)

Image Analyst
Image Analyst 2013년 11월 15일

1 개 추천

Why not simply use imresize()?
Alex Taylor
Alex Taylor 2013년 11월 15일

0 개 추천

The MATLAB interpolation functions require that the inputs be floating point, since interpolation is a floating point operation. Walter's comment is accurate, if you want to interpolate in double precision floating point, im2double will work.
To Image Analyst's point: are you trying to apply a geometric transformation like scaling, rotating, or a generic affine transformation to an image? If so, it would be easier to look at imresize, imrotate, or imwarp if you have the Image Processing Toolbox. These will take care of the resampling for you.

질문:

2013년 11월 15일

편집:

2013년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by