| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Video and Image Processing Blockset |
| Contents | Index |
| Learn more about Video and Image Processing Blockset |
You can use the Resize block to change the size of your image or video stream. In this example, you learn how to use the Resize block to reduce the size of an image:
Create a new Simulink model, and add to it the blocks shown in the following table.
Block | Library | Quantity |
|---|---|---|
Image From File | Video and Image Processing Blockset > Sources | 1 |
Resize | Video and Image Processing Blockset > Geometric Transformations | 1 |
Video Viewer | Video and Image Processing Blockset > Sinks | 2 |
Position the blocks as shown in the following figure.

Use the Image From File block to import the intensity image. Set the File name parameter to moon.tif. The tif file is a 537-by-358 matrix of 8-bit unsigned integer values.
Use the Video Viewer block to display the original image. Accept the default parameters.
The Video Viewer block automatically displays the original image in the Video Viewer window when you run the model.
Use the Resize block to shrink the image. Set the Resize factor in % parameter to 50.

The Resize block shrinks the image to half its original size.
Use the Video Viewer1 block to display the modified image. Accept the default parameters.
Connect the blocks as shown in the following figure.

Set the configuration parameters. Open the Configuration dialog box by selecting Configuration Parameters from the Simulation menu. Set the parameters as follows:
Solver pane, Stop time = 0
Solver pane, Type = Fixed-step
Solver pane, Solver = Discrete (no continuous states)
The original image appears in the Video Viewer window.

The reduced image appears in the Video Viewer1 window. Right-click the window and select Set Display To True Size. The smaller image is half the size of the original image.

In this example, you used the Resize block to shrink an image. For more information about this block, see the Resize block reference page in the Video and Image Processing Blockset Reference. For more information about other geometric transformation blocks, see the Rotate, Shear, and Translate block reference pages.
![]() | Rotating an Image | Cropping an Image | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |