Back to FabImage Library website

You are here: Start » Function Reference » Computer Vision » Camera Calibration » CreateRectificationMap_Advanced

CreateRectificationMap_Advanced


Header: FIL.h
Namespace: fil
Module: Calibration

Computes a spatial map for transforming distorted images to rectified images defined in world coordinate plane. Allows for flexible definition of output geometry.

Applications: Rarely seen special edge cases. Usually it is sufficient to use CreateRectificationMap_PixelUnits or CreateRectificationMap_WorldUnits filters.

Syntax

C++
C#
 
void fil::CreateRectificationMap_Advanced
(
	const fil::ImageFormat& inImageFormat,
	const fil::CreateSpatialMapUnit::Type& inCenterPointType,
	const ftl::Optional<fil::Point2D>& inCenterPoint,
	const fil::CreateSpatialMapUnit::Type& inOutputSizeType,
	const ftl::Optional<float>& inOutputWidth,
	const ftl::Optional<float>& inOutputHeight,
	const ftl::Optional<float>& inWorldScale,
	bool inInvertedWorldY,
	fil::InterpolationMethod::Type inInterpolationMethod,
	const fil::RectificationTransform& inTransform,
	fil::RectificationMap& outRectificationMap
)

Parameters

Name Type Range Default Description
Input value
inImageFormat const ImageFormat& Input image format.
Input value
inCenterPointType const CreateSpatialMapUnit::Type& Pixels Specifies units of measurement of inCenterPoint.
Input value
inCenterPoint const Optional<Point2D>& NIL Specifies a point which will be the center of output image. Depending on inCenterPointType it can be either defined in pixels of input image or in world units. Defaults to the center of input image.
Input value
inOutputSizeType const CreateSpatialMapUnit::Type& Pixels Specifies units of measurement of inOutputWidth and inOutputHeight.
Input value
inOutputWidth const Optional<float>& 0.001 - NIL Specifies the size of output image. Depending on inOutputSizeType it can be either defined in pixels or world units. Defaults to the size of input image.
Input value
inOutputHeight const Optional<float>& 0.001 - NIL Specifies the size of output image. Depending on inOutputSizeType it can be either defined in pixels or world units. Defaults to the size of input image.
Input value
inWorldScale const Optional<float>& 0.001 - NIL [pix / world unit] Specifies the scale for output image. By default scale is calculated such that there will be no rescaling at the inCenterPoint.
Input value
inInvertedWorldY bool False Set to true if world coordinate system has right-handed orientation, also known as mathematical or standard. This effectively mirrors the rectified image vertically.
Input value
inInterpolationMethod InterpolationMethod::Type Bilinear
Input value
inTransform const RectificationTransform& Transform's camera model is needed for undistortion of image, when not supplied the generated map will assume undistorted image on input. Transform's homography is needed for transforming to given world plane, when not supplied the generated map will only remove distortion of image.
Output value
outRectificationMap RectificationMap&

Description

Creates a RectificationMap, which is used by RectifyImage filter for image rectification onto a defined world plane. Point locations on rectified images are related to the world plane (defined by inTransform) only by translation and scaling.

This filter allows for the most flexible definition of output canvas geometry, however for most cases filters CreateRectificationMap_PixelUnits or CreateRectificationMap_WorldUnits suffice.

The filter may be used to generate a map which only removes a lens distortion in the image – to achieve this behaviour attach a camera model directly to inTransform (i.e. do not provide a homography matrix).

The inTransform may not contain a camera model – in such case the the generated map will assume undistorted image on input.

The output image dimensions, resolution and cropping are specified by:

  1. inCenterPoint - the point which will be the center of output image. Can be selected on the input image or it can be defined in world units - see inCenterPointType
  2. inOutputWidth,inOutputHeight - the size of output image, can be defined in output pixels or in world units - see inOutputSizeType
  3. inWorldScale - the scale for output image, defined in pixels per world unit.
For example, if one is interested in area spanning from (0,0) to (10,6) world coordinate, with resolution 100 pixels / world unit, then inputs would be set as follows:
  • inCenterPoint = (5,3)
  • inCenterPointType = WorldUnits
  • inOutputWidth = 10
  • inOutputHeight = 6
  • inOutputSizeType = WorldUnits
  • inWorldScale = 100

Auxiliary data contained inside the RectificationMap describes the relation of rectified image to the world plane.

Examples

Left: original image, as captured by a camera, with mild lens distortion present. Right: rectified image with annotated length measurement.