prepare_direct_variation_modelT_prepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModel (Operator)

Name

prepare_direct_variation_modelT_prepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModel — Vorbereitung eines Variationsmodells zum Vergleich.

Signatur

prepare_direct_variation_model(RefImage, VarImage : : ModelID, AbsThreshold, VarThreshold : )

Herror T_prepare_direct_variation_model(const Hobject RefImage, const Hobject VarImage, const Htuple ModelID, const Htuple AbsThreshold, const Htuple VarThreshold)

void PrepareDirectVariationModel(const HObject& RefImage, const HObject& VarImage, const HTuple& ModelID, const HTuple& AbsThreshold, const HTuple& VarThreshold)

void HVariationModel::PrepareDirectVariationModel(const HImage& RefImage, const HImage& VarImage, const HTuple& AbsThreshold, const HTuple& VarThreshold) const

void HVariationModel::PrepareDirectVariationModel(const HImage& RefImage, const HImage& VarImage, double AbsThreshold, double VarThreshold) const

static void HOperatorSet.PrepareDirectVariationModel(HObject refImage, HObject varImage, HTuple modelID, HTuple absThreshold, HTuple varThreshold)

void HVariationModel.PrepareDirectVariationModel(HImage refImage, HImage varImage, HTuple absThreshold, HTuple varThreshold)

void HVariationModel.PrepareDirectVariationModel(HImage refImage, HImage varImage, double absThreshold, double varThreshold)

Beschreibung

prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModel bereitet ein Variationsmodell zum Vergleich mit compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModel oder compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModel vor. Hierzu muss das Modell mit Mode='direct'"direct""direct""direct""direct" mit create_variation_modelcreate_variation_modelCreateVariationModelCreateVariationModelCreateVariationModel erzeugt worden sein. Im Unterschied zu prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModel werden das ideale Bild und das zugehörige Variationsbild nicht durch train_variation_modeltrain_variation_modelTrainVariationModelTrainVariationModelTrainVariationModel berechnet, sondern in RefImageRefImageRefImageRefImagerefImage und VarImageVarImageVarImageVarImagevarImage direkt übergeben. Dies ist sinnvoll, wenn, wie bei create_variation_modelcreate_variation_modelCreateVariationModelCreateVariationModelCreateVariationModel beschrieben, das Variationsmodell aus einem Bild erzeugt werden soll. Das Variationsbild VarImageVarImageVarImageVarImagevarImage sollte typischerweise mit Kantenoperatoren wie sobel_ampsobel_ampSobelAmpSobelAmpSobelAmp, edges_imageedges_imageEdgesImageEdgesImageEdgesImage oder gray_range_rectgray_range_rectGrayRangeRectGrayRangeRectGrayRangeRect erzeugt werden.

prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModel berechnet aus dem idealen Bild RefImageRefImageRefImageRefImagerefImage und dem Variationsbild VarImageVarImageVarImageVarImagevarImage zwei interne Schwellwertbilder und speichert sie im Variationsmodell ab. Diese Schwellwertbilder werden in compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModel oder compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModel verwendet, um den Vergleich des aktuellen Bildes mit dem Variationsmodell durchzuführen.

Zur Berechnung der Schwellwertbilder werden zwei Schwellwerte verwendet. Der Schwellwert AbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold gibt an, um wieviele Graustufen sich das Bild des aktuellen Objektes mindestens vom idealen Bild unterscheiden muss. Der Schwellwert VarThresholdVarThresholdVarThresholdVarThresholdvarThreshold gibt einen Faktor für den Unterschied des aktuellen Bildes relativ zu der im Variationsbild gespeicherten Variation des Objektes an. VarThresholdVarThresholdVarThresholdVarThresholdvarThreshold legt mittels VarImageVarImageVarImageVarImagevarImage Regionen fest, in denen Unterschiede in den Grauwerten auftreten dürfen, die nicht als Fehler gezählt werden sollen. Dadurch werden Abweichungen in bestimmten Bereichen des zu prüfenden Objekts erlaubt. AbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold und VarThresholdVarThresholdVarThresholdVarThresholdvarThreshold können jeweils einen oder zwei Werte enthalten. Falls zwei Werte angegeben werden, können unterschiedliche Schwellen für zu helle und zu dunkle Pixel festgelegt werden. Dabei bezieht sich der erste Wert auf die zu hellen Grauwerte und der zweite Wert auf die zu dunklen Grauwerte. Falls nur ein Wert angegeben wird, bezieht sich der Wert sowohl auf die zu hellen als auch auf die zu dunklen Grauwerte. Sei i(x,y) das ideale Bild RefImageRefImageRefImageRefImagerefImage, v(x,y) das Variationsbild VarImageVarImageVarImageVarImagevarImage, , , und (bzw. , , und ). Dann werden die beiden Schwellwertbilder wie folgt berechnet: Wenn das aktuelle Bild c(x,y) mit compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModel mit dem Variationsmodell verglichen wird, wird die Ausgaberegion aus allen Punkten bestimmt, die sich stark vom Modell unterscheiden, d.h. für die gilt: In compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModel stehen erweiterte Vergleichsmodi zur Verfügung, mit denen zusätzlich nur zu helle Fehler, nur zu dunkle Fehler und zu helle und zu dunkle Fehler als separate Regionen zurückgeliefert werden können.

Nachdem die Schwellwertbilder erzeugt worden sind, können sie mit get_thresh_images_variation_modelget_thresh_images_variation_modelGetThreshImagesVariationModelGetThreshImagesVariationModelGetThreshImagesVariationModel ausgelesen werden.

Es ist zu beachten, dass RefImageRefImageRefImageRefImagerefImage und VarImageVarImageVarImageVarImagevarImage nicht als ideales Bild bzw. als Variationsbild im Modell abgespeichert werden, um Speicherplatz im Modell zu sparen.

Ausführungsinformationen

Dieser Operator modifiziert den Zustand des folgenden Eingabeparameters:

Während der Ausführung dieses Operators muss der Zugriff auf den Wert dieses Parameters synchronisiert werden, wenn er über mehrere Threads hinweg verwendet wird.

Parameter

RefImageRefImageRefImageRefImagerefImage (input_object)  singlechannelimage objectHImageHImageHobject (byte / int2 / uint2)

Referenzbild des Objektes.

VarImageVarImageVarImageVarImagevarImage (input_object)  singlechannelimage objectHImageHImageHobject (byte / int2 / uint2)

Variationsbild des Objekts.

ModelIDModelIDModelIDModelIDmodelID (input_control, Zustand wird modifiziert)  variation_model HVariationModel, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

ID des Variationsmodells.

AbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold (input_control)  number(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Absoluter Mindestschwellwert für die Unterschiede bezüglich des Variationsmodells.

Defaultwert: 10

Wertevorschläge: 0, 5, 10, 15, 20, 30, 40, 50

Restriktion: AbsThreshold >= 0

VarThresholdVarThresholdVarThresholdVarThresholdvarThreshold (input_control)  number(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Schwellwert für die Unterschiede bezüglich der Variation des Variationsmodells.

Defaultwert: 2

Wertevorschläge: 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5

Restriktion: VarThreshold >= 0

Beispiel (HDevelop)

read_image (Image, 'model')
sobel_amp (Image, VarImage, 'sum_abs', 3)
get_image_pointer1 (Image, Pointer, Type, Width, Height)
create_variation_model (Width, Height, Type, 'direct', ModelID)
prepare_direct_variation_model (Image, VarImage, ModelID, 20, 1)
write_variation_model (ModelID, 'model.var')

Ergebnis

prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModel liefert 2 (H_MSG_TRUE) zurück, wenn alle Parameter korrekt sind.

Vorgänger

sobel_ampsobel_ampSobelAmpSobelAmpSobelAmp, edges_imageedges_imageEdgesImageEdgesImageEdgesImage, gray_range_rectgray_range_rectGrayRangeRectGrayRangeRectGrayRangeRect

Nachfolger

compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModel, compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModel, get_thresh_images_variation_modelget_thresh_images_variation_modelGetThreshImagesVariationModelGetThreshImagesVariationModelGetThreshImagesVariationModel, write_variation_modelwrite_variation_modelWriteVariationModelWriteVariationModelWriteVariationModel

Alternativen

prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModel

Siehe auch

create_variation_modelcreate_variation_modelCreateVariationModelCreateVariationModelCreateVariationModel

Modul

Matching