why I have Nan value in resampling image?

3 ビュー (過去 30 日間)
bkshn
bkshn 2013 年 12 月 6 日
回答済み: Alex Taylor 2013 年 12 月 7 日
Hello
I use a resampling on an image like below
NI = imresample([0.5,0.5],I,[1,1],'linear');
my first image (I) size was 375*500 and my resampled image (NI) size is 188*250.
the value of NI(188,255) is NAN.
Could you explain me why it happens?

回答 (3 件)

Image Analyst
Image Analyst 2013 年 12 月 6 日
I don't know. That function is not in MATLAB or the Image Processing Toolbox. Is that this File Exchange submission? Actually I'm surprised you can even access the 255th column when your image has only 250 columns - you should have gotten an index out of range error. NI(188,255) should not even exist if you resized to 188*250! So either dive into it yourself with the debugger or contact the author. Or better yet, if you have the Image Processing Toolbox, just use imresize() instead.

Alex Taylor
Alex Taylor 2013 年 12 月 6 日
This is the second post I've seen recently on imresample. Is the reason you are using this function that you don't have the Image Processing Toolbox? You should use imresize if you have access to it.
  2 件のコメント
bkshn
bkshn 2013 年 12 月 6 日
I found this function (imresample) in File Exchange submission. I want to resample my image not resize my image. it is why I emphasize using resampling.
Image Analyst
Image Analyst 2013 年 12 月 6 日
編集済み: Image Analyst 2013 年 12 月 6 日
Explain what you think the difference is. Either way (at least to me) you have an output image, which may or may not be the same size as the input image, comprised of values taken from an input image, which may or may not land exactly at the location of input pixels. What does it mean to you ? How are they different to you ?

サインインしてコメントする。


Alex Taylor
Alex Taylor 2013 年 12 月 7 日
Imresize, like all geometric transformation operations, uses resampling to define output values that do not lie at integral pixel values in the input image.
Imresample is just another version of an image resizing function. It appears to have numerics issues at the edges, which is why we are advising you to use imresize.

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by