| Image Processing Toolbox™ | ![]() |
X = dither(RGB, map)
X = dither(RGB, map, Qm, Qe)
BW = dither(I)
X = dither(RGB, map) creates an indexed image approximation of the RGB image in the array RGB by dithering the colors in the colormap map. The colormap cannot have more than 65,536 colors.
X = dither(RGB, map, Qm, Qe) creates an indexed image from RGB, where Qm specifies the number of quantization bits to use along each color axis for the inverse color map, and Qe specifies the number of quantization bits to use for the color space error calculations. If Qe < Qm, dithering cannot be performed, and an undithered indexed image is returned in X. If you omit these parameters, dither uses the default values Qm = 5, Qe = 8.
BW = dither(I) converts the grayscale image in the matrix I to the binary (black and white) image BW by dithering.
RGB can be uint8, uint16, single, or double. I can be uint8, uint16, int16, single, or double. All other input arguments must be double. BW is logical. X is uint8, if it is an indexed image with 256 or fewer colors; otherwise, it is uint16.
dither increases the apparent color resolution of an image by applying Floyd-Steinberg's error diffusion dither algorithm.
Convert intensity image to binary using dithering.
I = imread('cameraman.tif');
BW = dither(I);
imshow(I), figure, imshow(BW)[1] Floyd, R. W., and L. Steinberg, "An Adaptive Algorithm for Spatial Gray Scale," International Symposium Digest of Technical Papers, Society for Information Displays, 1975, p. 36.
[2] Lim, Jae S., Two-Dimensional Signal and Image Processing, Englewood Cliffs, NJ, Prentice Hall, 1990, pp. 469-476.
![]() | dicomwrite | edge | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |