Mayank Jain
Mayank Jain

Reputation: 2564

Showing different value in image with different color in Matlab

I am working in Matlab 2009. I have a array (say test) like:

 0    0    0     0
 1.2 1.2  1.4  1.6
 1.2 1.3  1.3  1.7

This array actually represents a Image after performing few operations.

I want the same values to be represented in one color. Say all pixels corresponding to value 1.2 should be represented in red color (while using imshow function).

How can this be done? Please help

Upvotes: 1

Views: 279

Answers (1)

marsei
marsei

Reputation: 7751

The function imagesc will assign one color per value.

The code

a=[ 0    0    0     0 
    1.2 1.2  1.4  1.6
    1.2 1.3  1.3  1.7];

imagesc(a);

will produce

enter image description here

Upvotes: 3

Related Questions