Lesson4 PDF
Lesson4 PDF
Lesson4 PDF
n Duration: 3 hr
n Outline:
1. Introduction to Matlab
2. Fundamentals
3. Spatial domain processing
4. Frequency domain processing
Preprocessing
n Duration: 3 hr
n Outline:
1. Introduction to Matlab
2. Fundamentals
3. Spatial domain processing
4. Frequency domain processing
Matlab working environment
§ Matlab desktop:
Ø command window
Ø workspace
Ø command history window
Ø current directory window
Ø figure window
Ø editor window
Matlab working environment (cont)
Command window
workspace
Matlab working environment (cont)
Figure window
Matlab working environment (cont)
History command
window
Matlab working environment (cont)
Editor window
Basic commands and formatting
Basic commands and formatting (cont)
Basic commands and formatting (cont)
Conditional statements and loops
§ Conditional statements
Conditional statements and loops (cont)
§ Loops
Preprocessing
n Duration: 3 hr
n Outline:
1. Introduction to Matlab
2. Fundamentals
3. Spatial domain processing
4. Frequency domain processing
Digital image representation
origin y
x
Digital image representation
§ Binary: 0 and 1
origin
⎡ f (1,1) f =
f (1,2) ... f (1, N ) ⎤⎥
⎢
⎢ f (2,1) f (2,2) ... f (2, N ) ⎥
f =⎢ ⎥
⎢ ... ⎥
⎢⎣ f (M ,1) f (M ,2) ... f (M , N ) ⎥⎦
Working with images (1/2)
§ Reading an image
>> imread(‘filename’);
e.g.
Working with images (2/2)
§ Displaying an image
>> figure, imshow(im);
n Duration: 3 hr
n Outline:
1. Introduction to Matlab
2. Fundamentals
3. Spatial domain processing
4. Frequency domain processing
Spatial domain processing
§ Histogram processing
§ Spatial filtering
Expression of spatial domain processing
g(x,y) = T[f(x,y)]
output input
operator: defined
over a specified
neighborhood
about point (x,y)
Image f(x,y)
Intensity transformation
§ Negative
§ Contrast stretching
§ Log transformation
§ Power-law transforms
Arithmetic operations: addition, subtraction
Addition
Subtraction
Arithmetic operations: multiplication,
division
Multiplication
Division
Negative
Example of leaf segmentation
Negative
§ It is normally
controlled by a
piecewise linear
transformation
§ Thresholding:
r1 = r2, s1 = 0, s2
= L-1.
§ Plots of the
equation s = c.rγ, for
various values of γ
(c = 1 in all cases)
Power-law transformation
Original γ=3
image c=1
γ=4 γ=5
c=1 c=1
Spatial domain processing
§ Histogram processing
§ Spatial filtering
Image histogram
image
histograms
Bright image
Low-contrast image
High-contrast image
Histogram equalization
Histogram equalization
Contrast stretching
Histogram equalization
Spatial domain processing
§ Histogram processing
§ Spatial filtering
Some typical lowpass filters
An example of image after lowpass filtering
n2
h= n1
Median filtering
§ Note: if the result is over the range [0, L-1], need to scale
and level-shift to remain in [0, L-1]
High-boost filters
§
é- 1 - 1 - 1ù é- 1 - 1 - 1ù é0 0 0ù
1ê ú 1ê
with A ³ 1, -1 9A -1 -1 = -1 8 - 1 ú + ê0 A -1 0ú
9 ê ú 9ê ú ê ú
êë- 1 - 1 - 1úû êë- 1 - 1 - 1úû êë0 0 0 úû
A = 1.15 A = 1.2
Image after high-boost filtering
Preprocessing
n Duration: 3 hr
n Outline:
1. Introduction to Matlab
2. Fundamentals
3. Spatial domain processing
4. Frequency domain processing
Discrete Fourier Transform (DFT)
DFT in image processing
Smoothing an image by low-pass filter
§ imshow
§ imfilter
§ conv2
§ medfilt2
§ imnoise
§ fspecial
§ dftfilt
§ freqz
§ hist