what does it mean Error using image TrueColor CData contains element out of range 0.0 <= value <= 1.0

5 ビュー (過去 30 日間)
trying to work out wfusimg example in mathwork
ct=imread('grayplay900x900.jpg');
mri = imread('graygoogle900x900.jpg');
XFUSmean = wfusimg(ct,mri,'db2',5,'mean','mean');
XFUSmaxmin = wfusimg(ct,mri,'db2',5,'max','min');
colormap(maps);
subplot(221),image(ct),axis square, title('play')
subplot(222), image(mri),axis square, title('google logo')
subplot(223), image(XFUSmean),axis square, title('mean')
however it gives the error ,Error using image TrueColor CData contains element out of range 0.0 <= value <= 1.0
  3 件のコメント
KSSV
KSSV 2017 年 3 月 6 日
ct and mri both should be either RGB or binary. In your case I think they are not.
Adam
Adam 2017 年 3 月 6 日
Surely the error is very self-explanatory?! It's hard to know how it could be any clearer.

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

回答 (1 件)

Jan
Jan 2017 年 3 月 6 日
The error message is clear: The command image is called with an agrument, which contains an RGB value outside the allowed range [0, 1]. Check this by using the debugger: Type this in the command line:
dbstop if error
Then run the code again. Matlab stops, when the error occurres. Then:
max(XFUSmean(:)) % Or which variable is concerned - I cannot guess this
min(XFUSmean(:))
class(XFUSmean)
What do you obeserve? The class double and values in the range of [0, 255]? Then divide the variable by 255 to get the standard image format.

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by