PLT 425 VISION SYSTEM Chapter 6 Edge Detection

  • Slides: 39
Download presentation
PLT 425 VISION SYSTEM Chapter 6: Edge Detection & Image Segmentation School of Mechatronic

PLT 425 VISION SYSTEM Chapter 6: Edge Detection & Image Segmentation School of Mechatronic Engineering Ai. COS Research Group

Image Segmentation Ø Objects are pictured as image against a background. We need not

Image Segmentation Ø Objects are pictured as image against a background. We need not require the background neither we need to process all data that correspond to the background. Ø Segmentation is a procedure in which items (objects or object portions, features) in an image are separated from background. Ø Segmentation is one of the most important elements of an automated vision system because only at this stage of image processing the objects are extracted from a scene for subsequent recognition and analysis. School of Mechatronic Engineering Ai. COS Research Group

Image Segmentation Grayscale image Image after segmentation (segmented image) School of Mechatronic Engineering Ai.

Image Segmentation Grayscale image Image after segmentation (segmented image) School of Mechatronic Engineering Ai. COS Research Group

Image Segmentation Ø Each region is an object candidate. Ø Segmentation is a very

Image Segmentation Ø Each region is an object candidate. Ø Segmentation is a very important step in understanding images. School of Mechatronic Engineering Ai. COS Research Group

Image Segmentation Image segmentation techniques can be classified into: Ø Thresholding: Can be further

Image Segmentation Image segmentation techniques can be classified into: Ø Thresholding: Can be further categorized into two, gray level thresholding and colour thresholding. Ø Clustering: Uses data clustering. All pixels of an image are assigned to their closest cluster centre. Ø Boundary-based: Segment an image into regions of common attribute by detecting the boundary of each region. Boundary detection can be accomplished by means of edge detection. School of Mechatronic Engineering Ai. COS Research Group

Thresholding Ø Thresholding is the simplest region segmentation technique. Ø Definition: Thresholding is used

Thresholding Ø Thresholding is the simplest region segmentation technique. Ø Definition: Thresholding is used to segment an image by setting all pixels whose intensity values are above a threshold to a foreground value and all the remaining pixels to a background value. Ø Simple segmentation is conversion of a grayscale image to a binary image where image is partitioned into two sets. School of Mechatronic Engineering Ai. COS Research Group

Thresholding Ø The input to a thresholding operation is typically a grayscale or color

Thresholding Ø The input to a thresholding operation is typically a grayscale or color image. In the simplest implementation, the output is a binary image representing the segmentation. Black pixels correspond to background and white pixels correspond to foreground (or vice versa). Ø In simplementations, the segmentation is determined by a single parameter known as the intensity threshold. In a single pass, each pixel in the image is compared with this threshold. If the pixel's intensity is higher than the threshold, the pixel is set to, say, white in the output. If it is less than the threshold, it is set to black. School of Mechatronic Engineering Ai. COS Research Group

Histogram Ø This is the simplest way to segment a gray scale image from

Histogram Ø This is the simplest way to segment a gray scale image from background. Ø Let k be the gray scale level (k= 0 - 255). Ø Let h(k) be the collection of all image pixels with gray scale k. Ø We can plot “h(k) vs k”. Ø This plot is known as Histogram. School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram h(k) k School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram h(k) k School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram h(k) k School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram h(k) k School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram Which histogram corresponding to the shown image? School of Mechatronic Engineering Ai.

Example: Histogram Which histogram corresponding to the shown image? School of Mechatronic Engineering Ai. COS Research Group

Answer for Previous Problem Ø Histogram 1 does not show a peak for the

Answer for Previous Problem Ø Histogram 1 does not show a peak for the background, so it can’t be the one. Ø The right histogram is 2. Why? In the upper left corner is the transition between the tool and the background very smooth, which means that gray levels are close to each other in that region. It justifies that the 2 peaks corresponding to the 2 objects are close to each other. Ø 2 peaks in histogram 3 is wide, which means the gray level between tools and background is much different. Histogram 3 is wrong. School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram A typical image and its histogram School of Mechatronic Engineering Ai. COS

Example: Histogram A typical image and its histogram School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram When a dark object is present on a bright background, then: Ø

Example: Histogram When a dark object is present on a bright background, then: Ø h(k) for all k having smaller values represent object; and Ø h(k) for all k having larger values will represent the background. Ø Then, there is a threshold value k=T at which the object and background separate from each other. School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram School of Mechatronic Engineering Ai. COS Research Group

Example: Histogram School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

h(k), number of pixels with k Histogram of a bright object against a dark

h(k), number of pixels with k Histogram of a bright object against a dark background Background T Gray level, k Object black T: threshold; white 1 if f(x, y) > T Modify all gray levels in the image as 0 of f(x, y) < T Then we get a binary image (white object against a black background) School of Mechatronic Engineering Ai. COS Research Group

Thresholding T Original image Histogram Segmented image T=120 School of Mechatronic Engineering Ai. COS

Thresholding T Original image Histogram Segmented image T=120 School of Mechatronic Engineering Ai. COS Research Group

Thresholding When: o T constant global thresholding o T change over image variable thresholding

Thresholding When: o T constant global thresholding o T change over image variable thresholding o T depends on its neighbor local / regional thresholding o T depends on spatial coordinates adaptive thresholding o multiple T? multiple thresholding o T in other dimension multivariable thresholding School of Mechatronic Engineering Ai. COS Research Group

Multiple Thresholding Ø A histogram with three dominant modes (two light objects on a

Multiple Thresholding Ø A histogram with three dominant modes (two light objects on a dark background) – Multiple Thresholding classifies a point (x, y) as belonging to the background if f(x, y) ≤ T 1, to one object class if T 1 < f(x, y) ≤ T 2, and to the other object class if f(x, y) > T 2 Ø The segmented image is given by: School of Mechatronic Engineering Ai. COS Research Group

Basic Global Thresholding From Gonzalez and Woods, page 764: School of Mechatronic Engineering Ai.

Basic Global Thresholding From Gonzalez and Woods, page 764: School of Mechatronic Engineering Ai. COS Research Group

Basic Global Thresholding School of Mechatronic Engineering Ai. COS Research Group

Basic Global Thresholding School of Mechatronic Engineering Ai. COS Research Group

Optimum Global Thresholding – Otsu’s Method Ø Otsu's method is used to automatically perform

Optimum Global Thresholding – Otsu’s Method Ø Otsu's method is used to automatically perform histogram shape-based image thresholding, or, the reduction of a gray level image to a binary image. Ø The algorithm assumes that the image to be thresholded contains two classes of pixels or bi-modal histogram (e. g. foreground and background) then calculates the optimum threshold separating those two classes so that their combined spread (intra-class variance) is minima. Ø Otsu is optimum in the sense that it maximizes the between-class variance (statistical discriminant analysis). School of Mechatronic Engineering Ai. COS Research Group

Optimum Global Thresholding – Otsu’s Method Basic Idea: A well-thresholded classes should be distinct

Optimum Global Thresholding – Otsu’s Method Basic Idea: A well-thresholded classes should be distinct with respect to the intensities values, and a threshold value could give the best (optimum) with the maximum between-class variance. Ø Normalize histogram PDF Ø Classes probability Ø Classes means and variance: - within class variance - between-class variance Ø Separability measure Ø Optimum threshold k* that maximizes between-class variance School of Mechatronic Engineering Ai. COS Research Group

Optimum Global Thresholding – Otsu’s Method School of Mechatronic Engineering Ai. COS Research Group

Optimum Global Thresholding – Otsu’s Method School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

Multiple Thresholding School of Mechatronic Engineering Ai. COS Research Group

Multiple Thresholding School of Mechatronic Engineering Ai. COS Research Group

Point, Line, and Edge Detection Ø Segmentation methods that are based on detecting sharp,

Point, Line, and Edge Detection Ø Segmentation methods that are based on detecting sharp, local changes in intensity. Ø That intensities local changes could be detected using derivatives (do you remember differentiation? ) School of Mechatronic Engineering Ai. COS Research Group

Detection of Single Point Ø Use Laplacian kernel/mask: where T is non-negative. School of

Detection of Single Point Ø Use Laplacian kernel/mask: where T is non-negative. School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

Line Detection Ø Use Laplacian kernel/mask as well. Ø Second derivatives gives stronger response

Line Detection Ø Use Laplacian kernel/mask as well. Ø Second derivatives gives stronger response and produce thinner lines. Ø Double line effect. School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

School of Mechatronic Engineering Ai. COS Research Group

Edge Detection Ø Most frequent use in image processing. Ø Method: Detecting local /

Edge Detection Ø Most frequent use in image processing. Ø Method: Detecting local / abrupt intensity change. Ø Edge models - step edge - ramp profile - roof edge Ø Basic edge detection - Using gradient operators School of Mechatronic Engineering Ai. COS Research Group

Edge Model School of Mechatronic Engineering Ai. COS Research Group

Edge Model School of Mechatronic Engineering Ai. COS Research Group

Basic Edge Detection Ø Image gradient and its properties - gradient vector - magnitude

Basic Edge Detection Ø Image gradient and its properties - gradient vector - magnitude vector - direction of gradient vector School of Mechatronic Engineering Ai. COS Research Group

Basic Edge Detection Ø Gradient operator - Roberts cross gradient operators (Roberts, 1965) -

Basic Edge Detection Ø Gradient operator - Roberts cross gradient operators (Roberts, 1965) - Prewitt operators (Prewitt, 1970) - Sobel operators (Sobel, 1970) School of Mechatronic Engineering Ai. COS Research Group

Basic Edge Detection Ø More advance techniques for edge detection - Laplacian Operator -

Basic Edge Detection Ø More advance techniques for edge detection - Laplacian Operator - Canny edge detector - Marr-Hildreth edge detector School of Mechatronic Engineering Ai. COS Research Group