Back to FabImage Library website

You are here: Start » Function Reference » Image » Image Spatial Transforms Maps » CreateCylinderMap

CreateCylinderMap


Header: FIL.h
Namespace: fil
Module: Calibration

Creates a spatial map for transformations from a cylinder surface to a flat rectangle.

Applications: Inspection of the surface of bottles and other cylindrical objects. The result is used by RemapImage.

Syntax

C++
C#
 
void fil::CreateCylinderMap
(
	const fil::ImageFormat& inImageFormat,
	const fil::Rectangle2D& inCylinderRectangle,
	const float inCylinderRadiusCorrection,
	ftl::Optional<fil::Point2D> inOpticalAxis,
	ftl::Optional<int> inNewWidth,
	ftl::Optional<int> inNewHeight,
	const int inMargin,
	fil::InterpolationMethod::Type inInterpolationMethod,
	fil::CylinderMappingMode::Type inCylinderMappingMode,
	fil::SpatialMap& outSpatialMap,
	ftl::Optional<fil::Region&> outOutputRegion = ftl::NIL
)

Parameters

Name Type Range Default Description
Input value inImageFormat const ImageFormat& Information about dimensions, depth and pixel type of the image
Input value inCylinderRectangle const Rectangle2D& Bounding rectangle of the cylinder
Input value inCylinderRadiusCorrection const float 0.0 - 0.0f How many pixels the cylinder radius is larger than the visible circle radius
Input value inOpticalAxis Optional<Point2D> NIL Coordinates of the camera optical axis (Auto = image center)
Input value inNewWidth Optional<int> 1 - NIL Width of an image created by output spatial map application
Input value inNewHeight Optional<int> 1 - NIL Height of an image created by output spatial map application
Input value inMargin const int 0 - 0 Width of the cylinder extreme points zone excluded from spatial map
Input value inInterpolationMethod InterpolationMethod::Type Bilinear Interpolation method used in extraction of image pixel values
Input value inCylinderMappingMode CylinderMappingMode::Type Determines which pixels of the mapped cylinder have to be within the given rectangle.
Output value outSpatialMap SpatialMap& Output spatial map
Output value outOutputRegion Optional<Region&> NIL Pixels set by the spatial map application

Optional Outputs

The computation of following outputs can be switched off by passing value ftl::NIL to these parameters: outOutputRegion.

Read more about Optional Outputs.

Description

The filter creates a spatial map that allows to transform a cylinder surface to a flat rectangle. The inCylinderRectangle should be the minimal rectangle that contains the given cylinder. Because of the presence of a camera, the cylinder radius is not equal to but greater than the width of the input rectangle. To compensate the difference, inCylinderRadiusCorrection has to be properly set experimentally. Another important parameter is the inOpticalAxis input that represents the coordinates of the camera optical axis, i.e. it shows which pixel is directly under the camera. It is set to the input image center by default.

Examples

Results of applying RemapImage with a spatial map created with the CreateCylinderMap filter.

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.

Errors

List of possible exceptions:

Error type Description
DomainError Cylinder stripe within rectangle thinner then a single pixel in CreateCylinderMap.
DomainError Empty domain in CreateCylinderMap.
DomainError Mapped image width too large in CreateCylinderMap.
DomainError Margin too large in CreateCylinderMap.