Ordered dithering

Ordered dithering
In this example image, the photograph shown on left has been quantized to 16 colors and dithered using the 8x8 ordered dithering pattern.

Ordered dithering is an image dithering algorithm. It is commonly used by programs that need to provide continuous image of higher colors on a display of less color depth. For example, Microsoft Windows uses it in 16-color graphics modes. It is easily distinguished by its noticeable crosshatch patterns.

The algorithm achieves dithering by applying a threshold map on the pixels displayed, causing some of the pixels to be rendered at a different color, depending on how far in between the color is of available color entries.

Different sizes of threshold maps exist:


\frac{\displaystyle 1}{\displaystyle 5}
\begin{bmatrix}
1 & 3 \\
4 & 2 \\
\end{bmatrix}

\frac{\displaystyle 1}{\displaystyle 10}
\begin{bmatrix}
3 & 7 & 4 \\
6 & 1 & 9 \\
2 & 8 & 5 \\
\end{bmatrix}

\frac{\displaystyle 1}{\displaystyle 17}
\begin{bmatrix}
1 & 9 & 3 & 11 \\
13 & 5 & 15 & 7 \\
4 & 12 & 2 & 10 \\
16 & 8 & 14 & 6 \\
\end{bmatrix}

\frac{\displaystyle 1}{\displaystyle 65}
\begin{bmatrix}
1  & 49 & 13 & 61 &  4 & 52 & 16 & 64 \\
33 & 17 & 45 & 29 & 36 & 20 & 48 & 32 \\
9  & 57 &  5 & 53 & 12 & 60 &  8 & 56 \\
41 & 25 & 37 & 21 & 44 & 28 & 40 & 24 \\
3  & 51 & 15 & 63 &  2 & 50 & 14 & 62 \\
35 & 19 & 47 & 31 & 34 & 18 & 46 & 30 \\
11 & 59 &  7 & 55 & 10 & 58 &  6 & 54 \\
43 & 27 & 39 & 23 & 42 & 26 & 38 & 22 \\
\end{bmatrix}

The map may be rotated or mirrored without affecting the power of the algorithm. This threshold map is also known as an index matrix or Bayer matrix.[1]

Arbitrary size threshold maps can be devised with a simple rule: First fill each slot with a successive integer starting from 1. Then reorder them such that the average distance between two successive numbers in the map is as large as possible, paying attention to that the table "wraps" around at edges.[citation needed]

The algorithm renders the image normally, but for each pixel, it adds a value from the threshold map, causing the pixel's value to be quantized one step higher if it exceeds the threshold. For example, in monochrome rendering, if the value of the pixel (scaled into the 0-9 range) is less than the number in the corresponding cell of the matrix, plot that pixel black, otherwise, plot it white.

A color scale shown undithered and dithered. The palette has 8 red tones, 8 green tones, and their intersections for a total of 64 colors, whereas the original image has 140 in both directions for a total of 19600 colors.

In pseudocode:

for each y
   for each x
      oldpixel := pixel[x][y] + threshold_map_4x4[x mod 4][y mod 4]
      newpixel := find_closest_palette_color(oldpixel)
      pixel[x][y] := newpixel

The values read from the threshold map should scale into the same range as is the minimal difference between distinct colors in the target palette.

Because the algorithm operates on single pixels and has no conditional statements, it is very fast and suitable for real-time transformations. Additionally, because the location of the dithering patterns stays always the same relative to the display frame, it is less prone to jitter than error-diffusion methods, making it suitable for animations.

The size of the map selected should be equal to or larger than the ratio of source colors to target colors. For example, when quantizing a 24bpp image to 15bpp (256 colors per channel to 32 colors per channel), the smallest map one would choose would be 4x2, for the ratio of 8 (256:32). This allows expressing each distinct tone of the input with different dithering patterns.[citation needed]

Notes

  1. ^ Bayer, Bryce (June 11-13 1973). "An optimum method for two-level rendition of continuous-tone pictures". IEEE International Conference on Communications 1: 11–15. 

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Riemersma dithering — is an image dithering technique that provides a middle ground between ordered dithering and error diffusion. The result is a bit more coarse than error diffusion techniques (such as Floyd Steinberg).When dithering a pixel, the number of… …   Wikipedia

  • Dither — For other uses, see Dither (disambiguation). Provincial definition of to dither from The Rural Economy of Yorkshire: Comprizing the Management of Landed Estates, and the Present Practice of Husbandry in the Agricultural Districts of that County,… …   Wikipedia

  • Bayer filter — The Bayer arrangement of color filters on the pixel array of an image sensor …   Wikipedia

  • упорядоченное сглаживание (контура изображения) — Метод формирования полутоновых изображений путем пороговой обработки исходного изображения. Выбор порогов осуществляется с помощью матрицы со случайным набором порогов. Ее использование позволяет создать эффект “черепичной крыши”, что улучшает… …   Справочник технического переводчика

  • Floyd-Steinberg-Algorithmus — Ein Bild, das mit dem Floyd Steinberg Algorithmus bearbeitet wurde Der Floyd Steinberg Algorithmus ist ein erstmals 1976 von Robert W. Floyd und Louis Steinberg veröffentlichter Dithering Algorithmus. In der Bildbearbeitung findet er häufig… …   Deutsch Wikipedia

  • Eighty Years' War — Relief of Leiden after the siege, 1574. Date 1568 1648 Location …   Wikipedia

  • Canadian federal election, 2011 — 2008 ← members May 2, 2011 (2011 05 02) …   Wikipedia

  • David Paterson — This article is about the former Governor of New York. For other spellings and people of the same name, see David Patterson (disambiguation). David Paterson Paterson at the 2008 Tribeca Film Festival 55th Governor of New York …   Wikipedia

  • Chickamauga Wars (1776–1794) — The Chickamauga Wars (1776–1794) were a series of raids, campaigns, ambushes, minor skirmishes, and several full scale frontier battles which were a continuation of the Cherokee (Ani Yunwiya, Ani Kituwa, Tsalagi, Talligewi) struggle against… …   Wikipedia

  • Indonesian National Revolution — A defiant Bung Tomo, one of the most revered revolutionary leaders. This famous photo represents for many who took part, both Dutch and Indonesian, the very soul of the revolutionary struggle …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”