best_matchT_best_matchBestMatchBestMatchbest_match (Operator)

Name

best_matchT_best_matchBestMatchBestMatchbest_match — Suche des besten Matching zwischen einem Template und einem Bild.

Warnung

best_matchbest_matchBestMatchBestMatchbest_match ist veraltet und wird nur aus Gründen der Rückwärtskompatibilität zur Verfügung gestellt. Neue Applikationen sollten stattdessen die Form-basierten oder NCC-basierten Operatoren verwenden.

Signatur

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   ( Nur Windows)

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   ( Nur Windows)

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]

Beschreibung

best_matchbest_matchBestMatchBestMatchbest_match führt ein Matching zwischen dem Template von TemplateIDTemplateIDTemplateIDtemplateIDtemplate_id und ImageImageImageimageimage durch. Dabei wird das Template so über die Punkte von ImageImageImageimageimage geschoben, dass es immer vollständig innerhalb von ImageImageImageimageimage liegt. best_matchbest_matchBestMatchBestMatchbest_match arbeitet ähnlich wie fast_matchfast_matchFastMatchFastMatchfast_match mit der Erweiterung, dass jedes mal wenn eine Position mit einem geringeren Matching-Fehler gefunden wurde, der Parameter MaxErrorMaxErrorMaxErrormaxErrormax_error intern entsprechend angepasst (d.h. verkleinert) wird, um die Rechenzeit zu verkürzen. Abhängig vom Parameter SubPixelSubPixelSubPixelsubPixelsub_pixel wird die Position in Subpixelgenauigkeit ausgegeben. Das Matching-Kriterium („displaced frame difference“) ist wie folgt definiert: Die Laufzeit des Verfahrens hängt von der Größe des Definitionsbereiches von ImageImageImageimageimage ab. Es ist daher wichtig, den Definitionsbereich möglichst einzugrenzen, d.h. den Operator nur in einer möglichst eng umrissenen „region of interest“ anzuwenden. Der Parameter MaxErrorMaxErrorMaxErrormaxErrormax_error legt den maximalen Fehler fest, den die gesuchte Position haben darf. Um so kleiner dieser Wert ist, um so schneller läuft das Verfahren.

RowRowRowrowrow und ColumnColumnColumncolumncolumn liefern die Position des Best-Match, wobei ErrorErrorErrorerrorerror die mittlere Abweichung der Grauwerte angibt.

Falls keine Position mit einem Fehler unter MaxErrorMaxErrorMaxErrormaxErrormax_error gefunden wurde, wird die Position (0,0) und ein Matching-Fehler von 255 für ErrorErrorErrorerrorerror geliefert. In diesem Fall muss der Wert für MaxErrorMaxErrorMaxErrormaxErrormax_error größer gewählt werden.

Der maximale Fehler der Position (ohne Rauschen) beträgt im sub-Pixel Modus 0.1 Pixel. Der mittlere Fehler beträgt 0.03 Pixel.

Ausführungsinformationen

Parameter

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

Eingabebild, in dem das Pattern gefunden werden soll.

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

Nummer des Templates.

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

Maximale mittlere Differenz der Grauwerte.

Default: 20.0

Wertevorschläge: 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

Wertebereich: 0 ≤ MaxError MaxError MaxError maxError max_error ≤ 255

Minimale Schrittweite: 1

Empfohlene Schrittweite: 3

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

Subpixel Genauigkeit falls 'true'"true""true""true""true".

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

Werteliste: 'false'"false""false""false""false", 'true'"true""true""true""true"

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

Zeilenposition des Best-Match.

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

Spaltenposition des Best-Match.

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

Mittlere Abweichung der Grauwerte des Best-Match.

Ergebnis

Sind die Parameterwerte korrekt, dann liefert best_matchbest_matchBestMatchBestMatchbest_match den Wert 2 ( H_MSG_TRUE) . Das Verhalten bei leerer Eingabe (keine Eingabebilder vorhanden) lässt sich mittels 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>) festlegen. Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

create_templatecreate_templateCreateTemplateCreateTemplatecreate_template, read_templateread_templateReadTemplateReadTemplateread_template, set_offset_templateset_offset_templateSetOffsetTemplateSetOffsetTemplateset_offset_template, set_reference_templateset_reference_templateSetReferenceTemplateSetReferenceTemplateset_reference_template, adapt_templateadapt_templateAdaptTemplateAdaptTemplateadapt_template, draw_regiondraw_regionDrawRegionDrawRegiondraw_region, draw_rectangle1draw_rectangle1DrawRectangle1DrawRectangle1draw_rectangle1, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain

Alternativen

fast_matchfast_matchFastMatchFastMatchfast_match, fast_match_mgfast_match_mgFastMatchMgFastMatchMgfast_match_mg, best_match_mgbest_match_mgBestMatchMgBestMatchMgbest_match_mg, best_match_pre_mgbest_match_pre_mgBestMatchPreMgBestMatchPreMgbest_match_pre_mg, best_match_rotbest_match_rotBestMatchRotBestMatchRotbest_match_rot, best_match_rot_mgbest_match_rot_mgBestMatchRotMgBestMatchRotMgbest_match_rot_mg, exhaustive_matchexhaustive_matchExhaustiveMatchExhaustiveMatchexhaustive_match, exhaustive_match_mgexhaustive_match_mgExhaustiveMatchMgExhaustiveMatchMgexhaustive_match_mg

Modul

Matching