Edge detection. Stefano Ferrari. Università degli Studi di Milano Elaborazione delle immagini (Image processing I)

Similar documents
Biomedical Image Analysis. Point, Edge and Line Detection

Image Processing. BITS Pilani. Dr Jagadish Nayak. Dubai Campus

Topic 4 Image Segmentation

EECS490: Digital Image Processing. Lecture #19

Sharpening through spatial filtering

Lecture 7: Most Common Edge Detectors

Digital Image Processing. Image Enhancement - Filtering

Line, edge, blob and corner detection

Neighborhood operations

PERFORMANCE ANALYSIS OF CANNY AND OTHER COMMONLY USED EDGE DETECTORS Sandeep Dhawan Director of Technology, OTTE, NEW YORK

Digital Image Processing COSC 6380/4393

Edge detection. Gradient-based edge operators

Local Image preprocessing (cont d)

Image Processing

Edge Detection. CSE 576 Ali Farhadi. Many slides from Steve Seitz and Larry Zitnick

Edge Detection Lecture 03 Computer Vision

Segmentation algorithm for monochrome images generally are based on one of two basic properties of gray level values: discontinuity and similarity.

Image Analysis. Edge Detection

Topological structure of images

Comparison between Various Edge Detection Methods on Satellite Image

Image Segmentation Image Thresholds Edge-detection Edge-detection, the 1 st derivative Edge-detection, the 2 nd derivative Horizontal Edges Vertical

CS334: Digital Imaging and Multimedia Edges and Contours. Ahmed Elgammal Dept. of Computer Science Rutgers University

Lecture 6: Edge Detection

Image segmentation. Stefano Ferrari. Università degli Studi di Milano Methods for Image Processing. academic year

Segmentation and Grouping

What Are Edges? Lecture 5: Gradients and Edge Detection. Boundaries of objects. Boundaries of Lighting. Types of Edges (1D Profiles)

SURVEY ON IMAGE PROCESSING IN THE FIELD OF DE-NOISING TECHNIQUES AND EDGE DETECTION TECHNIQUES ON RADIOGRAPHIC IMAGES

Other Linear Filters CS 211A

Chapter 10: Image Segmentation. Office room : 841

Edge Detection. EE/CSE 576 Linda Shapiro

CS534: Introduction to Computer Vision Edges and Contours. Ahmed Elgammal Dept. of Computer Science Rutgers University

Image Analysis. Edge Detection

Edge detection. Goal: Identify sudden. an image. Ideal: artist s line drawing. object-level knowledge)

EECS490: Digital Image Processing. Lecture #20

Edge Detection. Announcements. Edge detection. Origin of Edges. Mailing list: you should have received messages

Ulrik Söderström 16 Feb Image Processing. Segmentation

Practical Image and Video Processing Using MATLAB

(10) Image Segmentation

Biometrics Technology: Image Processing & Pattern Recognition (by Dr. Dickson Tong)

Lecture 4: Image Processing

Edge and local feature detection - 2. Importance of edge detection in computer vision

What is an edge? Paint. Depth discontinuity. Material change. Texture boundary

EDGE BASED REGION GROWING

DIGITAL IMAGE PROCESSING

CHAPTER 4 EDGE DETECTION TECHNIQUE

Digital Image Processing, 3rd ed.

Feature Detectors - Canny Edge Detector

Anno accademico 2006/2007. Davide Migliore

Performance Evaluation of Edge Detection Techniques for Images in Spatial Domain

Edge and Texture. CS 554 Computer Vision Pinar Duygulu Bilkent University

convolution shift invariant linear system Fourier Transform Aliasing and sampling scale representation edge detection corner detection

Feature Detectors - Sobel Edge Detector

How and what do we see? Segmentation and Grouping. Fundamental Problems. Polyhedral objects. Reducing the combinatorics of pose estimation

Final Review. Image Processing CSE 166 Lecture 18

EE795: Computer Vision and Intelligent Systems

Sobel Edge Detection Algorithm

Types of Edges. Why Edge Detection? Types of Edges. Edge Detection. Gradient. Edge Detection

Image Processing. Traitement d images. Yuliya Tarabalka Tel.

Edge Detection. Today s reading. Cipolla & Gee on edge detection (available online) From Sandlot Science

Filtering Images. Contents

Chapter 3: Intensity Transformations and Spatial Filtering

Edges and Binary Images

Concepts in. Edge Detection

Lecture: Edge Detection

An Algorithm for Blurred Thermal image edge enhancement for security by image processing technique

Image features. Image Features

Edge and corner detection

Filtering and Enhancing Images

Edge Detection. CS664 Computer Vision. 3. Edges. Several Causes of Edges. Detecting Edges. Finite Differences. The Gradient

Edge detection. Convert a 2D image into a set of curves. Extracts salient features of the scene More compact than pixels

Computer Vision. Image Segmentation. 10. Segmentation. Computer Engineering, Sejong University. Dongil Han

EDGE DETECTION-APPLICATION OF (FIRST AND SECOND) ORDER DERIVATIVE IN IMAGE PROCESSING

Review of Filtering. Filtering in frequency domain

JNTUWORLD. 4. Prove that the average value of laplacian of the equation 2 h = ((r2 σ 2 )/σ 4 ))exp( r 2 /2σ 2 ) is zero. [16]

Example 1: Regions. Image Segmentation. Example 3: Lines and Circular Arcs. Example 2: Straight Lines. Region Segmentation: Segmentation Criteria

Example 2: Straight Lines. Image Segmentation. Example 3: Lines and Circular Arcs. Example 1: Regions

1. What are the derivative operators useful in image segmentation? Explain their role in segmentation.

Edge Detection. Ziv Yaniv School of Engineering and Computer Science The Hebrew University, Jerusalem, Israel.

Filtering Applications & Edge Detection. GV12/3072 Image Processing.

CS 4495 Computer Vision. Linear Filtering 2: Templates, Edges. Aaron Bobick. School of Interactive Computing. Templates/Edges

Design of Improved Canny Edge Detection Algorithm

A Robust Method for Circle / Ellipse Extraction Based Canny Edge Detection

ELEN E4830 Digital Image Processing. Homework 6 Solution

COMPARATIVE STUDY OF IMAGE EDGE DETECTION ALGORITHMS

Effects Of Shadow On Canny Edge Detection through a camera

SRCEM, Banmore(M.P.), India

EN1610 Image Understanding Lab # 3: Edges

5. Feature Extraction from Images

Computer Vision I. Announcement. Corners. Edges. Numerical Derivatives f(x) Edge and Corner Detection. CSE252A Lecture 11

CS5670: Computer Vision

Point Operations and Spatial Filtering

REVIEW PAPER ON IMAGE EDGE DETECTION ALGORITHMS FOR SEGMENTATION

SECTION 5 IMAGE PROCESSING 2

ECEN 447 Digital Image Processing

Evaluation Of Image Detection Techniques

Outlines. Medical Image Processing Using Transforms. 4. Transform in image space

Topological structure of images

ECG782: Multidimensional Digital Signal Processing

Announcements. Edge Detection. An Isotropic Gaussian. Filters are templates. Assignment 2 on tracking due this Friday Midterm: Tuesday, May 3.

Concepts in. Edge Detection

Transcription:

Edge detection Stefano Ferrari Università degli Studi di Milano stefano.ferrari@unimi.it Elaborazione delle immagini (Image processing I) academic year 2011 2012 Image segmentation Several image processing based applications require the detection and the recognition of the objects on the scene. Segmentation is a critical task for such applications. It consists in assigning each pixel to an object. Two main criteria are used for guiding the partitioning: discontinuity; similarity. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 1

Formal description of the segmentation The segmentation of an image, R, can be defined as the partitioning of R in n subregions, R 1,..., R n, such that: n i=1 R i = R R i is a connected set, i = 1,..., n R i R j =, i, j, i j Q(R i ) = TRUE, i = 1,..., n Q(R i R j ) = FALSE, for each pair of adjacent regions R i e R j where Q is a logical predicate defined on the points of the considered region. Q is used for characterizing the objects of the image. Edge based segmentation a b c (a) An image is composed of object and background both of constant intensity. (b) Discontinuities are easily detected and identify the boundary. (c) Q(R) can be defined as TRUE iff all the pixels of R are on the same side of the boundary. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 2

Region based segmentation a b c (a) An image is composed of a textured object and a constant background. (b) Discontinuities form an intricate pattern of small edges. (c) The image in (a) can be subdivided in 4 4 regions and each region is marked as white if the standard deviation of the intensity of its pixel is positive (black, otherwise). Discontinuity types There are three main types of discontinuity that usually carry the information: isolated (edge) point abrupt local change of intensity edge segment connected set of discontinuity points line thin region where the intensity changes on both the sides Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 3

Discontinuity detection Derivative are the most suited tools for detecting changes but they are defined on continuous domains. Since the digital images are discrete, approximations have to be used (using Taylor series): first derivative: f x second derivative: = f (x + 1) f (x) 2 f = f (x + 1) 2f (x) + f (x 1) x 2 Hence, the value of the derivative estimated in a pixel will be considered a measure of discontinuity of the intensity in that point. Discontinuity detection (2) Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 4

Isolated points detection The Laplacian is the simplest derivative operator that is isotropic with respect to the four principal directions: 2 f = 2 f x 2 + 2 f y 2 Partial derivatives: 2 f x 2 = f (x + 1, y) 2f (x, y) + f (x 1, y) 2 f y 2 = f (x, y + 1) 2f (x, y) + f (x, y 1) Hence, the Laplacian can be computed as: 2 f (x, y) = f (x + 1, y) + f (x 1, y) + f (x, y + 1) +f (x, y 1) 4f (x, y) Optionally, the diagonals contribution can be added: 2 f (x, y) + f (x 1, y 1) + f (x + 1, y + 1) + f (x 1, y + 1) + f (x + 1, y 1) 4f (x, y) Thresholding Thresholding is the simplest technique for obtaining the pixels where a substantial discontinuity takes place. Hence, the image g is considered: { 1, if g(x, y) = 2 f (x, y) T 0, otherwise for a suitable threshold T. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 5

Thresholding (2) f 2 f g The X-ray image, f, of a turbine blade shows some porosity. The Laplacian of f is computed for detecting isolated points. The porosity is detected in the image g, obtained thresholding 2 f with a threshold equal to the 90% of the highest value of the Laplacian. Lines detection A line is a group of discontinuity pixels structured in linear arrangement. Hence, the detection of a line can be realized using isolated point detection techniques, such as the Laplacian. However, problems such as the double response of the Laplacian have to be handled. Besides, the thickness of the line have to be defined. Thick lines can be better detected by edge detectors. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 6

Lines detection (2) The Laplacian have a double response to the edges. Considering the absolute value, the thickness of the detected lines results doubled. Lines can be handled considering only the strictly positive values. Line detection masks Often, the direction of the lines is an important feature. The four masks act in the four specified directions. Each pixel can be associated to the direction for which the response is the highest. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 7

Specific directions detection a c e b d f The image (a) is processed with the 45 mask producing the image (b). (c) and (d) shows the details in the upper-left and bottom-right corners of (b) respectively. The response in (d) is stronger then in (c), due to the different lines thickness. In (e), only positive values are shown. In (f), (e) is thresholded using the its maximum value as threshold. Edge models Ideal edges Real edges Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 8

Ramp edges In real images, ramp edges are the most common (blur). The first derivative magnitude can be used to detect an edge. The sign of the second derivative tells if the pixel is on the dark or light side of the edge. The second derivative: produces a double response (undesirable); allows the localization through zero crossing. These consideration hold for edges of every orientation, considering the section of the image operated perpendicularly to the edge. Edge and noise Noise free ramp. The gray levels range in [0, 255]; Gaussian noise, zero mean, standard deviation of 0.1 (0.0392%). Gaussian noise, zero mean, standard deviation of 1.0 (0.392%). Gaussian noise, zero mean, standard deviation of 10.0 (3.92%). Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 9

Edge and noise (2) Although noise is almost invisible in the images, even a tiny amount of noise strongly affects the second derivative and a modest amount of noise can ruin the first derivative. Since derivative operators are the principal tool for edge detection, their effectiveness in real image can be questioned. Three fundamental steps have to be performed in edge detection: Smoothing for noise reduction Detection of edge points Edge localization Gradient based edge detection The gradient allows to find edge strength and direction. The gradient f of a bidimensional function, f (x, y) is: [ ] f gx f grad(f ) = x g y f y The magnitude of the gradient, M(x, y) is: M(x, y) = mag( f ) = gx 2 + gy 2 The approximation M(x, y) g x + g y is often used. The gradient vector points in the directions of the the greatest rate of change at the considered location: [ ] α(x, y) = tan 1 gy g x Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 10

Edge and gradient The direction of the edge is orthogonal to the direction of the gradient. Gradient is also called edge normal. Derivative operators Partial derivatives Derivative operators Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 11

. Example of use of the gradient a I b d c e The images (b) and (c) are respectively the magnitude of the (Sobel) horizontal and vertical gradients of (a), while (d) and (e) are the magnitude and the angle of the gradient. Example of use of the gradient (2) I As well as noise, too small details can crowd the gradient image and make difficult the edge detection. I Smoothing can handle this problem. (a) Original image (834 1114) are smoothed with a 5 5 averaging filter. (b-c) Horizontal and vertical gradients (Sobel) of (a). (d) Gradient magnitude. (e-f) Diagonal Sobel gradients. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 12

Example of use of the gradient (3) a b Thresholding can help in simplifying the edge detection. (a) Thresholding at the 33% of the maximum value of the gradient. (b) Thresholding the gradient of the smoothed image. Marr-Hildreth edge detector The Marr-Hildreth edge detector is based on two observations: intensity changes are not independent of image scale; the derivatives of the function carry useful information on changes of intensity. Hence, operators that act at different scales can be used. The Laplacian of the Gaussian satisfies both the requirements. The Gaussian is smooth both in the spatial and in the frequency domains: result is less affected by artifacts. The Laplacian is isotropic: no need of multiple masks for covering different directions. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 13

Marr-Hildreth edge detector (2) Marr-Hildreth edge detector (3) In order to achieve a good approximation of the Gaussian, n should be chosen at least as the smallest odd integer greater or equal to 6σ. 2 G can be obtained sampling the Gaussian function and then computing its Laplacian through the above illustrated operators. Due to the linearity of the operations: [ 2 G(x, y)] f (x, y) = 2 [G(x, y) f (x, y)] The Marr-Hildreth algorithm is composed of three steps: Filter the image with a n n Gaussian filter with an appropriate scale, σ. Compute the Laplacian (e.g., with a 3 3 mask). Find the zero-crossings. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 14

Marr-Hildreth edge detector (4) A simple algorithm for finding zero crossing can be used: if at least two opposite pixels have different sign, a zero crossing happens; a more robust variant can be obtained adding a condition on the absolute value of the difference of the opposite pixels. Marr-Hildreth edge detector (5) a c b d A 834 1114 image (2) is processed with a Laplacian of Gaussian filter (σ = 4, n = 25) (b). Zero crossing with threshold 0 (c) and 4% of the maximum value in (b). Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 15

Canny edge detector The Canny algorithm has three goals: Low error rate no missing edge, no false edge Well localized edge points Single edge point response Canny proved that a good approximation to the optimal step detector in 1-D is the first derivative of the Gaussian. Generalizing this result to 2-D would require to process the image for all the directions. Convolving the image with a Gaussian and then computing the gradient provides a good approximation. The gradient is used for estimating strength and direction of the edge in every point. Canny edge detector (2) Robust estimation of the direction using (non-maxima suppression) criterion: approximation of the direction to one of the four principal directions (horizontal, vertical and diagonal) if at least one of the neighboring along the edge direction has a gradient magnitude larger, the corresponding pixel in the edge image, g N, is set to 0, otherwise it is set to the gradient value. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 16

Canny edge detector (3) Robust detection and linking of the edge points: Hysteresis thresholding: two thresholds, T H and T L, such that: T L < T H g NL (x, y) = T L g N (x, y) T H g NH (x, y) = g N (x, y) T H g NH and g NL contain respectively the strong and the weak edge points After thresholding, the edges in g NH are usually broken, and in g NL there are some valid points. The valid points in g NL can be selected: for every point in g NH, mark as valid all the points in g NL that are 8-connected to the considered points; at the end, all the valid points in g NL are added to g NH. Marr vs. Canny comparison Marr Canny Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 17

Marr vs. Canny comparison (2) Marr Canny Edge linking Since in real images the edge detection does not produce a clean set of edge points, some processing for obtaining the structure of the edges is required. Local processing: each point is linked to the adjacent if magnitude and direction of the gradient are similar. Polygonal approximation: starting from a set of edge points, segments of a polygonal line are iteratively added until all the points are close enough to a segment. Hough transform: finding of the most probable lines. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 18

Local edge linking Gradient, horizontal edges, vertical edges, their union, final result after morphological thinning. Polygonal edge linking Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 19

Hough transform y = a x + b Vertical lines cannot be represented. Hough transform (2) Normal representation x cos θ + y sin θ = ρ Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 20

Hough transform (3) Quantization of the parameter space θ-ρ. Count of the possible lines. Use of the most probable ones. Optionally, some constraints can be added (e.g., direction). Hough transform: example Selection of the edge points through the Canny algorithm. Hough transform. Selection of the (nearly) vertical lines. Stefano Ferrari Elaborazione di immagini (Image processing) a.a. 2011/12 21