Dilation
Details and Options
- Dilation is also known as Minkowski addition.
- Dilation works with arbitrary 2D and 3D images, operating separately on each channel, as well as data arrays of any rank.
- The structuring element ker is a matrix containing
s and
s. - Dilation[image,r] is equivalent to Dilation[image,BoxMatrix[r]].
- The structuring element is automatically padded with zeros to have odd dimensions. »
- Dilation takes a Padding option that specifies the values to assume for pixels outside the image.
- By default, Padding0 is used for images, corresponding to pixel value 0 for all channels.
Examples
open all close allBasic Examples (3)
Scope (13)
Data (7)
Dilation of a 2D binary array:
Dilation[(| | | | | | |
| - | - | - | - | - | - |
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 1 | 1 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 0 | 0 | 0 | 0 | 0 |), (| | | |
| - | - | - |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 0 | 0 | 1 |)]//MatrixFormDilation[[image], (| | | |
| - | - | - |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |)]Dilation[(| | | | | |
| - | - | - | - | - |
| 2 | 3 | 2 | 5 | 5 |
| 1 | 4 | 1 | 2 | 5 |
| 3 | 2 | 1 | 4 | 5 |
| 2 | 1 | 2 | 3 | 1 |
| 1 | 1 | 2 | 4 | 2 |), 1]//MatrixFormdata = QuantityMagnitude@Values[FinancialData["AT&T", {{2012, 7, 1}, {2013, 1, 1}, "Day"}]];ListLinePlot[{data, Dilation[data, 5]}]Dilation of a grayscale image:
Dilation[[image], 3]Dilation[[image], 2]Dilation on a symbolic array of data:
Dilation[{a, b, c}, 1]Parameters (6)
Dilation[[image], {{1, 1, 1}}]Dilation[[image], {{1}, {1}, {1}}]Dilate with radius
, equivalent to BoxMatrix[r]:
Dilation[[image], 2]Dilate with a diagonal structuring element:
Dilation[[image], IdentityMatrix[9]]Structuring elements with even dimensions are right-padded with zeros:
Dilation[ArrayPad[{{1}}, 2], (| | |
| - | - |
| 1 | 1 |
| 1 | 1 |)] === Dilation[ArrayPad[{{1}}, 2], (| | | |
| - | - | - |
| 1 | 1 | 0 |
| 1 | 1 | 0 |
| 0 | 0 | 0 |)]Dilate a 3D volume using a 3D kernel:
Dilation[[image], DiamondMatrix[{2, 2, 2}]]Options (2)
Padding (2)
By default, the smallest possible number is used for padding when applying dilation to arrays:
Dilation[{1, 2, 3, 4, 5}, 1]Dilation[{1, 2, 3, 4, 5}, 1, Padding -> 100]By default, Padding->0 is used for images:
i = [image];Dilation[i, 20]Dilation[[image], 20, Padding -> Red]Applications (2)
Dilation increases the amount of white space in the image, therefore removing smaller, dark features:
Dilation[[image], 1]Compute external morphological gradient as a difference between dilated and original image:
i = [image];
ImageSubtract[Dilation[i, 1], i]Properties & Relations (2)
Binary dilation is extensive if the center of the structuring element is 1:
f = (| | | | | | |
| - | - | - | - | - | - |
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 1 | 1 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 0 | 0 | 0 | 0 | 0 |);ker = (| | | |
| - | - | - |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 0 | 0 | 1 |);(d = Dilation[f, ker])//MatrixFormExtensivity means that all elements of f are included in the Dilation[f,ker]:
BitAnd[f, d] === fDilation with a box structuring element is the same as MaxFilter:
MaxFilter[[image], 1] == Dilation[[image], 1]Tech Notes
Related Guides
Text
Wolfram Research (2008), Dilation, Wolfram Language function, https://reference.wolfram.com/language/ref/Dilation.html (updated 2012).
CMS
Wolfram Language. 2008. "Dilation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/Dilation.html.
APA
Wolfram Language. (2008). Dilation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Dilation.html
BibTeX
@misc{reference.wolfram_2026_dilation, author="Wolfram Research", title="{Dilation}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/Dilation.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_dilation, organization={Wolfram Research}, title={Dilation}, year={2012}, url={https://reference.wolfram.com/language/ref/Dilation.html}, note=[Accessed: 12-June-2026]}