| Video and Image Processing Blockset™ | ![]() |
Geometric Transformations

The Resize block enlarges or shrinks an image by resizing the image along one dimension (row or column). Then, it resizes the image along the other dimension (column or row).
Note This block supports intensity and color images on its ports. |
| Port | Input/Output | Supported Data Types | Complex Values Supported |
|---|---|---|---|
Image / Input | M-by-N matrix of intensity values or an M-by-N-by-P color video signal where P is the number of color planes |
| No |
ROI | Four-element vector that defines the ROI |
| No |
Output | Resized image | Same as Input port | No |
Flag | Boolean value that indicates whether the ROI is within the image bounds | Boolean | No |
If the data type of the input signal is floating point, the output has the same data type.
Use the Specify parameter to designate the parameters to use to resize your image. Your choices are 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.
If, for the Specify parameter, you select Output size as a percentage of input size, the Resize factor in % parameter appears in the dialog box. Enter a scalar percentage value that is applied to both rows and columns. You must enter a scalar value that is greater than 0. For a 0< resize factor <100, the block shrinks the image. For resize factor =100, the block does not change the image. For resize factor >100, the block enlarges the image. The dimensions of the output matrix depend on the Resize factor in % parameter and are given by the following equations:
number_output_rows = round(number_input_rows*resize_factor/100);
number_output_cols = round(number_input_cols*resize_factor/100);
Alternatively, you can enter a two-element vector, where the first element is the percentage by which to resize the rows and the second element is the percentage by which to resize the columns.
If, for the Specify parameter, you select Number of output columns and preserve aspect ratio, the Number of output columns parameter appears in the dialog box. Enter a scalar value that represents the number of columns you want the output image to have. The block calculates the number of output rows so that the output image has the same aspect ratio as the input image.
If, for the Specify parameter, you select Number of output rows and preserve aspect ratio, the Number of output rows parameter appears in the dialog box. Enter a scalar value that represents the number of rows you want the output image to have. The block calculates the number of output columns so that the output image has the same aspect ratio as the input image.
If, for the Specify parameter, you select Number of output rows and columns, the Number of output rows and columns parameter appears in the dialog box. Enter a two-element vector, where the first element is the number of rows in the output image and the second element is the number of columns. In this case, the aspect ratio of the image can change.
Use the Interpolation method parameter to specify which interpolation method the block uses to resize the image. If you select Nearest neighbor, the block uses one nearby pixel to interpolate the pixel value. This selection is the most computationally efficient, but it is the least accurate. If you select Bilinear, the block uses four nearby pixels to interpolate the pixel value. If you select Bicubic or Lanczos2, the block uses 16 nearby pixels to interpolate the pixel value. If you select Lanczos3, the block uses 36 surrounding pixels to interpolate the pixel value.
The Resize block performs optimally when the Interpolation method parameter is set to Nearest neighbor and one of the following conditions is met:
The Resize factor in % parameter is a multiple of 100.
Dividing 100 by the Resize factor in % parameter value results in an integer value.
Shrinking an image can introduce high frequency components into the image and aliasing might occur. If you select the Perform antialiasing when resize factor is between 0 and 100 check box, the block performs low pass filtering on the input image before shrinking it.
To resize a particular region of each image, select the Enable ROI processing check box. This option is available under these conditions:
Specify = Number of output rows and columns
Interpolation method = Nearest neighbor, Bilinear, or Bicubic
Clear the Perform antialiasing when resize factor is between 0 and 100 check box.
If you select the Enable ROI processing check box, the ROI port appears on the block. Use this port to define a region of interest (ROI) in the input matrix, I, that you want to resize. The input to this port must be a four-element vector, [row column height width]. The first two elements define the upper-left corner of the ROI, and the second two elements define the height and width of the ROI.
If you select the Enable ROI processing check box, the Output flag indicating if any part of ROI is outside image bounds check box appears in the dialog box. If you select this check box, the Flag port appears on the block. The following tables describe the Flag port output.
| Flag Port Output | Description |
|---|---|
| 0 | ROI is completely inside the input image. |
| 1 | ROI is completely or partially outside the input image. |
The following diagram shows the data types used in the Resize block for fixed-point signals.

You can set the interpolation weights table, product output, accumulator, and output data types in the block mask.
The Main pane of the Resize dialog box appears as shown in the following figure:

Specify which aspects of the image to resize. Your choices are 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.
Enter a scalar percentage value that is applied to both rows and columns or a two-element vector, where the first element is the percentage by which to resize the rows and the second element is the percentage by which to resize the columns. This parameter is visible if, for the Specify parameter, you select Output size as a percentage of input size.
Enter a scalar value that represents the number of columns you want the output image to have. This parameter is visible if, for the Specify parameter, you select Number of output columns and preserve aspect ratio.
Enter a scalar value that represents the number of rows you want the output image to have. This parameter is visible if, for the Specify parameter, you select Number of output rows and preserve aspect ratio.
Enter a two-element vector, where the first element is the number of rows in the output image and the second element is the number of columns. This parameter is visible if, for the Specify parameter, you select Number of output rows and columns.
Determine which interpolation method the block uses to resize the image. If you select Nearest neighbor, the block uses one nearby pixel to interpolate the pixel value. If you select Bilinear, the block uses two nearby pixels to interpolate the pixel value. If you select Bicubic or Lanczos2, the block uses four nearby pixels to interpolate the pixel value. If you select Lanczos3, the block uses six surrounding pixels to interpolate the pixel value.
If you select this check box, the block performs low-pass filtering on the input image before shrinking it to prevent aliasing.
Select this check box to resize a particular region of each image. This parameter is available when the Specify parameter is set to Number of output rows and columns, the Interpolation method parameter is set to Nearest neighbor, Bilinear, or Bicubic, and the Perform antialiasing when resize factor is between 0 and 100 check box is not selected.
If you select this check box, the Flag port appears on the block. The block outputs 1 at this port if the ROI is completely or partially outside the input image. Otherwise, it outputs 0.
The Fixed-point pane of the Resize dialog box appears as shown in the following figure.

Select the rounding mode for fixed-point operations.
Select the overflow mode for fixed-point operations.
Choose how to specify the word length of the values of the interpolation weights table. The fraction length of the interpolation weights table values is always equal to the word length minus one:
When you select Same as input, the word length of the interpolation weights table values match that of the input to the block.
When you select Binary point scaling, you can enter the word length of the interpolation weights table values, in bits.
When you select Slope and bias scaling, you can enter the word length of the interpolation weights table values, in bits.

As depicted in the preceding diagram, the output of the multiplier is placed into the product output data type and scaling. Use this parameter to specify how to designate this product output word and fraction lengths.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. The bias of all signals in the Video and Image Processing Blockset blocks is 0.

As depicted in the preceding diagram, inputs to the accumulator are cast to the accumulator data type. The output of the adder remains in the accumulator data type as each element of the input is added to it. Use this parameter to specify how to designate this accumulator word and fraction lengths.
When you select Same as product output, these characteristics match those of the product output.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. The bias of all signals in the Video and Image Processing Blockset blocks is 0.
Choose how to specify the word length and fraction length of the output of the block:
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. The bias of all signals in the Video and Image Processing Blockset blocks is 0.
[1] Ward, Joseph and David R. Cok. "Resampling Algorithms for Image Resizing and Rotation", Proc. SPIE Digital Image Processing Applications, vol. 1075, pp. 260-269, 1989.
[2] Wolberg, George. Digital Image Warping. Washington: IEEE Computer Society Press, 1990.
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
Image Processing Toolbox software |
![]() | Read Binary File | Rotate | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |