| Previous | Table of Contents | Next |
Assume we are processing the image from the top scan line to the bottom and we are now at the pixel with a value of 223. Since 223 is greater than 127, the output value for this pixel is 255. This assignment generates an output error of (255 223) or 32. Since error calculation often produces negative numbers, remember that signed arithmetic is implied. According to the Floyd Steinberg algorithm the generated error is distributed to neighboring pixels as follows:
Pictorially, this is represented as:
| | 7/16 | |
| 3/16 | 5/16 | 1/16 |
or:
| (1/16) | | 7 |
| 3 | 5 | 1 |
where represents the current computation pixel. So, after processing this point, the image fragment now looks like:
| ... | ... | ... | ... | ... |
| ... | ... | 255 | 186 | ... |
| ... | 194 | 190 | 198 | ... |
| ... | ... | ... | ... | ... |
Processing continues with the next point to the right which has an example value of 186, and so on. When the row is completely processed, the next row is processed similarly. So, the process begins at the first position (leftmost) on the first scan line and processes each scan line left to right.
After Floyd and Steinberg published their paper, many error diffusions appeared. A few are listed below:
Jarvis, Judice, and Ninke:
| (1/48) | | 7 | 5 | |
| 3 | 5 | 7 | 5 | 3 |
| 1 | 3 | 5 | 3 | 1 |
Stucki:
| (1/42) | | 8 | 4 | |
| 2 | 4 | 8 | 4 | 2 |
| 1 | 2 | 4 | 2 | 1 |
Stevenson and Arce:
| (1/200) | | 0 | 32 | 0 | ||
| 12 | 0 | 26 | 0 | 30 | 0 | 16 |
| 0 | 12 | 0 | 26 | 0 | 12 | 0 |
| 5 | 0 | 12 | 0 | 12 | 0 | 5 |
Note that error diffusion algorithms only alter pixel values that are not yet set to minimum values. These pixels are either ahead on the same line in the current direction of travel (forward is left to right and reverse is right to left) or close by (ahead or behind) on lower scan lines. When calculating pixel values bordering scan-line edges, there is not always a place to diffuse error to, particularly on lower lines. So, it is useful to center image scan lines in arrays that are longer than the scan line to facilitate computations. Floyd Steinberg needs an array two columns wider than image scan lines because errors are diffused to the following scan line one column to the right and one to the left of the current calculation pixel. Stevenson and Arce needs an array six columns wider than the scan line.
| Previous | Table of Contents | Next |