EDIT
I have a grayscale
image which contains pixel values of 300
, which I assigned manually to pixels that hold a specific criterion.
The case is that the other values in the image are 1
and 2
. So, I will have three values now: 1
, 2
, and 300
.
In order to display the image in a meaningful way, we can use thresholding
. So, this is as for the pixels with values 1
and 2
. For the pixels with the value 300
, how can I assign it some colour to be able to discriminate it from other parts of the image.
Thanks.
If all the values you have are
1,2,300
then a simple colormap will solve the issue. The trick is to assign the value3
instead of300
so the linear mapping of colormap can be used (1,2,3), for example, if your imagesc is calledim
:Here I created a 3-color colormap with colors for the 3 values (1 dark gray,2 lighter gray,3 red).
To do this without modifying your image data, you can use the
AlphaData
property to make a color overlay at select locations. Given a grayscale imageimg
,EDIT: If your other values are just 1 and 2, they will be very dark compared to 300, so the
[0 2]
inimshow
will help with that.