vector_angle_to_rigid ( : : Row1, Column1, Angle1, Row2, Column2, Angle2 : HomMat2D )

Compute a rigid affine transformation from points and angles.

vector_angle_to_rigid computes a rigid affine transformation, i.e., a transformation consisting of a rotation and a translation, from a point correspondence and two corresponding angles and returns it as the homogeneous transformation matrix HomMat2D. The matrix consists of 2 components: a rotation matrix R and a translation vector t (also see hom_mat2d_rotate and hom_mat2d_translate):

                              / 1 0 tx \   / R00 R01 0 \
  HomMat2D  =  |  R   t |  =  | 0 1 ty | * | R10 R11 0 |  =  H(t) * H(R)
               | 0 0  1 |     \ 0 0 1  /   \  0   0  1 /
                         

The coordinates of the original point are passed in (Row1,Column1), while the corresponding angle is passed in Angle1. The coordinates of the transformed point are passed in (Row2,Column2), while the corresponding angle is passed in Angle2. The following equation describes the transformation of the point using homogeneous vectors:

  /   Row2  \              /   Row1  \
  | Column2 | = HomMat2D * | Column1 |
  \    1    /              \    1    /

In particular, the operator vector_angle_to_rigid is useful to construct a rigid affine transformation from the results of the matching operators (e.g., find_shape_model or best_match_rot_mg), which transforms a reference image to the current image or (if the parameters are passed in reverse order) from the current image to the reference image.

HomMat2D can be used directly with operators that transform data using affine transformations, e.g., affine_trans_image.


Parameters

Row1 (input_control)
point.y -> real / integer
Row coordinate of the original point.

Column1 (input_control)
point.x -> real / integer
Column coordinate of the original point.

Angle1 (input_control)
angle.rad -> real / integer
Angle of the original point.

Row2 (input_control)
point.y -> real / integer
Row coordinate of the transformed point.

Column2 (input_control)
point.x -> real / integer
Column coordinate of the transformed point.

Angle2 (input_control)
angle.rad -> real / integer
Angle of the transformed point.

HomMat2D (output_control)
hom_mat2d-array -> real
Output transformation matrix.


Example
draw_rectangle2 (WindowID, RowTempl, ColumnTempl, PhiTempl, Length1, Length2)
gen_rectangle2 (Rectangle, RowTempl, ColumnTempl, PhiTempl, Length1, Length2)
reduce_domain (ImageTempl, Rectangle, ImageReduced)
create_template_rot (ImageReduced, 4, 0, rad(360), rad(1), 'sort',
                     'original', TemplateID)
while (true)
    best_match_rot_mg (Image, TemplateID, 0, rad(360), 30, 'true', 4, Row,
                       Column, Angle, ErrMatch)
    if (ErrMatch<255)
        vector_angle_to_rigid (Row, Column, Angle, RowTempl,
                               ColumnTempl, 0, HomMat2D)
        affine_trans_image (Image, ImageAffinTrans, HomMat2D, 'constant',
                            'false')
    endif
endwhile
clear_template (TemplateID)

Parallelization Information

vector_angle_to_rigid is reentrant and processed without parallelization.


Possible Predecessors

best_match_rot_mg, best_match_rot


Possible Successors

hom_mat2d_invert, affine_trans_image, affine_trans_region, affine_trans_contour_xld, affine_trans_polygon_xld, affine_trans_point_2d


Alternatives

vector_to_rigid


See also

dvf_to_hom_mat2d


Module

Foundation



Copyright © 1996-2008 MVTec Software GmbH