Documentation Center

  • Trial Software
  • Product Updates

vision.ImagePadder System object

Package: vision

Pad or crop input image along its rows, columns, or both

Description

The ImagePadder object pads or crop input image along its rows, columns, or both.

Construction

HIMPAD = vision.ImagePadder returns an image padder System object, HIMPAD, that performs two-dimensional padding and/or cropping of an input image.

HIMPAD = vision.ImagePadder(Name,Value) returns an image padder object, HIMPAD, 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
System Objects in MATLAB Code Generation
Code Generation Support, Usage Notes, and Limitations.

Properties

Method

How to pad input image

Specify how to pad the input image as Constant | Replicate | Symmetric | Circular. The default is Constant.

PaddingValueSource

How to specify pad value

Indicate how to specify the pad value as either Property | Input port. This property applies when you set the Method property to Constant. The default is Property.

PaddingValue

Pad value

Specify the constant scalar value with which to pad the image. This property applies when you set the Method property to Constant and the PaddingValueSource property to Property. The default is 0. This property is tunable.

SizeMethod

How to specify output image size

Indicate how to pad the input image to obtain the output image by specifying Pad size | Output size. When this property is Pad size, the size of the padding in the vertical and horizontal directions are specified. When this property is Output size, the total number of output rows and output columns are specified. The default is Pad size.

RowPaddingLocation

Location at which to add rows

Specify the direction in which to add rows to as Top | Bottom | Both top and bottom | None. Set this property to Top to add additional rows to the top of the image, Bottom to add additional rows to the bottom of the image, Both top and bottom to add additional rows to the top and bottom of the image, and None to maintain the row size of the input image. The default is Both top and bottom.

NumPaddingRows

Number of rows to add

Specify the number of rows to be added to the top, bottom, or both sides of the input image as a scalar value. When the RowPaddingLocation property is Both top and bottom, this property can also be set to a two element vector, where the first element controls the number of rows the System object adds to the top of the image and the second element controls the number of rows the System object adds to the bottom of the image. This property applies when you set the SizeMethod property to Pad size and the RowPaddingLocation property is not set to None. The default is [2 3].

NumOutputRowsSource

How to specify number of output rows

Indicate how to specify the number of output rows as Property | Next power of two. If this property is Next power of two, the System object adds rows to the input image until the number of rows is equal to a power of two. This property applies when you set the SizeMethod property to Output size. The default is Property.

NumOutputRows

Total number of rows in output

Specify the total number of rows in the output as a scalar integer. If the specified number is smaller than the number of rows of the input image, then image is cropped. This property applies when you set the SizeMethod property to Output size and the NumOutputRowsSource property to Property. The default is 12.

ColumnPaddingLocation

Location at which to add columns

Specify the direction in which to add columns one of Left | Right | Both left and right | None. Set this property to Left to add additional columns on the left side of the image, Right to add additional columns on the right side of the image, Both left and right to add additional columns on the left and right side of the image, and None to maintain the column length of the input image. The default is Both left and right.

NumPaddingColumns

Number of columns to add

Specify the number of columns to be added to the left, right, or both sides of the input image as a scalar value. When the ColumnPaddingLocation property is Both left and right, this property can also be set to a two element vector, where the first element controls the number of columns the System object adds to the left side of the image and the second element controls the number of columns the System object adds to the right side of the image. This property applies when you set the SizeMethod property to Pad size and the NumPaddingColumns property is not set to None. The default is 2.

NumOutputColumnsSource

How to specify number of output columns

Indicate how to specify the number of output columns as Property | Next power of two. If you set this property to Next power of two, the System object adds columns to the input until the number of columns is equal to a power of two. This property applies when you set the SizeMethod property to Output size. The default is Property.

NumOutputColumns

Total number of columns in output

Specify the total number of columns in the output as a scalar integer. If the specified number is smaller than the number of columns of the input image, then image is cropped. This property applies when you set the SizeMethod property to Output size and the NumOutputColumnsSource property to Property. The default is 10.

Methods

cloneCreate image padder object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
release Allow property value and input characteristics changes
stepPerform two-dimensional padding or cropping of input

Examples

Pad two rows to the bottom, and three columns to the right of an image.
Use the value of the last array element as the padding value.

 himpad = vision.ImagePadder('Method', 'Replicate', ...
 										'RowPaddingLocation', 'Bottom', ...
										'NumPaddingRows', 2, ...
										'ColumnPaddingLocation', 'Right', ...
										'NumPaddingColumns', 3);
 x = [1 2;3 4];
 y = step(himpad,x);

Algorithms

This object implements the algorithm, inputs, and outputs described on the Image Pad block reference page. The object properties correspond to the block parameters.

See Also

Was this topic helpful?