Operator Reference

create_template_rotT_create_template_rotCreateTemplateRotCreateTemplateRotcreate_template_rot (Operator)

create_template_rotT_create_template_rotCreateTemplateRotCreateTemplateRotcreate_template_rot — Preparing a pattern for template matching with rotation.

Warning

create_template_rotcreate_template_rotCreateTemplateRotCreateTemplateRotcreate_template_rot is obsolete and is only provided for reasons of backward compatibility. The operator will be removed with HALCON 25.11. New applications should use the shape-based or NCC-based operators instead.

Signature

Herror T_create_template_rot(const Hobject Template, const Htuple NumLevel, const Htuple AngleStart, const Htuple AngleExtend, const Htuple AngleStep, const Htuple Optimize, const Htuple GrayValues, Htuple* TemplateID)

void CreateTemplateRot(const HObject& Template, const HTuple& NumLevel, const HTuple& AngleStart, const HTuple& AngleExtend, const HTuple& AngleStep, const HTuple& Optimize, const HTuple& GrayValues, HTuple* TemplateID)

void HTemplate::HTemplate(const HImage& Template, Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const HString& Optimize, const HString& GrayValues)

void HTemplate::HTemplate(const HImage& Template, Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const char* Optimize, const char* GrayValues)

void HTemplate::HTemplate(const HImage& Template, Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const wchar_t* Optimize, const wchar_t* GrayValues)   ( Windows only)

void HTemplate::CreateTemplateRot(const HImage& Template, Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const HString& Optimize, const HString& GrayValues)

void HTemplate::CreateTemplateRot(const HImage& Template, Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const char* Optimize, const char* GrayValues)

void HTemplate::CreateTemplateRot(const HImage& Template, Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const wchar_t* Optimize, const wchar_t* GrayValues)   ( Windows only)

HTemplate HImage::CreateTemplateRot(Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const HString& Optimize, const HString& GrayValues) const

HTemplate HImage::CreateTemplateRot(Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const char* Optimize, const char* GrayValues) const

HTemplate HImage::CreateTemplateRot(Hlong NumLevel, double AngleStart, double AngleExtend, double AngleStep, const wchar_t* Optimize, const wchar_t* GrayValues) const   ( Windows only)

static void HOperatorSet.CreateTemplateRot(HObject template, HTuple numLevel, HTuple angleStart, HTuple angleExtend, HTuple angleStep, HTuple optimize, HTuple grayValues, out HTuple templateID)

public HTemplate(HImage template, int numLevel, double angleStart, double angleExtend, double angleStep, string optimize, string grayValues)

void HTemplate.CreateTemplateRot(HImage template, int numLevel, double angleStart, double angleExtend, double angleStep, string optimize, string grayValues)

HTemplate HImage.CreateTemplateRot(int numLevel, double angleStart, double angleExtend, double angleStep, string optimize, string grayValues)

def create_template_rot(template: HObject, num_level: int, angle_start: float, angle_extend: float, angle_step: float, optimize: str, gray_values: str) -> HHandle

Description

The operator create_template_rotcreate_template_rotCreateTemplateRotCreateTemplateRotcreate_template_rot preprocesses a pattern, which is passed as an image, for the template matching. An extension to create_templatecreate_templateCreateTemplateCreateTemplatecreate_template the matching can applied to rotated patterns. The parameters AngleStartAngleStartAngleStartangleStartangle_start and AngleExtendAngleExtendAngleExtendangleExtendangle_extend define the maximum rotation of the pattern: AngleStartAngleStartAngleStartangleStartangle_start specifies the maximum counter clockwise rotation and AngleExtendAngleExtendAngleExtendangleExtendangle_extend the maximum clockwise rotation relative to this angle. Therefore AngleExtendAngleExtendAngleExtendangleExtendangle_extend has to be smaller than . With the parameter AngleStepAngleStepAngleStepangleStepangle_step 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_rotcreate_template_rotCreateTemplateRotCreateTemplateRotcreate_template_rot and high memory requirements for the template. The amount of memory depends on the parameters AngleExtendAngleExtendAngleExtendangleExtendangle_extend and AngleStepAngleStepAngleStepangleStepangle_step. The number of pyramid levels can be neglected. If A is the number of pixels of TemplateTemplateTemplatetemplatetemplate, the memory M needed for the template in byte is about:

After the transformation, a number (TemplateIDTemplateIDTemplateIDtemplateIDtemplate_id) 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_templatecreate_templateCreateTemplateCreateTemplatecreate_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.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

TemplateTemplateTemplatetemplatetemplate (input_object)  singlechannelimage objectHImageHObjectHObjectHobject (byte)

Input image whose domain will be processed for the pattern matching.

NumLevelNumLevelNumLevelnumLevelnum_level (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximal number of pyramid levels.

Default: 4

List of values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

AngleStartAngleStartAngleStartangleStartangle_start (input_control)  angle.rad HTuplefloatHTupleHtuple (real) (double) (double) (double)

Smallest Rotation of the pattern.

Default: -0.39

Suggested values: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0

AngleExtendAngleExtendAngleExtendangleExtendangle_extend (input_control)  angle.rad HTuplefloatHTupleHtuple (real) (double) (double) (double)

Maximum positive Extension of AngleStartAngleStartAngleStartangleStartangle_start.

Default: 0.79

Suggested values: 6.28, 3.14, 1.57, 0.79, 0.39

Restriction: AngleExtend > 0

AngleStepAngleStepAngleStepangleStepangle_step (input_control)  angle.rad HTuplefloatHTupleHtuple (real) (double) (double) (double)

Step rate (angle precision) of matching.

Default: 0.0982

Suggested values: 0.3927, 0.1963, 0.0982, 0.0491, 0.0245

Restriction: AngleStep > 0

OptimizeOptimizeOptimizeoptimizeoptimize (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Kind of optimizing.

Default: 'sort' "sort" "sort" "sort" "sort"

List of values: 'none'"none""none""none""none", 'sort'"sort""sort""sort""sort"

GrayValuesGrayValuesGrayValuesgrayValuesgray_values (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Kind of gray values.

Default: 'original' "original" "original" "original" "original"

List of values: 'gradient'"gradient""gradient""gradient""gradient", 'normalized'"normalized""normalized""normalized""normalized", 'original'"original""original""original""original", 'sobel'"sobel""sobel""sobel""sobel"

TemplateIDTemplateIDTemplateIDtemplateIDtemplate_id (output_control)  template HTemplate, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Template number.

Result

If the parameters are valid, the operator create_template_rotcreate_template_rotCreateTemplateRotCreateTemplateRotcreate_template_rot returns the value 2 ( H_MSG_TRUE) . If necessary an exception is raised.

Possible Predecessors

draw_regiondraw_regionDrawRegionDrawRegiondraw_region, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, thresholdthresholdThresholdThresholdthreshold

Possible Successors

best_match_rotbest_match_rotBestMatchRotBestMatchRotbest_match_rot, best_match_rot_mgbest_match_rot_mgBestMatchRotMgBestMatchRotMgbest_match_rot_mg, adapt_templateadapt_templateAdaptTemplateAdaptTemplateadapt_template, set_reference_templateset_reference_templateSetReferenceTemplateSetReferenceTemplateset_reference_template, clear_templateclear_templateClearTemplateClearTemplateclear_template, set_offset_templateset_offset_templateSetOffsetTemplateSetOffsetTemplateset_offset_template, write_templatewrite_templateWriteTemplateWriteTemplatewrite_template

Alternatives

create_ncc_modelcreate_ncc_modelCreateNccModelCreateNccModelcreate_ncc_model, create_templatecreate_templateCreateTemplateCreateTemplatecreate_template

Module

Matching