VTrain Statement

Applies To
Vision Objects: Blob, Correlation, Edge, Geometric, Polar, ImageOp, Frame Line, Point, Contour

Description
VTrain enables you to train the search window and model window for an object from a SPEL+ program.

Usage

VTrain Sequence  [.Object], var [, flags ]
Sequence
Name of a sequence or string variable containing a sequence name.
Object
Name of an object or string variable containing an object name. The object must exist in the specified sequence. If omitted, the entire sequence can be trained.
var
Integer variable that will contain the return status.
flags
Optional. Configures VTrain operation.
1 - Show teach button. 2 - Don’t show model windows.

Values
Returns status in var.

If the [OK] button is clicked, var will contain 1, otherwise it will contain 0.

Remarks
The sequence must exist before you call VTrain. If Object is specified then it must exist in the specified sequence before you can call VTrain. When VTrain executes, a dialog is opened showing live video with the specified sequence or object. The user can then move and size the search and model windows just as you would in the Vision Guide window.

If flags bit 1 is set, a teach button will be displayed. For objects with models, such as Correlation, Geometric, and Polar objects, the model will be taught if the teach button is clicked. You can retrieve the ModelOK property after running VTrain to check if a model was trained. For Blob objects and ImageOp objects with operation set to Binarize, the teach button will open the Histogram dialog and the operator can adjust both high and low thresholds and then view the effects of changes.

If flags bit 2 is set, model windows will not be displayed. The operator can only change search windows.

For objects with models, you can call VTeach after calling VTrain to teach the model if you are not displaying the teach button.

After executing VTrain, you must call VSave to make the changes permanent.

See Also
VTeach, VSave