Behavior Control
This control is developed by:
AvatarDJ Sures
Created
Updated
Help Index

Train Vision Object By Script

How To Download and Use This Control

  1. Make sure you have the latest version of EZ-Builder installed.
  2. Select Download This Control button below to download the file.
  3. Double click the downloaded file to open it.
  4. The installer will automatically add this control to EZ-Builder.
Download This Control

In order to train objects to the camera device, the Train Object menu is used in the camera control. This menu normally requires human intervention to enter the object name and use the mouse. This plugin allows your robot to learn objects in real-time triggered by controlcommand() in EZ-Script programatically.

Here's an example script that learns an object titled DJ FACE via ez-script...

Code:


# Check if the camera is active. If not, exit the script and notify user
if (!$IsCameraActive)
say("The camera is not active")
halt()
endif

# This is the name of the object that will be stored
$LearnedObject = "DJ FACE"

# Attach to the camera for the control
ControlCommand("Train Vision Object By Script", Attach)

# Introduce verbally out of the PC speaker what it is about to happen
SayWait("Prepare to learn " + $LearnedObject + ". 3, 2, 1, learning")

# Instruct the plugin to begin learning
ControlCommand("Train Vision Object By Script", Learn, $LearnedObject)

# Wait until the plugin has completed learning the object
WaitFor($CameraIsLearning == 0)

# Speak what the object has been learned
Say("I have learned " + $LearnedObject)

# Enable object tracking in the camera control
ControlCommand("Camera", CameraObjectTracking)


You can also download the project here: trainobjectplugintest.EZB

Take a look at the Cheat Sheet to see what controlcommand() this plugin accepts.