How to convert specific pixel value to pseudocolor?
Show older comments
I have a uint8 image. If i want to convert all pixel with value smaller than 40 to red color. How can i do? Whould you please give me some hints.
2 Comments
Walter Roberson
on 25 Nov 2012
Is the uint8 image RGB or pseudocolor?
Is the desired output RGB or pseudocolor?
When you say "with value smaller than 40", are you referring to intensity in a particular colorplane, or are you referring to brightness, or are you referring to a pseudocolor map index (which is arbitrary and has no inherent meaning) ?
wang1031 yang
on 26 Nov 2012
Accepted Answer
More Answers (1)
IPT imoverlay is convenient here, and it will work fine for either I/RGB inputs. While imoverlay() wasn't available at the time, alternatives are not complicated either.
% read an image
inpict = imread('cameraman.tif');
% create a mask
mask = inpict<40;
% apply the mask
outpict = imoverlay(inpict,mask,[1 0 0]);
% that's it.
imshow(outpict,'border','tight')
Categories
Find more on Image Processing Toolbox 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!