Morphological Image Processing

Similar documents
Introduction. Computer Vision & Digital Image Processing. Preview. Basic Concepts from Set Theory

What will we learn? What is mathematical morphology? What is mathematical morphology? Fundamental concepts and operations

Morphological Image Processing

Mathematical Morphology and Distance Transforms. Robin Strand

Morphological Image Processing

Morphological Image Processing

Biomedical Image Analysis. Mathematical Morphology

morphology on binary images

International Journal of Advance Engineering and Research Development. Applications of Set Theory in Digital Image Processing

EECS490: Digital Image Processing. Lecture #17

09/11/2017. Morphological image processing. Morphological image processing. Morphological image processing. Morphological image processing (binary)

Morphological Image Processing

Lecture 7: Morphological Image Processing

[ ] Review. Edges and Binary Images. Edge detection. Derivative of Gaussian filter. Image gradient. Tuesday, Sept 16

Morphological Image Processing

Lab 2. Hanz Cuevas Velásquez, Bob Fisher Advanced Vision School of Informatics, University of Edinburgh Week 3, 2018

EE 584 MACHINE VISION

Morphological Image Algorithms

Image Analysis. Morphological Image Analysis

Topic 6 Representation and Description

EE795: Computer Vision and Intelligent Systems

Bioimage Informatics

From Pixels to Blobs

Mathematical morphology (1)

10.5 Morphological Reconstruction

Morphological Image Processing

Filters. Advanced and Special Topics: Filters. Filters

Chapter 9 Morphological Image Processing

Edges and Binary Images

Mathematical morphology... M.1 Introduction... M.1 Dilation... M.3 Erosion... M.3 Closing... M.4 Opening... M.5 Summary... M.6

CITS 4402 Computer Vision

Chapter 11 Representation & Description

Machine vision. Summary # 5: Morphological operations

Elaborazione delle Immagini Informazione multimediale - Immagini. Raffaella Lanzarotti

Digital Image Processing

Previously. Edge detection. Today. Thresholding. Gradients -> edges 2/1/2011. Edges and Binary Image Analysis

Morphological Image Processing GUI using MATLAB

C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S. Image Operations II

Digital Image Processing Fundamentals

CS443: Digital Imaging and Multimedia Binary Image Analysis. Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University

Edges and Binary Image Analysis. Thurs Jan 26 Kristen Grauman UT Austin. Today. Edge detection and matching

Processing of binary images

ECEN 447 Digital Image Processing

Edges and Binary Image Analysis April 12 th, 2018

11/10/2011 small set, B, to probe the image under study for each SE, define origo & pixels in SE

Image Processing. Bilkent University. CS554 Computer Vision Pinar Duygulu

11. Gray-Scale Morphology. Computer Engineering, i Sejong University. Dongil Han

Chapter 3. Image Processing Methods. (c) 2008 Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Digital Image Processing COSC 6380/4393

CS 5540 Spring 2013 Assignment 3, v1.0 Due: Apr. 24th 11:59PM

Babu Madhav Institute of Information Technology Years Integrated M.Sc.(IT)(Semester - 7)

Morphological Compound Operations-Opening and CLosing

Relational Database: The Relational Data Model; Operations on Database Relations

Digital Image Fundamentals II

Digital Image Processing

Image Processing (IP) Through Erosion and Dilation Methods

Lecture 18 Representation and description I. 2. Boundary descriptors

Morphological track 1

Albert M. Vossepoel. Center for Image Processing

Table 1. Different types of Defects on Tiles

Detection of Edges Using Mathematical Morphological Operators

Finger Print Analysis and Matching Daniel Novák

Two Image-Template Operations for Binary Image Processing. Hongchi Shi. Department of Computer Engineering and Computer Science

Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections.

Image Segmentation. Figure 1: Input image. Step.2. Use Morphological Opening to Estimate the Background

Chapter 4 Concepts from Geometry

Colorado School of Mines. Computer Vision. Professor William Hoff Dept of Electrical Engineering &Computer Science.

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

Morphology-form and structure. Who am I? structuring element (SE) Today s lecture. Morphological Transformation. Mathematical Morphology

Interactive Math Glossary Terms and Definitions

Digital Image Processing Chapter 11: Image Description and Representation

EC-433 Digital Image Processing

Fuzzy Soft Mathematical Morphology

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

INF Exercise for Thursday

Binary Image Processing. Introduction to Computer Vision CSE 152 Lecture 5

SPEED OPTIMIZATION OF CT-BASED MICROSTRUCTURE DETERMINATION USING MATRIX DECOMPOSITION

Binary Shape Characterization using Morphological Boundary Class Distribution Functions

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

CS534 Introduction to Computer Vision Binary Image Analysis. Ahmed Elgammal Dept. of Computer Science Rutgers University

Binary Image Analysis. Binary Image Analysis. What kinds of operations? Results of analysis. Useful Operations. Example: red blood cell image

Introduction to Medical Imaging (5XSA0)

ECG782: Multidimensional Digital Signal Processing

ECG782: Multidimensional Digital Signal Processing

Lecture 3: Basic Morphological Image Processing

Curriki Geometry Glossary

Approximation Algorithms for Geometric Intersection Graphs

Gesture based PTZ camera control

CSci 4968 and 6270 Computational Vision, Fall Semester, 2011 Lectures 2&3, Image Processing. Corners, boundaries, homogeneous regions, textures?

Hierarchical Representation of 2-D Shapes using Convex Polygons: a Contour-Based Approach

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling

Practical Image and Video Processing Using MATLAB

1.1 - Introduction to Sets

2 Review of Set Theory

Fast Distance Transform Computation using Dual Scan Line Propagation

Grade 5. Massachusetts Curriculum Framework for Mathematics 48

Image representation. 1. Introduction

Figure 8-7: Cameraman.tif Before and After Remapping, and Widening its Dynamic Range


CLASSIFICATION OF BOUNDARY AND REGION SHAPES USING HU-MOMENT INVARIANTS

Transcription:

Morphological Image Processing Ranga Rodrigo October 9, 29 Outline Contents Preliminaries 2 Dilation and Erosion 3 2. Dilation.............................................. 3 2.2 Erosion.............................................. 5 3 Opening and Closing 5 4 Labeling Connected Components Morphological image processing tools help us to extract image components that are useful in the representation and description of region shape, such as boundaries, skeletons, and convex hull. There are morphological techniques for pre- and postprocessing, such as morphological filtering, thinning, and pruning. Preliminaries Let Z be a set of integers. The sampling process used to produce the digital image may be viewed as a partitioning in the x y -plane in to a grid, with coordinates of the center of each grid being a pair of elements from the Cartesian product Z 2. In the terminology of set theory the function f (x, y ) is said to be a digital image if (x, y ) are integers from Z 2 and f is a mapping that assigns an intensity value in the set of real numbers, R, to each distinct pair of coordinates (x, y ). If the elements of R also are integers, a digital image then becomes a two-dimensional function, whose coordinates and the amplitude values are integers. Let A be a set in Z 2, the elements of which are pixel coordinates (x, y ). If w = (x, y ) is an element of A, then we write w A. Similarly, if w is not an element of A, we write w / A. A set of B pixels satisfying a particular condition is written as B = {w condition}.

A B A B A B (a) (b) A B (c) A B A B A (d) A (e) A B Figure : Set operations. For example, the set of all pixel coordinates that do not belong to A, denoted by A, is given by A = {w w / A}. This set is called the complement of A. The union of two sets, denoted by C = A B is the set of all elements that belong to wither A or B, or both. Similarly, the intersection of two sets A and B is the set of elements that belong to both sets, denoted by C = A B. The difference of sets A and B, denoted by A B, is the set of all elements that belong to A but not to B: A B = {w w A, w / B}. Figure illustrates these set operations. In addition to the basic operations, morphological operations often require two operations that are specific to sets whose elements are pixel coordinates. The reflection of set B, denoted by ˆB, is defined as ˆB = {w w = b, forb B}. The translation of set A by z = (z x, z y ), denoted by (A) z, is defined as (A) z = {c c = a + z, fora A}. A binary image can be viewed as a bivariate function of x and y. Morphological theory views a binary image as a set of it foreground (-valued) pixels, the elements of which are in Z 2. Set operations such as union and intersection can be applied directly to binary image sets. For example, if A and B are binary images, then C = A B is also a binary image, where a pixel in C is a foreground pixel if either or both of the corresponding pixels in A and B are foreground pixels. Table shows Matlab s logical operations that perform set operations on binary images. 2

y x (A) z (a) Translation ˆB (b) Reflection Figure 2: Translation and reflection. Dot identifies the origin. Table : Set operations for binary images in Matlab. Set operation MATLAB expression Name A B A & B AND A B A B OR A ~ A NOT A B A &~ B DIFFERENCE 2 Dilation and Erosion The operations of dilation and erosion are fundamental to morphological image processing. Many of the algorithms are based on these operations. 2. Dilation Dilation is an operation that grows or thickens objects in a binary image. The specific manner and the extent of this thickening is controlled by a shape referred to as a structuring element. Dilation is a process that translates the origin of the structuring element throughout the domain of the image and checks to see whether it overlaps with -valued pixels. The output image is at each location of the origin of the structuring element if the structuring element overlaps at least one -valued pixel in the input image. Mathematically, dilation is defined in terms of set operations. The dilation of A by B, denoted by A B, is defined as A B = z ( ˆB) z A, where is the empty set and B is the structuring element. In words, the dilation of A by B is the set consisting of all the structuring element origin locations where the reflected and translated B overlaps at least some portion of A. Dilation is commutative, i.e., A B = B A. It is a convention in image processing to let the first operand of A B be the image and the second operand be the structuring element, which is usually much smaller than the image. The Matlab image processing toolbox function imdilate performs dilation. The syntax is C = i m d i l a t e ( A, B) where A and C are binary images and B is a matrix of s and s that specify the structuring element. 3

Example. Write a Matlab program to dilate the image A with the structuring element B shown below. Structuring Element Decomposition Dilation is associative. That is A (B C ) = (A B) C. Suppose that structuring element B can be represented as a dilation of two structuring elements B and B 2 : B = B B 2. Then, A B = A (B B 2 ) = (A B ) B 2. In other words, dilating A with B is the same as first dilating A with B, and then dilating the result with B 2. We say that B can be decomposed into the structuring elements B and B 2. The associative property is important because the time required to compute dilation is proportional to the number of nonzero pixels in the structuring element. Consider for example, dilation with a 5 5 array of s:. This structuring element can be decomposed into a five-element row of s and a file-element column of s: The number of elements in the original structuring element is 25, but the total number of elements in the row-column decomposition is only. This means that dilation with the row structuring element first, followed by dilation with the column structuring element can be performed approximately 2.5 times faster that dilation with the 5 5 array of s.. 4

The strel Function Matlab image processing toolbox function strel constructs structuring elements with a variety of shapes and sizes. Its basic syntax is B = s t r e l ( shape, parameters ) This returns a special quantity called an strel object. The function imdilate is able to use the decomposed from of the structuring element. Example: B = s t r e l ( diamond, 5) creates a flat diamond sharped structuring element such that the distance from the structuring element s origin to the extreme points of the diamond is 5. There are other shapes such as disk, line, rectangle, etc. The following code shows how to use the structuring element generated by the strel function is used to carry out dilation. A = imread ( image. t i f ) ; B = s t r e l ( diamond, 5) C = i m d i l a t e ( A, B ) ; imshow (C) 2.2 Erosion Erosion shrinks or thins in a binary image. As in dilation, the manner and extent of shrinking is controlled by the structuring element. The output of erosion has a value at each location of the origin of the structuring element, such that the structuring element overlaps only -valued pixels of the input image. The mathematical definition of erosion is similar to that of dilation. The erosion of A by B, denoted by A B, is defined as A B = z (B) z A. In other words, erosion of A by B is the set of structuring element origin locations where the translated B has no overlap with the background of A. The Matlab image processing toolbox function imerode performs erosion. The syntax is C = imerode ( A, B) where A and C are binary images and B is a matrix of s and s that specify the structuring element. 3 Opening and Closing In practical image processing applications, dilation and erosion are used most often in various combinations. We can apply a series of dilation and erosion operations to an image, either using the same structuring element or, sometimes, a different one. Two such common operations are opening and closing. 5

Morphological Opening The morphological opening of A by B, denoted by A B, is simply erosion of A by B followed by the dilation of the result by B: A B = (A B) B. An alternative mathematical formulation of opening is A B = {(B) z (B) z A} where { } denotes the union of all sets inside braces, and the notation C D means that C is a subset of D. This formulation has a simple geometric interpretation: A B is the union of all translations of B that fit entirely within A. Morphological opening removes completely regions of an object that cannot 6

contain the structuring element, smoothes the object contours, breaks thin connections, and removes the protrusions. Morphological Closing The morphological closing of A by B, denoted by A B, is a dilation followed by an erosion: A B = (A B) B. Geometrically, A B is the complement of the union of all translations of B the do not overlap A. Like opening, morphological closing tends to smooth the contours of objects. Unlike opening, however, it generally joins narrow breaks, filling long thin gulfs, and fills holes smaller than the structuring element. 7

Matlab Functions for Opening and Closing Opening and closing are implemented in the toolbox with functions imopen and imclose. The following carries out opening: C = imopen ( A, B) Closing is carried out as follows: C = imclose ( A, B) In these code snippets, A is a binary image, and B is matrix of s and s that specifies the structuring element. A strel object, SE can be used instead of B. Example 2. Write a Matlab program to carry out morphological opening on an image using a square structuring element. 8

Example 3. Write a Matlab program to carry out morphological closing on an image using a square structuring element. Combining a closing and opening can be quite effective in removing noise. 9

Function bwmorph Image processing toolbox function bwmorph implements a variety of useful operations based on combinations of dilations, erosions, and lookup table operations. g = bwmorph( f, operation, n ) where f is an input binary image, operation is a string specifying the desired operation, and n is a positive integer specifying the number of times the operation is to be repeated. The operation can be open, close, dilate, erode, thin, skel, and several others. Thinning, (thin) means reducing binary objects or shapes in an image to strokes that are a single pixel wide. Skeletonisation (skel) is another way to reduce binary image objects to a set of thin strokes that retain the important information about the shapes of the original objects. Example 4. Write a Matlab program to carry out skeletonisation.

y w y y w y x x h h x x (a) 4-neighborhood (b) 8-neighborhood Figure 3: Neighborhoods. 4 Labeling Connected Components Using connected component analysis we can extract individual objects or connected components in an image. In order to do this, we must define connectedness A pixel p at coordinates (x, y ) has two horizontal and two vertical neighbors whose coordinates are This set is known as 4-neighbors of p, denoted by N 4 (p). In a similar manner we can define N 8 (p) as well. Figure 3 shows this. Two pixels p and q are said to be 4-adjacent if q N 4 (p). Similarly, two pixels p and q are said to be 4-adjacent if q N 8 (p). A path between pixels p and p n is a sequence of pixels p, p 2,..., p n such that p k is adjacent to p k +, for k < n. A path can be 4-connected or 8-connected depending on the definition of adjacency used. Two foreground pixels p and q are said to be 4-connected is there exists a 4- connected path between them, containing entirely foreground pixels. Similarly, two foreground pixels p and q are said to be 8-connected is there exists a 8-connected path between them, containing entirely foreground pixels. Example 5. Identify if the pixels p and q are 4-connected or 8-connected.

Connected Components For any foreground pixel p, the set of all foreground pixels connected to it is called the connected component containing p. The nature of the connected component depends on the definition of adjacency we choose between 4- and 8-adjacency. IPT Function bwlabel Matlab Image Processing Toolbox Function bwlabel computes all the connected components in a binary image. [ L, num] = bwlabel ( f, conn ) where f is a binary image and conn specifies the desired connectivity (either 4 or 8). Output L is called the label matrix, and num (optional) gives the total number of connected components found. 2