<s>
In	O
image	B-Algorithm
processing	I-Algorithm
,	O
histogram	B-Algorithm
matching	I-Algorithm
or	O
histogram	B-Algorithm
specification	I-Algorithm
is	O
the	O
transformation	O
of	O
an	O
image	O
so	O
that	O
its	O
histogram	B-Algorithm
matches	O
a	O
specified	O
histogram	B-Algorithm
.	O
</s>
<s>
The	O
well-known	O
histogram	B-Algorithm
equalization	I-Algorithm
method	O
is	O
a	O
special	O
case	O
in	O
which	O
the	O
specified	O
histogram	B-Algorithm
is	O
uniformly	O
distributed	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
use	O
histogram	B-Algorithm
matching	I-Algorithm
to	O
balance	O
detector	O
responses	O
as	O
a	O
relative	O
detector	O
calibration	O
technique	O
.	O
</s>
<s>
The	O
following	O
input	O
grayscale	O
image	O
is	O
to	O
be	O
changed	O
to	O
match	O
the	O
reference	O
histogram	B-Algorithm
.	O
</s>
<s>
It	O
will	O
be	O
matched	O
to	O
this	O
reference	O
histogram	B-Algorithm
to	O
emphasize	O
the	O
lower	O
gray	O
levels	O
.	O
</s>
<s>
Given	O
two	O
images	O
,	O
the	O
reference	O
and	O
the	O
target	O
images	O
,	O
we	O
compute	O
their	O
histograms	B-Algorithm
.	O
</s>
<s>
Following	O
,	O
we	O
calculate	O
the	O
cumulative	O
distribution	O
functions	O
of	O
the	O
two	O
images	O
 '	O
histograms	B-Algorithm
–	O
for	O
the	O
reference	O
image	O
and	O
for	O
the	O
target	O
image	O
.	O
</s>
<s>
Then	O
for	O
each	O
gray	O
level	O
,	O
we	O
find	O
the	O
gray	O
level	O
for	O
which	O
,	O
and	O
this	O
is	O
the	O
result	O
of	O
histogram	B-Algorithm
matching	I-Algorithm
function	O
:	O
.	O
</s>
<s>
In	O
typical	O
real-world	O
applications	O
,	O
with	O
8-bit	O
pixel	O
values	O
(	O
discrete	O
values	O
in	O
range	O
[	O
0	O
,	O
255 ]	O
)	O
,	O
histogram	B-Algorithm
matching	I-Algorithm
can	O
only	O
approximate	O
the	O
specified	O
histogram	B-Algorithm
.	O
</s>
<s>
Exact	O
histogram	B-Algorithm
matching	I-Algorithm
is	O
the	O
problem	O
of	O
finding	O
a	O
transformation	O
for	O
a	O
discrete	O
image	O
so	O
that	O
its	O
histogram	B-Algorithm
exactly	O
matches	O
the	O
specified	O
histogram	B-Algorithm
.	O
</s>
<s>
Because	O
of	O
this	O
there	O
may	O
be	O
holes	O
or	O
open	O
spots	O
in	O
the	O
output	O
matched	O
histogram	B-Algorithm
.	O
</s>
<s>
The	O
histogram	B-Algorithm
matching	I-Algorithm
algorithm	O
can	O
be	O
extended	O
to	O
find	O
a	O
monotonic	O
mapping	O
between	O
two	O
sets	O
of	O
histograms	B-Algorithm
.	O
</s>
<s>
Given	O
two	O
sets	O
of	O
histograms	B-Algorithm
and	O
,	O
the	O
optimal	O
monotonic	O
color	B-Algorithm
mapping	I-Algorithm
is	O
calculated	O
to	O
minimize	O
the	O
distance	O
between	O
the	O
two	O
sets	O
simultaneously	O
,	O
namely	O
where	O
is	O
a	O
distance	O
metric	O
between	O
two	O
histograms	B-Algorithm
.	O
</s>
<s>
The	O
optimal	O
solution	O
is	O
calculated	O
using	O
dynamic	B-Algorithm
programming	I-Algorithm
.	O
</s>
