translate
Translate structuring element
Syntax
Description
Examples
Translate Structuring Element
Read an image into the workspace.
I = imread('cameraman.tif');
Create a structuring element and translate it down and to the right by 25 pixels.
se = translate(strel(1), [25 25]);
Dilate the image using the translated structuring element.
J = imdilate(I,se);
Display the original image and the translated image.
figure
imshow(I), title('Original')
figure
imshow(J), title('Translated');
Translate Offset Structuring Element
Create an offset structuring element.
SE = offsetstrel('ball', 5, 6.5)
SE = offsetstrel is a ball shaped offset structuring element with properties: Offset: [11x11 double] Dimensionality: 2
SE.Offset
ans = 11×11
-Inf -Inf 0 0.8123 1.6246 2.4369 1.6246 0.8123 0 -Inf -Inf
-Inf 0.8123 1.6246 2.4369 3.2492 3.2492 3.2492 2.4369 1.6246 0.8123 -Inf
0 1.6246 2.4369 3.2492 4.0615 4.0615 4.0615 3.2492 2.4369 1.6246 0
0.8123 2.4369 3.2492 4.0615 4.8738 4.8738 4.8738 4.0615 3.2492 2.4369 0.8123
1.6246 3.2492 4.0615 4.8738 5.6861 5.6861 5.6861 4.8738 4.0615 3.2492 1.6246
2.4369 3.2492 4.0615 4.8738 5.6861 6.4984 5.6861 4.8738 4.0615 3.2492 2.4369
1.6246 3.2492 4.0615 4.8738 5.6861 5.6861 5.6861 4.8738 4.0615 3.2492 1.6246
0.8123 2.4369 3.2492 4.0615 4.8738 4.8738 4.8738 4.0615 3.2492 2.4369 0.8123
0 1.6246 2.4369 3.2492 4.0615 4.0615 4.0615 3.2492 2.4369 1.6246 0
-Inf 0.8123 1.6246 2.4369 3.2492 3.2492 3.2492 2.4369 1.6246 0.8123 -Inf
⋮
Translate the structuring element.
V = [2 2]; SE2 = translate(SE,V)
SE2 = offsetstrel is a ball shaped offset structuring element with properties: Offset: [15x15 double] Dimensionality: 2
SE2.Offset
ans = 15×15
-Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf
-Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf
-Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf
-Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf
-Inf -Inf -Inf -Inf -Inf -Inf 0 0.8123 1.6246 2.4369 1.6246 0.8123 0 -Inf -Inf
-Inf -Inf -Inf -Inf -Inf 0.8123 1.6246 2.4369 3.2492 3.2492 3.2492 2.4369 1.6246 0.8123 -Inf
-Inf -Inf -Inf -Inf 0 1.6246 2.4369 3.2492 4.0615 4.0615 4.0615 3.2492 2.4369 1.6246 0
-Inf -Inf -Inf -Inf 0.8123 2.4369 3.2492 4.0615 4.8738 4.8738 4.8738 4.0615 3.2492 2.4369 0.8123
-Inf -Inf -Inf -Inf 1.6246 3.2492 4.0615 4.8738 5.6861 5.6861 5.6861 4.8738 4.0615 3.2492 1.6246
-Inf -Inf -Inf -Inf 2.4369 3.2492 4.0615 4.8738 5.6861 6.4984 5.6861 4.8738 4.0615 3.2492 2.4369
⋮
Input Arguments
SE
— Structuring element
strel
or offsetstrel
object
Structuring element, specified as a strel
or offsetstrel
object.
v
— Translation offsets
numeric vector
Translation offsets, specified as a numeric vector. Each element specifies the amount of desired translation in the corresponding dimension.
Output Arguments
SE2
— Translated structuring element
strel
or offsetstrel
object
Translated structuring elements, returned as a strel
or offsetstrel
object.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)