Post on 03-Jan-2016
transcript
• What are edges in an image?
• Edge Detection
• Edge Detection Methods
• Edge Operators
• Matlab Program
Edges are those places in an image that correspond to object boundaries.
Edges are pixels where image brightness changes abruptly.
Edges are used frequently for segmenting images based on local changes in intencity
Spatial Coordinates
Brightness
Edge information in an image is found by looking at the relationship a pixel has with its neighborhoods.
If a pixel’s gray-level value is similar to those around it, there is probably not an edge at that point.
If a pixel’s has neighbors with widely varying gray levels, it may present an edge point.
Change is measured by derivative in 1DBiggest change, derivative has maximum magnitudeOr 2nd derivative is zero.
Calculus describes changes of continuous functions using derivatives; an image function depends on two variables - partial derivatives. A change of the image function can be described by a gradient that points in the direction of the largest growth of the image function.An edge is a property attached to an individual pixel and is calculated from the image function behavior in a neighborhood of the pixel.
Edge detectors •locate sharp changes in the intensity function •edges are pixels where brightness changes abruptly.
•The gradient direction gives the direction of maximal growth of the function, e.g., from black (f(i,j)=0) to white (f(i,j)=255).
•This is illustrated below; closed lines are lines of the same brightness. •Boundary and its parts (edges) are perpendicular to the direction of the gradient.
Image gradient• The gradient of an image:
• The gradient points in the direction of most rapid change in intensity
The gradient direction is given by:
• how does this relate to the direction of the edge?
The edge strength is given by the gradient magnitude
Tentukanlah besarnya gradien dan arah gradien tiap titik pada citra
berikut ini!
1 1 1 1 1 0
2 2 0 0 0 0
2 2 0 0 0 0
2 2 2 1 0 0
1 1 1 1 0 0
1 1 1 0 0 0
1 1 1 1 0 0
1 1 1 1 1 1
How can we differentiate a digital image f[x,y]?Option 1: reconstruct a continuous image, then take
gradientOption 2: take discrete derivative (finite difference)
How would you implement this as a cross-correlation?
Better approximations of the derivatives existThe Sobel operators below are very commonly
used
-1 0 1
-2 0 2
-1 0 1
1 2 1
0 0 0
-1 -2 -1
• The standard defn. of the Sobel operator omits the 1/8 term– doesn’t make a difference for edge detection
– the 1/8 term is needed to get the right gradient value, however
Mark edge point onlyNo information about edge orientationWork best with binary imagesPrimary disadvantage:
High sensitivity to noiseFew pixels are used to approximate the
gradient
First form of Roberts Operator
Second form of Roberts Operator
22 ),1()1,()1,1(),( crIcrIcrIcrI
|),1()1,(||)1,1(),(| crIcrIcrIcrI
10
011h
01
102h
Looks for edges in both horizontal and vertical directions, then combine the information into a single metric.
Edge Magnitude = Edge Direction =
111
000
111
y
101
101
101
x
22 yx
x
y1tan
Similar to the Prewitt, with different mask coefficients:
Edge Magnitude = Edge Direction =
121
000
121
y
101
202
101
x
22 yx
x
y1tan
Consider a single row or column of the imagePlotting intensity as a function of position gives a signal
Where is the edge?
Edge magnitude is approximated in digital images by a convolution sum.
The sign of the result (+ or -) from two adjacent pixels provide edge orientation and tells us which side of edge brighter
Masks for 4 and 8 neighborhoods
Mask with stressed significance of the central pixel or its neighborhood
010
141
010
111
181
111
121
242
121
212
141
212
Matlab’s image processing toolbox provides edge function to find edges in an image:
I = imread('rice.tif'); BW1 = edge(I,'prewitt'); BW2 = edge(I,'canny'); imshow(BW1) figure, imshow(BW2)Edge function supports six different edge-
finding methods: Sobel, Prewitt, Roberts, Laplacian of Gaussian, Zero-cross, and Canny.