documentation

VLWorkerBehaviour Class Reference

Inherits MonoBehaviour.

Public Types

enum  ImageStream { ImageStream.None, ImageStream.CameraImage, ImageStream.DebugImage }
 

Public Member Functions

bool GetTrackingRunning ()
 
bool GetTrackerInitialized ()
 
delegate void TrackerInitializingAction ()
 Delegate for OnTrackerInitializing events. More...
 
delegate void TrackerInitializedAction (bool success)
 Delegate for OnTrackerInitialized events. More...
 
delegate void TrackerInitializedWithIssuesAction (VLTrackingIssues errors, VLTrackingIssues warnings)
 Delegate for OnTrackerInitializedWithIssues events. More...
 
delegate void TrackerStoppedAction (bool success)
 Delegate for OnTrackerStopped events. More...
 
delegate void TrackerRunningAction (bool success)
 Delegate for OnTrackerRunning events. More...
 
delegate void TrackerRanOnceAction (bool success)
 Delegate for OnTrackerRanOnce events. More...
 
delegate void TrackerPausedAction (bool success)
 Delegate for OnTrackerPaused events. More...
 
delegate void TrackerResetSoftAction (bool success)
 Delegate for OnTrackerResetSoft events. More...
 
delegate void TrackerResetHardAction (bool success)
 Delegate for TrackerResetHardAction events. More...
 
delegate void CalibrationDataAction (VLCameraCalibration result)
 
delegate void TrackingStatesAction (VLTrackingState state)
 Delegate for OnTrackingStates events. More...
 
delegate void PerformanceInfoAction (VLPerformanceInfo state)
 Delegate for OnPerformanceInfo events. More...
 
delegate void ImageAction (VLImageWrapper image)
 Delegate for OnImage events. More...
 
delegate void ExtrinsicDataAction (VLExtrinsicDataWrapper extrinsicData)
 Delegate for OnExtrinsicData events. More...
 
delegate void IntrinsicDataAction (VLIntrinsicDataWrapper intrinsicData)
 Delegate for OnIntrinsicData events. More...
 
VLWorker GetWorker ()
 Returns the owned VLWorker object. More...
 
bool AddCameraCalibrationDB (string uri)
 Adds the camera calibration DataBase using the URI. It will not be loaded at this point but only the addability checked. The loading of the actual database happens when starting the tracking pipe! More...
 
void StartTracking (string filename)
 Start the tracking using a vl-file. More...
 
void StartTrackingFromString (string trackingConfig, string projectDir, string overrideParameter=null)
 Start the tracking using a tracking configuration as string. More...
 
void StopTracking ()
 Stop the tracking (releases all tracking resources). More...
 
void PauseTracking ()
 Pause the tracking. More...
 
void ResumeTracking ()
 Resume the tracking. More...
 
void RunTrackingOnce ()
 Runs the tracking once while the tracking is paused. More...
 
void ResetTrackingSoft ()
 Reset the tracking. More...
 
void ResetTrackingHard ()
 Reset the tracking and all keyframes. More...
 
void SetWaitForEvents (bool wait)
 Set waitForEvents to the given value. More...
 
VLDeviceInfo GetDeviceInfo ()
 Returns the device info, when the worker object has been initialized. You can call this function in order to get useful system information before starting the tracking pipe You might use this structure for retreiving the available cameras in the system. More...
 
bool GetTrackerType (out string trackerType)
 Returns the type of the loaded tracking pipeline. Works for tracking configurations loaded from a vl-file or vl-string. More...
 
bool SetCameraCalibrationState (string camCalibState)
 
bool WriteCameraCalibration (string uri)
 
bool RunOnceSync ()
 
VLFrame TrackFrame (VLFrame frame)
 
Texture2D GetStreamTexture (ImageStream streamType)
 

Static Public Member Functions

static void EmitEvents (VLFrame frame)
 

Data Fields

VLLicenseFile licenseFile
 Path of the license file relative to StreamingAssets, e.g. VisionLib/license.xml. More...
 
string calibrationDataBaseURI
 
bool synchronousWorker = false
 
string baseDir
 Directory from which the tracking configuration files will be loaded. More...
 
int targetFPS = 30
 Target number of frames per second for the tracking thread. More...
 
bool waitForEvents = false
 Whether to wait for tracking events. More...
 
VLUnitySdk.LogLevel logLevel = VLUnitySdk.LogLevel.Warning
 VisionLib log level. More...
 

Events

static TrackerInitializingAction OnTrackerInitializing
 Event which will be emitted once after calling the StartTracking function. More...
 
static TrackerInitializedAction OnTrackerInitialized
 Event which will be emitted after the tracking configuration was loaded. More...
 
static TrackerInitializedWithIssuesAction OnTrackerInitializedWithIssues
 Event which will be emitted after the tracking configuration was loaded. More...
 
static TrackerStoppedAction OnTrackerStopped
 Event which will be emitted after the tracking was stopped. More...
 
static TrackerRunningAction OnTrackerRunning
 Event which will be emitted once after the tracking was stopped or paused and is now running again. More...
 
static TrackerRanOnceAction OnTrackerRanOnce
 Event which will be emitted once after the tracking was explicitly ran once. More...
 
static TrackerPausedAction OnTrackerPaused
 Event which will be emitted after the tracking was paused. More...
 
static TrackerResetSoftAction OnTrackerResetSoft
 Event which will be emitted after a soft reset was executed. More...
 
static TrackerResetHardAction OnTrackerResetHard
 Event which will be emitted after a hard reset was executed. More...
 
static CalibrationDataAction OnCameraCalibrationData
 
static TrackingStatesAction OnTrackingStates
 Event with the current tracking state of all tracked objects. This Event will be emitted for each tracking frame. More...
 
static PerformanceInfoAction OnPerformanceInfo
 Event with the current tracking performance. This Event will be emitted for each tracking frame. More...
 
static ImageAction OnImage
 Event with the current tracking image. This Event will be emitted for each tracking frame. More...
 
static ImageAction OnDebugImage
 Event with the current debug image. This Event will be emitted for each tracking frame, if debugLevel is at least 1 More...
 
static ExtrinsicDataAction OnExtrinsicData
 Event with the current extrinsic data. This Event will be emitted for each tracking frame. More...
 
static IntrinsicDataAction OnIntrinsicData
 Event with the current intrinsic data. This Event will be emitted for each tracking frame. More...
 

Member Enumeration Documentation

◆ ImageStream

Enumerator
None 
CameraImage 
DebugImage 

Member Function Documentation

◆ AddCameraCalibrationDB()

bool VLWorkerBehaviour.AddCameraCalibrationDB ( string  uri)
inline

Adds the camera calibration DataBase using the URI. It will not be loaded at this point but only the addability checked. The loading of the actual database happens when starting the tracking pipe!

Returns
true, if camera calibration DB was added, false otherwise.
Parameters
uriURI pointing to the camera calibration to be merged.

◆ CalibrationDataAction()

delegate void VLWorkerBehaviour.CalibrationDataAction ( VLCameraCalibration  result)

◆ EmitEvents()

static void VLWorkerBehaviour.EmitEvents ( VLFrame  frame)
inlinestatic

◆ ExtrinsicDataAction()

delegate void VLWorkerBehaviour.ExtrinsicDataAction ( VLExtrinsicDataWrapper  extrinsicData)

Delegate for OnExtrinsicData events.

Parameters
extrinsicDataVLExtrinsicDataWrapper.

◆ GetDeviceInfo()

VLDeviceInfo VLWorkerBehaviour.GetDeviceInfo ( )
inline

Returns the device info, when the worker object has been initialized. You can call this function in order to get useful system information before starting the tracking pipe You might use this structure for retreiving the available cameras in the system.

Returns
The device info object or null.

◆ GetStreamTexture()

Texture2D VLWorkerBehaviour.GetStreamTexture ( ImageStream  streamType)
inline

◆ GetTrackerInitialized()

bool VLWorkerBehaviour.GetTrackerInitialized ( )
inline

◆ GetTrackerType()

bool VLWorkerBehaviour.GetTrackerType ( out string  trackerType)
inline

Returns the type of the loaded tracking pipeline. Works for tracking configurations loaded from a vl-file or vl-string.

Parameters
trackerTypeloaded tracker type
Returns
returns true on success; false otherwise.

◆ GetTrackingRunning()

bool VLWorkerBehaviour.GetTrackingRunning ( )
inline

◆ GetWorker()

VLWorker VLWorkerBehaviour.GetWorker ( )
inline

Returns the owned VLWorker object.

Returns
VLWorker object or null, if the VLWorker wasn't initialized yet.

◆ ImageAction()

delegate void VLWorkerBehaviour.ImageAction ( VLImageWrapper  image)

Delegate for OnImage events.

Parameters
imageVLImageWrapper.

◆ IntrinsicDataAction()

delegate void VLWorkerBehaviour.IntrinsicDataAction ( VLIntrinsicDataWrapper  intrinsicData)

Delegate for OnIntrinsicData events.

Parameters
intrinsicDataVLIntrinsicDataWrapper.

◆ PauseTracking()

void VLWorkerBehaviour.PauseTracking ( )
inline

Pause the tracking.

◆ PerformanceInfoAction()

delegate void VLWorkerBehaviour.PerformanceInfoAction ( VLPerformanceInfo  state)

Delegate for OnPerformanceInfo events.

Parameters
stateVLPerformanceInfo with information about the performance.

◆ ResetTrackingHard()

void VLWorkerBehaviour.ResetTrackingHard ( )
inline

Reset the tracking and all keyframes.

◆ ResetTrackingSoft()

void VLWorkerBehaviour.ResetTrackingSoft ( )
inline

Reset the tracking.

◆ ResumeTracking()

void VLWorkerBehaviour.ResumeTracking ( )
inline

Resume the tracking.

◆ RunOnceSync()

bool VLWorkerBehaviour.RunOnceSync ( )
inline

◆ RunTrackingOnce()

void VLWorkerBehaviour.RunTrackingOnce ( )
inline

Runs the tracking once while the tracking is paused.

◆ SetCameraCalibrationState()

bool VLWorkerBehaviour.SetCameraCalibrationState ( string  camCalibState)
inline

◆ SetWaitForEvents()

void VLWorkerBehaviour.SetWaitForEvents ( bool  wait)
inline

Set waitForEvents to the given value.

See waitForEvents for further information.

◆ StartTracking()

void VLWorkerBehaviour.StartTracking ( string  filename)
inline

Start the tracking using a vl-file.

The type of the tracker will be derived from the vl-file.

◆ StartTrackingFromString()

void VLWorkerBehaviour.StartTrackingFromString ( string  trackingConfig,
string  projectDir,
string  overrideParameter = null 
)
inline

Start the tracking using a tracking configuration as string.

Parameters
trackingConfigTracking configuration as string
projectDirDirectory
overrideParameter

◆ StopTracking()

void VLWorkerBehaviour.StopTracking ( )
inline

Stop the tracking (releases all tracking resources).

◆ TrackerInitializedAction()

delegate void VLWorkerBehaviour.TrackerInitializedAction ( bool  success)

Delegate for OnTrackerInitialized events.

Parameters
successtrue, if the tracking configuration was loaded successfully; false, otherwise.

◆ TrackerInitializedWithIssuesAction()

delegate void VLWorkerBehaviour.TrackerInitializedWithIssuesAction ( VLTrackingIssues  errors,
VLTrackingIssues  warnings 
)

Delegate for OnTrackerInitializedWithIssues events.

Parameters
errorsnull, if the no warning was emitted VLTrackingIssues, as a list of VLTrackingIssue.
warningsnull, if the no warning was emitted VLTrackingIssues, as a list of VLTrackingIssue.

◆ TrackerInitializingAction()

delegate void VLWorkerBehaviour.TrackerInitializingAction ( )

Delegate for OnTrackerInitializing events.

◆ TrackerPausedAction()

delegate void VLWorkerBehaviour.TrackerPausedAction ( bool  success)

Delegate for OnTrackerPaused events.

Parameters
successtrue, on success; false, otherwise.

◆ TrackerRanOnceAction()

delegate void VLWorkerBehaviour.TrackerRanOnceAction ( bool  success)

Delegate for OnTrackerRanOnce events.

Parameters
successtrue, on success; false, otherwise.

◆ TrackerResetHardAction()

delegate void VLWorkerBehaviour.TrackerResetHardAction ( bool  success)

Delegate for TrackerResetHardAction events.

Parameters
successtrue, on success; false, otherwise.

◆ TrackerResetSoftAction()

delegate void VLWorkerBehaviour.TrackerResetSoftAction ( bool  success)

Delegate for OnTrackerResetSoft events.

Parameters
successtrue, on success; false, otherwise.

◆ TrackerRunningAction()

delegate void VLWorkerBehaviour.TrackerRunningAction ( bool  success)

Delegate for OnTrackerRunning events.

Parameters
successtrue, on success; false, otherwise.

◆ TrackerStoppedAction()

delegate void VLWorkerBehaviour.TrackerStoppedAction ( bool  success)

Delegate for OnTrackerStopped events.

Parameters
successtrue, on success; false, otherwise.

◆ TrackFrame()

VLFrame VLWorkerBehaviour.TrackFrame ( VLFrame  frame)
inline

◆ TrackingStatesAction()

delegate void VLWorkerBehaviour.TrackingStatesAction ( VLTrackingState  state)

Delegate for OnTrackingStates events.

Parameters
stateVLTrackingState with information about the currently tracked objects.

◆ WriteCameraCalibration()

bool VLWorkerBehaviour.WriteCameraCalibration ( string  uri)
inline

Field Documentation

◆ baseDir

string VLWorkerBehaviour.baseDir

Directory from which the tracking configuration files will be loaded.

If this is null or an empty string, then the tracking configuration files will be loaded from the /StreamingAssets/VisionLib/ directory. This has the advantage, that they can be found on all platforms. Otherwise you need to make sure, that the baseDir is accessible for the current platform.

◆ calibrationDataBaseURI

string VLWorkerBehaviour.calibrationDataBaseURI

◆ licenseFile

VLLicenseFile VLWorkerBehaviour.licenseFile

Path of the license file relative to StreamingAssets, e.g. VisionLib/license.xml.

◆ logLevel

VLUnitySdk.LogLevel VLWorkerBehaviour.logLevel = VLUnitySdk.LogLevel.Warning

VisionLib log level.

Available log levels:

  • 0: Log
  • 1: Fatal
  • 2: Warning
  • 3: Notice
  • 4: Info
  • 5: Debug

Log level N will disable all log messages with a level > N.

◆ synchronousWorker

bool VLWorkerBehaviour.synchronousWorker = false

◆ targetFPS

int VLWorkerBehaviour.targetFPS = 30

Target number of frames per second for the tracking thread.

The tracking will run as fast as possible, if the value is zero or less.

Higher values will result in a smoother tracking experience, but the battery will be drained faster.

◆ waitForEvents

bool VLWorkerBehaviour.waitForEvents = false

Whether to wait for tracking events.

If true, the Update member function will wait until there is at least one tracking event. This will limit the speed of the Unity update cycler to the speed of the tracking, but the tracking will feel more smooth, because the camera image will be shown with less delay.

If false, the speed of the tracking and the Unity update cycle are largely separate. Due to the out of sync update rates, the camera might be shown with a slight delay.

Event Documentation

◆ OnCameraCalibrationData

CalibrationDataAction VLWorkerBehaviour.OnCameraCalibrationData
static

◆ OnDebugImage

ImageAction VLWorkerBehaviour.OnDebugImage
static

Event with the current debug image. This Event will be emitted for each tracking frame, if debugLevel is at least 1

◆ OnExtrinsicData

ExtrinsicDataAction VLWorkerBehaviour.OnExtrinsicData
static

Event with the current extrinsic data. This Event will be emitted for each tracking frame.

◆ OnImage

ImageAction VLWorkerBehaviour.OnImage
static

Event with the current tracking image. This Event will be emitted for each tracking frame.

◆ OnIntrinsicData

IntrinsicDataAction VLWorkerBehaviour.OnIntrinsicData
static

Event with the current intrinsic data. This Event will be emitted for each tracking frame.

◆ OnPerformanceInfo

PerformanceInfoAction VLWorkerBehaviour.OnPerformanceInfo
static

Event with the current tracking performance. This Event will be emitted for each tracking frame.

◆ OnTrackerInitialized

TrackerInitializedAction VLWorkerBehaviour.OnTrackerInitialized
static

Event which will be emitted after the tracking configuration was loaded.

◆ OnTrackerInitializedWithIssues

TrackerInitializedWithIssuesAction VLWorkerBehaviour.OnTrackerInitializedWithIssues
static

Event which will be emitted after the tracking configuration was loaded.

◆ OnTrackerInitializing

TrackerInitializingAction VLWorkerBehaviour.OnTrackerInitializing
static

Event which will be emitted once after calling the StartTracking function.

◆ OnTrackerPaused

TrackerPausedAction VLWorkerBehaviour.OnTrackerPaused
static

Event which will be emitted after the tracking was paused.

◆ OnTrackerRanOnce

TrackerRanOnceAction VLWorkerBehaviour.OnTrackerRanOnce
static

Event which will be emitted once after the tracking was explicitly ran once.

◆ OnTrackerResetHard

TrackerResetHardAction VLWorkerBehaviour.OnTrackerResetHard
static

Event which will be emitted after a hard reset was executed.

◆ OnTrackerResetSoft

TrackerResetSoftAction VLWorkerBehaviour.OnTrackerResetSoft
static

Event which will be emitted after a soft reset was executed.

◆ OnTrackerRunning

TrackerRunningAction VLWorkerBehaviour.OnTrackerRunning
static

Event which will be emitted once after the tracking was stopped or paused and is now running again.

◆ OnTrackerStopped

TrackerStoppedAction VLWorkerBehaviour.OnTrackerStopped
static

Event which will be emitted after the tracking was stopped.

◆ OnTrackingStates

TrackingStatesAction VLWorkerBehaviour.OnTrackingStates
static

Event with the current tracking state of all tracked objects. This Event will be emitted for each tracking frame.