PRODUCTS
Products Overview
Mathematica
Mathematica Student Edition
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Wolfram
SystemModeler
Wolfram
Finance Platform
Mathematica
Add-Ons
Wolfram|Alpha Products
SOLUTIONS
Solutions Overview
Engineering
Aerospace Engineering & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Materials Science
Mechanical Engineering
Operations Research
Optics
Petroleum Engineering
Biotechnology & Medicine
Bioinformatics
Medical Imaging
Finance, Statistics & Business Analysis
Actuarial Sciences
Data Science
Econometrics
Economics
Financial Engineering & Mathematics
Financial Risk Management
Statistics
Software Engineering & Content Delivery
Authoring & Publishing
Interface Development
Software Engineering
Web Development
Science
Astronomy
Biological Sciences
Chemistry
Environmental Sciences
Geosciences
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
Education
STEM Education Initiative
Higher Education
Community & Technical College Education
Primary & Secondary Education
Students
Technology
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
Merchandise
SUPPORT
Support Overview
Mathematica
Documentation
Support Articles
Learning Center
Technical Services
Training
Does My Site Have a License?
Wolfram User Portal
COMMUNITY
COMPANY
About Wolfram Research
News
Events
Wolfram Blog
Careers
Stephen Wolfram's Home Page
Contact Us
OUR SITES
All Sites
Wolfram|Alpha
Connected Devices Project
Demonstrations Project
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Media
Wolfram
Tones
Wolfram Science
Stephen Wolfram
DOCUMENTATION CENTER SEARCH
User's Guide
Morphology
6.2 Set Description of Binary Images
The language of mathematical morphology is that of set theory. Sets in mathematical morphology represent the shapes that are visible in binary images. The set of all the white (or black) pixels in a binary image constitutes a complete description of the image. Each element of the set is a 2-tuple of integer values identifying the Cartesian coordinates of each white (or black) pixel with respect to some assumed coordinate center. It is typical to assume that the coordinate center coincides with a corner element of the array.
ToSet
[
img
]
returns
ToSet
[
img
,
cntr
]
returns
ToSet
[
img
,
cntr
,
v
]
returns
FromSet
[
dims
,
set
]
creates an array of dimensions
dims
with ones in positions given by
set
FromSet
[
dims
,
set
,
cntr
]
returns an array of dimensions
dims
with ones in positions given by
set
relative to
cntr
FromSet
[
dims
,
set
,
cntr
,
{
a
,
b
}
]
returns
,
with element
a
in positions given by
set
relative to
cntr
,
and b otherwise
GlobalSet
[
{
n
,
m
}
,
cntr
]
returns a list of all positions in an array of dimensions
n × m
and a center at
cntr
ComplementSet
[
,
]
returns all the elements of set
that are not in set
Set-theoretic functions.
This loads the package.
In[1]:=
Here is an example binary image.
In[2]:=
The set description
of image A is obtained by locating all the ones in the image. We assume the default origin location at position {1, 1} in array
A
and return all positions as offsets from the origin. Different choices for the location of the origin result in different set descriptions
. The set descriptions differ by a translation.
In[3]:=
Out[3]=
To obtain the set complement (or background image) of some set
, it is necessary to define the global set
, a set of all coordinate pairs of an N
_{1}
× N
_{2}
image.
In[4]:=
Out[4]=
Here is the set complement.
In[5]:=
Out[5]=
Here we view the complement image.
In[6]:=
Out[6]//MatrixForm=
The set description of a translation of a set is the vector sum of the positions of the elements of the set with a translation vector. Consider a translation of set
by the vector {1,1}.
In[7]:=
Out[7]=
In[8]:=
Out[8]//MatrixForm=
The set description of a reflection of a set
with respect to element
_{0}
is the vector difference of
_{0}
and the position of each element of the set. Typically,
_{0}
is the origin. However, in the context of a matrix implementation of reflection, it is more convenient to set
_{0}
={N
_{1}
-1,N
_{2}
-1}, where N
_{1}
, N
_{2}
are the row and column dimensions of the matrix.
In[9]:=
Out[9]=
In[10]:=
Out[10]//MatrixForm=
In matrix notation, reflection of an N
_{1}
× N
_{2}
array A denoted
, is defined
where
is the
r
th and
c
th element of array
. The last result is the same as that obtained using the function
Reflect
.
In[11]:=
Out[11]=
The set theoretic concepts of translation and reflection will be used in the next section to define the fundamental operators of binary morphology
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.