Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Image » Image Spatial Transforms » CropImageToRectangle


Module: FoundationLite

Creates an image from a rectangular fragment of another image (with black margins if requested).


Usually used for creating images of individual objects, e.g. after Template Matching.
Name Type Range Description
inImage Image Input image
inRectangle Rectangle2D Rectangle defining a rotated subimage
inRectangleAlignment CoordinateSystem2D* Adjusts the rectangle to the position of the inspected object
inScaleMode CropScaleMode InputScale keeps the input scale unchanged, AlignedScale rescales according to the input alignment scale
inInterpolationMethod InterpolationMethod
inMargin Real 0.0 - Width of an additional margin for the output image
inBorderColor Pixel Color used for locations outside the rectangle
outImage Image Output image
outAlignedRectangle Rectangle2D Input rectangle after transformation (in the image coordinates)
outOutputAlignment CoordinateSystem2D Alignment of the output image


  • It is usually recommended to use Local Coordinate Systems rather than image cropping.
  • To obtain output images with constant dimensions regardless of inRectangleAlignment set inScaleMode to AlignedScale. The output image size will be equal to inRectangle size optionally modified by inMargin.


CropImageToRectangle used to extract an image of an object.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of CropImage filter group.