MATLAB: Separating particular pixels based on RGB value

classifyingfilteringimageimage processingImage Processing Toolboxpixelsrgb

I want to separate a group of pixels in an image which have RGB greater than [120 115 118 ] . How can I do it? The pixels having RGB values above the mentioned ones must appear in black color.How to do it? Thanks in advance.

Best Answer

locations = YourImage(:,:,1) > 120 & YourImage(:,:,2) > 115 & YourImage(:,:,3) > 118;
YourImage(repmat(locations,1,1,3)) = 0;
Related Question