What should I insert for 'MAP' in immovie(X,MAP)?
3 views (last 30 days)
Show older comments
Maya West
on 24 Apr 2017
Answered: Prashant Arora
on 26 Apr 2017
I'm not sure what to put for the input argument 'MAP' in immovie(X,MAP). I have the X (a 900x1200x1x60 matrix) but any input I have for MAP resullts in error. I've tried variations of gray(256) and colormap. Each matrix is in color (but are still 2D matrices) so I expect my movie to also be in color. This is the error I am getting.
Error using im2uint8 (line 83) Invalid indexed image: an index was less than 1.
Error in immovie>parse_inputs (line 88) X = im2uint8(X,'indexed');
Error in immovie (line 38) [X,map] = parse_inputs(varargin{:});
Error in TweetAnalysis (line 993) mov=immovie(statemat,double(colormap));
0 Comments
Accepted Answer
Prashant Arora
on 26 Apr 2017
Hi Maya,
The reason you are getting this error is because the function call immovie(X,map) requires X to be an indexed image. This means that the values of X must greater than 1. To read more about indexed images, you can check out the following link
If your image has intensity values from 0 to 1 and you would like to use a colormap of gray(256), you need to scale the image intensity to [1 256]. You can do by using something like this:
X = X.*255 + 1 % Add 1 to start index from 1
I hope this helps!
0 Comments
More Answers (0)
See Also
Categories
Find more on Basic Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!