vision.GeometricScaler System object

Package: vision

Enlarge or shrink image size

Description

The GeometricScaler object enlarges or shrinks image sizes.

J= step(H,I) returns a resized image, J, of input image I.

J= step(H,I,ROI) resizes a particular region of the image I defined by the ROI specified as [x y width height], where [x y] represents the upper left corner of the ROI. This option applies when you set the SizeMethod property to Number of output rows and columns, the Antialiasing property to false, the InterpolationMethod property to Bilinear, Bicubic or Nearest neighbor, and the ROIProcessing property to true.

[J,FLAG] = step(H,I,ROI) also returns FLAG which indicates whether the given region of interest is within the image bounds. This applies when you set the SizeMethod property to Number of output rows and columns, the Antialiasing property to false, the InterpolationMethod property to Bilinear, Bicubic or Nearest neighbor and, the ROIProcessing and the ROIValidityOutputPort properties to true.

Construction

H = vision.GeometricScaler returns a System object, H, that changes the size of an image or a region of interest within an image.

H = vision.GeometricScaler(Name,Value) returns a geometric scaler 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

Properties

SizeMethod

Aspects of image to resize

Specify which aspects of the input image to resize as one of Output size as a percentage of input size | Number of output columns and preserve aspect ratio | Number of output rows and preserve aspect ratio | Number of output rows and columns. The default is Output size as a percentage of input size.

ResizeFactor

Percentage by which to resize rows and columns

Set this property to a scalar percentage or a two-element vector. The default is [200 150]. When you set this property to a scalar percentage, the object applies this value to both rows and columns. When you set this property to a two-element vector, the object uses the first element as the percentage to resize the rows, and the second element as the percentage to resize the columns. This property applies when you set the SizeMethod property to Output size as a percentage of input size.

NumOutputColumns

Number of columns in output image

Specify the number of columns of the output image as a positive, integer scalar value. The default is 25. This property applies when you set the SizeMethod property to Number of output columns and preserve aspect ratio.

NumOutputRows

Number of rows in output image

Specify the number of rows of the output image as a positive integer scalar value. The default is 25. This property applies when you set the SizeMethod property to Number of output rows and preserve aspect ratio.

Size

Dimensions of output image

Set this property to a two-element vector. The default is [25 35]. The object uses the first element for the number of rows in the output image, and the second element for the number of columns. This property applies when you set the SizeMethod property to Number of output rows and columns.

InterpolationMethod

Interpolation method used to resize the image

Specify the interpolation method to resize the image as one of Nearest neighbor | Bilinear | Bicubic | Lanczos2 | Lanczos3. The default is Bilinear. When you set this property to Nearest neighbor, the object uses one nearby pixel to interpolate the pixel value. When you set this property to Bilinear, the object uses four nearby pixels to interpolate the pixel value. When you set this property to Bicubic or Lanczos2, the object uses sixteen nearby pixels to interpolate the pixel value. When you set this property to Lanczos3, the object uses thirty six surrounding pixels to interpolate the pixel value.

Antialiasing

Enable low-pass filtering when shrinking image

Set this property to true to perform low-pass filtering on the input image before shrinking it. This prevents aliasing when the ResizeFactor property value is between 0 and 100 percent.

ROIProcessing

Enable region-of-interest processing

Indicate whether to resize a particular region of each input image. The default isfalse. This property applies when you set the SizeMethod property to Number of output rows and columns, the InterpolationMethod parameter to Nearest neighbor, Bilinear, or Bicubic, and the Antialiasing property to false.

ROIValidityOutputPort

Enable indication that ROI is outside input image

Indicate whether to return the validity of the specified ROI being completely inside image. The default isfalse. This property applies when you set the ROIProcessing property to true.

 Fixed-Point Properties

Methods

cloneCreate geometric scaler 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
stepResize image

Examples

Enlarge an image. Display the original and the enlarged images.

 I=imread('cameraman.tif');
 hgs=vision.GeometricScaler;
 hgs.SizeMethod = ...
  			'Output size as a percentage of input size';
 hgs.InterpolationMethod='Bilinear';

 J = step(hgs,I);
 imshow(I); title('Original Image');
 figure,imshow(J);title('Resized Image');

Algorithms

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

Was this topic helpful?