ip edgedetection 120515002343 phpapp02

Upload: hosein-bahreini

Post on 02-Jun-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    1/44

    EDGE DETECTION

    Presentation by Sarbjeet Singh

    (National Institute of Technical Teachers Training and research) Chandigarh

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    2/44

    10/29/2014 ECE - Sarbjeet Singh 2

    CONTENTS

    Introduction Types of Edges Steps in Edge Detection Methods of Edge Detection

    First Order Derivative Methods First Order Derivative Methods - Summary

    Second Order Derivative Methods Second Order Derivative Methods - Summary

    Optimal Edge Detectors Canny Edge Detection

    Edge Detector Performance

    Application areas

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    3/44

    10/29/2014 ECE - Sarbjeet Singh 3

    INTRODUCTION

    Edge - Area of significantchange in the imageintensity / contrast

    Edge Detection

    Locating areas withstrong intensity contrasts

    Use of Edge Detection Extracting informationabout the image. E.g.location of objects

    present in the image,their shape, size, imagesharpening andenhancement

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    4/44

    10/29/2014 ECE - Sarbjeet Singh 4

    TYPES OF EDGES

    Variation ofIntensity / GrayLevel

    Step Edge

    Ramp Edge

    Line Edge

    Roof Edge

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    5/44

    10/29/2014 ECE - Sarbjeet Singh 5

    Steps in Edge Detection

    Filtering Filter image to improveperformance of the Edge Detector wrt noise

    Enhancement Emphasize pixels having

    significant change in local intensity Detection Identify edges - thresholding

    Localization Locate the edge accurately,estimate edge orientation

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    6/44

    10/29/2014 ECE - Sarbjeet Singh 6

    Noisy Image

    Example of Noisy Image

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    7/44

    10/29/2014 ECE - Sarbjeet Singh 7

    METHODS OF EDGE DETECTION

    First Order Derivative / Gradient Methods

    Roberts Operator

    Sobel Operator

    Prewitt Operator

    Second Order Derivative

    Laplacian

    Laplacian of Gaussian

    Difference of Gaussian

    Optimal Edge Detection

    Canny Edge Detection

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    8/44

    First Derivative

    At the point of greatestslope, the firstderivative has maximum

    value E.g. For a Continuous 1-

    dimensional function f(t)

    10/29/2014 ECE - Sarbjeet Singh 8

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    9/44

    10/29/2014 ECE - Sarbjeet Singh 9

    Gradient

    For a continuous two dimensionalfunction Gradient is defined as

    y

    f

    xf

    Gy

    GxyxfG )],([

    GyGxGyGxG 22

    Gx

    Gy1tan

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    10/44

    10/29/2014 ECE - Sarbjeet Singh 10

    Gradient

    Approximation of Gradient for adiscrete two dimensional function

    Convolution Mask

    Gx=

    Gy=

    Differences are computed at theinterpolated points [i, j+1/2] and[i+1/2, j]

    -1 1-1 1

    ],1[],[

    ],[]1,[

    jifjifGy

    jifjifGx

    1 1

    -1 -1

    -1 1

    1

    -1

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    11/44

    10/29/2014 ECE - Sarbjeet Singh 11

    Gradient Methods RobertsOperator

    Provides an approximation to the gradient

    Convolution Mask Gx=

    Gy =

    Differences are computed at the interpolated points [i+1/2,j+1/2] and not [i, j]

    1 00 -1

    0 -1

    1 0

    )1,(),1()1,1(),()],([ jifjifjifjifGyGxjifG

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    12/44

    10/29/2014 ECE - Sarbjeet Singh 12

    Roberts Operator - Example

    The output imagehas been scaled bya factor of 5

    Spurious dotsindicate that theoperator issusceptible to

    noise

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    13/44

    10/29/2014 ECE - Sarbjeet Singh 13

    Gradient Methods Sobel Operator

    The 3X3 convolution mask smoothes the image bysome amount , hence it is less susceptible to noise. Butit produces thicker edges. So edge localization is poor

    Convolution Mask

    Gx = Gy=

    The differences are calculated at the center pixel of themask.

    -1 0 1-2 0 2

    -1 0 1

    1 2 10 0 0

    -1 -2 -1

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    14/44

    10/29/2014 ECE - Sarbjeet Singh 14

    Sobel Operator - Example

    Compare the output ofthe Sobel Operator withthat of the RobertsOperator: The spurious edges are

    still present but theyare relatively lessintense compared togenuine lines

    Roberts operator hasmissed a few edges

    Sobel operator detectsthicker edges

    Will become more clearwith the final demo

    Outputs of Sobel (top) and Roberts operator

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    15/44

    10/29/2014 ECE - Sarbjeet Singh 15

    Gradient Methods PrewittOperator

    It is similar to the Sobel operator but uses slightlydifferent masks

    Convolution Mask

    Px=

    Py=

    -1 0 1-1 0 1

    -1 0 1

    1 1 1

    0 0 0-1 -1 -1

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    16/44

    10/29/2014 ECE - Sarbjeet Singh 16

    First Order Derivative Methods -Summary

    Noise simple edge detectors are affectedby noise filters can be used to reducenoise

    Edge Thickness Edge is several pixels

    wide for Sobel operatoredge is not

    localized properly Roberts operator is very sensitive to noise Sobel operator goes for averaging and

    emphasizes on the pixel closer to thecenter of the mask. It is less affected bynoise and is one of the most popular EdgeDetectors.

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    17/44

    10/29/2014 ECE - Sarbjeet Singh 17

    Second Order Derivative Methods

    Zero crossing of the second derivativeof a function indicates the presence ofa maxima

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    18/44

    10/29/2014 ECE - Sarbjeet Singh 18

    Second Order Derivative Methods -Laplacian

    Defined as

    Mask

    Very susceptible to noise, filteringrequired, use Laplacian of Gaussian

    0 1 01 -4 1

    0 1 0

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    19/44

    10/29/2014 ECE - Sarbjeet Singh 19

    Second Order Derivative Methods -Laplacian of Gaussian

    Also called Marr-Hildreth EdgeDetector

    Steps Smooth the image using Gaussian filter

    Enhance the edges using Laplacianoperator

    Zero crossings denote the edge location Use linear interpolation to determine the

    sub-pixel location of the edge

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    20/44

    10/29/2014 ECE - Sarbjeet Singh 20

    Laplacian of Gaussian contd.

    Defined as

    Greater the value of s, broader is the

    Gaussian filter, more is the smoothing Too much smoothing may make the

    detection of edges difficult

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    21/44

    10/29/2014 ECE - Sarbjeet Singh 21

    Laplacian of Gaussian - contd.

    Also called the Mexican Hat operator

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    22/44

    10/29/2014 ECE - Sarbjeet Singh 22

    Laplacian of Gaussian contd.

    Mask

    Discrete approximation to LoG function with Gaussian = 1.4

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    23/44

    10/29/2014 ECE - Sarbjeet Singh 23

    Second Order Derivative MethodsDifference of Gaussian - DoG

    LoG requires large computation timefor a large edge detector mask

    To reduce computationalrequirements, approximate the LoGby the difference of two LoG theDoG

    2

    2

    )2

    22(

    2

    1

    )2

    22(

    22),(

    22

    21

    ss

    ssyxyx

    eeyxDoG

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    24/44

    10/29/2014 ECE - Sarbjeet Singh 24

    Difference of Gaussian contd.

    Advantage of DoG

    Close approximation of LoG

    Less computation effort

    Width of edge can be adjusted bychanging s1 and s2

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    25/44

    10/29/2014 ECE - Sarbjeet Singh 25

    Second Order Derivative MethodsSummary

    Second Order Derivative methodsespecially Laplacian, are verysensitive to noise

    Probability of false and missing edgesremain

    Localization is better than Gradient

    Operators

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    26/44

    10/29/2014 ECE - Sarbjeet Singh 26

    Optimal Edge Detector

    Optimal edge detector depending on

    Low error rate edges should not be missedand there must not be spurious responses

    Localizationdistance between points marked

    by the detector and the actual center of theedge should be minimum

    Response Only one response to a single edge

    One dimensional formulation Assume that 2D images have constant cross

    section in some direction

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    27/44

    10/29/2014 ECE - Sarbjeet Singh 27

    First Criterion: Edge Detection

    Response of filter to the edge:

    RMS response of filter to noise :

    First criterion: output Signal to Noise

    Ratio

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    28/44

    10/29/2014 ECE - Sarbjeet Singh 28

    Second Criterion: Edge Localization

    A measure that increases as thelocalization increases is needed

    Reciprocal of RMS distance of themarked edge from center of true edgeis taken as the measure of localization

    Localization is defined as:

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    29/44

    10/29/2014 ECE - Sarbjeet Singh 29

    Third Criterion Elimination ofmultiple responses

    In presence of noise several maxima aredetected it is difficult to separate noisefrom edge

    We try to obtain an expression for thedistance between adjacent noise peaks

    The mean distance between the adjacentmaxima in the output is twice the distance

    between the adjacent zero crossings in thederivative of output operator

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    30/44

    10/29/2014 ECE - Sarbjeet Singh 30

    Noise estimation

    Important to estimate the amount of noisein the image to set thresholds

    Noise component can be efficiently isolated

    using Weiner Filteringrequires the

    knowledge of the autocorrelation ofindividual components and their cross-correlation

    Noise strength is estimated by GlobalHistogram Estimation

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    31/44

    10/29/2014 ECE - Sarbjeet Singh 31

    Thresholding

    Broken edges due to fluctuation ofoperator output above and below thethreshold results in Streaking

    Use double thresholding to eliminatestreaking

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    32/44

    10/29/2014 ECE - Sarbjeet Singh 32

    Two Dimensional Edge Detection

    In two dimensions edge has both positionand direction

    A 2-D mask is created by convolving alinear edge detection function aligned

    normal to the edge direction with aprojection function parallel the edgedirection

    Projection function is Gaussian with samedeviation as the detection function

    The image is convolved with a symmetric2-D Gaussian and then differentiatednormal to the edge direction

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    33/44

    10/29/2014 ECE - Sarbjeet Singh 33

    Implementation of Canny EdgeDetector

    Step 1

    Noise is filtered out usually a Gaussian filteris used

    Width is chosen carefully Step 2

    Edge strength is found out by taking thegradient of the image

    A Roberts mask or a Sobel mask can be used

    GyGxGyGxG 22

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    34/44

    10/29/2014 ECE - Sarbjeet Singh 34

    Implementation of Canny EdgeDetector contd.

    Step 3

    Find the edge direction

    Step 4

    Resolve edge direction

    Gx

    Gy1tan

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    35/44

    10/29/2014 ECE - Sarbjeet Singh 35

    Canny Edge Detector contd.

    Step 5

    Non-maxima suppression trace alongthe edge direction and suppress any

    pixel value not considered to be an edge.Gives a thin line for edge

    Step 6

    Use double / hysterisis thresholding toeliminate streaking

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    36/44

    10/29/2014 ECE - Sarbjeet Singh 36

    Canny Edge Detector contd.

    Compare the results of Sobel andCanny

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    37/44

    10/29/2014 ECE - Sarbjeet Singh 37

    Edge Detector Performance

    Criteria

    Probability of false edges

    Probability of missing edges

    Error in estimation of edge angle

    Mean square distance of edge estimatefrom true edge

    Tolerance to distorted edges and otherfeatures such as corners and junctions

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    38/44

    10/29/2014 ECE - Sarbjeet Singh 38

    Figure of Merit

    Basic errors in a Edge Detector

    Missing Edges

    Error in localizing

    Classification of noise as Edge

    IA: detected edges

    II: ideal edges

    d : distance between actual and ideal edges

    a: penalty factor for displaced edges

    IA

    i iIA dIIFM

    121

    1

    ),max(

    1

    a

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    39/44

    10/29/2014 ECE - Sarbjeet Singh 39

    Applications

    Enhancement of noisy images satellite images, x-rays, medicalimages like cat scans

    Text detection

    Mapping of roads

    Video surveillance, etc.

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    40/44

    10/29/2014 ECE - Sarbjeet Singh 40

    Applications

    Canny Edge Detector for RemoteSensing Images

    Reasons to go for Canny Edge Detector

    Remote sensed images are inherentlynoisy

    Other edge detectors are very sensitiveto noise

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    41/44

    10/29/2014 ECE - Sarbjeet Singh 41

    Edge map of remote sensed image using Canny

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    42/44

    10/29/2014 ECE - Sarbjeet Singh 42

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    43/44

    Thank You

    10/29/2014 ECE - Sarbjeet Singh 43

  • 8/10/2019 Ip Edgedetection 120515002343 Phpapp02

    44/44

    10/29/2014 ECE - Sarbjeet Singh 44

    References Machine Vision Ramesh Jain, Rangachar Kasturi, Brian G Schunck,

    McGraw-Hill, 1995 INTRODUCTION TO COMPUTER VISION

    AND IMAGE PROCESSING - by Luong Chi MaiDepartment of Pattern Recognition and Knowledge EngineeringInstitute of Information Technology, Hanoi, Vietnamhttp://www.netnam.vn/unescocourse/computervision/computer.htm

    The Hypermedia Image Processing Reference -http://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htm A Survey and Evaluation of Edge Detection Operators Application to

    Medical Images Hanene Trichili, Mohamed-Salim Bouhlel, Nabil Derbel,Lotfi Kamoun, IEEE, 2002

    Using The Canny Edge Detector for Feature Extraction and Enhancement ofRemote Sensing Images - Mohamed Ali David Clausi, Systems DesignEngineering, University of Waterloo, IEEE 2001

    A Computational Approach to Edge DetectionJohn Canny, IEEE, 1986

    http://www.netnam.vn/unescocourse/computervision/computer.htmhttp://www.netnam.vn/unescocourse/computervision/computer.htmhttp://www.netnam.vn/unescocourse/computervision/computer.htmhttp://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htmhttp://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htmhttp://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htmhttp://www.netnam.vn/unescocourse/computervision/computer.htmmailto:[email protected]