Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have an image classification problem. I have an image which spesify classes' labels using "imread" funtion of Matlab $(A=imread('r.bmp'))$ the output for example for 3 classes is as $$A= \begin{matrix} 1 & 1 & 1& 2& 2&2 &3&3& 3 \\ 1 & 1 & 1& 2& 2&2 &3&3& 3 \\ 1 & 1 & 1& 2& 2&2 &3&3& 3 \end{matrix}$$ How can I use "colormap" function of matlab to generate an image with specified color for each class??(i.e. each class in this image is specified with different color) can anyone help me to solve this problem? Thank you!

share|improve this question
Maybe try this question in StackOverflow, as it is more a programming question (and SO is much more active) –  Ander Biguri Dec 5 '12 at 8:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.