fast_matchT_fast_matchFastMatchFastMatchfast_match (Operator)

Name

fast_matchT_fast_matchFastMatchFastMatchfast_match — Searching all good matches of a template and an image.

Warning

fast_matchfast_matchFastMatchFastMatchfast_match 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

fast_match(Image : Matches : TemplateID, MaxError : )

Herror T_fast_match(const Hobject Image, Hobject* Matches, const Htuple TemplateID, const Htuple MaxError)

void FastMatch(const HObject& Image, HObject* Matches, const HTuple& TemplateID, const HTuple& MaxError)

HRegion HTemplate::FastMatch(const HImage& Image, double MaxError) const

HRegion HImage::FastMatch(const HTemplate& TemplateID, double MaxError) const

static void HOperatorSet.FastMatch(HObject image, out HObject matches, HTuple templateID, HTuple maxError)

HRegion HTemplate.FastMatch(HImage image, double maxError)

HRegion HImage.FastMatch(HTemplate templateID, double maxError)

def fast_match(image: HObject, template_id: HHandle, max_error: float) -> HObject

Description

The operator fast_matchfast_matchFastMatchFastMatchfast_match performs a matching of the template of TemplateIDTemplateIDTemplateIDtemplateIDtemplate_id and ImageImageImageimageimage. Hereby the template will be moved over the points of ImageImageImageimageimage so that the template always lies completely inside of ImageImageImageimageimage. The matching criterion (“displaced frame difference”) is defined as follows: The difference between fast_matchfast_matchFastMatchFastMatchfast_match and exhaustive_matchexhaustive_matchExhaustiveMatchExhaustiveMatchexhaustive_match is that the matching for one position is stopped if the error is too high. This leads to a reduced runtime but one might miss correct matches. The runtime of the operator depends mainly on the size of the domain of ImageImageImageimageimage. Therefore it is important to restrict the domain as far as possible, i.e. to apply the operator only in a very confined “region of interest”. The parameter MaxErrorMaxErrorMaxErrormaxErrormax_error determines the maximal error which the searched position is allowed to show. The lower this value is, the faster the operator runs.

All points which show a matching error smaller than MaxErrorMaxErrorMaxErrormaxErrormax_error will be returned in the output region MatchesMatchesMatchesmatchesmatches. This region can be used for further processing. For example by using a connection and best_matchbest_matchBestMatchBestMatchbest_match to find all the matching objects. If no point has a match error below MaxErrorMaxErrorMaxErrormaxErrormax_error the empty region (i.e no points) is returned.

Execution Information

Parameters

ImageImageImageimageimage (input_object)  singlechannelimage(-array) objectHImageHObjectHObjectHobject (byte)

Input image inside of which the pattern has to be found.

MatchesMatchesMatchesmatchesmatches (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

All points whose error lies below a certain threshold.

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

Template number.

MaxErrorMaxErrorMaxErrormaxErrormax_error (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Maximal average difference of the gray values.

Default: 20.0

Suggested values: 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 11.0, 15.0, 17.0, 20.0, 30.0

Value range: 0 ≤ MaxError MaxError MaxError maxError max_error ≤ 255

Minimum increment: 1

Recommended increment: 1

Result

If the parameter values are correct, the operator fast_matchfast_matchFastMatchFastMatchfast_match returns the value 2 ( H_MSG_TRUE) . If the input is empty (no input images are available) the behavior can be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

create_templatecreate_templateCreateTemplateCreateTemplatecreate_template, read_templateread_templateReadTemplateReadTemplateread_template, adapt_templateadapt_templateAdaptTemplateAdaptTemplateadapt_template, draw_regiondraw_regionDrawRegionDrawRegiondraw_region, draw_rectangle1draw_rectangle1DrawRectangle1DrawRectangle1draw_rectangle1, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain

Possible Successors

connectionconnectionConnectionConnectionconnection, best_matchbest_matchBestMatchBestMatchbest_match

Alternatives

best_matchbest_matchBestMatchBestMatchbest_match, best_match_mgbest_match_mgBestMatchMgBestMatchMgbest_match_mg, fast_match_mgfast_match_mgFastMatchMgFastMatchMgfast_match_mg, exhaustive_matchexhaustive_matchExhaustiveMatchExhaustiveMatchexhaustive_match, exhaustive_match_mgexhaustive_match_mgExhaustiveMatchMgExhaustiveMatchMgexhaustive_match_mg

Module

Matching