Herror ::affine_trans_region (
    Hobject Region,
    Hobject *RegionAffineTrans,
    const HTuple &HomMat2D,
    const HTuple &Interpolate
)
HRegion HRegion::AffineTransRegion (
    const HTuple &HomMat2D,
    const HTuple &Interpolate
) const
HRegionArray HRegionArray::AffineTransRegion (
    const HTuple &HomMat2D,
    const HTuple &Interpolate
) const

Transform a region using an affine transformation.

::affine_trans_region applies an arbitrary affine transformation, i.e., scaling, rotation, translation, and skewing, to a region. The affine map is described by the transformation matrix given in HomMat2D , which is built up by using ::hom_mat2d_identity, ::hom_mat2d_scale, ::hom_mat2d_rotate, and ::hom_mat2d_translate. The components of the homogeneous transformation matrix are interpreted as follows: the row coordinate of the image corresponds to the x coordinate of the matrix, while the column coordinate of the image corresponds to the y coordinate of the matrix. This is necessary to obtain a right-handed coordinate system, which is assumed for the homogeneous transformation matrices, also for the image. In particular, by doing so roatations are performed in the correct direction. Note that the (x,y) order of the matrices quite naturally corresponds to the usual (row,column) order for coordinates in the image.

The parameter Interpolate determines whether the transformation is to be done by using interpolation internally. This can lead to smoother region boundaries, especially if regions are enlarged. However, the runtime increases drastically.


Attention

::affine_trans_region in general is not reversible (clipping and discretization during rotation and scaling).

The components of the homogeneous transformation matrix are interpreted as follows: the row coordinate of the image corresponds to the x coordinate of the matrix, while the column coordinate of the image corresponds to the y coordinate of the matrix. This is necessary to obtain a right-handed coordinate system, which is assumed for the homogeneous transformation matrices, also for the image. In particular, by doing so roatations are performed in the correct direction. Note that the (x,y) order of the matrices quite naturally corresponds to the usual (row,column) order for coordinates in the image.


Parameters

Region (input_object)
region(-array) -> Hobject: HRegion(Array)
Region(s) to be rotated and scaled.

RegionAffineTrans (output_object)
region(-array) -> Hobject * : HRegion(Array)
Transformed output region(s).
Number of elements: RegionAffineTrans == Region

HomMat2D (input_control)
affine2d-array -> HTuple.double
Input transformation matrix.
Number of elements: 6

Interpolate (input_control)
string -> HTuple.char *
Should the transformation be done using interpolation?
Default value: 'false'
List of values: 'true', 'false'


Result

::affine_trans_region returns H_MSG_TRUE if all parameters are correct. The behavior in case of empty input (no regions given) can be set via ::set_system('no_object_result',<Result>), the behavior in case of an empty input region via ::set_system('empty_region_result',<Result>), and the behavior in case of an empty result region via ::set_system('store_empty_region',<true/false>). If necessary, an exception handling is raised.


Possible Predecessors

::hom_mat2d_identity, ::hom_mat2d_scale, ::hom_mat2d_translate, ::hom_mat2d_invert, ::hom_mat2d_rotate


Possible Successors

::select_shape


Alternatives

::move_region, ::mirror_region, ::zoom_region


See also

::affine_trans_image


Module

Region processing



Copyright © 1996-2002 MVTec Software GmbH