best_matchT_best_matchBestMatchBestMatchbest_match (算子名称)

名称

best_matchT_best_matchBestMatchBestMatchbest_match — 搜索模板和图像的最佳匹配。

警告

best_matchbest_matchBestMatchBestMatchBestMatchbest_match is obsolete and is only provided for reasons of backward compatibility. New applications should use the shape-based or NCC-based operators instead.

参数签名

best_match(Image : : TemplateID, MaxError, SubPixel : Row, Column, Error)

Herror T_best_match(const Hobject Image, const Htuple TemplateID, const Htuple MaxError, const Htuple SubPixel, Htuple* Row, Htuple* Column, Htuple* Error)

void BestMatch(const HObject& Image, const HTuple& TemplateID, const HTuple& MaxError, const HTuple& SubPixel, HTuple* Row, HTuple* Column, HTuple* Error)

void HTemplate::BestMatch(const HImage& Image, double MaxError, const HString& SubPixel, HTuple* Row, HTuple* Column, HTuple* Error) const

void HTemplate::BestMatch(const HImage& Image, double MaxError, const HString& SubPixel, double* Row, double* Column, double* Error) const

void HTemplate::BestMatch(const HImage& Image, double MaxError, const char* SubPixel, double* Row, double* Column, double* Error) const

void HTemplate::BestMatch(const HImage& Image, double MaxError, const wchar_t* SubPixel, double* Row, double* Column, double* Error) const   ( Windows only)

void HImage::BestMatch(const HTemplate& TemplateID, double MaxError, const HString& SubPixel, HTuple* Row, HTuple* Column, HTuple* Error) const

void HImage::BestMatch(const HTemplate& TemplateID, double MaxError, const HString& SubPixel, double* Row, double* Column, double* Error) const

void HImage::BestMatch(const HTemplate& TemplateID, double MaxError, const char* SubPixel, double* Row, double* Column, double* Error) const

void HImage::BestMatch(const HTemplate& TemplateID, double MaxError, const wchar_t* SubPixel, double* Row, double* Column, double* Error) const   ( Windows only)

static void HOperatorSet.BestMatch(HObject image, HTuple templateID, HTuple maxError, HTuple subPixel, out HTuple row, out HTuple column, out HTuple error)

void HTemplate.BestMatch(HImage image, double maxError, string subPixel, out HTuple row, out HTuple column, out HTuple error)

void HTemplate.BestMatch(HImage image, double maxError, string subPixel, out double row, out double column, out double error)

void HImage.BestMatch(HTemplate templateID, double maxError, string subPixel, out HTuple row, out HTuple column, out HTuple error)

void HImage.BestMatch(HTemplate templateID, double maxError, string subPixel, out double row, out double column, out double error)

def best_match(image: HObject, template_id: HHandle, max_error: float, sub_pixel: str) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]

def best_match_s(image: HObject, template_id: HHandle, max_error: float, sub_pixel: str) -> Tuple[float, float, float]

描述

该算子 best_matchbest_matchBestMatchBestMatchBestMatchbest_match performs a matching of the template of TemplateIDTemplateIDTemplateIDTemplateIDtemplateIDtemplate_id and ImageImageImageImageimageimage. Hereby the template will be moved over the points of ImageImageImageImageimageimage so that the template will lie always inside ImageImageImageImageimageimage. best_matchbest_matchBestMatchBestMatchBestMatchbest_match works similar to fast_matchfast_matchFastMatchFastMatchFastMatchfast_match, with the exception, that each time a better match is found the value of MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error is internally updated to a lower value to reduce runtime.

With regard to the parameter SubPixelSubPixelSubPixelSubPixelsubPixelsub_pixel, the position will be indicated by subpixel accuracy. The matching criterion (“displaced frame difference”) is defined as follows: The runtime of 该算子 depends on the size of the domain of ImageImageImageImageimageimage. Therefore it is important to restrict the domain as far as possible, i.e. to apply 该算子 only in a very confined “region of interest”. The parameter MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error determines the maximal error which the searched position is allowed to have at most. The lower this value is, the faster 该算子 runs.

RowRowRowRowrowrow and ColumnColumnColumnColumncolumncolumn return the position of the best match, whereby ErrorErrorErrorErrorerrorerror indicates the average difference of the gray values. If no position with an error below MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error was found the position (0,0) and a matching result of 255 for ErrorErrorErrorErrorerrorerror are returned. In this case MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error has to be set larger.

The maximum error of the position (without noise) is 0.1 pixel. The average error is 0.03 pixel.

运行信息

参数表

ImageImageImageImageimageimage (input_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte)

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

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

Template number.

MaxErrorMaxErrorMaxErrorMaxErrormaxErrormax_error (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Maximum 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, 40.0, 50.0, 60.0, 70.0

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

Minimum increment: 1

Recommended increment: 3

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

Subpixel accuracy in case of 'true'"true""true""true""true""true".

Default: 'false' "false" "false" "false" "false" "false"

List of values: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"

RowRowRowRowrowrow (output_control)  point.y(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Row position of the best match.

ColumnColumnColumnColumncolumncolumn (output_control)  point.x(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Column position of the best match.

ErrorErrorErrorErrorerrorerror (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Average divergence of the gray values of the best match.

结果

If the parameter values are correct, 该算子 best_matchbest_matchBestMatchBestMatchBestMatchbest_match 返回值 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>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>). 如有必要,将引发异常。

可能的前置算子

create_templatecreate_templateCreateTemplateCreateTemplateCreateTemplatecreate_template, read_templateread_templateReadTemplateReadTemplateReadTemplateread_template, set_offset_templateset_offset_templateSetOffsetTemplateSetOffsetTemplateSetOffsetTemplateset_offset_template, set_reference_templateset_reference_templateSetReferenceTemplateSetReferenceTemplateSetReferenceTemplateset_reference_template, adapt_templateadapt_templateAdaptTemplateAdaptTemplateAdaptTemplateadapt_template, draw_regiondraw_regionDrawRegionDrawRegionDrawRegiondraw_region, draw_rectangle1draw_rectangle1DrawRectangle1DrawRectangle1DrawRectangle1draw_rectangle1, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain

可替代算子

fast_matchfast_matchFastMatchFastMatchFastMatchfast_match, fast_match_mgfast_match_mgFastMatchMgFastMatchMgFastMatchMgfast_match_mg, best_match_mgbest_match_mgBestMatchMgBestMatchMgBestMatchMgbest_match_mg, best_match_pre_mgbest_match_pre_mgBestMatchPreMgBestMatchPreMgBestMatchPreMgbest_match_pre_mg, best_match_rotbest_match_rotBestMatchRotBestMatchRotBestMatchRotbest_match_rot, best_match_rot_mgbest_match_rot_mgBestMatchRotMgBestMatchRotMgBestMatchRotMgbest_match_rot_mg, exhaustive_matchexhaustive_matchExhaustiveMatchExhaustiveMatchExhaustiveMatchexhaustive_match, exhaustive_match_mgexhaustive_match_mgExhaustiveMatchMgExhaustiveMatchMgExhaustiveMatchMgexhaustive_match_mg

模块

Matching