Back to Adaptive Vision Library website

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

CropImageToRectangle


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

Syntax

C++
C#
 
void avl::CropImageToRectangle
(
	const avl::Image& inImage,
	const avl::Rectangle2D& inRectangle,
	atl::Optional<const avl::CoordinateSystem2D&> inRectangleAlignment,
	avl::InterpolationMethod::Type inInterpolationMethod,
	float inMargin,
	avl::Image& outImage,
	atl::Optional<avl::Rectangle2D&> outAlignedRectangle = atl::NIL,
	atl::Optional<avl::CoordinateSystem2D&> outOutputAlignment = atl::NIL
)

Parameters

Name Type Range Default Description
inImage const Image& Input image
inRectangle const Rectangle2D& Rectangle defining a rotated subimage
inRectangleAlignment Optional<const CoordinateSystem2D&> NIL Adjusts the rectangle to the position of the inspected object
inInterpolationMethod InterpolationMethod::Type Bilinear
inMargin float 0.0 - Width of an additional black margin for the output image
outImage Image& Output image
outAlignedRectangle Optional<Rectangle2D&> NIL Input rectangle after transformation (in the image coordinates)
outOutputAlignment Optional<CoordinateSystem2D&> NIL Alignment of the output image

Hints

  • It is usually recommended to use Local Coordinate Systems rather than image cropping.

Examples

CropImageToRectangle used to extract an image of an object.