MATLAB: Color Image filtration.

image color filtering

Hello,
hope that everything goes well with you all.
I am doing some resarch on image color filtering technique for my final year project. since i am new to this area I am so much confused and I have so many doubts. i would like if possible to get some clarifications on the following question so I can be able to work well on my research.
1- Is it possible to convert an RGB image into gray and keep one or two color? if possible can we call this process as filtering?
2- Can a grayscal image with one color (RED) be converted to YCbCr color mode?
Thank you…!

Best Answer

Is it possible to convert an RGB image into gray and keep one or two color?
Yes, provided the result is to be RGB.
For example,
%make it gray
gray_image = rgb2gray(original_image);
N = numel(gray_image);
%make the grayscale image into an RGB representation of a grayscale image
gray_as_rgb = repmat(gray_image, [1 1 3]);
%[255 255 0] is pure yellow. Find all the pixels that were that
mask = find(original_image(:,:,1) == 255 & original_image(:,:,2) == 255 & original_image(:,:,3) == 0);
%now paint the yellow back into the grayscale image
gray_as_rgb(mask) = 255;
gray_as_rgb(N+mask) = 255;
gray_as_rgb(2*N+mask) = 0;
Can a grayscal image with one color (RED) be converted to YCbCr color mode?
You would have had to convert back into RGB in order to hold the red as well, and that RGB can be converted into YCbCr