Documente Academic
Documente Profesional
Documente Cultură
Points
Lines
Edges
DIFFERENTIATION
or DISCONTINUITY
Image differentiation enhances edges
f
f ( x 1) f ( x ) ; x is discrete
x
Gray level
Position
Properties::
Taylor series:
f h f 2 2
f ( x h) f ( x ) h ....
x 2! x 2
Again,
f h f 2 2
f ( x h) f ( x ) h ....
x 2! x 2
Add the two, for a discrete image, h=1
f
2
f ( x 1) f ( x 1) 2 f ( x )
x 2
2 f
f ( x 1, y ) f ( x 1, y ) 2 f ( x , y )
x 2
2 f
f ( x , y 1) f ( x , y 1) 2 f ( x , y )
y 2
2
f 2
f
f
2
2
x 2
y
f ( x 1, y ) f ( x 1, y ) f ( x , y 1) f ( x , y 1) 4 f ( x , y )
g w( s, t ) f ( x s, y t )
0 1 0
w =
1 -4 1
0 1 0
The Laplacian derivative is used to highlight
featureless background.
The image can be sharpen by adding or
Laplacian, i.e.,
g( x , y ) f ( x , y ) 2 f ( x , y )
f ( x , y ) f ( x 1, y ) f ( x 1, y ) .... 4 f ( x , y )
5 f ( x , y ) f ( x 1, y ) .....
0 -1 0
w =
-1 5 -1
0 -1 0
Composite mask
Unsharp masking and high-boost filtering
f E ( x , y ) f ( x , y ) f ( x, y )
fE(x,y) = edges
high-boost filtering
f hb ( x, y) Af ( x, y) f ( x, y)
where A 2
f hb ( x, y) ( A 2) f ( x, y) 2 f ( x, y) f ( x, y)
f hb ( x , y ) ( A 2) f ( x , y ) f s ( x , y )
Recall: f s ( x, y) f ( x, y) f ( x, y)
2
or
f hb ( x , y ) ( A 1) f ( x , y ) 2 f ( x , y ) Central coefficient is“+”
Composite mask
0 -1 0
w =
-1 (A- -1
1)+4
0 -1 0
A=1
A=2.0 A=2.7
9
R g( x , y ) wi zi
i 1
Point Detection
• T: nonnegative threshold: | R | T
9
R w1 z1 w2 z2 ... w9 z9 wi zi
i 1
• A point has been detected at the location
on which the mask is centered if: |R|>T
Response R1 R2 R3 R4
Edge Detection
Either:
Positive peak
Negative peak
Or:
Zero crossing
Effect of noise on
edge detection!!!!!
To suppress the effect of noise, the Laplacian is combined
with smoothing function as a precursor to find edges
via zero cross linking.
r2
Consider the Gaussian function h( r ) e 2 2
r2
r 2
2 2
2
h(r )
2
e 2
4
f
G x x
f
G y f
y
mag(f ) G 2
x G 2
y
1/ 2
Gy
( x , y ) tan
1
Gx
In vector analysis, the gradient points in the direction
of maximum rate of change of f at coordinates (x,y)
Laplacian
2
f 2
f
f
2
2
x 2
y
0 1 0 1 1 1
1 -4 1 1 -8 1
0 1 0 1 1 1
Laplacian is generally not used in its original form
for edge detection for several reasons::
g( x ) f ( x ) * h( x ) f (u)h( x u)du
Discrete
M 1 N 1
1
g( x , y ) f ( x , y ) * h( x , y )
MN
f (m, n)h( x m, y n)
m 0 n 0
f(x)
h(x)
x
x
h(x-u) g(x)
f(u)
g(u)
u x
How to represent an image as a SET????
Grayscale image
x1 , y1 , f1 , x2 , y2 , f 2 ,....., xn , yn , f n
The edges break due to
• Real life:
– The detected set of pixels very rarely
describes a complete edge due to effects
from: noise, breaks in the edge due to non-
uniform illumination.
Edge Linking &
Boundary Detection
• Solution:
• Criteria used/Properties:
• In other words:
1. f mag (F ) G 2
x G y
2 1/ 2
or f | Gx | | G y |
f ( x, y) f ( x, y) T
Gx
(x’,y’) and (x,y) are similar if:
( x, y) ( x, y) A
where A is an angle threshold.
Local Processing
Global Processing via
the Hough Transform
• Points are linked by determining whether
they lie on a curve of specified shape.
• Problem:
– But: b = -xia + yi
equation of single line on ab
plane
Accumulator cell
• Since a,b approach infinity as a line
approaches the vertical, we can use the
normal representation of a line:
y
x cos y sin
Summary
We need a 3D accumulator!!!!!!!
Global processing via Hough transformation
(xi,yi)
Global Processing via
Graph-Theoretic Techniques
• A global approach for edge detection
and linking based on representing edge
segments in the form of a graph and
searching the graph for low-cost paths
that corresponds to significant edges.
Global Processing via
Graph-Theoretic Techniques
• Edge element:
– The boundary between two pixels p & q such
that p and q are 4-neighbors.
• Edge:
– A sequence of connected edge elements.
Global Processing via
Graph-Theoretic Techniques
c( p, q) H [ f ( p) f (q)]
H: the highest intensity value in the image
Global Processing via
Graph-Theoretic Techniques
• Minimum cost path:
Image Segmentation
Image Segmentation
Image Segmentation
Thresholding can be viewed upon as function
of (x,y,p(x,y),f(x,y))
T T x, y, p( x, y ), f ( x, y )
If T depends on
1. f(x,y), the threshold is global
2.f(x,y) and p(x,y), it is local
3.(x,y), it is dynamic or adaptive
Basic global thresholding
Role of illumination in thresholding
Generally we know f ( x, y) i ( x, y)r ( x, y)
f ( x, y) r ( x, y)
h( x , y )
g( x , y ) k
Basic Adaptive Thresholding
The following algorithm can be used to compute T
automatically
A
Use of boundary characteristics for
histogram improvement and local
thresholding
Local Thresholding
A
A
Segmentation based on single and
double derivatives
f mag(F ) G x2 G y2
1/ 2
or f | G x | | G y |
2
f 2
f
f
2
2
x 2
y
s( x , y ) 0 if f T
if f T and 2 f 0
if f T and f 0 2
Region based segmentation
Basic formulation::
If R represent the entire image, we may view the segmentation process
that partition R into n sub-regions R1, R2, R3… Rn such that
n
1. Ri R
i 1
d ij ( x , y ) 1 if f ( x , y , t i ) f ( x , y , t j ) T
0 otherwise
DI
Problem with deciding the value of T, as the
illumination may vary from one frame to the other
f ij ( x , y ) f ( x , y , t j ) f ( x , y , t i )
a=imread('one.jpg');
%a is my reference image
b=imread('two.jpg');
%want to bring the illumination of b same as a
[bw,ax,ay]=roipoly(a);
clear bw;
[bw,bx,by]=roipoly(b);
clear bw;
a=double(a);b=double(b);
a=a*(255/max(max(a)));
ax=uint8(ax);ay=uint8(ay);bx=uint8(bx);by=uint8(by);
delf=b(bx(1,1),by(1,1))-a(ax(1,1),ay(1,1));
sign1=sign(delf);
tol=1.0;
counter=0;
while delf>tol
if sign1==1
fj=(b-delf)*(255/max(max(b-delf)));
else
fj=(b+delf)*(255/max(max(b+delf)));
end
b=fj;
delf=b(bx(1,1),by(1,1))-a(ax(1,1),ay(1,1));
counter=1+counter;
end
imtool(uint8(b));
imtool(uint8(a));
Accumulative difference image (ADI)