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,
gray_image = rgb2gray(original_image);
N = numel(gray_image);
gray_as_rgb = repmat(gray_image, [1 1 3]);
mask = find(original_image(:,:,1) == 255 & original_image(:,:,2) == 255 & original_image(:,:,3) == 0);
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
Best Answer