You are on page 1of 22

Image Processing Using MATLAB

Fundamental concepts and operations


 Basic set operations:

 Complement

 Difference

 Translation

 Reflection
Fundamental concepts and operations
 Basic set
operations

Copyright © 2011 by John Wiley & Sons, Inc. All rights reserved.
Fundamental concepts and operations
 Logical equivalents(e)of set theory operations
(f)

Figur e 13.1 Basic set operations: (a) set A; (b) translation of A by x = (x 1 , x 2 ); (c) set B ;
 Intersection ~ logical AND
reflection of B ; (e) set A and its complement A c ; (f) set difference (A − B ).

The equivalent expression using conventional image processing notation would be:

1 if A (x, y) and B (x, y) are both 1
C (x, y) = (13
0 otherwise
This expression leads quite easily to a single MATLAB statement that perform
 Similarly:
intersection operation using the logical operator AND (&). Similarly, complement can
obtianed using the
 Complement ~unary NOT
logical (~) operator, set union can beimplemented using the logi
NOT
operator OR (| ) and set difference (A − B ) can be expressed as ( A & ~B) . Figure 1
 Union ~ logical OR for two binary input images. Please notethat wehavefollow
showsrepresentativeresults
 Difference ~ A AND
theIPT convention, (NOTforeground
representing B) (1-valued) pixelsaswhitepixelsagainst abla
background.

13.2.1 Copyright
By Oge Marques The structuring element
© 2011 by John Wiley &
Fundamental concepts and operations
 Logical equivalents of set theory operations
The structuring element
 Examples:

square cross

 MATLAB functions
 strel
Dilation and erosion
 The two fundamental morphological image
operations.
 Dilation: a morphological operation whose
effect is to “grow” or “thicken” objects in a
binary image.
 The extent and direction of this thickening is
controlled by the size and shape of the structuring
element.
 Mathematically:
Dilation and erosion
 Dilation – geometrical interpretation
Dilation and erosion
 Dilation – MATLAB example

a = [0 0 0 0 0;
0 1 1 0 0;
0 1 1 0 0;
0 0 1 0 0;
0 0 0 0 0]

se1 = strel('square',2)
b = imdilate (a,se1)

se2 = strel('rectangle', [1 2])


c = imdilate (a,se2)
Dilation and erosion
 Erosion: a morphological operation whose effect is
to “shrink” or “thin” objects in a binary image.
 The direction and extent of this thinning is controlled
by the shape and size of the structuring element.

 Mathematically:
Dilation and erosion
 Erosion – geometrical interpretation
Dilation and erosion
 Erosion– MATLAB example (13.4)

a = [ 0 0 0 0 0 ; 0 1 1 1 0; 1 1 1 0 0; 0 1 1 1 1; 0 0 0 0 0]
se1 = strel('square',2)
b = imerode (a,se1)

se2 = strel('rectangle', [1 2])


c = imerode (a,se2)
Dilation and erosion
 Erosion and dilation can be interpreted in terms of
whether a SE fits or hits an image (region)

 Erosion:

 Dilation:
Compound operations
 Opening: erosion followed by dilation
 Mathematically:

or:

 In MATLAB: imopen (Tutorial 13.1)


Compound operations

 Opening:
example
Compound operations
 Opening: geometrical interpretation
Compound operations
 Closing: dilation followed by erosion
 Mathematically:

 In MATLAB: imclose (Tutorial 13.1)


Compound operations

 Closing:
example
Compound operations
 Closing: geometrical interpretation
Morphological algorithms

A = imread('circles.png');
B = bwmorph(A,'skel', Inf);
C = bwmorph(B,'spur',Inf);
D = bwmorph(A,'remove');
E = bwmorph(D,'thicken',3);
F = bwmorph(E,'thin',3);
Morphological
algorithms
Morphological algorithms

 Operations
supported by
bwmorph

You might also like