translate

Translate structuring element (STREL)

Syntax

SE2 = translate(SE,V)

Description

SE2 = translate(SE,V) translates the structuring element SE in N-D space. SE is an array of structuring elements, created using the strel function.

V is an N-element vector that specifies the offsets of the desired translation in each dimension, relative to the structuring element's origin. If you specify an array, translate reshapes the array into a vector.

SE2 is an array of structuring elements the same size as SE. Each individual structuring element in SE2 is the translation of the corresponding structuring element in SE.

Class Support

SE and SE2 are STREL objects; V is a vector of doubles that must contain only integers.

Examples

Translate a 3-by-3 structuring element.

se = strel(ones(3))

se2 = translate(se,[-2 -2])

The following figure shows the original structuring element and the translated structuring element.

Dilating with a translated version of strel(1) is a way to translate an input image in space by an integer number of pixels. This example translates the cameraman.tif image down and to the right by 25 pixels.

I = imread('cameraman.tif');
se = translate(strel(1), [25 25]);
J = imdilate(I,se);
imshow(I), title('Original')
figure, imshow(J), title('Translated');

See Also

|

Was this topic helpful?