Professional Documents
Culture Documents
4
Image Negatives
The negative of an image with gray L
levels is given by the expression
s=L–1–r
Where r is value of input pixel, and
s is value of processed pixel
5
6
Log Transformations
The general form of the log
transformation shown in
s = c log(1+r)
7
C = 1.0
C = 0.8
8
Exponential Transformations
The general form of the log
transformation shown in
s = c exp(r)
9
C = 1.0
C = 0.8
10
Power-Law Transformations
Power-law transformations have the
basic form
s cr
Where c and are positive constant.
Sometime above Equation is written as
s c(r )
11
= 0.5
= 1.0
= 5.0
12
Piecewise-Linear
Transformation Functions
Translate Mapping
Contrast stretching
Gray-level slicing
Bit-plane slicing
13
Translate Mapping
14
Contrast stretching
One of the simplest piecewise linear
functions is a contrast-stretching
transformation.
The idea behind contrast stretching is to
increase the dynamic range of the gray
levels in the image being processed.
15
Contrast stretching
16
Contrast stretching
17
Gray-level slicing
Highlighting a specific range of gray
levels in an image often is desired.
There are several ways of doing level
slicing, but most of them are variations of
two basic themes.
One approach is to display a high value
for all gray levels in the range of interest
and a low value for all other gray levels.
18
Gray-level slicing
0 255 0 255
19
Bit-plane slicing
Instead of highlighting gray-level ranges,
highlighting the contribution made to total
image appearance by specific bits might be
desired.
Suppose that each pixel in an image is
represented b y 8 bits. Imagine that the image is
composed of eight 1-bit planes, ranging from
bit-plane 0, the least significant bit to bit-plane
7, the most significant bit.
20
Bit-plane 0
(least significant)
1
1
0
0
1
1
10110011 0
1
Bit-plane 7
(most significant) 21
Bit-plane slicing
Original Image
22
Histogram Processing
The histogram of a digital image with gray levels
in the range [0,L-1] is a discrete function
h(rk ) nk
Where rk is the kth gray level and
nk is the number of pixels in the image having
gray level rk
23
HISTOGRAM
pixels
130
36 36
22
0 1 2 3 level
Image 16x14 = 224 pixels 24
Role of Histogram Processing
The role of histogram processing in
image enhancement example
Dark image
Light image
Low contrast
High contrast
25
Histogram Processing
Histogram Equalization
Histogram Matching(Specification)
Local Enhancement
26
Initial part of discussion
Let r represent the gray levels of the
image to be enhanced.
Normally, we have used pixel values in
the interval [0,L-1], but now we assume
that r has been normalized to the interval
[0,1], with r=0 representing black and
r=1 representing white.
27
Histogram Equalization
We focus attention on transformations of the form
s T ( r ) where 0 r 1
That produce a level s for every pixel value r in the
original image.
29
Transformation function
Level s
sk=T(rk) T(r)
rk Level r
0 1
30
Note
The inverse transformation from s back to r is
denoted
s T 1 (r ) where 0 r 1
31
Fundamental of random variable
32
PDF
The PDF (probability density function) is
denoted by p(x)
ตัวอย่ าง การทอยลูกเต๋ า ความน่ าจะเป็ นที่ลกู เต๋ าจะขึน้ หน้ าต่ างๆ
เป็ นดังต่ อไปนี ้
pdf
1/6
1 2 3 4 5 6 หน้าลูกเต๋ า 33
CDF
The CDF (cumulative density function) is
denoted by P(x)
ตัวอย่ าง การทอยลูกเต๋ า ความน่ าจะเป็ นที่ลกู เต๋ าจะขึน้ หน้ าต่ างๆ
เป็ นดังต่ อไปนี ้
cdf
1
1/6
1 2 3 4 5 6 หน้าลูกเต๋ า 34
Relation between PDF and CDF
PDF can find from this equation
d [ P( x)]
p( x) P( x)
dx
P ( x xn ) p( x)dx
x x0
35
Idea of Histogram Equalization
The gray levels in an image may be viewed as
random variables in the interval [0,1].
Let pr(r) denote the pdf of random variable r and
ps(s) denote the pdf of random variable s; if pr(r) and T(r)
are known and T-1(s) satisfies condition (a), the formula
should be
dr
p s ( s ) pr ( r )
ds
r
s T (r ) pr ( w)dw
0
36
Idea of Histogram Equalization
By Leibniz’s rule that the derivative of a definite
integral with respect to its upper limit is simply
the integrand evaluated at that limit.
ds dT (r )
dr dr
d r
pr ( w)dw
dr 0
pr ( r )
37
Idea of Histogram Equalization
Substituting into the first equaltion
dr
p s ( s ) pr ( r )
ds
1
pr ( r )
pr ( r )
1, 0 s 1
38
Idea of Histogram Equalization
The probability of occurrence of gray level rk in
an image is approximated by
nk
pk (rk ) k 0,1,2,..., L 1
n
k
sk T (rk ) pr (rj )
j 0
k nj
k 0,1,2,..., L 1
j 0 n
39
Histogram Equalization
40
Example for
Histogram Equalization
จงทำฮิ สโตแกรม อีควอไรเซชั่น ของ ค่ าสี จำนวนพิกเซล
(nj)
ภาพที่มีรายละเอียดต่ อไปนี ้
0 30
สูตร
k nj 1 50
sk , k 0,1,.., L 1
j 0 n 2 100
L 1
3 1500
n nj
j 0 4 2300
30 50 100 1500 2300 4000 200 20 5 4000
8200
6 200
7 20
41
Example for
Histogram Equalization
0 nj n0 30 0
s0 0.0037
j 0 n n 8200 7
1 n
n n 30 50 80 0
s1 0 1
j
0.0098
j 0 n n 8200 8200 7
2 n
n n n 30 50 100 180 0
s2 0 1 2
j
0.022
j 0 n n 8200 8200 7
3 n
30 50 100 1500 1680 1
s3 j 0.205
j 0 n 8200 8200 7
4 n
30 50 100 1500 2300 3980 3
s4
j
0.485
j 0 n 8200 8200 7
5 n
30 50 100 1500 2300 4000 7980 7
s5
j
0.973
j 0 n 8200 8200 7
6 n
30 50 100 1500 2300 4000 200 8180 7
s6 j 0.998
j 0 n 8200 8200 7
7 n
30 50 100 1500 2300 4000 200 20 8200 7
s7 42
j
1
j 0 n 8200 8200 7
Example for
Histogram Equalization
43
Example for
Histogram Equalization(2)
ค่ าสี จำนวน
k k nj k nj
(k) พิกเซล(nj)
n
j 0
j n sk ( L 1)
n
j 0 j 0
0 30 30 0.0037 0.0256
1 50 80 0.0098 0.0683
2 100 180 0.0220 0.1537
3 1500 1680 0.2050 1.4241
4 2300 3980 0.4854 3.3976
5 4000 7980 0.9732 6.8122
6 200 8180 0.9976 6.9830
7 20 8200 1.0000 7.0000
44
Histogram Specification
can called “Histogram Matching”
Histogram equalization automatically
determines a transformation function that
seeks to produce an output image that
has a uniform histogram.
In particular, it is useful sometimes to be
able to specify the shape of the histogram
that we wish the processed image to have.
45
Meaning:
Histogram Specification
In this notation, r and z denote the gray
levels of the input and output (processed)
images, respectively.
We can estimate pr(r) from the given
image
While pz(z) is the specified probability
density function that we wish the output
image to have
46
Meaning:
Histogram Specification
Let s be a random variable with the
property s T (r ) pr (w)dw (1)
r
0
47
Procedure:
Histogram Specification
1) Use Eq.(1) to obtain the transformation
function T(r)
2) Use Eq.(2) to obtain the transformation
function G(z)
3) Obtain the inverse transformation function G-
1
48
Input Image
Specified histogram
49
Result form
Histogram Specification
50
Local Enhancement
Normally, Transformation function based
on the content of an entire image.
Some cases it is necessary to enhance
details over small areas in an image.
The histogram processing techniques are
easily adaptable to local enhancement.
51
Local Enhancement
Pixel-to-pixel translation Nonoverlapping region
52
Local Equalization
53
Enhancement Using
Arithmetic/Logic Operations
Are performed on a pixel-by-pixel basis
between two or more images
Logic operations are concerned with the ability
to implement the AND, OR, and NOT logic
operators because these three operators are
functionally complete.
Arithmetic operations are concerned about
+,-,*, / and so on (arithmetic operators)
54
Image Subtraction
The difference between two images f(x,y)
and h(x,y) expressed as
g(x,y) = f(x,y) – h(x,y)
55
56
Image Averaging
Consider a noisy image g(x,y) formed by
the addition of noise to original image
f(x,y)
g ( x, y ) f ( x , y ) ( x , y ) where η(x,y) is noise
58
Image Averaging (Gray Scale)
1 image
2 5 10 20
images images images images
59
Image Averaging (Color Image)
Average image
60