Graphics    

Dithering Truecolor on Indexed Color Systems

Overview

Set DithermapMode to manual to use the current Dithermap or auto to force MATLAB to create a new Dithermap based on the colors displayed in the figure.

More Detail

MATLAB enables you to take advantage of truecolor systems (24-bit displays) by specifying CData as RGB triples, instead of values that index into the figure colormap. Index color systems interpret truecolor specifications by mapping each color to the closest color in the dithermap, which is assigned to the Dithermap property. MATLAB uses the Floyd-Steinberg algorithm to perform the mapping.

The dithermap is a colormap that replaces the figure colormap (which is not used in this case). The default dithermap contains a sampling of colors from the entire spectrum. This produces reasonably good quality with any object coloring. However, if the figure contains objects of primarily one color, a dithermap concentrated in the same color produces better color resolution.

Auto Dither Mode

When you set DithermapMode to auto, MATLAB automatically creates a dithermap based on the colors in the figure. MATLAB produces an appropriate dithermap using the minimum variance quantization algorithm; however, the process is time consuming. Also, MATLAB regenerates the dithermap each time it re-renders the figure.

To avoid excessive rendering time, you should reset DithermapMode to manual after MATLAB generates the dithermap. MATLAB then uses this dithermap without regenerating it until you once again set DithermapMode to auto. You do not need to regenerate the dithermap unless you change the colors used in the figure.

You can save a dithermap by assigning the Dithermap property to a variable and saving it as a MAT-file.

MATLAB creates a dithermap, which you can then save.

Dithermap Size

To obtain the highest color resolution, the default dithermap is as large as the system allows. This is usually less than 256 colors because a certain number of slots are reserved for system colors. Also, MATLAB fixed colors are not overwritten by the dithermap.

Effects of Dithering

Dithering reduces the resolution of the displayed graphics because the colors are mapped in groups of six pixels. For example, suppose the color of one pixel is defined as orange, but the dithermap does not have this color. MATLAB selects combinations of colors from the dithermap that, taken together as a six-pixel group, approximate the color orange.


  Nonactive Figures and Shared Colors Selecting Drawing Methods