Next: Mathematical Justification of the
Up: Error Diffusion Using Linear
Previous: Error Diffusion Halftone Production
Linear pixel shuffling (LPS) is a method
for visiting image pixels distributed
evenly all over an image. LPS uses a
simple linear rule, given by matrix
multiplication (modulo a parameter
depending on the image size)
![\begin{displaymath}
\left[
\!\!
\begin{array}{c}
i \\ j
\end{array}\!\!
\right]...
...M \left[
\!\!
\begin{array}{c}
x \\ y
\end{array}\!\!
\right]\end{displaymath}](img10.gif) |
(2) |
The original image processing pseudocode
uses Eq. (2), becoming:
for ( x = 0; x < N; x++ ) {
for ( y = 0; y < N; y++ ) {
multiply M * (x,y)'
to obtain (i,j)';
process pixel i,j
}
}
The matrix M and the parameter N
are described below.
Define the Fibonacci-like sequence Gby the recurrence:
| G0 |
= |
0 |
|
| G1 |
= |
1 |
|
| G2 |
= |
1 |
|
| Gn+1 |
= |
 |
(3) |
Terms G0 through G14 of this sequence are
0, 1, 1, 1, 2, 3, 4, 6, 9, 13, 19, 28, 41, 60, 88
We also need this sequence with negative
subscripts (the definition allows us to
work backwards in the subscripts easily).
Terms G-1 through G-14 are
0, 1, 0, -1, 1, 1, -2, 0, 3, -2, -3, 5, 1, -8
For our algorithm, we round the image
size up to a square of side Gn (this
is the N in the above pseudocode) and
ignore pixels that fall outside
the actual image.
Define a
table T with
entries defined as
 |
(4) |
Because
 |
(5) |
for all n,
every number in
occurs in T exactly Gn times. Here is
a portion of the
table
for
.
0 60 32 4 64 36 8 68 40 12 72 44 16
41 13 73 45 17 77 49 21 81 53 25 85 57
82 54 26 86 58 30 2 62 34 6 66 38 10
35 7 67 39 11 71 43 15 75 47 19 79 51
76 48 20 80 52 24 84 56 28 0 60 32 4
29 1 61 33 5 65 37 9 69 41 13 73 45
70 42 14 74 46 18 78 50 22 82 54 26 86
23 83 55 27 87 59 31 3 63 35 7 67 39
64 36 8 68 40 12 72 44 16 76 48 20 80
17 77 49 21 81 53 25 85 57 29 1 61 33
58 30 2 62 34 6 66 38 10 70 42 14 74
11 71 43 15 75 47 19 79 51 23 83 55 27
52 24 84 56 28 0 60 32 4 64 36 8 68
A particularly nice feature of the table
T is that values which are numerically
close are physically distant. Examine a
block centered at one
of the zeros in T:
49 21 81 53 25 85 57
2 62 34 6 66 38 10
43 15 75 47 19 79 51
84 56 28 0 60 32 4
37 9 69 41 13 73 45
78 50 22 82 54 26 86
31 3 63 35 7 67 39
Notice that the smaller numbers are not close to 0.
Because T was constructed
using a simple linear rule, this phenomenon
holds for any value, not just zero; it
is even more visible for larger values
of Gn.
The LPS pixel selection algorithm works
by first visiting the elements in the
square that correspond to
the positions (i,j) for which Tij=0,
followed by positions (i,j) for which
Tij=1, and so on. We may express this
in the processing pseudocode:
for ( x = 0; x < N; x++ ) {
process all N pixels i,j
such that T[i][j] = x
}
The matrix M that achieves this is
![\begin{displaymath}M = \left[
\!\!
\begin{array}{cc}
G_{-n+1} & G_{n-3} \\
G_{-n} & G_{n-2}
\end{array}\!\!
\right]\end{displaymath}](img18.gif) |
(6) |
For example, using
![\begin{displaymath}M = \left[
\!\!
\begin{array}{cc}
G_{-13} & G_{11} \\
G_{-14...
...
\begin{array}{cc}
1 & 28 \\
-8 & 41
\end{array}\!\!
\right]\end{displaymath}](img20.gif) |
(7) |
Next: Mathematical Justification of the
Up: Error Diffusion Using Linear
Previous: Error Diffusion Halftone Production
2000-04-14