Sakar Ghimire

1 min read 180 views

Image Dithering

Image Dithering_image

Image Dithering is a process of adding some noise to an image. This noise can be used to randomize the quantization error. Dithering is an image processing technique which can be used to create the illusion of color depth on systems with a limited color palette. It introduces noise or a pattern into an image, and often these patterns are visible. 

Error diffusion dithering is a process of image dithering using error diffusion, in which the quantization error of the current pixel is added to the pixel on the right and below according to a predefined formula. The error diffusion dithering algorithm can be written as: 

  1. For each point in image, find the closest color available (for grayscale images, this is just a thresholding operation).
  2. Calculate the difference between the value in the image and the color you have.
  3. Now divide up these error values and distribute them over the neighboring pixels which you have not visited yet. 
  4. When you get to these later pixels, just add the errors distributed from the earlier pixels, clip the values to the allowed range if needed, and then repeat.

Here, I provide an implementation for the Jarvis Judice Ninke dithering algorithm in a grayscale image. The figures provided show the effect on image before and after applying the dithering algorithm. 

Before dithering:

After dithering:



Code