You are here: Start » Function Reference » Image Spatial Transforms Maps » CreatePerspectiveMap_Points
CreatePerspectiveMap_Points
Creates a perspective transform map from four points denoting a rectangle in the world coordinates.
Header: | AVL.h |
---|
Syntax
void avl::CreatePerspectiveMap_Points ( const avl::ImageFormat& inImageFormat, const atl::Optional<avl::Region>& inRoi, const atl::Array<avl::Point2D>& inImagePoints, const atl::Optional<atl::Array<avl::Point2D>>& inTargetPoints, const atl::Optional<avl::Size>& inNewSize, const avl::InterpolationMethod::Type inInterpolationMethod, avl::SpatialMap& outSpatialMap, avl::Matrix& outTransformMatrix )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
inImageFormat | const ImageFormat& | |||
inRoi | const Optional<Region>& | NIL | Range of pixels to be processed | |
inImagePoints | const Array<Point2D>& | Points define real object plane corners. | ||
inTargetPoints | const Optional<Array<Point2D>>& | NIL | Points define target plane corners. If NIL then image corners are used starting from (0,0) (Width, 0) (Width, Height), (0, Height) | |
inNewSize | const Optional<Size>& | NIL | New image size after remapping | |
inInterpolationMethod | const InterpolationMethod::Type | Interpolation method used in extraction of image pixel values | ||
outSpatialMap | SpatialMap& | Created SpatialMap with perspective transform | ||
outTransformMatrix | Matrix& | Used transform matrix |
Description
This operation computes a SpatialMap which can be later used for removing a perspective distortion from an image.
The operation maps the input image points (inImagePoints) onto locations described by the target points (inTargetPoints). If the inTargetPoints input is set to Auto this array will be made from the corner points of the input image. Both array must contains four points.
The input inNewSize allows rescaling of the output image.
The inImageFormat format is necessary for preparation of a spatial map.
The outTransformMatrix output allows verifying the found transformation.
For more information about distortion removal please refer to: Machine Vision Guide - Camera Calibration
Examples
Remarks
Notice that both inImagePoints array and inTargetPoints must be made of four points. This filter creates point to point transform so changing the points' order in the array may yield an unexpected result.
The best way to understand the relation between inImagePoints and inTargetPoints is to present the first of them on the input image and the second on the background of the remapped image.
Errors
Error type | Description |
---|---|
DomainError | Each of input array must contain four points in CreatePerspectiveMap_Points |
See Also
- CreatePerspectiveMap_Path – Creates a perspective transform map from planes defined by paths.
- RemapImage – Applies a precomputed image transform, defined by a spatial map object.