Error on ind2rgb
Afficher commentaires plus anciens
Greetings everyone.
[X, MAP] = imread('test.jpg');
RGB = ind2rgb(X,MAP);
LAB = rgb2lab(RGB);
Here I tried to convert from index to RGB image using 'ind2rgb' command, but the result is like this: Index exceeds matrix dimensions.
Error in ind2rgb (line 26) r = zeros(size(a)); r(:) = cm(a,1);
I already tried to looking for the solution on the internet, but I couldn't find it.
Hope someone who knew how to fix it, kindly give me a lead here.
Here I also attached the file that I used for this command.

Thank you before.
4 commentaires
KSSV
le 8 Nov 2017
It is because map might be [0 0] or empty matrix.
Rik
le 8 Nov 2017
I don't see an error with you code, but why do you read the image as an indexed image? Why not let imread read you image as an RGB immediately?
Stephen23
le 8 Nov 2017
"Why not let imread read you image as an RGB immediately?"
imread does not convert indexed images to RGB.
Arygianni Valentino
le 8 Nov 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!