Topics Covered:
− Matlab orientation and refreshment
− Review of linear algebra and linear systems
− Image transformations
− Image enhancement in spatial and frequency domains
− Image restoration and segmentation
− Advanced topics in medical applications
You are encouraged to collaborate on homework
problems and labs with your classmates. However,
cheating of any kind, including copying of others’
work of any kind is prohibited, and will not be
tolerated All university,
tolerated.
university school,
school department rules
apply.
Image Processing Photoshop
Question: Any image processing function missing in Photoshop?
• Digital Image Processing Using MATLAB
by Gonzalez, Woods, and Eddins
• Mastering MATLAB
by Hanselman and Littlefield
• Digital Signal Processing
Chapter 2: Digital Image Fundamentals
• Numerical Analysis
• Mathematical Methods
• Basic statistics
Chapter 2
•
•
•
•
•
Human Visual System
Image sampling
Image interpolation
A
Averaging
i ffor noise
i reduction
d i
Linear and Shift Invariant Systems
Fovea: 1.5mm x 1.5mm
Density of cones: 150,000 /mm2
170 m
1
Optical Nerve and Visual Cortex
Function of Eyes: Optical Electrical
Optical Illusions
• How accurately can we estimate and compare distances and areas?
• By which features can we detect and distinguish objects?
Why do we need long optical nerves?
Adelson's checker shadow illusion
Square A is exactly the same
shade of grey as square B.
Link
When interpreted as a 3D scene,
our visual system immediately
estimates a lighting vector and
uses this to judge the property of
the material.
The Brain Sees What We Don't
The human visual system is extremely powerful in
recognizing objects, but is less well suited for
accurate measurements of gray values, distances,
and areas.
areas
Solution: Let computers do the math and
measurements.
http://www.michaelbach.de/ot/
The brain studying the brain
Image Sampling and Digitizing
A
B
C
Regular rectangular grid
Question: B and C are mathematically identical?
2
Other regular sampling grids
Signal Sampling in 1D
Regular rectangular grid is one of the sampling grids.
Triangular grid
Hexagonal grid
Irregular grids: require advanced math skills.
Example: Simulate cell growth.
Matrix Representation
j
i
FN N
•
•
•
f11
f
21
...
f i1
...
f N 1
f12
f 22
...
fi 2
...
fN2
...
...
...
...
...
...
f1 j
f2 j
...
f ij
...
f Nj
Each pixel has one value only.
Pixels are indexed by integers.
No area is associated with a pixel.
Neighborhood Relations
Indexing in 2D and 3D
...
...
...
...
...
...
f1N
f 2 N
...
f iN
...
f NN
Image processing convention: start from upper left corner
Spatial Resolution
Question:
FOV=10mx20m
4 and 8 neighbors
6, 18, 26 neighbors
what is the resolution?
Same FOV. a: 3 × 4, b: 12 × 16, c: 48 × 64, d: 192 × 256
When FOV is fixed, small matrix size low spatial
resolution.
3
Question: Spatial Resolution
Intensity Resolution: Quantization
Fovea: 1.5mm x 1.5mm
Density of cones: 150,000 /mm2
170 m
What is the spatial resolution in the
vertical direction of the tree?
Clearly state your assumptions.
From 256 gray levels to 2 gray levels.
In practice, intensity levels are sufficient for visualization in most situations.
Linear System and Shift Invariant System
X(n)
T
Y(n)
Linear Operator
T{X(n)} = Y(n)
Shift invariant: T{X(nn0)} = Y(nn0)
X1(n)
T
Y1(n)
T{X1(n)} = Y1(n)
X2(n)
T
Y2(n)
T{X2(n)} = Y2(n)
Linear: T{aX1(n) + bX2(n)} = aY1(n) + bY2(n)
Question: Are they shift invariant operators?
Square operator: Y(n) = T{X(n)} = X2(n)
Flip operator:
Y(n) = T{X(n)} = X(n)
Question: Are they linear operators?
Square operator: Y(n) = T{X(n)} = X2(n)
Shift operator: Y(n) = T{X(n)} = X(n) + c
Homework: summation operator is linear.
Satisfy both requirements: Linear Shift Invariant System (LSI)
Brightness, Contrast and SNR
Brightness, Contrast and SNR
•
Brightness Intensity.
•
Contrast Dynamic range
Brightness Intensity.
Contrast Dynamic range
SNR Signal to noise ratio
The definitions of contrast and SNR may be
different in different areas.
•
SNR Signal to noise ratio
SNR in MRI and other medical imaging modalities:
Question:
High brightness but low contrast, examples?
SNR
avg ( signal )
std (background )
Question: which part is the background?
4
Signal Averaging
Signal Averaging
g ( x , y ) f ( x, y ) n ( x , y )
• One of the most widely used technique in medical
imaging, especially in MRI.
By averaging N noisy images, the averaged image will be
g ( x, y )
• Result: improve signal to noise ratio (noise reduction)
The expectation value of g ( x, y )
g ( x, y ) f ( x, y )
• Question: Averaging changes numerator(signal),
denominator(noise), or both?
SNR
1 N
g i ( x, y )
N i 1
Variance and standard deviation of signal and noise will be
1 2
σ noise
N
1
σ noise
N
σ 2signal
avg ( signal )
std (background )
σ signal
Signal Averaging
Image interpolation
• Requirements:
– Uncorrelated and zero mean noise
– Registered images
52
39
• Questions:
16
– Signal averaging leads to higher contrast?
– Signal averaging leads to higher SNR?
– Can you estimate the SNR improvement after averaging 100
noisy images?
39
16
28 27
10
14
What is the intensity at k=1.2?
• What is the original signal or image?
• Can we reliably reconstruct the original image/object
back from the sampled data we have?
14
What is the intensity at k=1.2?
Inverse Problem
52
28 27
10
Image Interpolation
• Interpolation is model based.
• Optimized interpolation exists.
• Commonly used interpolation methods:
–
–
–
–
N
Nearest
t neighbor
i hb
Linear, bilinear, trilinear
Cubic, bicubic, tricublic
Spline, many variations
5
Order of continuous
Spatial Resolution and Sampling Rate
Nearest
neighbor
Given resolution Sampling rate
Given sampling rate resolution
To fully recover the required
details Nyquist criteria
Linear
Question: The lamp pole in C is
larger than the pole in D. Why?
The lamp pole in c and d: partial
pixel or partial volume effect
Cubic
Low sampling rate Less details
Sampling vs Interpolation
• Sampling means that all information is lost except at the
grid points. (continuous discrete)
• Interpolation is to fill the gap between discrete grids.
(discrete continuous)
Read DIP Chapter 2
• Basic Relationships between Pixels and Distance
Measures
• Arithmetic Operation
• Set and Logical Operations
Affine Transformation
Geometric Transformation
• Spatial transformation of coordinates
• Intensity interpolation
• Affine Transformation
–
–
–
–
Translation
Rotation
Scaling
Sheering
Translate
Rotate
Scale
Sheer
Rigid Body
6
Affine Transformation in 3D
Affine Transformation
x1 a11
y a
2 21
Translation
Rotation
Scaling
Sheering
Translate
a12 x t1
a22 y t2
x1 1 0 x t1 x t1
y 0 1 y t y t
2
2
2
x1 cos(θ) sin(θ) x 0
y sin(θ) cos(θ) y 0
2
Rotate
Rigid Body
Affine Transformation
x1 a11 a12 x t1
y a
2 21 a22 y t 2
Translate
Rotate
Affine Transformation
x1 a11
y a
2 21
a12 x t1
a22 y t2
Sheer
x1 1
y s
2 y
sX x x sX y
1 y y s y x
Scale
x1 s X
y 0
2
0 x s X x
s y y s y y
Scaling
x1 1 0 x t1 x t1
y 2 0 1 y t 2 y t 2
x1 cos(θ) sin(θ) x 0
y sin(θ) cos(θ) y 0
2
Question: How to implement scaling: x ax, y by?
Better Way: Homogeneous Coordinates
x1 a11
y a
1 21
1 0
a12
a22
0
What’s the difference?
x1 a11 a12
y a
1 21 a22
1 0
0
t1 x
t 2 y
1 1
Question: Write down the transformation of
translation, rotation, scaling and sheering.
x1
y1 1 x
t1 x
t 2 y
1 1
a11
y 1a21
t1
a12
a22
t2
0
0
1
7
Advantages of Homogeneous Coordinates
• What are the advantages of the 3x3 transformation
matrix?
– Concatenating
C
t
ti a sequence off operations
ti
– Reducing image blurring
Question: Why concatenation can reduce image blurring?
Implementation
3D Affine Transformation
x1 a11 a12 a13 t1 x
y1 a 21 a 22 a 23 t 2 y
z1 a31 a32 a33 t 3 z
0
0
1 1
1 0
High Dimensional Affine Transformation?
Implementation
Inverse mapping
F
Forward
d mapping
i
Question: Which mapping is better? Why?
1. Forward mapping could lead holes and overlaps in
the output image
2. Inverse mapping is more efficient to implement than
forward mapping.
Nearest Neighbor
Linear
Cubic
Affine Transformation for Registration
1. Implementation issues: matrix size
and interpolation
2. How to determine the transformation
matrix?
•
•
Marker
Cost functions
• Cross Correlation
• Mutual Information
• ……
Intensity Transformation
Gray level mapping
8
Intensity Transformation
Lookup Table
Input
0
1
2
…
180
…
255
Intensity Transformation
255
Output
0
1
1
…
221
…
255
Transformation
function T(r)
L = 256
0
255
Image Negative
Log Transformation
L1
Purpose: Output image may
be better suitable for
visualization
s = L1 r
0
Purpose: Spreading/compressing
a narrow range of the low
intensity values in the input image
into a wider range of intensities
– s =c*log(1+ r)
– c is a constant
L1
Power Law Transformation
s c(r ε)γ
Purpose: the same as the log
transformation
Advantages:
• More flexible in comparison to log
transformation
• Varying one parameter is enough to
yield a change in the image
• Varying gamma can get a family of
transformation curves
s c(r ε)γ
c = 1,
γ = 1, 3, 4
Criteria: Subjective or Objective?
9
Which gray mapping method?
255
0
threshold
255
0
255
negative
• Purpose: increase the dynamic range of intensities in the
image
• Determine 2 points (r1,s1) and (r2,s2) which band the
transformation line
r1, r2 relate to the input image
s1, s2 relate to the output image
Result is 3 sections each with a different linear
transformation
255
255
255
PiecewiseLinear Transformation Functions
0
log
255
0
255
γ=2
PiecewiseLinear Transformation Functions
Looks better after transformation?
Application: Contrast Stretching
Disadvantage: requires considerably more user input.
Bit Plane Slicing
Bit Planes
Original
Least significant bit plane
Most significant bit plane
For pattern recognition, the most significant bit plane is enough
10
Recon from bit planes 78
bit planes 68
bit planes 58
Most medical images are saved in 16 bit integer, unsigned
Bit Planes (18)
Bit Planes (916)
Steganography
Original image in uint16
Recon image from bit plane 8 to 14
In most hospitals and universities, the first choice is ‘keep everything’.
Removing all but the two least significant bits of each color component
produces an almost completely black image. Making that image 85 times
brighter produces the image on the right side.
http://en.wikipedia.org/wiki/Steganography
11
Histogram
Histogram Processing
• Histograms are the basis for numerous spatial domain
processing techniques
• Simple to calculate
calculate, easy to implement
Histogram
• What is a histogram?
– A discrete function h(rk) = nk where rk is the kth intensity value
and nk is the number of pixels in the image with intensity rk.
• Normalized histogram
– p(rk) = nk/(total pixels), k = 0,1,2,…,L1
– p(rk) ~ the probability of occurrence of intensity level rk in an
image.
– sum(p(rk)) = 1
Normalized Histogram
• Assuming that we are using a normalized histogram
– s=T(r) and that 0<= r <=1
– s is the output grey scale for every pixel with value r in input
image
• • Assume that the transformation satisfies
– a) T(r) is a single valued and monotonically increasing in the
interval 0<=r<=1
1
– b) 0<=T(r) <=1 for 0<=r<=1
Transform
ation
function
T(r)
• The inverse function is r =T1(s)
• 0<=s<=1
0
• Let pr(r) and ps(s) denote the Probability Density Function (PDF) of
the random variables r and s respectively.
• Given pr(r) and T(r), if T(r) is continuous and differentiable, the PDF
of the transformed variable s
ddr
p s ( s ) pr ( r )
ds
• The PDF of the transformed variable, s, is determined by the PDF of
the input image and on the transformation function
1
• Most widely used: a cumulative distribution function as the
transformation function
r
s T (r ) ( L 1) pr (t )dt
0
• The function satisfies conditions a) and b)
• monotonically increasing
• range of [0, 1] (scaled to (L1))
• Most widely used: a cumulative distribution function as the
transformation function
12
p s ( s ) pr ( r )
dr
ds
Histogram Equalization
r
s T (r ) ( L 1) pr (t )dt
0
ds dT (r )
d r
( L 1) pr (t )dt ( L 1) pr (r )
d
dr
d
dr
d 0
dr
p s ( s ) pr ( r )
Histogram
Equalization
1
1
dr
pr ( r )
ds
( L 1) pr (r ) L 1
Histogram of the input image
Histogram of the output image
• The resulting ps(s) always is uniform, independently of the form
of pr(r).
Histogram Equalization Implementation
Histogram Equalization
k
sk T ( rk ) ( L 1) pr ( ri )
i 0
L 1 k
ni
MN i 0
k 0,1,2,..., L 1
Input histogram
Qualitative
Dark image
Input images
Quantitative
Histogram
Equalized
Output histogram
Histogram
Dark image
Light image
Light image
Low contrast
Low contrast
High contrast
Transformation function
High contrast
13
The original image before histogram equalization
http://en.wikipedia.org/wiki/Histogram_equalization
Same image after histogram equalization
http://en.wikipedia.org/wiki/Histogram_equalization
Histogram Specification
• Histogram Specification
• Local Histogram Processing
• Sometimes, histogram equalization is not the best
approach
• Fundamentals of Spatial Filtering
• Order Statistic Filter
• Generate a processed image with a specified histogram
Histogram Specification
• pr(r): Input image’s PDF
• pz(z): specified or desired PDF for output
r
s T (r ) pr (t )dt
0
Define:
Histogram Specification
• Procedure
– Calculate T(r)  input histogram
– Calculate G(z) – desired histogram
– Obtain
Ob i G11  transformation
f
i ffunction
i
z
G ( z ) p z (t )dt s
0
G ( z ) T (r )
z G 1 ( s) G 1[T (r )]
Input T(r) G1 output
Problem: No analytical expression for T(r) and G1 in
most cases.
14
Histogram Specification
• Discrete formulation
• Requirement:
pz(zi) != 0
k
sk T (rk ) pr (ri )
• Why?
i 0
k
vk G ( z k ) p z ( z i ) s k
i 0
zk G 1[T (rk )] G 1 ( sk )
• How to implement
sk zk?
Local Histogram Processing
• Define a mask and move the center from pixel to pixel
for each neighborhood. (sliced window)
• Calculate histogram equalization/specification function
• Map the intensity of pixel centered in neighborhood
• Can use new pixel values and previous histogram to
calculate next histogram (implementation details)
original
equalized
specified
Note: Histogram specification is easier for discrete case, but the
histogram of an output image is the approximation for desired
histogram.
Example of Local Histogram Equalization
Fundamentals of Spatial Filtering
• Spatial
p
filtering
g basically
y consists of
– A neighborhood or a kernel
– A predefined operation
original
global
local
• The value of the kernel center is the
result of the filtering operation
15
Spatial Filtering Kernel
• Operate on a neighborhood with an odd kernel size. E.g.
3x3, 5x5, etc.
g ( x , y ) w ( 1, 1) f ( x 1, y 1) w ( 1,0 ) f ( x 1, y ) ...
w ( 0,0 ) f ( x , y ) ... w (1,1) f ( x 1, y1)
Simplified Notation
General Linear Filter
g ( x , y ) w ( 1, 1) f ( x 1, y 1) w ( 1,0 ) f ( x 1, y ) ...
R w1 z1 w2 z 2 ... wmn z mn
w ( 0,0 ) f ( x , y ) ... w (1,1) f ( x 1, y1)
• We proved that the weighted summation is a
linear operation
• One to one correspondence between linear
spatial filters and filters in the frequency domain
R w1 z1 w 2 z 2 ... w9 z 9
wT z
Nonlinear spatial filter
Order Statistic Filter:
• Median Filter
• Max, Min Filter
• Percentage Filter
Median Filter
• Purpose: remove salt and pepper noise
• Operation: replace the centre pixel with the
neighborhood median
• A nonlinear filter
filter, based on the ranking of pixels in a
kernel
8
2
8 2 5 5 4 6 7 8 9
5
5
4
6
7
8
9
Sort
2 4 5 5 6 7 8 8 9
16
Other Percentage Filters
• Use ranking to find image properties
• For 3x3 kernel,
• Max Filter (100%)  finds the bright spots in the image
– R = max(z
( k  k=1,…,9)
k 1
9)
• Min Filter (0%)  finds the darkest spots in the image
Averaging Filter
• Purpose: remove high frequencies from the image
(smoothing or blurring)
• Operation: Assign the average value of a kernel to the
center of a neighborhood
• The size of kernel controls the smoothing effect
– R = min(zk  k=1,…,9)
• Predefined percentage
8
2
5
5
4
6
7
8
9
Averaging vs. Median Filter
XRay image
3x3 averaging filter
8 2 5 5 4 6 7 8 9
Average: 6
Difference between median and average?
Weighted Average
1
3x3 median filter
? ×
It seems that the averaging is quite close to the
median. Why the output images are so different?
Gaussian Kernel
1
1
1
1
Weighted Averaging Equation
1
g ( x, y )
1
w(s, t ) f ( x s, y t )
s 1t 1
1
1
w(s, t )
s 1t 1
You can design your own filters by modifying the weights.
17
Kernel Size
1x1
3x3
9x9
5x5
Image from Hubble
Space Telescope
35 x 35
15 x 15
•
•
15 x 15 averaging
kernel
Thresholding
Get a gross representation of objects
Detect large objects
Image Sharpening
• Operators for sharpening: derivative operator which is
proportional to the degree of intensity discontinuity.
Image Sharpening
• Image differentiation enhances edges and other
discontinuities
• How to compute the differentiation?
– Numerical Computing or Scientific Computing
• Finite difference
Finite Difference
Finite Difference
How to compute
Finite difference approximates an operator
(e.g., the derivative) and solves a problem on a
points ((the g
grid))
set of p
FD: convergence, accuracy, speed, etc.
x1
x
x+1
f
x
?
f
f ( x 1) f ( x) =
x
f
f ( x) f ( x 1) =
Backward difference:
x
f
1
1
Central difference:
f (x ) f (x ) =
x
2
2
F
Forward
d diff
difference:

18
Accuracy
Finite Difference
32
Using Taylor’s Theorem to estimate the approximation
errors:
38
56
Question: Calculate the finite difference
x1
x
x+1
f
f ( x 1) f ( x) =
x
f
f ( x) f ( x 1) =
Backward difference:
x
f
1
1
Central difference:
f (x ) f (x ) =
x
2
2
• Forward difference O(h)
• Backward difference O(h)
• Central difference O(h2)
f
x
F
Forward
d diff
difference:

Finite Difference
32
38
56
How to compute
x1
x
x+1
Central difference:
2 f
x 2
?
Distance
Velocity
Acceleration
2 f
f ( x 1) f ( x 1) 2 f ( x)
x 2
=
 2x
+
Use the central difference formula for the first derivative and apply a
central difference formula for the derivative of f' at x.
Question: Derive the formula and calculate
2 f
x 2
Observations
Firstorder derivative
• Horizontal segments zero
• Onset of step or ramp nonzero
• Ramp
R
with
i h constant slope
l
nonzero
Secondorder derivative
• Horizontal segments zero
• Onset of step or ramp nonzero
• Ramp with constant slope zero
Laplacian Filter
• Rosnefeld and Kak (1982) introduced Laplacian filter to
image processing
• Second derivative operator
• Isotropic
p operator:
p
spatial
p
invariant
2 f
y1
2 f 2 f
x 2 y 2
2 f
f ( x 1) f ( x 1) 2 f ( x )
x 2
y
y+1
x1
x
x+1
2 f
f ( y 1) f ( y 1) 2 f ( y )
y 2
19
Laplacian Filter
y1
y
y
y+1
y+1
x1
x
x+1
x1
f f
f ( x 1, y ) f ( x 1, y )
x 2
y 2
f ( x , y 1) f ( x , y 1) 4 f ( x , y )
2 f
Laplacian Filter
y1
2
2
• This Laplacian filter implementation is isotropic
in the x or y direction (90 degree isotropic)
Laplacian Filter
x
x+1
2 f 2 f
f ( x 1, y 1) f ( x 1, y 1)
x 2
y 2
f ( x 1, y 1) f ( x 1, y 1) 4 f ( x , y )
2 f
Add the effect of the diagonals to the filters to
make it 45 degree isotropic
Laplacian Filter: Image Sharpening
Sharpened Image = Original + Laplacian image
Isotropic results
for increments of
90 degrees
Isotropic results
for increments of
45 degrees
f ( x , y ) 2 f ( x , y ) if Laplacian kernel center < 0
g ( x, y )
2
f ( x , y ) f ( x , y ) if Laplacian kernel center > 0
Alternatives:
Note: same operation as image smoothing
Unsharp Masking
• Widely used in printing and publishing industries for
image sharpening
Laplacian without
scaling
Laplacian with
scaling (Set min
scaling.
to zero to raise all
values above
zero).
Use D4 sharpen
kernel
Use D8 sharpen
kernel with
additional
differentiation in
the diagonal
directions.
• Method:
– Blur the original image
– Subtract the blurred image from the original. The result
difference image called the mask
– Add the mask to the original image
20
Unsharp Masking
Highboost Filtering
g mask ( x , y ) f ( x , y ) f ( x , y )
g ( x, y ) f ( x, y ) k g mask ( x, y )
Original
Gaussian blurred
For weighting factor k,
k = 1,
k >1,
unsharp masking
highboost filtering
Mask
Unsharp mask, k=1
Highboost filtering, k>1
Point Detection
Point and Line Detection
Point Detection
y1
y
• Detect isolated points in an image
• Method:
• A point,
point at (x,y),
(x y) is detected if R>T
• T is a threshold
• R is the filter (R=w1z1+w2z2+…+w9z9)
Point Detection
2 f 2 f
f ( x 1, y ) f ( x 1, y )
x 2 y 2
f ( x, y 1) f ( x, y 1) 4 f ( x, y )
2 f
y+1
x1
x
x+1
• Compute the Laplacian image
• Convolve with the image
• Threshold the image
21
Line Detection
Line Detection
What are the problems of using
the absolute value of Laplacian?
• Similar to point detection
• Sharpen an image
• Threshold the image to get lines
What is the limitation of the
p
in edge
g detection?
Laplacian
•
•
Double the width of lines
Laplacian can detect thin
lines only.
Can Laplacian detect thicker
lines by increasing the kernel
size?
Line Detection
Apply +45
degree line
detector mask
• Detect lines in specified directions
threshold
Keep >0 values
Gradient Filter – 1st Order Derivatives
What is the gradient?
Gradient Filter
• In 2D, The gradient of f at (x,y) is a two dimensional
vector
Gradient = 0.6
In 1D, gradient = slope
C
A
Gradient in 1D
B
grad ( f ) f ( x ) g x
f
x
ff
gx
grad ( f ) f ( x , y ) fx
g y
y
Question: from ABC.
Gradient (AB) = 0.8,
Gradient (BC) ??
22
The magnitude of the gradient:
mag ( f ( x , y ))
g 2x g 2y
The magnitude of the gradient:
mag ( f ( x , y ))
g 2x g 2y
The gradient is NOT isotropic, but the gradient magnitude is.
The gradient is NOT isotropic, but the gradient magnitude is.
Approximation:
Approximation:
mag ( f ( x , y )) g x g y
Pros and cons of the approximation?
mag ( f ( x , y )) g x g y
Pros and cons of the approximation?
Fast computing, but lost isotropic property (only for 90° rotation)
Gradient Filtering
Robert proposed a way to
compute the gradient with cross
differences:
g x z9 z5
g y z8 z 6
f [( z 9 z 5 ) 2 ( z 8 z 6 ) 2 ]1 / 2
f z9 z 5 z8 z 6
Gradient Filtering
Prewitt Operator
g x ( z 7 z 8 z 9 ) ( z1 z 2 z 3 )
g y ( z 3 z 6 z 9 ) ( z1 z 4 z 7 )
f ( z 7 z 8 z 9 ) ( z1 z 2 z 3 )
( z 3 z 6 z 9 ) ( z1 z 4 z 7 )
Problems: 2 x 2 op matrix is awkward to implement
Gradient Filtering
Sensitivity to Noise
Sobel Operator
g x ( z 7 2 z 8 z 9 ) ( z1 2 z 2 z 3 )
g y ( z 3 2 z 6 z 9 ) ( z1 2 z 4 z 7 )
f ( z 7 2 z 8 z 9 ) ( z1 2 z 2 z 3 )
•The
Th 1st
1 t and
d2
2nd
dd
derivative
i ti
are sensitive to noise
•Use smoothing to keep the
main changes
( z 3 2 z 6 z 9 ) ( z1 2 z 4 z 7 )
Sobel has better noise suppression characteristics
23
Sensitivity to Noise
• The 1st and 2nd derivative are sensitive to noise
• Use a blurring filter to eliminate details and thus
• only keep the main changes
Sum of coefficients
is 0. Why?
Roberts
R
b t C
Cross
Gradient Operator
In an area of
constant intensity,
the response
should be 0.
Sobel Operator
• Sobel operator is widely used in edge detection.
Contact lens
Tree leaves
Masks for detecting horizontal and vertical edges
Sobel gx
Sobel gy
Sobel gx+gy
Masks for detecting diagonal edges
24
Smoothed
with 5x5
averaging
filter
Sobel gx
Sobel gx+g
gy
S b l gy
Sobel
Image
Sobel gradient image
Sobel
diagonal
operators
Sobel x gradient image
Sobel ygradient image
Combining Spatial Enhancement Methods
Advance Techniques for Edge Detection
=
+
• MarrHildreth edge detector
• Canny edge detector
Laplacian
5x5 average
smoothing
Sobel
Mask
Geometric, Intensity Transformation and
spatial Filtering
Mask
• Affine transformation
– Geometric modification
– Operations:
O
ti
translation,
t
l ti
rotation,
t ti
scaling
li and
d
shearing
– Techniques: operation multiplication,
interpolation
+
Original
Gamma
25
Geometric, Intensity Transformation and
spatial Filtering
Geometric, Intensity Transformation and
spatial Filtering
• Intensity transformation
– Gray level mapping
– Operations: transformation function. Pixel by
pixel.
i l
– Techniques: image negatives, threshold, log
transformation, gamma transformation,
piecewiselinear transformation
– Histogram processing: histogram equalization
and specification, local histogram processing
• Spatial filtering
– A neighborhood or a kernel. (Kernel level)
– A predefined operation
– Operations:
• Smoothing: averaging, median
• Sharpening: Laplacian, Highboost, gradient
• Edge detection: Laplacian, gradient
– Techniques
• Sliding window
• Finite difference
26