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

1 view (last 30 days)
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 Comments

Sign in to comment.

Answers (1)

Jan
Jan on 6 Mar 2017
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.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!