Download Ch 5 part2 Geometric Transformation

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Charge-coupled device wikipedia , lookup

Computer vision wikipedia , lookup

Anaglyph 3D wikipedia , lookup

Autostereogram wikipedia , lookup

Edge detection wikipedia , lookup

Rendering (computer graphics) wikipedia , lookup

BSAVE (bitmap format) wikipedia , lookup

Indexed color wikipedia , lookup

Hold-And-Modify wikipedia , lookup

Stereoscopy wikipedia , lookup

Image segmentation wikipedia , lookup

Medical image computing wikipedia , lookup

Stereo display wikipedia , lookup

Image editing wikipedia , lookup

Spatial anti-aliasing wikipedia , lookup

Transcript
Morphological Image Processing
(Chapter 9)
CSC 446
Lecturer: Nada ALZaben
Outline:







Introduction.
Some basic Concepts from Set theory
Logic operations involving Binary Images.
Dilation and Erosion
Open and Close
Processing gray scale images.
The Hit-and-Miss transformation
Introduction
 The
word morphology commonly denotes
a branch of biology that deals with the form
and structure of animals and plants.
 Mathematical morphology is a tool that
extract image components that are useful in
the representation and discription of region
shape such as:
Boundaries
Skeletons
Convex hull .
 Sets
in mathematical morphology represent
objects in an image.
Some basic Concepts from Set theory
be set in 𝑍 2 . If a= 𝑎1 , 𝑎2 is an element of A
then we write:
𝑎 ∈ 𝐴 if not we say 𝑎 ∈ 𝐴
 Empty set is called null set and denoted by ∅.
 Sets are specified by the contents of two braces {}.
 Elements of the sets in this chapter are the pixel
coordinates of representing objects in an image.
 Example:- when we write
𝐶 = 𝑤 𝑤 = −𝑑, 𝑓𝑜𝑟 𝑑 ∈ 𝐷
we mean that set C is the set of elements w such that
w is formed by multiplying each of the two
coordinates of all the elements of set D by -1.
 Let A
Some basic Concepts from Set
theory.. (cont.)
 if
every elements A is also an element of another
set B then A is subset of B, 𝐴 ⊆ 𝐵.
 Union of sets take all elements of A and B is
C = 𝐴 ∪ 𝐵.
 Intersection of two sets A and B is set of elements
belonging to both A and B , C = 𝐴 ∩ 𝐵.
 Two sets are disjoint or mutually exclusive if they
have no common elements C = 𝐴 ∩ 𝐵 = ∅
 The complement of a set A is the set of element
not contained in A. 𝐴𝑐 = {w|w ∈ 𝐴}
 The difference of two sets A and B is 𝐴 − 𝐵
= {w|w ∈ 𝐴, w ∈B}=𝐴 ∩ 𝐵𝑐
Some basic Concepts from Set
theory.. (cont.)
The
reflection of set B is (𝐵) is defined as
𝐵 = 𝑤 𝑤 = −𝑏, 𝑏 ∈ 𝐵
The translation of set A by point z=(𝑧1 , 𝑧2 ),
(𝐴)𝑧 is defined as
(𝐴)𝑧 = 𝑐 𝑐 = 𝑎 + 𝑧, 𝑓𝑜𝑟 𝑎 ∈ 𝐴
Example.
Logic Operation Involving Binary
Images.
Mostly
used images are the binary images.
The principle logic operations used in image
processing are AND, OR and NOT
Logic operations are operated on a pixel by
pixel basis between 2 images ,but, (NOT)
operation use one image.

Logic Operation Involving Binary
Images.
More
operations:
XOR: when only 1 in a pixel or the other
pixel is 1 but not both.
NOT-AND: select the black pixel that
simultaneously are in B but not in A.
NOTE:
Intersection ==AND
Union ==OR
Complement ==NOT
Logic Operation Involving Binary
Images.
Logic Operation Involving Binary
Images.
Note:
-In binary images white will represent the foreground (1) while black is the
background (0).
-The set of coordinate to the image is simply the set of 2D Euclidean coordinates
of al the foreground pixels in the image as the origin normally takes in one of the
corners.
Logic Operation Involving Binary
Images.
Dilation and Erosion
Dilation
is a morphological transformation
which essentially expands an object by adding
a layer of pixels around it’s edges and as a
result it shrinks any hole in the object.
With A and B as sets in 𝑍 2 the Dilation of A
by B denoted as: 𝐴 ⊕ 𝐵 = 𝑧 𝐵 𝑧 ∩ 𝐴 ≠ ∅
This equation means get the reflection of B
about its origin and shifting this reflection by
z. the dilation of A by B then is a set of all
displacements z such that 𝐵 and A overlap
by at least one element.
B usually called structuring element (kernal).
Dilation and Erosion
Dilation
advantage
in bridges gaps in
an image.
Dilation Algorithm:
Consider
each of the background pixels in the
input image as input.
For each background pixel we put the
structure element on top of the image so that
the origin of the structure element coincides
with the input image.
If at least one pixel in the structure
element coincides with the foreground
pixel in the image underneath then the input
pixel is set to the foreground , otherwise
leave it as it background value.
Dilation and Erosion
Dilation example
1
1
1
1
1
1
1
1
1
Dilation and Erosion
Erosion
is a morphological dual to dilation
which essentially shrinks an object by
removing a layer of pixels around it’s edges
and as a result it expands any hole in the
object.
With A and B as sets in 𝑍 2 the Erosion of A
by B denoted as: 𝐴 ⊖ 𝐵 = 𝑧 (𝐵)𝑧 ⊆ 𝐴
Meaning the erosion of A by B then is a set of
all points z such that (𝐵) translated by z is
contained in A.
Dilation and Erosion
 Erosion
advantage in
eliminating irrelevant
details in term of size
in an image.
 Note: if the structure
element is larger than
the object then the
object will be
eliminated completely
Erosion algorithm:
Consider
each of the foreground pixels in
the input image as input.
For each foreground pixel we put the
structure element on top of the image so that
the origin of the structure element coincides
with the input image.
If for every pixel in the structure element
the corresponding pixel in image underneath
is a foreground pixel then the input pixel is
left as foreground , otherwise set it to
background value.
Dilation and Erosion
Opening and Closing
Now
we know that Erosion shrinks an object
while Dilation expands it.
By combining these operations we get Open
or Close operation.
Open: Erosion then Dilation
Close: Dilation then Erosion.
Opening
and closing smothes the contour of
an object but:
Opening: breaks narrow lines and eliminates thin
protrusions( do thickening)
Closing: focus on thin protrusions so it eliminates
small holes and fill gaps.
Opening and Closing
Opening:𝐴 ∘ 𝐵
= 𝐴⊖𝐵 ⊕𝐵
Closing: 𝐴 ⦁ 𝐵 = 𝐴 ⊕ 𝐵 ⊖ 𝐵
ex:
Opening and Closing
Perform
open transformation on image 1
and closing on image 2 where B is 1?
Open by 1
Close by 1
Processing gray scale images
 Same
methods can be applied to gray scale images
just little modification.
 Grayscale
erode: output at a point is minimum
of image pixel and structuring element pixel.
𝐷𝐺 𝐴, 𝐵 = 𝑚𝑖𝑛[𝑗, 𝑘] ∈ 𝐵 𝑎 𝑚 − 𝑗, 𝑛 − 𝑘 , 𝑏 𝑗, 𝑘
 Grayscale dilate: output is maximum of image and
structuring element.
𝐷𝐺 𝐴, 𝐵 = 𝑚𝑎𝑥[𝑗, 𝑘] ∈ 𝐵 𝑎 𝑚 − 𝑗, 𝑛 − 𝑘 , 𝑏 𝑗, 𝑘
Processing gray scale images
0
0
0
0
0
0
0
0
1 1
0
0
3
5
5
3
0
0
1 1
0
0
5
9
9
5
0
0
0
0
3
5
5
3
0
0
0
0
0
0
0
0
0
0
The structuring
element
Initial image
1
1
1
1
1
1
1
1
-1 -1 -1 -1 -1 -1 -1 -1
1
1
4
6
6
6
4
1
-1 -1
2
4
2
-1 -1 -1
1
1
6
10 10 10
6
1
-1 -1
2
4
2
-1 -1 -1
1
1
6
10 10 10
6
1
-1 -1 -1 -1 -1 -1 -1 -1
1
1
4
6
4
1
-1 -1 -1 -1 -1 -1 -1 -1
6
6
Dilation results
Erosion results
The Hit-and-Miss transform
The
hit-and-miss transform is a general binary
morphological operation that can be used to
look for particular patterns of foreground and
background pixels in an image. A⊛B
It is actually the basic operation of binary
morphology since almost all the other binary
morphology operators can be derived from it.
As with other binary morphology operators
it takes as input a binary image and a
structuring element and produce another
binary image as output.
The Hit-and-Miss transform
The
structure element contain both 1 and 0
The operation is done as: translating the
structure image over all points in the image
then by comparing the structure element 1’s
and 0’s with image if they match then set the
underlying pixel to foreground otherwise set
as background.
X
1
X
1
1
Example of structure element  0
0
0
X
The Hit-and-Miss transform
Ex: assume
the origin is at the center of 3X3
structure element. In order to find all corners
in an image we need to run hit and miss four
times with four different structure element.
X
1
X
X
1
X
0
0
X
X
0
0
0
1
1
1
1
0
0
1
1
1
1
0
0
0
X
x
0
0
x
1
X
x
1
X
After
obtaining the locations of corners we
then simply OR all these images together to
get the final result.
The Hit-and-Miss transform
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
0
0
0
0
1
1
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
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
X
0
1
1
x
1
X
Exercise: do the rest and find the
result..
Exercise :
 How
can the hit and miss transform be used
to perform erosion?
 How can the hit and miss transform be used
with the not operation to perform dilation?
 What is the smallest number of different
structuring elements that you would need to
use to locate all foreground points in an
image where they have at least one neighbor
using the hit and miss transform? What do
they look like?