Skip to content

Extras

This section describes additional functions of the VIRNECT Track Framework for Android.

Get Framework Log Messages

The internal framework logs can be dumped to the console with the following command:

Track.dumpLog() 

Regardless of the internal log level, the dumpLog method will always use Android log level Info


Get Target Meta Information

Meta information about targets, like their type or physical size, can be retrieved by calling getTargetInfo. The method requires an array of types, TargetInformation that is pre-initialized with the requested target names.

// Assuming targetNames is of type String[] 
val targetInfos = targetNames.map{Common.TargetInformation(it)}.toTypedArray()
Track.getTargetInfo(targetInfos)

Modify Trackable Targets at Runtime

The tracking of each target can be activated or deactivated during runtime by modifying the target meta information. To do so, set the mIgnore property of the target information accordingly.

// Assuming targetNames is of type String[] 
val targetInfos = targetNames.map{Common.TargetInformation(it)}.toTypedArray()

// Get target meta information
Track.getTargetInfo(targetInfos)

// Deactivate tracking for first target
targetInfos[0].ignore = true

// Apply target meta information
trackingFramework.setTargetInformation(targetInfos)

Changing any other property of the target meta information will not affect the framework.


Retrieve Image from Image Source

You can retrieve a shallow copy of the latest processed image as a RGBA ByteBuffer for visualization purposes.

// Get last processed image as ByteBuffer
val RGBAImage = Track.getFrame()

Use a File Sequence as Image Source

For development and debugging purposes, the Track framework can also be used with a file sequence instead of camera input. Therefore the path to the file sequence needs to be specified before calling the initialization method.

// Set file sequence path before initializing Track framework
Track.setFileSequencePath("/sdcard/fileSequence/")
Track.initialize(context)

When the file sequence is active, the camera does not invoke the processing methods. Since the process or processWithCallback method should not be called on UI/Main thread, a separate thread is needed:

Thread {
    while (Track.processWithCallback()) {
        SystemClock.sleep(16) // Limit to 60 FPS
    }
Log.e(TAG, "File sequence finished")
}.start()

Record a file sequence

VIRNECT Track provides the functionality to record a file sequence. The startRecording method needs to be called when the framework is initialized and already running. It takes the path to save the images as a first parameter and a boolean flag to choose between JPG and PGM format as a second.

fun toggleRecording(){
    if(Track.isRecording())
        Track.stopRecording()
    else
        Track.startRecording("/sdcard/recording/",false) // Record JPG images
}
Back to top