How to fix interp2() error?

13 ビュー (過去 30 日間)
layal alsini
layal alsini 2019 年 4 月 12 日
編集済み: KSSV 2019 年 4 月 14 日
I need to sample and recostract an image using interp2() function, by two methods 'linear' and 'nearest'
I have tried the code below with the method 'nearest' and it works well.
image = imread('Image1.bmp','bmp');
V = image(1:3:end,1:3:end);
Vq = interp2(V,2);
but when I tried the method 'linear', it didn't work with the error massage
Error using griddedInterpolant
Sample values must be a single or double array.
Error in interpn (line 125)
F = griddedInterpolant(X,V,method,extrap);
Error in Sampling (line 14)
Vq = interpn(V,2);
How I can fix this Error??

回答 (1 件)

KSSV
KSSV 2019 年 4 月 12 日
image = imread('Image1.bmp','bmp');
image = double(image) ;
V = image(1:3:end,1:3:end);
Vq = interp2(V,2);
  2 件のコメント
layal alsini
layal alsini 2019 年 4 月 14 日
thax for your answer
I tried to change it into duoble .. but the output is a blank white picture !!!
KSSV
KSSV 2019 年 4 月 14 日
編集済み: KSSV 2019 年 4 月 14 日
After interpolation before plotting....
image=uint8(image);

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

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by