1.5.2.2 Dithering
In the world of computer graphics, dithering refers to the process of applying patterns
to areas of color in order to stimulate a wider color range. In dithering, spatial
resolution of an output image is the same as that of a source image, which is
different from digital halftoning with the patterning method. Some basic dithering
techniques consist of threshold dithering, random modulation, order dithering, and
error diffusion.
Threshold Dithering: First, all pixels of a gray scale image are normalized to
the value from zero to one. The naive version of the algorithm is to set the threshold
equaling 0.5. If the intensity of a pixel is less than 0.5, replace a pixel with black,
else replace a pixel with white. However, to keep the overall image brightness the
same between the original image and the dithering image, first compute the average
intensity over the image. Use a threshold that gives that average during performing
the dithering process. For example, if the average intensity is 0.6, use a threshold
that is higher than 40 percent of the pixels, and lower than the remaining 60 percent.
The dithering image will consist of white pixels 60 percent and black pixels 40
percent. The average value of black and white pixels will be equal to 0.6, which is
the same as the original normalized image. The results of threshold dithering can be
shown in Fig. 1.16.
Random Modulation: This method adds a random amount of noise to each pixel
before thresholding. Typically, uniformly random amount from [−a,a] or a better
quality noise such as Gaussian noise is added to pixel values. The threshold selection
is the same as threshold dithering. This approach is not good for black and white
because of noisy effect but provides better qualities for more colors. In color images,
a small random color to each pixel is added to pixel values before finding the closest
color in the table. Fig.1.17 shows the result of random modulation.
Ordered Dithering: This approach breaks an image into small blocks. Then,
define a threshold matrix. Use a different threshold for each pixel of the block.
Each pixel is compared to its corresponding threshold. The thresholds can be clustered,
which look like newsprint or they can be random, which gives a better result.
Fig.1.18 shows the process of ordered dithering. A block of normalized pixels is
compared pixel-by-pixel with a threshold matrix. If a pixel is higher than a threshold,
the pixel will be white, else, it will be black.
Fig.1.19 shows a dithering image obtained from an ordered dithering method
with a threshold matrix shown in the figure.