# Changeset 1968 for wwwTweet

Ignore:
Timestamp:
Nov 16, 2007, 2:34:16 AM (13 years ago)
Message:
• Simple error diffusion.
Location:
www/study
Files:
2 edited

Unmodified
Removed
• ## www/study/part3.html

 r1956

3.1. Floyd-Steinberg error diffusion

The most famous error diffusion method is the Floyd-Steinberg algorithm.  It handles each pixel of the image one after the other and propagates the error to adjacent pixels:

The error is computed by simply substracting the source value and the destination value. Destination value can be chosen by many means but does not impact the image a lot compared to the error distribution coefficients choice. The image on the left is the result using a 0.5 threshold. The image on the right is a variant called serpentine Floyd-Steinberg that parses every odd line in reverse order (right to left). The results are very close to the original Floyd-Steinberg, but the method avoids artifacts in some corner cases:

not impact the image a lot with most methods in comparison to the crucial choice of error distribution coefficients.

This is the simplest error diffusion method. It thresholds the image to 0.5 and propagates 100% of the error the the next (right) pixel:

3.1. Floyd-Steinberg error diffusion

The most famous error diffusion method is the Floyd-Steinberg algorithm. It propagates the error to more than one adjacent pixels using the following coefficients:

On the left is the result of the simple algorithm. The image on the right is a variant called serpentine Floyd-Steinberg which parses every odd line in reverse order (right to left). The results are very close to the original Floyd-Steinberg, but the method avoids artifacts in some corner cases:

• ## www/study/study.py

 r1942 ey[lines - 1] = [0.] * (w + rows - 1) dest.writePng(name) mat = [[ -1, 1]] test3xx(lenna256bw, mat, False, "out3-0-1.png") test3xx(gradient256bw, mat, False, "grad3-0-1.png") mat = [[    0.,    -1, 7./16],
Note: See TracChangeset for help on using the changeset viewer.