ClassesClassesClassesClasses | | | | Operators

train_variation_modeltrain_variation_modelTrainVariationModeltrain_variation_modelTrainVariationModelTrainVariationModel (Operator)

Name

train_variation_modeltrain_variation_modelTrainVariationModeltrain_variation_modelTrainVariationModelTrainVariationModel — Train a variation model.

Signature

train_variation_model(Images : : ModelID : )

Herror train_variation_model(const Hobject Images, const Hlong ModelID)

Herror T_train_variation_model(const Hobject Images, const Htuple ModelID)

Herror train_variation_model(Hobject Images, const HTuple& ModelID)

void HImage::TrainVariationModel(const HVariationModel& ModelID) const

void HImageArray::TrainVariationModel(const HVariationModel& ModelID) const

void HVariationModel::TrainVariationModel(const HImageArray& Images) const

void TrainVariationModel(const HObject& Images, const HTuple& ModelID)

void HVariationModel::TrainVariationModel(const HImage& Images) const

void HImage::TrainVariationModel(const HVariationModel& ModelID) const

void HOperatorSetX.TrainVariationModel(
[in] IHUntypedObjectX* Images, [in] VARIANT ModelID)

void HVariationModelX.TrainVariationModel([in] IHImageX* Images)

void HImageX.TrainVariationModel([in] IHVariationModelX* ModelID)

static void HOperatorSet.TrainVariationModel(HObject images, HTuple modelID)

void HVariationModel.TrainVariationModel(HImage images)

void HImage.TrainVariationModel(HVariationModel modelID)

Description

train_variation_modeltrain_variation_modelTrainVariationModeltrain_variation_modelTrainVariationModelTrainVariationModel trains the variation model that is passed in ModelIDModelIDModelIDModelIDModelIDmodelID with one or more images, which are passed in ImagesImagesImagesImagesImagesimages.

As described for create_variation_modelcreate_variation_modelCreateVariationModelcreate_variation_modelCreateVariationModelCreateVariationModel, a variation model that has been created using the mode 'standard'"standard""standard""standard""standard""standard" can be trained iteratively, i.e., as soon as images of good objects become available, they can be trained with train_variation_modeltrain_variation_modelTrainVariationModeltrain_variation_modelTrainVariationModelTrainVariationModel. The ideal image of the object is computed as the mean of all previous training images and the images that are passed in ImagesImagesImagesImagesImagesimages. The corresponding variation image is computed as the standard deviation of the training images and the images that are passed in ImagesImagesImagesImagesImagesimages.

If the variation model has been created using the mode 'robust'"robust""robust""robust""robust""robust", the model cannot be trained iteratively, i.e., all training images must be accumulated using concat_objconcat_objConcatObjconcat_objConcatObjConcatObj and be trained with train_variation_modeltrain_variation_modelTrainVariationModeltrain_variation_modelTrainVariationModelTrainVariationModel in a single call. If any images have been trained previously, the training information of the previous call is discarded. The image of the ideal object is computed as the median of all training images passed in ImagesImagesImagesImagesImagesimages. The corresponding variation image is computed as a suitably scaled median absolute deviation of the training images and the median image.

Attention

At most 65535 training images can be trained.

Parallelization

This operator modifies the state of the following input parameter:

The value of this parameter may not be shared across multiple threads without external synchronization.

Parameters

ImagesImagesImagesImagesImagesimages (input_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject (byte / int2 / uint2)

Images of the object to be trained.

ModelIDModelIDModelIDModelIDModelIDmodelID (input_control, state is modified)  variation_model HVariationModel, HTupleHTupleHVariationModel, HTupleHVariationModelX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

ID of the variation model.

Example (HDevelop)

open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, \
                   'default', -1, 'default', 'model.seq', 'default', \
                   -1, -1, AcqHandle)
grab_image (Image, AcqHandle)
get_image_pointer1 (Image, Pointer, Type, Width, Height)
dev_display (Image)
draw_region (Region, WindowHandle)
reduce_domain (Image, Region, ImageReduced)
area_center (Region, Area, RowRef, ColumnRef)
create_shape_model (ImageReduced, 4, 0, rad(360), rad(1), 'none', \
                    'use_polarity', 40, 10, TemplateID)
create_variation_model (Width, Height, Type, 'standard', ModelID)
for K := 1 to 100 by 1
    grab_image (Image, AcqHandle)
    find_shape_model (Image, TemplateID, 0, rad(360), 0.5, 1, 0.5, \
                      'true', 4, 0.9, Row, Column, Angle, Score)
    if (|Score| == 1)
        vector_angle_to_rigid (Row, Column, Angle, RowRef, \
                               ColumnRef, 0, HomMat2D)
        affine_trans_image (Image, ImageTrans, HomMat2D, 'constant', \
                            'false')
        train_variation_model (ImageTrans, ModelID)
    endif
endfor
prepare_variation_model (ModelID, 10, 4)
write_region (Region, 'model.reg')
write_shape_model (TemplateID, 'model.shm')
write_variation_model (ModelID, 'model.var')
clear_shape_model (TemplateID)
clear_variation_model (ModelID)
close_framegrabber (AcqHandle)

Result

train_variation_modeltrain_variation_modelTrainVariationModeltrain_variation_modelTrainVariationModelTrainVariationModel returns 2 (H_MSG_TRUE) if all parameters are correct.

Possible Predecessors

create_variation_modelcreate_variation_modelCreateVariationModelcreate_variation_modelCreateVariationModelCreateVariationModel, find_shape_modelfind_shape_modelFindShapeModelfind_shape_modelFindShapeModelFindShapeModel, affine_trans_imageaffine_trans_imageAffineTransImageaffine_trans_imageAffineTransImageAffineTransImage, concat_objconcat_objConcatObjconcat_objConcatObjConcatObj

Possible Successors

prepare_variation_modelprepare_variation_modelPrepareVariationModelprepare_variation_modelPrepareVariationModelPrepareVariationModel

See also

prepare_variation_modelprepare_variation_modelPrepareVariationModelprepare_variation_modelPrepareVariationModelPrepareVariationModel, compare_variation_modelcompare_variation_modelCompareVariationModelcompare_variation_modelCompareVariationModelCompareVariationModel, compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModel, clear_variation_modelclear_variation_modelClearVariationModelclear_variation_modelClearVariationModelClearVariationModel

Module

Matching


ClassesClassesClassesClasses | | | | Operators