0% found this document useful (0 votes)
7 views25 pages

Histogram Specification

This document discusses histogram specification, which is a technique for modifying the tonal distribution of digital images. It describes equalizing the histogram of an original image and specifying a desired histogram. It then covers transforming the original image to match the specified histogram using inverse transformation functions. The text provides details on the continuous and discrete mathematical formulas and implementations used for histogram specification.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views25 pages

Histogram Specification

This document discusses histogram specification, which is a technique for modifying the tonal distribution of digital images. It describes equalizing the histogram of an original image and specifying a desired histogram. It then covers transforming the original image to match the specified histogram using inverse transformation functions. The text provides details on the continuous and discrete mathematical formulas and implementations used for histogram specification.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Histogram Specification

desired
­1
equalize G equalize G
Histogram Specification (cont.)
● Equalize the levels of the original image.
● Specify the desired density function
(histogram) and obtain the transformation
function G(z).
● Apply the inverse transformation function
-1
z = G (s) to the levels obtained in first step.
Histogram Specification (cont.)
­from text­
● Saw what we want the histogram to look like and
come up with a transform function that will give
it to us.
● Continuous random variables r & z. Pr(r) and
Pz(z) denote their probability density functions.
(Continuous equivalent of a histogram).
● Pr(r) input image
● Pz(z) desired output image (processed) This is
what we'd like the processed image to have.
Histogram Specification (cont.)
­from text­
● Continuous version of histogram equalization.
● Cumulative Distribution Function

s =T r = ∫ Pr w dw
0
Histogram Specification (cont.)
­from text­
● Continuous version of histogram equalization.
● Cumulative distribution function.
r

s=T r =∫ P r  wdw


z 0
G  z=∫ P z t dt =s
0
 G  z=T r 
−1 −1
z=G  s=G T r 
Histogram Specification (cont.)
­from text­
● If you have Pr(r) estimated from input image, you
can obtain T(r) from
r

∫ P r  wdw
0
Transformation G(z) can be obtained by
using z
since you
∫ P z t dt specified Pz(z)!
0
Histogram Specification (cont.)
­from text­
-1
● Assume G exists and that is satisfys:
● Single­Valued, monotonically increasing
-1
● 0 <= G (z) <= 1 for 0 <= z <= 1
Histogram Specification (cont.)
­from text­
● You can obtain an image with the specified
probability density function from an input
function using the following:
– obtain T(r) using equilization
– obtain G(z) by equalizing specified histogram
– obtain G (z)
-1
– obtain the output image by applying G to all-1pixels
in input image.
Histogram Specification (cont.)
­from text­
● So far so good (continuously speaking)
● In practice it is difficult to obtain analytical
-1
expressions for T(r) and G
● With discrete values it becomes possible to
make a close approximation to the histogram.
discrete Formulas
k k
nj
s k =T r k = ∑ P r r j = ∑ k =0,1,2,... , L −1
j =0 j =0 n
L is the number of discrete gray levels
n = total # pixels
n = # of pixels with gray level j
j
k
v k =G  z k = ∑ p z  z i =s k k =0,1,2,. .. , L −1
i=0
−1
z k =G [T r k ] k =0,1,2,. .. , L −1
−1
z k =G  s k  k =0,1,2,. .. , L −1
Implementation
● Each set of gray levels is a 1D array
● All mappings from r to s and s to z are simple
table lookups
● Each element (e.g. s ) contains
k 2 important
pieces of information:
– subscript k denotes the location of the element in
the array
– s denotes the value at that location
● We need to only look at integer values
Refer to Figure 3.19 GW
● (a) a hypothetical transform function given an
image that was equalized.
-1
● (b) Equalize specified histogram. G is just
running the transform backwards.
● But wait a minute! Where did we get the z's???
● We have to use an iterative scheme.
Iterative Scheme
● Obtain histogram of the given image.
● Equalize the image to precompute a mapped
level sk for each rk . T
● Obtain G from the specified histogram by
equalization.
● Precompute z k for each sk using iterative
scheme (3.3­17)
● Map r k­> s k and back to z k .
● Moon example 3.4, page 100, 101, 102 GW
desired
0.3 0.3
0.2 0.2
0.1 0.1

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 – 0.19 0 – 0.0
1 – 0.25 1.0 1 – 0.0
1.0
2 – 0.21 2 – 0.0
0.8 0.8
3 – 0.16 3 – 0.15
0.6 0.6
4 – 0.08 4 – 0.20
0.4 0.4
5 – 0.06 5 – 0.30
0.2 0.2
6 – 0.03 6 – 0.20
0.0 7 – 0.15 0.0
7 – 0.02
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7

7 1.0
6 0.8
5
4 0.6
3 0.4
2 0.2
1
0 0.0
0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7
1 3
7 1.0
6 0.8
5
4 0.6
3 0.4
2 0.2
1
0 0.0
0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7
1 3
7 1.0 2 5
6 0.8
5
4 0.6
3 0.4
2 0.2
1
0 0.0
0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7
1 3
7 1.0 2 5
6
5
0.8 3 6
4 0.6
3 0.4
2 0.2
1
0 0.0
0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7
1 3
7 1.0 2 5
6
5
0.8 3 6
0.6
4
3
4 6
0.4
2 0.2
1
0 0.0
0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7
1 3
7 1.0 2 5
6
5
0.8 3 6
0.6
4
3
4 6
0.4
2 0.2 5 7
1
0 0.0
0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7
1 3
7 1.0 2 5
6
5
0.8 3 6
0.6
4
3
4 6
0.4
2 0.2 5 7
1
0 0.0 6 7
0 1 2 3 4 5 6 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
1 3
7 1.0 2 5
6
5
0.8 3 6
0.6
4
3
4 6
0.4
2 0.2 5 7
1
0 0.0 6 7
0 1 2 3 4 5 6 7 7 7
equalized histogram
0.3 0.3
0.2 0.2
0.1 0.1
r s
0 1
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
1 3
2 5 1 = 0.19
7 1.0
6 0.8 3 6 3 = 0.25
5
0.6 5 = 0.21
4
3
4 6
0.4
5 6 = .16+.08=.24
2 0.2 7
1
7 7 = .06+.03+.02
0 0.0 6
= 0.11
0 1 2 3 4 5 6 7 7 7
desired equalized histogram

0.3
0.3
0.2
0.2
0.1 r s 0.1
0 0
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 1 0
2 0
7 1.0
6 3 1
0.8
5
4 0.6 4 2
3 0.4 5 4
2 0.2
1 6 6
0.0
0 7 7
0 1 2 3 4 5 6 7
0 1 3
equalized orig resultant histogram
1 3 4 0.3 0.3
2 5 5 0.2 0.2
3 6 6
0.1 0.1
4 6 6
5 7 7
0 1 2 3 4 5 6 7
6 7 7 0 1 2 3 4 5 6 7

7 7 7
7 1.0
6 0.3
0.8
5
4 0.6 0.2
3 0.4
2 0.2
0.1
1
0 0.0
0 1 2 3 4 5 6 7
desired 0 1 2 3 4 5 6 7

You might also like