WolframAlpha.com
WolframCloud.com
All Sites & Public Resources...
Products & Services
Wolfram|One
Mathematica
Wolfram|Alpha Notebook Edition
Finance Platform
System Modeler
Wolfram Player
Wolfram Engine
WolframScript
Enterprise Private Cloud
Application Server
Enterprise Mathematica
Wolfram|Alpha Appliance
Enterprise Solutions
Corporate Consulting
Technical Consulting
Wolfram|Alpha Business Solutions
Resource System
Data Repository
Neural Net Repository
Function Repository
Wolfram|Alpha
Wolfram|Alpha Pro
Problem Generator
API
Data Drop
Products for Education
Mobile Apps
Wolfram Player
Wolfram Cloud App
Wolfram|Alpha for Mobile
Wolfram|Alpha-Powered Apps
Services
Paid Project Support
Wolfram U
Summer Programs
All Products & Services »
Technologies
Wolfram Language
Revolutionary knowledge-based programming language.
Wolfram Cloud
Central infrastructure for Wolfram's cloud products & services.
Wolfram Science
Technology-enabling science of the computational universe.
Wolfram Notebooks
The preeminent environment for any technical workflows.
Wolfram Engine
Software engine implementing the Wolfram Language.
Wolfram Natural Language Understanding System
Knowledge-based broadly deployed natural language.
Wolfram Data Framework
Semantic framework for real-world data.
Wolfram Universal Deployment System
Instant deployment across cloud, desktop, mobile, and more.
Wolfram Knowledgebase
Curated computable knowledge powering Wolfram|Alpha.
All Technologies »
Solutions
Engineering, R&D
Aerospace & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Mechanical Engineering
Operations Research
More...
Finance, Statistics & Business Analysis
Actuarial Sciences
Bioinformatics
Data Science
Econometrics
Financial Risk Management
Statistics
More...
Education
All Solutions for Education
Tech & Trends
Machine Learning
Multiparadigm Data Science
High-Performance Computing
Quantum Computation Framework
Software & Web
Software Development
Authoring & Publishing
Interface Development
Web Development
Sciences
Astronomy
Biology
Chemistry
More...
All Solutions »
Learning & Support
Learning
Wolfram Language Documentation
Fast Introduction for Programmers
Wolfram U
Videos & Screencasts
Wolfram Language Introductory Book
Webinars & Training
Summer Programs
Books
Need Help?
Support FAQ
Wolfram Community
Contact Support
Premium Support
Paid Project Support
Technical Consulting
All Learning & Support »
Company
About
Company Background
Wolfram Blog
Events
Contact Us
Work with Us
Careers at Wolfram
Internships
Other Wolfram Language Jobs
Initiatives
Wolfram Foundation
MathWorld
Computer-Based Math
A New Kind of Science
Wolfram Technology for Hackathons
Student Ambassador Program
Wolfram for Startups
Demonstrations Project
Wolfram Innovator Awards
Wolfram + Raspberry Pi
Summer Programs
More...
All Company »
Search
Legacy Documentation
Digital Image Processing
(2000)
This is documentation for an obsolete product.
Current products and services
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
Enable JavaScript to interact with content and submit forms on Wolfram websites.
Learn how »