Einführung in Visual Computing Unit 18: Morphological Operations http:// www.caa.tuwien.ac.at/cvl/teaching/sommersemester/evc Content: Introduction Structuring Element Erosion Dilation Opening Closing Hit ‐ and ‐ Miss Thinning 1 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Introduction Morphology denotes branch of biology that deals with form and structure of animals and plants. Same word in the context of Mathematical Morphology : Tool for extracting image components that are useful in representation and description of region shape , such as boundaries , skeletons etc. Language of Mathematical Morphology is set theory . Sets in Mathematical Morphology represent objects in image. Motive: Extract features from shape 2 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Introduction Morph means “Shape” We do Morphology for Shape Analysis & Shape Study. Shape analysis easy in case of binary images , pixel locations describe the shape. Digital Morphology is a way to describe or analyze the shape of objects in digital images 3 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Introduction Value of each pixel in the output image is based on a comparison of the corresponding pixel in the input image with its neighbors . By choosing size and shape of neighborhood , you can construct a morphological operation that is sensitive to specific shapes in the input image. Morphologic operations are especially suited to the processing of binary and greyscale images. Good for, e.g., Noise removal in background Removal of holes in foreground / background 4 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Basic Concepts From Set Theory Let A and B be sets. To indicate a is an element of A write a A. To indicate a is not an element of A write a A. A is a subset of B, written A B, if for every a A, a B . The union of A and B, A B x | x A or x B . The intersecti on of A and B, A B x | x A and x B . c The complement of A, A x | x A . The difference of A and B, A B x | x A and x B . 5 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Examples A B A B A A A B B B c A c A B A B A A B 6 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Dilation and Erosion Dilation and Erosion are the two fundamental morphological operations . Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels on object boundaries . In morphological dilation and erosion operations, the state of any given pixel in the output image is determined by applying a rule to the corresponding pixel and its neighbors in the input image . The rule used to process the pixels defines the operation as Dilation or Erosion . 7 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
A first Example: Erosion Erosion is an important morphological operation Applied Structuring Element: 8 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 Output Image 9 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 0 Output Image 10 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 0 0 Output Image 11 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 0 0 0 Output Image 12 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 0 0 0 1 Output Image 13 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 0 0 0 1 0 Output Image 14 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 0 0 0 1 0 0 Output Image 15 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example for Erosion 1 0 0 0 1 1 1 0 1 1 Input image 1 1 1 Structuring Element 0 0 0 0 1 0 0 0 Output Image 16 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Dilation & Erosion Basic operations Are dual to each other: Erosion shrinks foreground, enlarges Background Dilation enlarges foreground, shrinks background 17 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Structuring Element
Structuring Element Essential part of morphological operations is the Structuring Element used to probe the input image. Two ‐ dimensional structuring elements consist of a matrix of 0’s and 1’s, much smaller than the image being processed. Structuring Elements can have varying sizes Element values are 0,1 and none (!) Structural Elements have origin (anchor pixel) 19 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Structuring Elements The center pixel of the structuring element, called the origin , identifies the pixel of interest—the pixel being processed. The pixels in the structuring element containing 1’s define the neighborhood of the structuring element. 20 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Example of Structuring Elements (Kernels) Empty spots in the Structuring Elements are don’t care’s! Box Disc 21 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Erosion
Erosion Erosion is the set of all points in the image, where the structuring element “ fits into ”. Consider each foreground pixel in the input image If the structuring element fits in, write a “1” at the origin of the structuring element! Simple application of pattern matching Input: Binary Image (Gray value) Structuring Element, containing only 1s! 23 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Erosion Brief Description To delete or to reduce something Pixels matching a given pattern are deleted from the image. Basic effect Erode away the boundaries of regions of foreground pixels (i.e. white pixels, typically). Common names: Erode, Shrink, Reduce 24 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Erosion How It Works A A & B are sets in Z², the erosion of A by B, denoted as B z ( ) A B z B A In words, this equation indicates that the erosion of A by B is the set of all points z such that B , translated by z , is contained in A . 25 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Erosion Effect of erosion using a 3 × 3 square structuring element Set of coordinate points = { ( ‐ 1, ‐ 1), (0, ‐ 1), (1, ‐ 1), ( ‐ 1, 0), (0, 0), (1, 0), ( ‐ 1, 1), (0, 1), (1, 1) } A 3 × 3 square structuring element 26 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Erosion Erosion By a Rectangular Structuring Element B A A B 27 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Another Example of Erosion White = 0, black = 1, dual property, image as a result of erosion gets darker 28 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Matlab Programming: Erosion %Read image I = imread(‘ford.tiff'); figure('Name', 'original'); imshow(I); %create structuring elements % 11 ‐ by ‐ 11 square se1 = strel('square',11); %Apply erosion operation figure('Name', 'Erode'); Ierode1 = imerode(I,se1); %Show the result image subplot(1,1,1), imshow(Ierode1), title('11x11 square'); 29 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Iterative Operation of Erosion Original Image after 1 erosion after 5 erosions after inf erosions 30 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Counting Coins Counting coins is difficult because they touch each other! Solution: Binarization and Erosion separates them! 31 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Dilation
Dilation Dilation is the set of all points in the image, where the structuring element “ touches ” the foreground . Consider each pixel in the input image If the structuring element touches the foreground image, write a “1” at the origin of the structuring element! Input: Binary Image Structuring Element, containing only 1s!! 33 Robert Sablatnig, Computer Vision Lab, EVC ‐ 18: Morphological Operations
Recommend
More recommend