Herror ::create_template_rot (
    Hobject Template,
    const HTuple &NumLevel,
    const HTuple &AngleStart,
    const HTuple &AngleExtend,
    const HTuple &AngleStep,
    const HTuple &Optimize,
    const HTuple &GrayValues,
    long *TemplateID
)
HTuple HImage::CreateTemplateRot (
    const HTuple &NumLevel,
    const HTuple &AngleStart,
    const HTuple &AngleExtend,
    const HTuple &AngleStep,
    const HTuple &Optimize,
    const HTuple &GrayValues
) const

Preparing a pattern for template matching with rotation.

The operator ::create_template_rot preprocesses a pattern, which is passed as an image, for the template matching. An extension to ::create_template the matching can applied to rotated patterns. The parameters AngleStart and AngleExtend define the maximum rotation of the pattern: AngleStart specifies the maximum counter clockwise rotation and AngleExtend the maximum clockwise rotation relative to this angle. Therefore AngleExtend has to be smaller than 2 * pi. With the parameter AngleStep the maximum angle resolution (on the highest resolution level) can be specified.

You have to be aware, that all possible rotations are calculated beforehand to reduce runtime during matching. This leads to a higher execution time for ::create_template_rot and high memory requirements for the template. The amount of memory depends on the parameters AngleExtend and AngleStep. The number of pyramid levels can be neglected. If A is the number of pixels of Template, the memory M needed for the template in byte is about:

     M = A * 12 * AngleExtend / AngleStep

After the transformation, a number (TemplateID) is assigned to the template for being used in the further process.

A description of the other parameters can be found at the operator ::create_template.


Attention

You have to be aware, that depending on the resolution a large number of pre calculated patterns have to be created which might result in a large amount of memory needed.


Parameters

Template (input_object)
image -> Hobject: HImage ( byte )
Input image whose domain will be processed for the pattern matching.

NumLevel (input_control)
integer -> HTuple.long
Maximal number of pyramid levels.
Default value: 4
List of values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

AngleStart (input_control)
angle.rad -> HTuple.double
Smalltest Rotation of the pattern.
Default value: -0.39
Suggested values: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0

AngleExtend (input_control)
angle.rad -> HTuple.double
Maximum positive Extention of AngleStart.
Default value: 0.79
Suggested values: 6.28, 3.14, 1.57, 0.79, 0.39
Restriction: AngleExtend > 0

AngleStep (input_control)
angle.rad -> HTuple.double
Step rate (angle precition) of matching.
Default value: 0.0982
Suggested values: 0.3927, 0.1963, 0.0982, 0.0491, 0.0245
Restriction: AngleStep > 0

Optimize (input_control)
string -> HTuple.char *
Kind of optimizing.
Default value: 'sort'
List of values: 'none', 'sort'

GrayValues (input_control)
string -> HTuple.char *
Kind of grayvalues.
Default value: 'original'
List of values: 'original', 'normalized', 'gradient', 'sobel'

TemplateID (output_control)
template -> long *
Template number.


Result

If the parameters are valid, the operator ::create_template_rot returns the value H_MSG_TRUE. If necessary an exception handling will be raised.


Possible Predecessors

::draw_region, ::reduce_domain, ::threshold


Possible Successors

::best_match_rot, ::best_match_rot_mg, ::adapt_template, ::set_reference_template, ::clear_template, ::set_offset_template, ::write_template


Alternatives

::create_template


Module

Gray value template matching



Copyright © 1996-2002 MVTec Software GmbH