Document 15072464

advertisement
Mata kuliah : T0283 - Computer Vision
Tahun
: 2010
Lecture 02
Point Based Image Processing
Learning Objectives
After carefully listening this lecture, students will be able
to do the following :
understand spatial information based image operation
such as point-based processing
demonstrate how point-based image processing is
performed (i.e. contrast enhancement and histogram
equalization.
January 20, 2010
T0283 - Computer Vision
3
Digital Image Representation
(Review Last Lecture)
For computer representation, function (e.g.
intensity) must be sampled at discrete intervals.
Sampling map the intensity values into discrete
intervals.
Points at which an image is sampled are called
picture elements or pixels.
Resolution specifies the distance between points accuracy.
January 20, 2010
T0283 - Computer Vision
4
Spatial Digitization (Sampling)
y
f(x,y)
s(x,y)
grid
x
I(x,y) = f (x,y) . s(x,y) where s(x,y) = 1 for every value of x and y
January 20, 2010
T0283 - Computer Vision
5
Spatial Digitization (Sampling)
24 x 36
48 x 72
400 x 267
January 20, 2010
96 x 144
T0283 - Computer Vision
6
Image Quantization
Output Intensity
5 th level
4 th level
3 rd level
2 nd level
1st level
0 th level
Input Intensity
January 20, 2010
T0283 - Computer Vision
7
Image Quantization
1 bit/piksel
2 bit/piksel
8 bit/piksel
January 20, 2010
3 bit/piksel
T0283 - Computer Vision
8
Digital Image Representation
0,0
c
I(r,c)
r
M-1,N-1
A digital image is represented by a matrix of numeric values
each representing a quantized intensity value.
I(r,c) - intensity value at position corresponding to row r and column c
of the matrix.
Intensity value can be represented by 1 bit for black and white images
(binary valued images), 8 bits for monochrome imagery to encode
color or grayscale levels, 24 bits (color-RGB).
January 20, 2010
T0283 - Computer Vision
9
Classification of Image Operations
Spatial Domain Methods
Point processing transformations
Area/Mask processing transformations
Geometric transformations
Frame processing transformations
Frequency Domain Methods
January 20, 2010
T0283 - Computer Vision
10
Point Processing Methods
The most primitive, yet essential, image
processing operations.
Intensity transformations that convert an old
pixel into a new pixel based on some predefined
function
They operate on a pixel based solely on that
pixel’s value
Used primarily for contrast enhancement
January 20, 2010
T0283 - Computer Vision
11
Binary Images & Thresholding
Comparing an image I(m,n) with threshold T
Separate light object from dark background
If I[m,n]  T
I[m,n] = object = 1
else
I[m,n] = background = 0
Separate dark object from light background
January 20, 2010
If I[m,n]  T
I[m,n] = object = 1
else
I[m,n] = background = 0
T0283 - Computer Vision
12
January 20, 2010
T0283 - Computer Vision
13
Determining Threshold T
Fixed threshold – independently chosen
Histogram derived threshold – automatically
determined using histogram
January 20, 2010
T0283 - Computer Vision
14
Triangle algorithm
January 20, 2010
T0283 - Computer Vision
15
Contrast Stretching/Compression
Stretch gray-level ranges where we desire more information
January 20, 2010
T0283 - Computer Vision
16
Negative Transformations
January 20, 2010
T0283 - Computer Vision
17
Intensity-Level Slicing
Highlight a specific range of gray-level only
Thresholding
January 20, 2010
T0283 - Computer Vision
18
Non-Linear Transformations
We may use any function, provided that is gives a one-to-one
or many-to-one mapping
Logarithmic
January 20, 2010
Exponential
T0283 - Computer Vision
19
Histogram Equalization
Low contrast images usually mostly dark, mostly light, or mostly
gray
High contrast images have large regions of dark and large regions
of white (e.g. standing in front of a window on a sunny day)
Good contrast images exhibit a wide range of pixel values (i.e. no
single gray level dominates the image)
January 20, 2010
T0283 - Computer Vision
20
January 20, 2010
T0283 - Computer Vision
21
Histogram Equalization (cont’d)
Histogram equalization is a transformation that stretches
the contrast by redistributing the gray-level values
uniformly
January 20, 2010
T0283 - Computer Vision
22
Histogram Equalization (cont’d)
In practice, the histogram might not become totally flat !
January 20, 2010
T0283 - Computer Vision
23
Histogram Equalization Procedures
January 20, 2010
I
xI = I/7
(scaled)
nI
P(I)
(freq.)
Fx(xI)
(CDF)
J
Output
P(J)
(freq.)
0
0.000
8
0.125
0.125
0
0.125
1
0.143
0
0.0
0.125
0
0.0
2
0.286
0
0.0
0.125
0
0.0
3
0.429
0
0.0
0.125
0
0.0
4
0.571
31
0.484
0.609
4
0.484
5
0.714
16
0.250
0.859
6
0.250
6
0.857
8
0.125
0.984
7
0.141
7
1.000
1
0.016
1.000
7
-
T0283 - Computer Vision
24
Histogram Equalized Image
January 20, 2010
.609
.609
.609
.609
.609
.609
.609
0.125
.609
.859
.859
.859
.859
.859
.609
0.125
.609
.859
.984
.984
.984
.859
.609
0.125
.609
.859
.984
1.000
.984
.859
.609
0.125
.609
.859
.984
.984
.984
.859
.609
0.125
.609
.859
.859
.859
.859
.859
.609
0.125
.609
.609
.609
.609
.609
.609
.609
0.125
.609
.609
.609
.609
.609
.609
.609
0.125
T0283 - Computer Vision
25
After Scaling
J = int [7(Fx – 0.125)/0.875 + 0.5]
January 20, 2010
4
4
4
4
4
4
4
0
4
6
4
4
4
6
4
0
4
6
7
7
7
6
4
0
4
6
7
7
7
6
4
0
4
6
7
7
7
6
4
0
4
6
6
6
6
6
4
0
4
4
4
4
4
4
4
0
4
4
4
4
4
4
4
0
T0283 - Computer Vision
26
Histogram Equalization Procedures
for i=0 :maxgval
ihist(i+1) = sum(I(:)==i)/(rows*cols);
end
icdf(1)= ihist(1);
for i=2: 1: 256
icdf(i) = ihist(i) + icdf(i-1);
end
for i=1:1:rows
for j=1: 1: cols
k = I(i,j)+1;
ieq(i,j) = round(255*(icdf(k)-icdfmin)/(1.00-icdfmin)+0.5);
end
end
January 20, 2010
T0283 - Computer Vision
27
January 20, 2010
T0283 - Computer Vision
28
Histogram Equalization Procedures
(Improvement)
for i=0 : maxgval
ihist(i+1) = sum(I(:)==i);
end
icdf(1)= ihist(1);
for i=2: 1: 256
icdf(i) = ihist(i) + icdf(i-1);
end
ideal(:) = uint16((rows*cols)/256);
for i=2: 1: 256
ideal(i) = ideal(i) + ideal(i-1);
end
January 20, 2010
T0283 - Computer Vision
29
for i = 1:1:256
map(i) = i-1;
end
j=1; i=1;
while(j<256)
while(icdf(i) < ideal(j))
i=i+1;
map(i) = j;
end
j=j+1;
end
for i=1:1:rows
for j=1:1:cols
pxval = I(i,j)+1;
ieq(i,j) = map(pxval)-1;
end
end
January 20, 2010
T0283 - Computer Vision
30
January 20, 2010
T0283 - Computer Vision
31
Download