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.4 Grayscale Morphological Operators
Morphological concepts may be extended to grayscale images. The common approach is to use a grayscale extremum operation over a small neighborhood defined by the structuring element. Grayscale dilation is a convolution-like operation. A typically small structuring element is scanned over an image and, at each position, the maximum of point-by-point sums of the image and the structuring element is computed. For notational convenience we assume arrays with square dimensions. Then, given a 2M+1×2M+1 structuring element B and an N×N image array A, the dilation of A by B may be defined as
for all i,j such that -M≤i,j≤M, with 0≤n
_{1}
,n
_{2}
≤N-1. For example, with M=1 and B(i,j)=0 for all
i, j
, we get
Dilation tends to grow the white regions of an image. If the structuring element has positive values, the resulting image tends to be brighter.
Grayscale erosion is the dual of grayscale dilation; the structuring element values are subtracted from the image during the scanning process and a minimum of each set of values is returned. This may be implemented as a correlation-like operation where the extremum operator
Min
and subtraction replace multiplication and addition, respectively. Given a 2M+1×2M+1 structuring element B and an N×N image array A, the erosion of A by B may be defined as
for all i,j such that -M≤i,j≤M, with 0≤n
_{1}
,n
_{2}
≤N-1. Erosion tends to shrink the white regions of an image. If the structuring element has positive values, the resulting image tends to be darker.
GrayscaleDilate
[
img
,
s
]
gives
GrayscaleErode
[
img
,
s
]
gives
GrayscaleClose
[
img
,
s
]
gives
GrayscaleOpen
[
img
,
s
]
gives
GrayscaleTopHat
[
img
,
s
]
gives
Grayscale morphology functions.
This loads the package.
In[1]:=
Here we choose a 3×3 structuring element of ones and generate a box-like image.
In[2]:=
Here is the dilation result.
In[3]:=
Out[3]//MatrixForm=
Here is the result of eroding the previous output.
In[4]:=
Out[4]//MatrixForm=
Here is an example of grayscale dilation and erosion of the example
books
image. The structuring element
B
is defined as a uniform array of ones.
In[5]:=
In[6]:=
Out[6]=
Grayscale dilation and erosion are frequently concatenated to form grayscale open and close operators. The expressions for opening and closing have the same form as their binary counterparts. The closing of image A by structuring element B is simply the dilation of A by B, followed by erosion of the result with B (see Equation (6.3.7)). Similarly, the opening of A by B, is an erosion of A followed by dilation (see Equation (6.3.8)).
In[7]:=
Out[7]=
The morphological top-hat transformation (also known as the white top-hat transformation) is defined as
where
is the grayscale open operation. This transformation is useful for enhancing positive peaks in the dark areas of an image. The structuring element should be larger than the peaks.
In[8]:=
Out[8]=
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.