Mathematical Morphology and Distance Transforms

Similar documents
Used to extract image components that are useful in the representation and description of region shape, such as

CS 4495 Computer Vision Binary images and Morphology

Chapter I : Basic Notions

(9) Morphological Image Processing (a) Basic set operations

Morphological image processing

Mathematical Morphology

Part I : Bases. Part I : Bases

Foundation for Neutrosophic Mathematical Morphology

MORPHOLOGICAL IMAGE ANALYSIS III

Part II : Connection

Chapter VIII : Thinnings

Morphology Gonzalez and Woods, Chapter 9 Except sections 9.5.7, 9.5.8, and Repetition of binary dilatation, erosion, opening, closing

Mathematical Morphology

Morphological Operations. GV12/3072 Image Processing.

Chapter III: Opening, Closing

Digital Signal Processing

Chapter VI. Set Connection and Numerical Functions

Mathematics for Economists

The Frequency Domain. Many slides borrowed from Steve Seitz

Fuzzy Sets and Fuzzy Techniques. Sladoje. Introduction. Operations. Combinations. Aggregation Operations. An Application: Fuzzy Morphologies

ELEC Digital Logic Circuits Fall 2014 Boolean Algebra (Chapter 2)

Multimedia Databases. Wolf-Tilo Balke Philipp Wille Institut für Informationssysteme Technische Universität Braunschweig

Computer Assisted Image Analysis

Multimedia Databases. Previous Lecture. 4.1 Multiresolution Analysis. 4 Shape-based Features. 4.1 Multiresolution Analysis

Mid Term-1 : Practice problems

Multimedia Databases. 4 Shape-based Features. 4.1 Multiresolution Analysis. 4.1 Multiresolution Analysis. 4.1 Multiresolution Analysis

Algorithms for Picture Analysis. Lecture 07: Metrics. Axioms of a Metric

Course 212: Academic Year Section 1: Metric Spaces

Real Analysis on Metric Spaces

3 Boolean Algebra 3.1 BOOLEAN ALGEBRA

repetition, part ii Ole-Johan Skrede INF Digital Image Processing

Introduction to Dynamical Systems

MATH 31BH Homework 1 Solutions

Measures. Chapter Some prerequisites. 1.2 Introduction

Lab 1 starts this week: go to your session

Introduction. Chapter 1. Contents. EECS 600 Function Space Methods in System Theory Lecture Notes J. Fessler 1.1

On bisectors in Minkowski normed space.

Thus, X is connected by Problem 4. Case 3: X = (a, b]. This case is analogous to Case 2. Case 4: X = (a, b). Choose ε < b a

Lecture 2: A crash course in Real Analysis

Some Background Material

Math General Topology Fall 2012 Homework 1 Solutions

Relations on Hypergraphs

Lectures on Geometry

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

Lecture Notes in Advanced Calculus 1 (80315) Raz Kupferman Institute of Mathematics The Hebrew University

REVIEW OF ESSENTIAL MATH 346 TOPICS

A Logical Perspective on Mathematical Morphology

Construction of a general measure structure

Introduction to Real Analysis Alternative Chapter 1

Topology, Math 581, Fall 2017 last updated: November 24, Topology 1, Math 581, Fall 2017: Notes and homework Krzysztof Chris Ciesielski

Lecture 4. Algebra, continued Section 2: Lattices and Boolean algebras

Section 2: Classes of Sets

Large subsets of semigroups

Stat 609: Mathematical Statistics I (Fall Semester, 2016) Introduction

Fraunhofer Institute for Computer Graphics Research Interactive Graphics Systems Group, TU Darmstadt Fraunhoferstrasse 5, Darmstadt, Germany

Set, functions and Euclidean space. Seungjin Han

CS 372: Computational Geometry Lecture 14 Geometric Approximation Algorithms

Mathematical Morphology on Hypergraphs: Preliminary Definitions and Results

Notes for Functional Analysis

INF Shape descriptors

Mathematical Morphology

MA651 Topology. Lecture 10. Metric Spaces.

Theoretical Computer Science

Sets and Motivation for Boolean algebra

Lattice Theory Lecture 4. Non-distributive lattices

Latin squares: Equivalents and equivalence

Extension of continuous functions in digital spaces with the Khalimsky topology

CSE 206A: Lattice Algorithms and Applications Spring Minkowski s theorem. Instructor: Daniele Micciancio

Mathematics Review for Business PhD Students Lecture Notes

Quantitative Description of Genomic Evolution of Olfactory Receptors

(x k ) sequence in F, lim x k = x x F. If F : R n R is a function, level sets and sublevel sets of F are any sets of the form (respectively);

Math 341: Convex Geometry. Xi Chen

Digital Image Processing COSC 6380/4393

Analysis-3 lecture schemes

the time it takes until a radioactive substance undergoes a decay

Quasi-conformal maps and Beltrami equation

Smooth Structure. lies on the boundary, then it is determined up to the identifications it 1 2

R1: Sets A set is a collection of objects sets are written using set brackets each object in onset is called an element or member

A metric space is a set S with a given distance (or metric) function d(x, y) which satisfies the conditions

Uncertainty of Spatial Metric Relations in GIs

2 Metric Spaces Definitions Exotic Examples... 3

Proof: The coding of T (x) is the left shift of the coding of x. φ(t x) n = L if T n+1 (x) L

CHAPTER 7. Connectedness

Mapping Australian Curriculum (AC) Mathematics and VELS Mathematics. Australian Curriculum (AC) Year 9 Year 10/10A

Solutions to Tutorial 7 (Week 8)

Mathematics Review for Business PhD Students

Duality and Automata Theory

MATH 614 Dynamical Systems and Chaos Lecture 6: Symbolic dynamics.

Chapter 2 Metric Spaces

Master of Intelligent Systems - French-Czech Double Diploma. Hough transform

MAE 598: Multi-Robot Systems Fall 2016

A thesis. submitted in partial fulfillment. of the requirements for the degree of. Master of Science in Mathematics. Boise State University

Topics in Stochastic Geometry. Lecture 4 The Boolean model

Chapter II. Metric Spaces and the Topology of C

Real Analysis Notes. Thomas Goller

Neural Codes and Neural Rings: Topology and Algebraic Geometry

Math 201 Topology I. Lecture notes of Prof. Hicham Gebran

MASTERS EXAMINATION IN MATHEMATICS SOLUTIONS

Introduction to Proofs in Analysis. updated December 5, By Edoh Y. Amiran Following the outline of notes by Donald Chalice INTRODUCTION

Fuchsian groups. 2.1 Definitions and discreteness

Transcription:

Mathematical Morphology and Distance Transforms Vladimir Curic Centre for Image Analysis Swedish University of Agricultural Sciences Uppsala University

About the teacher PhD student at CBA Background in mathematics Research topic: Mathematical morphology and Discrete geometry Distance measures in digital spaces Adaptive mathematical morphology Contact: vlada@cb.uu.se

Today s lecture Mathematical morphology Distance transforms Chapters 9.1 9.6 in Gonzales-Woods book (for mathematical morphology) Notes for Distance transforms

Part 1 Mathematical Morphology

Morphology in Britannica encyclopedia Morphology, in biology, is the study of the size, shape, and structure of animals, plants, and micro-organisms and the relationships of their internal parts Morphology, in linguistics, is the study of the internal construction of words Mathematical morphology?

History Mathematical Morphology was founded in the mid-sixties in France George Matheron and Jean Serra are two founders of mathematical morphology Study of geometry of porous media 11th International Symposium on Mathematical Morphology ISMM 2013, May 27-29, Uppsala (http://ismm.cb.uu.se/)

Mathematical morphology The theory for the analysis of spatial structures Analysis of shapes and objects It is based on: Discrete space: Set theory, Lattice algebra Continuous space: Partial differential equations Structuring elements

Set theory The language of mathematical morphology is set theory We will mostly work in Z 2 Easy to extend to Z n Can be extended to a continuous domain If x = (x 1, x 2 ) is an element in X: x X Today s lecture covers only binary mathematical morphology (gray-scale mathematical morphology in Image Analysis 2)

Some set theory Empty set: Every element in A is also in B (subset): A B Union of A and B: C = A B = {x x A or x B} Intersection of A and B: C = A B = {x x A and x B} Disjoint/mutually exclusive: A B =

Some more set theory Complement of A: A C = {x x A} (OBS! with respect to which universe) Difference of A and B: A\B = {x x A and x B} = A B C Reflection (Transposition) of A: Â = { a a A} The set A is symmetric if and only if A = Â Translation of A by a vector z = (z 1, z 2 ): (A) Z = {x x = a+z, a A}

How to describe the SE Small set used to probe the image under study Possible to define in many different ways! Information needed: Position of origin for SE Position of elements belonging to SE

How to describe the SE The shape and size must be adapted to geometric properties for the objects OBS! Matlab assumes that the center of the structuring elements is its origin! Matlab: SE = strel(shape, parameters)

Five basic morphological operators Erosion Dilation Opening Closing Hit-or-Miss transform

Erosion OBS! Does the structuring element fit the set? Erosion of a set X by structuring element B, ε B (X) : all x in X such that B is in X when origin of B is x Shrinks the object Matlab: E = imerode(i,se) ε B (X) = X B = {x B x X}

Erosion - problem

Erosion - result

Erosion - Typical applications Erosion Removing structures of certain shape and size, given by SE

Erosion - properties 1 It is increasing, i.e., if A C, then A B C B 2 If the origin belongs to the structuring element B, then the erosion is anti-extensive, i.e., A B A 3 It is distributive over set intersection, i.e., (A 1 A 2 ) B = (A 1 B) (A 2 B) 4 It is translation invariant

Dilation OBS! Does the structuring element hit the set? Dilation of a set X by structuring element B, δ B (X) : all x in X such that the reflection of B hits X when origin of B is x Enlarges the object Matlab: D = imdilate(i,se) δ B (X) = X B = {x (ˆB) x X }

Dilation - problem

Dilation - result

Dilation - Typical applications Dilation Filling of holes of certain shape and size, given by SE

Dilation - properties 1 It is increasing, i.e., if A C, then A B C B 2 If the origin belongs to the structuring element B, then it is extensive A A B 3 It is distributive over set union, i.e., (A 1 A 2 ) B = (A 1 B) (A 2 B) 4 It is translation invariant

Erosion - Dilation duality Erosion and dilation are dual with respect to complementation and reflection (A B) C = A C ˆB (a) A (b) A B (c) (A B) C (d) A C (e) A C ˆB

How to choose appropriate SE? Different structuring elements give different results Depend on previous knowledge Linear structuring elements for linear structures Circular structuring elements for circular structures

Opening and closing Combine erosion and dilation using the same SE Opening Matlab: O = imopen(i,se) Closing Matlab: C = imclose(i,se)

Opening Erosion followed by dilation A B = (A B) B Eliminates protrusions Breaks connections Smooths contour

Opening (first erosion)

Opening (then dilation)

Opening - properties 1 It is idempotent, i.e., (A B) B = A B 2 It is increasing, i.e., if A C, then A B C B 3 It is anti-extensive, i.e., A B A 4 It is translation invariant

Closing Dilation followed by erosion A B = (A B) B Smooths contour Fuses narrow breaks and long thin gulfs Eliminates small holes Fills gaps in the contour

Closing (first dilation)

Closing (then erosion)

Closing - properties 1 It is idempotent, i.e., (A B) B = A B 2 It is increasing, i.e., if A C, then A B C B 3 It is extensive, i.e., A A B 4 It is translation invariant

Opening - Closing duality Opening and closing are dual operators A B = (A c ˆB) c Opening (roll ball inside of the object) Boundary of A B is equal to points in B that reaches closest to the boundary of A, when B is rolled inside A Closing (roll ball outside of the object) Boundary of A B is equal to points in B that reaches closest to the boundary of A, when B is rolled outside A

Exercise 1 Find erosion, dilation, opening and closing for the given image and SE

Exercise 2 Find erosion, dilation, opening and closing for the given image and SE

Hit-or-miss transformation Transformation that involves two structuring elements First has to fit with the object while, simultaneously, the second has to fit the background First has to hit the object while, simultaneously, second has to miss it A B = (A B 1 ) (A C B 2 ) Composite SE B = (B 1,B 2 ): Object part (B 1 ) and background (B 2 )

Hit-or-miss transformation ( or HMT) Alternative: A B = (A B 1 ) (A C B 2 ) = (A B 1 ) (A ˆB 2 ) C = (A B 1 )\(A ˆB 2 ) B 1 and B 2 share the same origin and are disjoint sets

Applications of mathematical morphology More in the course book: Chapter 9.5 Boundary extraction β(a) = A\(A B) Boundary extraction β(a) = (A B)\A

Part 2 Distance Transforms

Distance transforms Input: Binary image. Output: In each object (background) pixel, write the distance to the closest background (object) pixel. Definition A function d is a metric (distance measure) for the pixels x, y, and z if (i) d(x, y) 0 (ii) d(x, y) = 0 iff x = y (iii) d(x, y) = d(y, x) (iv) d(x, y) d(x, z)+d(z, y)

Different metrics Minkowski distances Euclidean d E (p, q) = (x p x q ) 2 +(y p y q ) 2 City block d 4 (p, q) = x p x q + y p y q Chess-board d 8 (p, q) = max( x p x q, y p y q ) where p = (x p,y p ) and q = (x q,y q ).

Different mask for distance transforms Minkowski distances Euclidean mask: 2 1 2 1 p City block mask: 2 1 2 1 p Chess-board mask: 1 1 1 1 p Weighted measures 4 3 4 3 p Matlab DT = bwdist(i,method) If distance between two 4-connected pixels is 3, then the distance between 4-connected pixels should be 4. Chamfer 3,4 since 4/3 1.33 is close to 2.

Algorithm for distance transformation Distance from each object pixel to the closest background pixel p current pixel g 1 g 4 neighbouring pixels w 1 w 4 weights (according to choice of metric) 1. Set background pixels to zero and object pixels to infinity. 2. Forward pass, from (0, 0) to (max(x), max(y)): if p > 0, p = min(g i +w i ), i = 1, 2, 3, 4. 3. Backward pass, from (max(x), max(y)) to (0, 0): If p > 0, p = min(p, min(g i +w i )), i = 1, 2, 3, 4.

Chamfer 3, 4 distance Binary original image 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0

Chamfer 3, 4 distance 1. Starting image 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 3 4 3 p

Chamfer 3, 4 distance 2. First pass from top left down to bottom right 0 0 0 0 0 0 0 0 0 3 0 0 3 0 0 0 0 3 3 0 3 0 0 0 0 3 4 3 4 3 3 0 0 3 6 6 7 6 4 0 0 3 6 9 10 8 4 0 0 0 0 3 6 8 0 0 0 0 0 0 0 0 0 0 p 3 4 3 4

Chamfer 3, 4 distance 3. Second pass from bottom right down to top left 0 0 0 0 0 0 0 0 0 3 0 0 3 0 0 0 0 3 3 0 3 0 0 0 0 3 4 3 4 3 3 0 0 3 6 6 7 6 3 0 0 3 3 4 6 4 3 0 0 0 0 3 3 3 0 0 0 0 0 0 0 0 0 0

Applications using the distance transform (DT) I. Find the shortest path between two points a and b. 1 Generate the DT with a as the object. 2 Go from b in the steepest gradient direction. II. Find the radius of a round object 1 Generate the DT of the object. 2 The maximum value equals the radius. Next lecture and Lab 2: watershed algorithm!

Applications using the distance transform (DT) III. Skeletons Definitions: If O is the object, B is the background, and S is the skeleton, then S is topological equivalent to O S is centered in O S is one pixel wide (difficult!) O can be reconstructed from S Matlab SK = bwmorph(i,operation)

Skeletons (Centers of Maximal Discs) A disc is made of all pixels that are within a given radius r. A disc in an object is maximal if it is not covered by any other disc in the object. A reversible representation of an object is the set of centers of maximal discs. Algorithm Find the skeleton with Centers of Maximal Discs (CMD) Completely reversible situation 1 Generate distance transform of object 2 Identify CMDs (smallest set of maxima) 3 Link CMDs Pruning is to remove small branches (no longer fully reversible.)

Topic not covered in this lecture Mathematical morphology for gray-valued image (Image Analysis 2) Morphological Skeletons Number of applications of mathematical morphology and distance transform (Lab 2)

Trends in mathematical morphologypossible topics for master thesis Adaptive mathematical morphology Nonlocal mathematical morphology Multi-valued mathematical morphology Efficient GPU implementations

Exercise Reading material: Chapters 9.1-9.6 Two problem given during the lecture (OBS! non-symmetric SE) Book: Exercise 9.3, 9.5, 9.7, 9.14, 9.19