<s>
In	O
photography	O
and	O
image	B-Algorithm
processing	I-Algorithm
,	O
color	B-Algorithm
balance	I-Algorithm
is	O
the	O
global	O
adjustment	O
of	O
the	O
intensities	O
of	O
the	O
colors	O
(	O
typically	O
red	O
,	O
green	O
,	O
and	O
blue	O
primary	O
colors	O
)	O
.	O
</s>
<s>
Hence	O
,	O
the	O
general	O
method	O
is	O
sometimes	O
called	O
gray	B-Algorithm
balance	I-Algorithm
,	O
neutral	O
balance	O
,	O
or	O
white	B-Algorithm
balance	I-Algorithm
.	O
</s>
<s>
Color	B-Algorithm
balance	I-Algorithm
changes	O
the	O
overall	O
mixture	O
of	O
colors	O
in	O
an	O
image	O
and	O
is	O
used	O
for	O
color	O
correction	O
.	O
</s>
<s>
Generalized	O
versions	O
of	O
color	B-Algorithm
balance	I-Algorithm
are	O
used	O
to	O
correct	O
colors	O
other	O
than	O
neutrals	O
or	O
to	O
deliberately	O
change	O
them	O
for	O
effect	O
.	O
</s>
<s>
White	B-Algorithm
balance	I-Algorithm
is	O
one	O
of	O
the	O
most	O
common	O
kinds	O
of	O
balancing	O
,	O
and	O
is	O
when	O
colors	O
are	O
adjusted	O
to	O
make	O
a	O
white	O
object	O
(	O
such	O
as	O
a	O
piece	O
of	O
paper	O
or	O
a	O
wall	O
)	O
appear	O
white	O
and	O
not	O
a	O
shade	O
of	O
any	O
other	O
colour	O
.	O
</s>
<s>
Image	O
data	O
acquired	O
by	O
sensors	O
–	O
either	O
film	O
or	O
electronic	O
image	B-Algorithm
sensors	I-Algorithm
–	O
must	O
be	O
transformed	O
from	O
the	O
acquired	O
values	O
to	O
new	O
values	O
that	O
are	O
appropriate	O
for	O
color	O
reproduction	O
or	O
display	O
.	O
</s>
<s>
The	O
color	B-Algorithm
balance	I-Algorithm
operations	O
in	O
popular	O
image	B-Application
editing	I-Application
applications	O
usually	O
operate	O
directly	O
on	O
the	O
red	O
,	O
green	O
,	O
and	O
blue	O
channel	O
pixel	B-Algorithm
values	O
,	O
without	O
respect	O
to	O
any	O
color	O
sensing	O
or	O
reproduction	O
model	O
.	O
</s>
<s>
In	O
film	O
photography	O
,	O
color	B-Algorithm
balance	I-Algorithm
is	O
typically	O
achieved	O
by	O
using	O
color	O
correction	O
filters	O
over	O
the	O
lights	O
or	O
on	O
the	O
camera	O
lens	O
.	O
</s>
<s>
Sometimes	O
the	O
adjustment	O
to	O
keep	O
neutrals	O
neutral	O
is	O
called	O
white	B-Algorithm
balance	I-Algorithm
,	O
and	O
the	O
phrase	O
color	B-Algorithm
balance	I-Algorithm
refers	O
to	O
the	O
adjustment	O
that	O
in	O
addition	O
makes	O
other	O
colors	O
in	O
a	O
displayed	O
image	O
appear	O
to	O
have	O
the	O
same	O
general	O
appearance	O
as	O
the	O
colors	O
in	O
an	O
original	O
scene	O
.	O
</s>
<s>
To	O
address	O
this	O
critical	O
color	B-Algorithm
balance	I-Algorithm
issue	O
,	O
the	O
tri-color	O
primaries	O
themselves	O
are	O
formulated	O
to	O
not	O
balance	O
as	O
a	O
true	O
neutral	O
color	O
.	O
</s>
<s>
Most	O
digital	O
cameras	O
have	O
means	O
to	O
select	O
color	O
correction	O
based	O
on	O
the	O
type	O
of	O
scene	O
lighting	O
,	O
using	O
either	O
manual	O
lighting	O
selection	O
,	O
automatic	B-Algorithm
white	I-Algorithm
balance	I-Algorithm
,	O
or	O
custom	O
white	B-Algorithm
balance	I-Algorithm
.	O
</s>
<s>
This	O
captures	O
an	O
image	O
of	O
the	O
ambient	O
light	O
,	O
which	O
enables	O
a	O
digital	O
camera	O
to	O
set	O
the	O
correct	O
color	B-Algorithm
balance	I-Algorithm
for	O
that	O
light	O
.	O
</s>
<s>
Examples	O
are	O
Retinex	O
,	O
an	O
artificial	B-Architecture
neural	I-Architecture
network	I-Architecture
or	O
a	O
Bayesian	O
method	O
.	O
</s>
<s>
Color	B-Algorithm
balance	I-Algorithm
is	O
also	O
related	O
to	O
color	O
constancy	O
.	O
</s>
<s>
Viggiano	O
found	O
that	O
white	B-Algorithm
balancing	I-Algorithm
in	O
the	O
camera	O
's	O
native	O
RGB	O
color	O
model	O
tended	O
to	O
produce	O
less	O
color	O
inconstancy	O
(	O
i.e.	O
,	O
less	O
distortion	O
of	O
the	O
colors	O
)	O
than	O
in	O
monitor	O
RGB	O
for	O
over	O
4000	O
hypothetical	O
sets	O
of	O
camera	O
sensitivities	O
.	O
</s>
<s>
This	O
means	O
that	O
it	O
is	O
advantageous	O
to	O
get	O
color	B-Algorithm
balance	I-Algorithm
right	O
at	O
the	O
time	O
an	O
image	O
is	O
captured	O
,	O
rather	O
than	O
edit	O
later	O
on	O
a	O
monitor	O
.	O
</s>
<s>
If	O
one	O
must	O
color	B-Algorithm
balance	I-Algorithm
later	O
,	O
balancing	O
the	O
raw	B-Application
image	I-Application
data	I-Application
will	O
tend	O
to	O
produce	O
less	O
distortion	O
of	O
chromatic	O
colors	O
than	O
balancing	O
in	O
monitor	O
RGB	O
.	O
</s>
<s>
Color	O
balancing	O
is	O
sometimes	O
performed	O
on	O
a	O
three-component	O
image	O
(	O
e.g.	O
,	O
RGB	O
)	O
using	O
a	O
3x3	O
matrix	B-Architecture
.	O
</s>
<s>
This	O
type	O
of	O
transformation	O
is	O
appropriate	O
if	O
the	O
image	O
was	O
captured	O
using	O
the	O
wrong	O
white	B-Algorithm
balance	I-Algorithm
setting	O
on	O
a	O
digital	O
camera	O
,	O
or	O
through	O
a	O
color	O
filter	O
.	O
</s>
<s>
In	O
this	O
type	O
of	O
transformation	O
the	O
3x3	O
matrix	B-Architecture
is	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
where	O
,	O
,	O
and	O
are	O
the	O
color	O
balanced	O
red	O
,	O
green	O
,	O
and	O
blue	O
components	O
of	O
a	O
pixel	B-Algorithm
in	O
the	O
image	O
;	O
,	O
,	O
and	O
are	O
the	O
red	O
,	O
green	O
,	O
and	O
blue	O
components	O
of	O
the	O
image	O
before	O
color	O
balancing	O
,	O
and	O
,	O
,	O
and	O
are	O
the	O
red	O
,	O
green	O
,	O
and	O
blue	O
components	O
of	O
a	O
pixel	B-Algorithm
which	O
is	O
believed	O
to	O
be	O
a	O
white	O
surface	O
in	O
the	O
image	O
before	O
color	O
balancing	O
.	O
</s>
<s>
This	O
is	O
a	O
simple	O
scaling	O
of	O
the	O
red	O
,	O
green	O
,	O
and	O
blue	O
channels	O
,	O
and	O
is	O
why	O
color	B-Algorithm
balance	I-Algorithm
tools	O
in	O
Photoshop	B-Operating_System
have	O
a	O
white	O
eyedropper	O
tool	O
.	O
</s>
<s>
It	O
has	O
been	O
demonstrated	O
that	O
performing	O
the	O
white	B-Algorithm
balancing	I-Algorithm
in	O
the	O
phosphor	O
set	O
assumed	O
by	O
sRGB	O
tends	O
to	O
produce	O
large	O
errors	O
in	O
chromatic	O
colors	O
,	O
even	O
though	O
it	O
can	O
render	O
the	O
neutral	O
surfaces	O
perfectly	O
neutral	O
.	O
</s>
<s>
where	O
,	O
,	O
and	O
are	O
the	O
color-balanced	O
tristimulus	O
values	O
;	O
,	O
,	O
and	O
are	O
the	O
tristimulus	O
values	O
of	O
the	O
viewing	O
illuminant	O
(	O
the	O
white	O
point	O
to	O
which	O
the	O
image	O
is	O
being	O
transformed	O
to	O
conform	O
to	O
)	O
;	O
,	O
,	O
and	O
are	O
the	O
tristimulus	O
values	O
of	O
an	O
object	O
believed	O
to	O
be	O
white	O
in	O
the	O
un-color-balanced	O
image	O
,	O
and	O
,	O
,	O
and	O
are	O
the	O
tristimulus	O
values	O
of	O
a	O
pixel	B-Algorithm
in	O
the	O
un-color-balanced	O
image	O
.	O
</s>
<s>
If	O
the	O
tristimulus	O
values	O
of	O
the	O
monitor	O
primaries	O
are	O
in	O
a	O
matrix	B-Architecture
so	O
that	O
:	O
</s>
<s>
Johannes	O
von	O
Kries	O
,	O
whose	O
theory	O
of	O
rods	O
and	O
three	O
color-sensitive	O
cone	O
types	O
in	O
the	O
retina	O
has	O
survived	O
as	O
the	O
dominant	O
explanation	O
of	O
color	O
sensation	O
for	O
over	O
100	O
years	O
,	O
motivated	O
the	O
method	O
of	O
converting	O
color	O
to	O
the	O
LMS	O
color	B-Algorithm
space	I-Algorithm
,	O
representing	O
the	O
effective	O
stimuli	O
for	O
the	O
Long-	O
,	O
Medium-	O
,	O
and	O
Short-wavelength	O
cone	O
types	O
that	O
are	O
modeled	O
as	O
adapting	O
independently	O
.	O
</s>
<s>
A	O
3x3	O
matrix	B-Architecture
converts	O
RGB	O
or	O
XYZ	O
to	O
LMS	O
,	O
and	O
then	O
the	O
three	O
LMS	O
primary	O
values	O
are	O
scaled	O
to	O
balance	O
the	O
neutral	O
;	O
the	O
color	O
can	O
then	O
be	O
converted	O
back	O
to	O
the	O
desired	O
final	O
color	B-Algorithm
space	I-Algorithm
:	O
</s>
<s>
where	O
,	O
,	O
and	O
are	O
the	O
color-balanced	O
LMS	O
cone	O
tristimulus	O
values	O
;	O
,	O
,	O
and	O
are	O
the	O
tristimulus	O
values	O
of	O
an	O
object	O
believed	O
to	O
be	O
white	O
in	O
the	O
un-color-balanced	O
image	O
,	O
and	O
,	O
,	O
and	O
are	O
the	O
tristimulus	O
values	O
of	O
a	O
pixel	B-Algorithm
in	O
the	O
un-color-balanced	O
image	O
.	O
</s>
<s>
If	O
the	O
camera	O
's	O
raw	O
RGB	O
values	O
are	O
known	O
,	O
one	O
may	O
use	O
the	O
3x3	O
diagonal	B-Algorithm
matrix	I-Algorithm
:	O
</s>
<s>
The	O
best	O
color	O
matrix	B-Architecture
for	O
adapting	O
to	O
a	O
change	O
in	O
illuminant	O
is	O
not	O
necessarily	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
in	O
a	O
fixed	O
color	B-Algorithm
space	I-Algorithm
.	O
</s>
