Translate image in two-dimensional plane using displacement vector
The GeometricTranslator object translates images in two-dimensional plane using displacement vector.
H = vision.GeometricTranslator returns a System object, H. This object moves an image up or down, and left or right.
H = vision.GeometricTranslator(Name,Value) returns a geometric translator System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).
|Code Generation Support|
|Supports MATLAB® Function block: Yes|
|Code Generation Support, Usage Notes, and Limitations|
Output size as full or same as input image size
Specify the size of output image after translation as one of Full | Same as input image. The default is Full. When you set this property to Full, the object outputs a matrix that contains the translated image values. When you set this property to Same as input image, the object outputs a matrix that is the same size as the input image and contains a portion of the translated image.
Source of specifying offset values
Specify how the translation parameters are provided as one of Input port | Property. The default is Property. When you set the OffsetSource property to Input port, a two-element offset vector must be provided to the object's step method.
Specify the number of pixels to translate the image as a two-element offset vector. The default is [1.5 2.3]. The first element of the vector represents a shift in the vertical direction and a positive value moves the image downward. The second element of the vector represents a shift in the horizontal direction and a positive value moves the image to the right. This property applies when you set the OffsetSource property to Property.
Maximum number of pixels by which to translate image
Specify the maximum number of pixels by which to translate the input image as a two-element real vector with elements greater than 0. The default is [8 10]. This property must have the same data type as the Offset input. This property applies when you set the OutputSize property to Full and OffsetSource property to Input port. The system object uses this property to determine the size of the output matrix. If the Offset input is greater than this property value, the object saturates to the maximum value.
Value of pixels outside image
Specify the value of pixels that are outside the image as a numeric scalar value or a numeric vector of same length as the third dimension of input image. The default is 0.
Interpolation method used to translate image
Specify the interpolation method used to translate the image as one of Nearest neighbor | Bilinear | Bicubic. The default is Bilinear. When you set this property to Nearest neighbor, the object uses the value of the nearest pixel for the new pixel value. When you set this property to Bilinear, the object sets the new pixel value as the weighted average of the four nearest pixel values. When you set this property to Bicubic, the object sets the new pixel value as the weighted average of the sixteen nearest pixel values.
|clone||Create geometric translator object with same property values|
|getNumInputs||Number of expected inputs to step method|
|getNumOutputs||Number of outputs from step method|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|step||Return a translated image|
Translate an image
htranslate=vision.GeometricTranslator; htranslate.OutputSize='Same as input image'; htranslate.Offset=[30 30]; I=im2single(imread('cameraman.tif')); Y = step(htranslate,I); imshow(Y);
This object implements the algorithm, inputs, and outputs described on the Translate block reference page. The object properties correspond to the block parameters.