Wed 23 Mar 2016 08:33:45 AM UTC, original submission:
When running the following code, which converts rgb to ind and back to rgb, the following exception is raised:
Mrgb=ind2rgb(Mind,map)
error: ind2rgb: MAP must be a valid colormap
error: called from
ind2x at line 37 column 5
ind2rgb at line 49 column 10
Example code
M(:,:,1) = [225 230 250 243 20 3 244 247 255 255
242 252 239 0 239 224 27 252 255 255
224 239 28 243 236 231 240 11 255 255
243 252 15 224 15 12 251 0 255 255
224 11 252 227 0 11 232 251 0 255
243 4 255 228 19 4 243 224 0 255
- 255 236 251 228 251 224 243 255 0
19 236 255 224 27 12 251 236 255 0
0 255 255 255 255 255 255 255 255 0
255 0 0 0 0 0 0 0 0 255];
M(:,:,2) =[255 255 255 255 0 0 255 255 255 255
255 255 255 0 255 255 0 255 255 255
255 255 0 255 255 255 255 0 255 255
255 255 0 255 0 0 255 0 255 255
255 0 255 255 0 0 255 255 0 255
255 0 255 255 0 0 255 255 0 255
- 255 255 255 255 255 255 255 255 0
- 255 255 255 0 0 255 255 255 0
- 255 255 255 255 255 255 255 255 0
255 0 0 0 0 0 0 0 0 255];
M(:,:,3) = [255 255 255 255 0 0 255 255 255 255
255 255 255 0 0 0 0 255 255 255
255 255 0 0 0 0 0 0 255 255
255 255 0 0 0 0 0 0 255 255
255 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 255
- 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0
255 0 0 0 0 0 0 0 0 255];
[Mind map]=rgb2ind(M)
Mrgb=ind2rgb(Mind,map)
|