MATLAB: How to get a dithered color image

colormapditheringImage Processing Toolboxrgb image

I know that
X = dither(RGB, map);
returns an indexed image approximation to the given RGB image. I have two questions:
(1) Is there a second step that converts the indexed image to an RGB image using the provided colormap?
(2) How to design a colormap that matches the original colors of the image?
Note: I want a dithered color image not an indexed image.
Any hint/help is appreciated!

Best Answer

I've never used dither() so I don't know what it does. But to answer your questions:
(1) Yes. It's called ind2rgb().
rgbImage = ind2rgb(indexedImage, customColorMap);
(2) Call rgb2ind():
[indexedImage, customColorMap] = rgb2ind(grayImage, numColors);
Related Question