what should I do to convert matrix X and map in imread function into the way it suppose to be????
1 view (last 30 days)
Show older comments
when I use imread(X, map)... function for a picture and write whos, matrix X and matrix map suppose to be a [n m] and [n 3] respectively. However, when I do it, matrix X and map will be shown as [n m 3] and [0 0] respectively! what should I do to convert it into the way it suppose to be????
0 Comments
Accepted Answer
Walter Roberson
on 10 Nov 2013
The map is returned as empty if it is a truecolor image. If you want to convert it to an indexed image for some reason, use rgb2ind()
3 Comments
Walter Roberson
on 10 Nov 2013
rgb2ind() does an approximation.
[X,map] = rgb2ind(RGB,n) converts the RGB image to an indexed image X using minimum variance quantization and dithering. map contains at most n colors. n must be less than or equal to 65,536.
So you tell it how many colors you want your map to be, and it figures out the set of colors that gives you the least total error between original colors and the colors in the output map.
More Answers (0)
See Also
Categories
Find more on Modify Image Colors 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!