<s>
Error	B-Algorithm
diffusion	I-Algorithm
is	O
a	O
type	O
of	O
halftoning	O
in	O
which	O
the	O
quantization	B-Algorithm
residual	O
is	O
distributed	O
to	O
neighboring	O
pixels	B-Algorithm
that	O
have	O
not	O
yet	O
been	O
processed	O
.	O
</s>
<s>
Unlike	O
many	O
other	O
halftoning	O
methods	O
,	O
error	B-Algorithm
diffusion	I-Algorithm
is	O
classified	O
as	O
an	O
area	O
operation	O
,	O
because	O
what	O
the	O
algorithm	O
does	O
at	O
one	O
location	O
influences	O
what	O
happens	O
at	O
other	O
locations	O
.	O
</s>
<s>
This	O
means	O
buffering	B-General_Concept
is	O
required	O
,	O
and	O
complicates	O
parallel	B-Operating_System
processing	I-Operating_System
.	O
</s>
<s>
Error	B-Algorithm
diffusion	I-Algorithm
has	O
the	O
tendency	O
to	O
enhance	O
edges	O
in	O
an	O
image	O
.	O
</s>
<s>
In	O
this	O
sense	O
,	O
it	O
was	O
an	O
analog	O
version	O
of	O
error	B-Algorithm
diffusion	I-Algorithm
.	O
</s>
<s>
Floyd	B-Algorithm
and	I-Algorithm
Steinberg	I-Algorithm
described	O
a	O
system	O
for	O
performing	O
error	B-Algorithm
diffusion	I-Algorithm
on	O
digital	B-General_Concept
images	O
based	O
on	O
a	O
simple	O
kernel	O
:	O
</s>
<s>
where	O
""	O
denotes	O
a	O
pixel	B-Algorithm
in	O
the	O
current	O
row	O
which	O
has	O
already	O
been	O
processed	O
(	O
hence	O
diffusing	O
error	O
to	O
it	O
would	O
be	O
pointless	O
)	O
,	O
and	O
"	O
#	O
"	O
denotes	O
the	O
pixel	B-Algorithm
currently	O
being	O
processed	O
.	O
</s>
<s>
Error	B-Algorithm
diffusion	I-Algorithm
takes	O
a	O
monochrome	O
or	O
color	O
image	O
and	O
reduces	O
the	O
number	O
of	O
quantization	B-Algorithm
levels	O
.	O
</s>
<s>
A	O
popular	O
application	O
of	O
error	B-Algorithm
diffusion	I-Algorithm
involves	O
reducing	O
the	O
number	O
of	O
quantization	B-Algorithm
states	O
to	O
just	O
two	O
per	O
channel	O
.	O
</s>
<s>
In	O
the	O
discussion	O
which	O
follows	O
,	O
it	O
is	O
assumed	O
that	O
the	O
number	O
of	O
quantization	B-Algorithm
states	O
in	O
the	O
error	O
diffused	O
image	O
is	O
two	O
per	O
channel	O
,	O
unless	O
otherwise	O
stated	O
.	O
</s>
<s>
The	O
simplest	O
form	O
of	O
the	O
algorithm	O
scans	O
the	O
image	O
one	O
row	O
at	O
a	O
time	O
and	O
one	O
pixel	B-Algorithm
at	O
a	O
time	O
.	O
</s>
<s>
The	O
current	O
pixel	B-Algorithm
is	O
compared	O
to	O
a	O
half-gray	O
value	O
.	O
</s>
<s>
If	O
it	O
is	O
above	O
the	O
value	O
a	O
white	O
pixel	B-Algorithm
is	O
generated	O
in	O
the	O
resulting	O
image	O
.	O
</s>
<s>
If	O
the	O
pixel	B-Algorithm
is	O
below	O
the	O
half	O
way	O
brightness	O
,	O
a	O
black	O
pixel	B-Algorithm
is	O
generated	O
.	O
</s>
<s>
The	O
generated	O
pixel	B-Algorithm
is	O
either	O
full	O
bright	O
,	O
or	O
full	O
black	O
,	O
so	O
there	O
is	O
an	O
error	O
in	O
the	O
image	O
.	O
</s>
<s>
The	O
error	O
is	O
then	O
added	O
to	O
the	O
next	O
pixel	B-Algorithm
in	O
the	O
image	O
and	O
the	O
process	O
repeats	O
.	O
</s>
<s>
One	O
dimensional	O
error	B-Algorithm
diffusion	I-Algorithm
tends	O
to	O
have	O
severe	O
image	O
artifacts	O
that	O
show	O
up	O
as	O
distinct	O
vertical	O
lines	O
.	O
</s>
<s>
Two	O
dimensional	O
error	B-Algorithm
diffusion	I-Algorithm
reduces	O
the	O
visual	O
artifacts	O
.	O
</s>
<s>
The	O
simplest	O
algorithm	O
is	O
exactly	O
like	O
one	O
dimensional	O
error	B-Algorithm
diffusion	I-Algorithm
,	O
except	O
half	O
the	O
error	O
is	O
added	O
to	O
the	O
next	O
pixel	B-Algorithm
,	O
and	O
half	O
of	O
the	O
error	O
is	O
added	O
to	O
the	O
pixel	B-Algorithm
on	O
the	O
next	O
line	O
below	O
.	O
</s>
<s>
where	O
"	O
#	O
"	O
denotes	O
the	O
pixel	B-Algorithm
currently	O
being	O
processed	O
.	O
</s>
<s>
Further	O
refinement	O
can	O
be	O
had	O
by	O
dispersing	O
the	O
error	O
further	O
away	O
from	O
the	O
current	O
pixel	B-Algorithm
,	O
as	O
in	O
the	O
matrices	O
given	O
above	O
in	O
Digital	B-General_Concept
era	O
.	O
</s>
<s>
The	O
sample	O
image	O
at	O
the	O
start	O
of	O
this	O
article	O
is	O
an	O
example	O
of	O
two	O
dimensional	O
error	B-Algorithm
diffusion	I-Algorithm
.	O
</s>
<s>
However	O
,	O
better	O
visual	O
results	O
may	O
be	O
obtained	O
by	O
first	O
converting	O
the	O
color	O
channels	O
into	O
a	O
perceptive	O
color	O
model	O
that	O
will	O
separate	O
lightness	O
,	O
hue	O
and	O
saturation	O
channels	O
,	O
so	O
that	O
a	O
higher	O
weight	O
for	O
error	B-Algorithm
diffusion	I-Algorithm
will	O
be	O
given	O
to	O
the	O
lightness	O
channel	O
,	O
than	O
to	O
the	O
hue	O
channel	O
.	O
</s>
<s>
This	O
error	O
will	O
be	O
diffused	O
in	O
the	O
neighboring	O
pixels	B-Algorithm
.	O
</s>
<s>
In	O
addition	O
,	O
gamma	O
correction	O
may	O
be	O
needed	O
on	O
each	O
of	O
these	O
perceptive	O
channels	O
,	O
if	O
they	O
do	O
n't	O
scale	O
linearly	O
with	O
the	O
human	O
vision	O
,	O
so	O
that	O
error	B-Algorithm
diffusion	I-Algorithm
can	O
be	O
accumulated	O
linearly	O
to	O
these	O
gamma-corrected	O
linear	O
channels	O
,	O
before	O
computing	O
the	O
final	O
color	O
channels	O
of	O
the	O
rounded	O
pixel	B-Algorithm
colors	O
,	O
using	O
a	O
reverse	O
conversion	O
to	O
the	O
native	O
non	O
gamma-corrected	O
image	O
format	O
and	O
from	O
which	O
the	O
new	O
residual	O
error	O
will	O
be	O
computed	O
and	O
converted	O
again	O
to	O
be	O
distributed	O
to	O
the	O
next	O
pixels	B-Algorithm
.	O
</s>
<s>
Error	B-Algorithm
Diffusion	I-Algorithm
may	O
also	O
be	O
used	O
to	O
produce	O
output	O
images	O
with	O
more	O
than	O
two	O
levels	O
(	O
per	O
channel	O
,	O
in	O
the	O
case	O
of	O
color	O
images	O
)	O
.	O
</s>
<s>
make	O
the	O
next	O
generated	O
pixel	B-Algorithm
be	O
black	O
.	O
</s>
<s>
generated	O
pixel	B-Algorithm
being	O
white	O
.	O
</s>
<s>
This	O
results	O
in	O
error	B-Algorithm
diffusion	I-Algorithm
having	O
a	O
higher	O
apparent	O
resolution	O
than	O
other	O
halftone	O
methods	O
.	O
</s>
