Important Note:
Motive API wiki pages are being updated for 3.0 beta. Some of the functions may be missing in the documentation. Please refer to the NPTrackingTools header file for any information that are not documented here.
The Motive API allows control of, and access to, the backend software platform of Motive via C/C++ interface. In other words, the Motive API offers Motive functions without the graphical user interface on top. Using the API, you can employ several features of Motive in your custom applications, such as accessing 2D camera images, marker centroid data, unlabeled 3D points, labeled markers, and Rigid Body tracking data. When you install Motive, all of the required components for utilizing the API are installed within the Motive install directory. The key files for using the Motive API are listed in the below section.
Camera control
Frame control
Point Cloud reconstruction engine control
Obtain and use reconstructed 3D Marker data
Rigid body tracking
Query results
Stream results over the network
In-depth hardware control (e.g. hardware sync customization). Use the Camera SDK instead.
Direct support for data recording and playback.
Control over peripheral devices (Force plates and NI-DAQ)
Functionalities for Skeleton assets.
The Motive API is supported in Windows only
Must have a valid Motive license and a corresponding Hardware key.
When you install Motive, all of the required components of the Motive API will be placed within the installation directory, and by default, Motive is installed in C:\Program Files\OptiTrack\Motive
. The following table lists all of the key files of the API and where they could be found.
This guide introduces some of the commonly used functions of the Motive API.
The following page provides a full list of the Motive API functions.
Many of the Motive API functions return their results as integer values defined NPRESULT. This value expresses the outcome of the result. Not only it indicates whether the function operated successfully or not, but it also provides more detailed information on what type of error has occurred. When you get the NPRESULT output from a function, you can use the TT_GetResultString function to get the plain text result that corresponds to the error message.
Also, camera video types, or image processing modes, are expressed as integer values as well. These values are listed below and are commented within the header file as well.
NPRESULT Values
Camera Video Type Definitions
Filename | Directory | Description |
---|---|---|
NPTrackingTools.h
[Motive Install Directory]\inc\NPTrackingTools.h
The header file NPTrackingTools.h contains declarations for functions and classes of the API. Necessary functions and classes are thoroughly commented within this file. This header file must be #included in your source code for utilizing the Motive API functions.
RigidBodySettings.h
[Motive Install Directory]\inc\RigidBodySettings.h
The header file RigidBodySettings.h contains the class declaration for the cRigidBodySettings class, which is used to modify and configure the settings for Rigid Body assets. This header file is included within the NPTrackingTools.h file, so it would not be necessary to separately include this.
lib folder
[Motive Install Directory]\lib
This folder includes C++ 64-bit library files (.lib and .dll) for employing the Motive API. The library is compiled using Visual Studio 2013 with the dynamic run-time (\MD) library, so make sure the client application also uses the same settings. 32-bit NPTrackingTools library has been deprecated since version 2.1.
Sample project
[Motive Install Directory]\Samples\markers
This folder contains a sample Visual Studio project (marker.sln) that uses the Motive API for accessing cameras, markers, and Rigid Body tracking information. Refer to this folder to find out how the API could be used.
Platforms folder
[Motive Install Directory]\plugins\
The platforms folder is located in the plugins folder and it contains qwindows.dll which is required for running applications using the Motive API. Copy and paste this folder into the EXE directory.
Third-party libraries
[Motive Install Directory]
Third-party DLL libraries are required for all applications built against the API. Please see Motive API: Quick Start Guide for more information
SDK/API Support Disclaimer
We provide developer tools to enable OptiTrack customers across a broad set of applications to utilize their systems in the ways that best suit them. Our Motive API through the NatNet SDK and Camera SDK is designed to enable experienced software developers to integrate data transfer and/or system operation with their preferred systems and pipelines. Sample projects are provided alongside each tool, and we strongly recommend the users to reference or use the samples as reliable starting points. The following list specifies the range of support that will be provided for the SDK tools:
Using the SDK tools requires background knowledge on software development; therefore, we do not provide support for basic project setup, compiling, and linking when using the SDK/API to create your own applications.
Although we ensure the SDK tools and their libraries work as intended, we do not provide support for custom developed applications that have been programmed or modified by users using the SDK tools.
Ticketed support will be provided for licensed Motive users using the Motive API and/or the NatNet SDK tools from the included libraries and sample source codes only.
The Camera SDK is a free product, and therefore we do not provide free ticketed support for it.
For other questions, please check out the NaturalPoint forums. Very often, similar development issues get reported and solved there.
This guide provides detailed instructions on commonly used functions of the Motive API for developing custom applications. For a full list of the functions, refer to the Motive API: Function Reference page. Also, for a sample use case of the API functions, please check out the provided marker project. In this guide, the following topics will be covered:
Library files and header files
Initialization and shutdown
Capture setup (Calibration)
Configuring camera settings
Updating captured frames
3D marker tracking
Rigid body tracking
Data streaming
When developing a Motive API project, make sure its linker knows where to find the required library files. This can be done either by specifying its location within the project or by copying these files onto the project folder.
MotiveAPI.h
Motive API libraries (.lib and .dll) are located in the lib folder within the Motive install directory; which is located at C:\Program Files\OptiTrack\Motive\lib
by default. In this folder, library files for both 64-bit (MotiveAPI.dll and MotiveAPI.lib) platforms can be found. When using the API library, all of the required DLL files must be located in the executable directory. Copy and paste the MotiveAPI.dll file onto the folder alongside the executable file.
Third-party Libraries
Additional third-party libraries are required for Motive API, and most of the DLL files for these libraries can be found in the Motive install directory C:\Program Files\OptiTrack\Motive\
. You can simply copy and paste all of the DLL files from the Motive installation directory into the directory of the Motive API project to use them. Highlighted items in the below image are the required DLL files.
Lastly, copy the C:\Program Files\OptiTrack\Motive\plugins\platforms
folder and its contents into the EXE as well since the libraries contained in this folder will also be used.
For function declarations, there are two required header files: MotiveAPI.h and RigidBodySettings.h, and these files are located in the C:\Program Files\OptiTrack\Motive\inc\
folder. Always include the directive syntax for adding the MotiveAPI.h header file for all programs that are developed against the Motive API. The syntax for including RigidBodySetting.h file is already included in the MotiveAPI.h file, so there is no need to include this separately.
The MotiveAPI.h file contains the declaration for most of the functions and classes in the API.
The RigidBodySettings.h file contains declaration for the cRigidBodySettings class, which is used for configuring Rigid Body asset properties.
Note: You could define these directories by using the MOTIVEAPI_INC
, MOTIVEAPI_LIB
environment variables. Check the project properties (Visual Studio) of the provided marker project for a sample project configuration.
Motive API, by default, loads the default calibration (CAL) and Application profile (MOTIVE) files from the program data directory unless separately specified. These are the files that Motive also loads at the application startup, and they are located in the following folder:
Default System Calibration: C:\ProgramData\OptiTrack\Motive\System Calibration.cal
Default Application Profile: C:\ProgramData\OptiTrack\MotiveProfile.motive
If there are specific files that need to be loaded into the project, you can export and import two files from Motive: motive application profile (MOTIVE) and camera calibration (CAL). The application profile is imported in order to obtain software settings and trackable asset definitions. Only after the camera calibration is imported, reliable 3D tracking data can be obtained. Application profiles can be loaded using the TT_LoadProfile function, and the calibration files can be loaded using the TT_LoadCalibration function.
When using the API, connected devices and the Motive API library need to be properly initialized at the beginning of a program and closed down at the end. The following section covers Motive API functions for initializing and closing down devices.
To initialize all of the connected cameras, call the TT_Initialize function. This function initializes the API library and gets the cameras ready for capturing data, so always call this function at the beginning of a program. If you attempt to use the API functions without the initialization, you will get an error.
Motive Profile Load
Please note that TT_Initialization loads the default Motive profiles (MOTIVE) from the ProgramData directory during the initialization process. To load Motive profile, or settings, from a specified directory, use TT_LoadProfile.
The TT_Update function is primarily used for updating captured frames, which will be covered later, but there is another use. The TT_Update can also be called to update a list of connected devices, and you can call this function after the initialization to make sure all of the newly connected devices are properly initialized in the beginning.
When exiting out of a program, make sure to call the TT_Shutdown function to completely release and close down all of the connected devices. Cameras may fail to shut down completely when this function is not called.
The Motive application profile (MOTIVE) stores all the trackable assets involved in a capture and software configurations including application settings and data streaming settings. When using the API, it is strongly recommended to first configure all of the settings and define trackable assets in Motive, export a profile MOTIVE file, and then load the file by calling the TT_LoadProfile function. This way, you can adjust the settings for your need in advance and apply them to your program without worrying about configuring individual settings.
Cameras must be calibrated in order to track in 3D space. However, since camera calibration is a complex process, and because of this, it's easier to have the camera system calibrated from Motive, export the camera calibration file (CAL), and the exported file can be loaded into custom applications that are developed against the API. Once the calibration data is loaded, the 3D tracking functions can be used. For detailed instructions on camera calibration in Motive, please read through the Calibration page.
Loading Calibration
Open Motive.
[Motive] Calibrate: Calibrate camera system using the Calibration panel. Read through the Calibration page for details.
[Motive] Export: After the system has been calibrated, export the calibration file (CAL) from Motive.
Close out of Motive.
[API] Load: Import calibration onto your custom application by calling the TT_LoadCalibration function to import CAL files.
When successfully loaded, you will be able to obtain 3D tracking data using the API functions.
Note:
Calibration Files: When using the exported calibration files, make sure to use only valid calibration. Exported calibration file can be used again as long as the system setup remains unchanged. Note that the file will no longer be valid if any of the system setups have been altered after the calibration. Also, calibration quality may degrade over time due to environmental factors. For these reasons, we recommend re-calibrating the system routinely to guarantee the best tracking quality.
Tracking Bars: If you are using a tracking bar, camera calibration is not required for tracking 3D points.
Connected cameras are accessible by index numbers. The camera indexes are assigned in the order the cameras are initialized. Most of the API functions for controlling cameras require an index value. When processing all of the cameras, use the TT_CameraCount function to obtain the total camera count and process each camera within a loop. For pointing to a specific camera, you can use the TT_CameraID or TT_CameraName functions to check and use the camera with given its index value. This section covers Motive API functions for checking and configuring camera frame rate, camera video type, camera exposure, pixel brightness threshold, and IR illumination intensity.
The following functions return integer values for the configured settings of a camera specified by its index number. Camera video type is returned as an integer value that represents a image processing mode, as listed in the NPVIDEOTYPE.
These camera settings are equivalent to the settings that are listed in the Devices pane of Motive. For more information on each of the camera settings, refer to the Devices pane page.
Now that we have covered functions for obtaining configured settings, now let's modify some of them. There are two main functions for adjusting the camera settings: TT_SetCameraSettings and TT_SetCameraFramerate. The TT_SetCameraSettings function configures video type, exposure, threshold, and intensity settings of a camera which is specified by its index number. The TT_SetCameraFrameRate is used for configuring frame rate of a camera. Supported frame rate range may vary for different camera models. Check the device specifications and apply the frame rates only within the supported range.
If you wish to keep part of the current camera settings, you can use the above functions to obtain the configured settings (e.g. TT_CameraVideoType, TT_CameraFrameRate, TT_CameraExposure, etc.) and use them as input arguments for the TT_SetCameraSettings function. The following example demonstrates modifying frame rate and IR illumination intensity for all of the cameras, while keeping the other settings constant.
Camera Settings
Valid frame rate values: Varies depending on camera models, refer to the respective hardware specifications.
Valid exposure values: Depends on camera model and frame rate settings.
Valid threshold values: 0 - 255
Valid intensity values: 0 - 15
Video Types
Video Type: see the Data Recording page for more information on image processing modes.
Segment Mode: 0
Grayscale Mode: 1
Object Mode: 2
Precision Mode: 4
MJPEG Mode: 6
There are other camera settings, such as imager gain, that can be configured using the Motive API. Please refer to the Motive API: Function Reference page for descriptions on other functions.
In order to process multiple consecutive frames, you must update the camera frames using the following API functions: TT_Update or TT_UpdateSingleFrame. Call one of the two functions repeatedly within a loop to process all of the incoming frames. In the 'marker sample', TT_Update function is called within a while loop as the frameCounter variable is incremented, as shown in the example below.
There are two functions for updating the camera frames: TT_Update and TT_UpdateSingleFrame. At the most fundamental level, these two functions both update the incoming camera frames. However, they may act differently in certain situations. When a client application stalls momentarily, it could get behind on updating the frames and the unprocessed frames may be accumulated. In this situation, each of these two functions will behave differently.
The TT_Update() function will disregard accumulated frames and service only the most recent frame data, but it also means that the client application will not be processing the previously missed frames.
The TT_UpdateSingleFrame() function ensures that only one frame is processed each time the function is called. However, when there are significant stalls in the program, using this function may result in accumulated processing latency.
In general, a user should always use TT_Update(). Only in the case where a user wants to ensure their client application has access to every frame of tracking data and they are having problems calling TT_Update() in a timely fashion, should they consider using TT_UpdateSingleFrame(). If it is important for your program to obtain and process every single frame, use the TT_UpdateSingleFrame() function for updating the data.
After loading valid camera calibration, you can use the API functions to track retroreflective markers and get their 3D coordinates. The following section demonstrates using the API functions for obtaining the 3D coordinates. Since marker data is obtained for each frame, always call the TT_Update, or the TT_UpdateSingleFrame, function each time newly captured frames are received.
Marker Index
In a given frame, each reconstructed marker is assigned a marker index number. These marker indexes are used for pointing to a particular reconstruction within a frame. You can also use the TT_FrameMarkerCount function to obtain the total marker count and use this value within a loop to process all of the reconstructed markers. Marker index values may vary between different frames, but unique identifiers will always remain the same. Use the TT_FrameMarkerLabel function to obtain the individual marker labels if you wish to access same reconstructions for multiple frames.
Marker Position
For obtaining 3D position of a reconstructed marker, you can use TT_FrameMarkerX, TT_FrameMarkerY, and TT_FrameMarkerZ functions. These functions return 3D coordinates (X/Y/Z) of a marker in respect to the global coordinate system, which was defined during the calibration process. You can further analyze 3D movements directly from the reconstructed 3D marker positions, or you can create a Rigid Body asset from a set of tracked reconstructions for 6 Degrees of Freedom tracking data. Rigid body tracking via the API will be explained in the later section.
For tracking 6 degrees of freedom (DoF) movement of a Rigid Body, a corresponding Rigid Body (RB) asset must be defined. A RB asset is created from a set of reflective markers attached to a rigid object which is assumed to be undeformable. There are two main approaches for obtaining RB assets when using Motive API; you can either import existing Rigid Body data or you can define new Rigid Bodies using the TT_CreateRigidBody function. Once RB assets are defined in the project, Rigid Body tracking functions can be used to obtain the 6 DoF tracking data. This section covers sample instructions for tracking Rigid Bodies using the Motive API.
We strongly recommend reading through the Rigid Body Tracking page for more information on how Rigid Body assets are defined in Motive.
Let's go through importing RB assets into a client application using the API. In Motive, Rigid Body assets can be created from three or more reconstructed markers, and all of the created assets can be exported out into either application profile (MOTIVE) or a Motive Rigid Body file (TRA). Each Rigid Body asset saves marker arrangements when it was first created. As long as the marker locations remain the same, you can use saved asset definitions for tracking respective objects.
Exporting all RB assets from Motive:
Exporting application profile: File → Save Profile
Exporting Rigid Body file (TRA): File → Export Rigid Bodies (TRA)
Exporting individual RB asset:
Exporting Rigid Body file (TRA): Under the Assets pane, right-click on a RB asset and click Export Rigid Body
When using the API, you can load exported assets by calling the TT_LoadProfile function for application profiles and the TT_LoadRigidBodies or TT_AddRigidBodes function for TRA files. When importing TRA files, the TT_LoadRigidBodies function will entirely replace the existing Rigid Bodies with the list of assets from the loaded TRA file. On the other hand, TT_AddRigidBodes will add the loaded assets onto the existing list while keeping the existing assets. Once Rigid Body assets are imported into the application, the API functions can be used to configure and access the Rigid Body assets.
Rigid body assets can also be defined directly using the API. The TT_CreateRigidBody function defines a new Rigid Body from given 3D coordinates. This function takes in an array float values which represent x/y/z coordinates or multiple markers in respect to Rigid Body pivot point. The float array for multiple markers should be listed as following: {x1, y1, z1, x2, y2, z2, …, xN, yN, zN}. You can manually enter the coordinate values or use the TT_FrameMarkerX, TT_FrameMarkerY, and TT_FrameMarkerZ functions to input 3D coordinates of tracked markers.
When using the TT_FrameMarkerX/Y/Z functions, you need to keep in mind that these locations are taken in respect to the RB pivot point. To set the pivot point at the center of created Rigid Body, you will need to first compute pivot point location, and subtract its coordinates from the 3D coordinates of the markers obtained by the TT_FrameMarkerX/Y/Z functions. This process is shown in the following example.
Example: Creating RB Assets
6 DoF Rigid Body tracking data can be obtained using the TT_RigidBodyLocation function. Using this function, you can save 3D position and orientation of a Rigid Body into declared variables. The saved position values indicate location of the Rigid Body pivot point, and they are represented in respect to the global coordinate axis. The Orientation is saved in both Euler and Quaternion orientation representations.
Example: RB Tracking Data
In Motive, Rigid Body assets have Rigid Body properties assigned to each of them. Depending on how these properties are configured, display and tracking behavior of corresponding Rigid Bodies may vary. When using the API, Rigid Body properties are configured and applied using the cRigidBodySettings class which is declared within the RigidBodySetting.h header file.
Within your program, create an instance of cRigidBodySettings class and call the API functions to obtain and adjust Rigid Body properties. Once desired changes are made, use the TT_SetRigidBodySettings function to assign the properties back onto a Rigid Body asset.
For detailed information on individual Rigid Body settings, read through the Properties: Rigid Body page.
Once the API has been successfully initialized, data streaming can be enabled, or disabled, by calling either the TT_StreamNP, TT_StreamTrackd, or TT_StreamVRPN function. The TT_StreamNP function enables/disables data streaming via the NatNet. The NatNet SDK is a client/server networking SDK designed for sending and receiving NaturalPoint data across networks, and tracking data from the API can be streamed to client applications from various platforms via the NatNet protocol. Once the data streaming is enabled, connect the NatNet client application to the server IP address to start receiving the data.
The TT_StreamNP function is equivalent to Broadcast Frame Data from the Data Streaming pane in Motive.
The Motive API does not currently support configuring data streaming settings directly from the API. To configure the streaming server IP address and the data streaming settings, you will need to use Motive and save an application profile MOTIVE file that contains the desired configuration. Then, the exported profile can be loaded when using the API. Through this way, you will be able to set the interface IP address and decide which data to be streamed over the network.
For more information on data streaming settings, read through the Data Streaming page.
This page provides a sample and instructions on how to use Motive API functions to calibrate a camera system.
The following sample code demonstrates calibration process using the Motive API. For details on specific functions, please refer to the Motive API: Function Reference page.
Auto-Masking
Auto-Masking is done directly by calling the TT_AutoMaskAllCameras function. When this is called, Motive will sample for a short amount of time and apply a mask to the camera imagers where light was detected.
<source> //== To auto-mask, call TT_AutoMaskAllCameras().
TT_AutoMaskAllCameras(); printf( "============\nCamera masking started\n============\n" ); </source>
Camera Mask
This function returns memory block of the mask. One bit per a pixel of the mask. Masking pixels are rasterized from left to right and from top to bottom of the camera's view.
Clear Masks
This function can clear existing masks from the 2D camera view. It returns true when it successfully removes pixel masks. Otherwise, masking is always additive through the API.
Set Camera Mask
The TT_SetCameraMask can be used to replace the existing camera mask for any camera. A mask is an array of bytes, one byte per mask pixel block. Returns true when masks are applied.
Setting ground plane is done directly by calling the TT_SetGroundPlane function. When this is called, camera system will search for 3-markers that resemble a calibration square and uses the inputted vertical offset value to configure the ground plane.
Please use the table of contents to the right to navigate to specific functions or specific group of functions.
Important Note:
Some of the functions may be missing in the documentation. Please refer to the NPTrackingTools header file for any information that are not documented here.
Initializes the API and prepares all connected devices for capturing. Please note that TT_Initialize also loads the default profile from the ProgramData directory: C:\ProgramData\OptiTrack\MotiveProfile.motive
. When there is a need to load the profile from a separate directory, use TT_LoadProfile function.
Description
This function initializes the API library and prepares all connected devices for capturing.
When using the API, this function needs to be called at the beginning of a program before using the cameras.
Returns an NPRESULT value. When the function successfully updates the data, it returns 0 (or NPRESULT_SUCCESS).
Function Input
None
Function Output
NPRESULT
C++ Example
Shuts down all of the connected devices.
Description
This function closes down all connected devices and the camera library. To ensure that all devices properly shutdown, call this function before terminating an application.
When the function successfully closes down the devices, it returns 0 (or NPRESULT_SUCCESS).
When calling this function, currently configured camera calibration will be saved under the default System Calibration.cal file.
Function Input
None
Function Output
NPRESULT
C++ Example
Processes incoming frame data from the cameras.
Description
This function updates frame information with the most recent data from the cameras and 3D processing engines.
Another use of this function is to pick up newly connected cameras. Call this function at the beginning of a program in order to make sure that all of the new cameras are properly recognized.
TT_Update vs. TT_UpdateSingleFrame: In the case when a client application stalls momentarily, the program may get behind on updating the frames. In this situation, the TT_Update() function will disregard accumulated frames and service only the most recent frame data, but this also means that the client application will be missing the previous frames. On the other hand, the TT_UpdateSingleFrame function ensures that always a consecutive frame is updated each time the function is called. In general, a user should always use TT_Update(). Only in the case where a user wants to ensure their client application has access to every frame of tracking data and they are having problems calling TT_Update() in a timely fashion, should they consider using TT_UpdateSingleFrame(). If it is important for your program to obtain and process every single frame, use the TT_UpdateSingleFrame() function for updating the data.
Returns an NPRESULT integer value, depending on whether the operation was successful or not. Returns NPRESULT_SUCCESS when it successfully updates the frame data.
Function Input
None
Function Output
NPRESULT
C++ Example
Updates a single frame of camera data.
Description
Every time this function is called, it updates frame information with the next frame of camera data.
Using this function ensures that every frame of data is processed.
TT_Update() vs. TT_UpdateSingleFrame(): In the case when a client application stalls momentarily, the program may get behind on updating the frames. In this situation, the TT_Update() function will disregard accumulated frames and service only the most recent frame data, but this also means that the client application will be missing the previous frames. On the other hand, the TT_UpdateSingleFrame function ensures that always a consecutive frame is updated each time the function is called. In general, a user should always use TT_Update(). Only in the case where a user wants to ensure their client application has access to every frame of tracking data and they are having problems calling TT_Update() in a timely fashion, should they consider using TT_UpdateSingleFrame(). If it is important for your program to obtain and process every single frame, use the TT_UpdateSingleFrame() function for updating the data.
Returns an NPRESULT value. When the function successfully updates the data, it returns 0 (or NPRESULT_SUCCESS).
Function Input
None
Function Output
NPRESULT
C++ Example
Loads a Motive camera calibration file.
Description
These functions load a camera calibration file (CAL).
Camera calibration files need to be exported from Motive.
Returns a NPRESULT integer value. If the file was successfully loaded, it returns NPRESULT_SUCCESS.
Function Input
Filename (const char, const wchar_t)
Function Output
NPRESULT
C++ Example
Imports TRA files and loads Rigid Body assets from it.
Description
This function imports and loads Rigid Body assets from a saved TRA file.
TRA files contain exported Rigid Body asset definitions from Motive.
All existing assets in the project will be replaced with the Rigid Body assets from the TRA file when this function is called. If you want to keep existing assets and only wish to add new Rigid Bodies, use TT_AddRigidBodies function.
Returns an NPRESULT integer value. It returns NPRESULT_SUCCESS when the file is successfully loaded.
Function Input
Filename (const char, const wchat_t)
Function Output
NPRESULT
C++ Example
Saves all of the Rigid Body asset definitions into a TRA file.
Description
This function saves all of the Rigid Body assets from the project into a TRA file.
Attach *.tra extension at the end of the filename.
Returns an NPRESULT integer value. It returns 0 or NPRESULT_SUCCESS when successfully saving the file.
Function Input
Filename (const char, const wchar_t)
Function Output
NPRESULT
C++ Example
Loads a TRA file and adds its Rigid Body assets onto the project.
Description
This function adds Rigid Body assets from the imported TRA file onto the existing list.
Adds Rigid Bodies from imported TRA files onto the asset list of the current project.
Returns an NPRESULT integer value. If the Rigid Bodies have been added successfully, it returns 0 or NPRESULT_SUCCESS.
Function Input
Filename (const char, const wchat_t)
Function Output
NPRESULT
C++ Example
Loads a Motive User Profile (.MOTIVE).
Description
Loads the default application profile file (MOTIVE), which is located in the ProgramData directory: C:\ProgramData\OptiTrack\MotiveProfile.motive
The MOTIVE files store software configurations as well as other software-wide settings.
Profile files also loads trackable asset definitions. Once the application profile containing trackable assets is imported, there is no need to import TRA and SKL files separately.
Returns an NPRESULT integer value. If the project file was successfully loaded, it returns 0 (NPRESULT_SUCCESS).
Function Input
Filename (const char, const wchar_t)
Function Output
NPRESULT
C++ Example
Loads a Motive TTP project file.
Description
Loads a Motive TTP project file. TTP project file loads and saves both camera calibration and Rigid Body assets, so when using TTP files, there is no need to import or export CAL or TRA files separately.
Loading a project file will import all of the required information for tracking. These include camera calibration and Rigid Body assets that are associated with a Motive project.
Returns an NPRESULT integer value. If the project file was successfully loaded, it returns 0 (NPRESULT_SUCCESS).
Function Input
Filename (const char, const wchar_t)
Function Output
NPRESULT
C++ Example
Saves current application setting into a Profile XML file.
Description
This function saves the current configuration into an application Profile XML file.
Attach *.xml extension at the end of the filename.
Returns an NPRESULT integer value. If the profile XML file was saved successfully, it returns 0 (NPRESULT_SUCCESS).
Function Input
Filename (const char, const wchar_t)
Function Output
NPRESULT
C++ Example
Loads calibration from memory.
Description
This function loads camera calibration from memory. In order to do this, the program must have saved calibration memory.
It assumes the pointer argument (unsigned char*) points to a memory block where calibration data is already stored. The address and size of the calibration buffer must be determined by the developer using the API.
Function Input
Buffer (unsigned char*)
Size of the buffer (int)
Function Output
NPRESULT
C++ Example
Gets camera extrinsics from a calibration file in memory.
Description
This allows for acquiring camera extrinsics for cameras not connected to system.
It simply returns the list of details for all cameras contained in the calibration file.
Function Input
Buffer (unsigned char*)
Size of the buffer (int)
Result
Function Output
NPRESULT
C++ Example
Start a new calibration wanding for all cameras.
Description
This will cancel any existing calibration process.
Function Input
None
Function Output
C++ Example
Returns the current calibration state.
Description
Returns the current calibration state.
Function Input
None
Function Output
NPRESULT
C++ Example
During calibration wanding, this will return a vector of camera indices that are lacking the minimum number of calibration samples to begin calculation.
Description
When the returned vector for this method goes to zero size, you can call TT_StartCalibrationCalculation() to begin calibration calculations.
Wanding samples will continue to be collected until TT_StartCalibrationCalculation() is called.
Function Input
None
Function Output
Vector (int)
C++ Example
During calibration wanding.
Description
This will return the number of wand samples collected for the given camera.
Return 0 otherwise.
Function Input
Camera index (int)
Function Output
Number of samples (int)
C++ Example
Cancels wanding or calculation and resets calibration engine.
Description
Cancels wanding or calculation
Resets calibration engine
Function Input
none
Function Output
Exits either TT_StartCalibrationWanding() or TT_StartCalibratoinCalculation()
C++ Example
Once wanding is complete, call this to begin the calibration calculations.
Description
Starts calibration calculations after wanding.
Function Input
Boolean value
Function Output
Starts calculation
C++ Example
During calibration calculation.
Description
This method will return the current calibration quality in the range [0-5], with 5 being best.
Returns zero otherwise
Function Input
none
Function Output
Quality on scale of 0-5 (int)
C++ Example
Run once TT_CalibrationState() returns "Complete".
Description
Call this method to apply the calibration results to all cameras.
Function Input
none
Function Output
Apply calibration results
C++ Example
Set the ground plane using a standard or custom ground plane template.
Description
If true then this function will use a custom ground plane.
Function Input
Boolean value of useCustomGroundPlane
Function Output
Either applies custom or preset ground plane to calibration.
C++ Example
Translate the existing ground plane (in mm).
Description
Takes float variables to alter existing ground plane.
Function Input
X, Y, and Z values (float)
Function Output
Applies new values to existing ground plane.
C++ Example
Enables/disables the NatNet streaming of the Natrual Point tracking data.
Description
This function enables/disables NaturalPoint data stream.
This is equivalent to the Broadcase Frame Data in the Data Streaming panel in Motive.
Returns a NPRESULT integer value. If the operation was successful, it returns 0 (NPRESULT_SUCCESS).
Function Input
Boolean argument enabled (true) / disabled (false)
Function Output
NPRESULT
C++ Example
Enables/disables streaming frame data into trackd.
Description
This function enables/disables streaming data into trackd.
Returns a NPRESULT integer value. If the operation was successful, it returns 0 (NPRESULT_SUCCESS).
Function Input
True for enabling and false for disabling (bool)
Function Output
NPRESULT
C++ Example
Enables/disables data stream into VRPN.
Description
This function enables/disables data streaming into VRPN.
To stream onto VRPN, the port address must be specified. VRPN server applications run through 3883 port, which is default port for the VRPN streaming.
Returns an NPRESULT integer value. If streaming was successfully enabled, or disabled, it returns 0 (NPRESULT_SUCCESS).
Function Input
True for enabling and false for disabling (bool)
Streaming port address (int)
Function Output
NPRESULT
C++ Example
Gets total number of reconstruected markers in a frame.
Description
This function returns a total number of reconstructed 3D markers detected in current capture frame.
Use this function to count a total number of markers, access every markers, and obtain the marker index values.
Function Input
None
Function Output
Total number of reconstructed markers in the frame (int)
C++ Example
Returns x-position of a reconstructed marker.
Description
This function returns X coordinate of a reconstructed 3D marker in respect to the global coordinate system, in meters.
It requires a marker index value.
Function Input
Marker index (int)
Function Output
X-position of the 3D marker (float)
C++ Example
Returns y-position of a reconstructed marker.
Description
This function returns Y coordinate of a reconstructed 3D marker in respect to the global coordinate system, in meters.
It requires a marker index value.
Function Input
Marker index (int)
Function Output
Y-position of the 3D marker (float)
C++ Example
Returns z-position of a reconstructed marker.
Description
This function returns Z coordinate of a reconstructed 3D marker in respect to the global coordinate system, in meters.
It requires a marker index value.
Function Input
Marker index (int)
Function Output
Z-position of the 3D marker (float)
C++ Example
Returns residual value of a marker.
Description
This function returns a residual value for a given marker indicated by the marker index.
Unit of the returned value is in millimeters.
The marker index value may change between frames, but the unique identifier will always remain the same.
Function Input
Marker index (int)
Function Output
Residual value (float)
Returns a unique identifier of a marker.
Description
This function returns a unique identifier (cUID) for a given marker.
Markers have an index from 0 to [totalMarkers -1] for a given frame. In order to access unique identifier of any marker, it's index must be inputted.
The marker index value may change between frames, but the unique identifier will always remain the same.
Function Input
Marker index (int)
Function Output
Marker label (cUID)
C++ Example
Returns a timestamp value for the current frame.
Description
This function returns a timestamp value of the current frame.
Function Input
None
Function Output
Frame timestamp (double)
C++ Example
Checks whether a camera is contributing to reconstruction of a 3D marker, and saves corresponding 2D location as detected in the camera's view.
Description
This function evaluates whether the specified camera (cameraIndex) is contributing to point cloud reconstruction of a 3D point (markerIndex).
It returns true if the camera is contributing to the marker.
After confirming that the camera contributes to the reconstruction, this function will save the 2D location of the corresponding marker centroid in respect to the camera's view.
The 2D location is saved in the declared variable.
Function Input
3D reconstructed marker index (int)
Camera index (int)
Reference variables for saving x and y (floats).
Function Output
True / False (bool)
C++ Example
Flushes out the camera queues.
Description
This function flushes camera queues.
In an event when you are tracking a very high number (hundreds) of markers and the application has accumulated data processing latency, you can call TT_FlushCameraQueues() to refresh the camera queue before calling TT_Update() for processing the frame. After calling this function, avoid calling it again until the TT_Update() function is called and NPRESULT_SUCCESS is returned.
Function Input
None
Function Output
Void
C++ Example
Checks whether Rigid Body is tracked or not.
Description
Checks whether the Rigid Body is being tracked in the current frame.
Returns true if the Rigid Body is tracked.
Function Input
Rigid body index (int)
Function Output
True / False (bool)
C++ Example
Obtains and saves 3D position, quaternion orientation, and Euler orientation of a Rigid Body
Description
This function saves position and orientation of a Rigid Body. Specifically, position and orientation at the Rigid Body pivot point is obtained.
3D coordinates of the Rigid Body will be assigned in declared variable addresses (*x, *y, *z).
Orientation of the Rigid Body will be saved in two different formats; Euler and quaternion rotations. Yaw, pitch, and roll values for Euler representation will be saved in the declared variable addresses (*yaw, *pitch, *roll), and qx, qy, qz, and qw values for the quaternion rotation will be saved in declared variable addresses (*qx, *qy, *qz, and *qw).
Function Input
Rigid body index (int)
Declared variable (float) addresses for:
3D coordinates (x,y,z)
Quaternion Rotation (qx, qy, qz, qw)
Euler Rotation ( yaw, pitch, roll)
Function Output
Void
C++ Example
Clears and removes all Rigid Body assets.
Description
This function clears all of existing Rigid Body assets in the project.
Function Input
None
Function Output
Void
C++ Example
Removes a Rigid Body from the project
Description
This function removes a single Rigid Body from a project.
Returns a NPRESULT integer value. If the operation was successful, it returns 0 (NPRESULT_SUCCESS).
Function Input
Rigid body index (int)
Function Output
NPRESULT
C++ Example
Returns a total number of Rigid Bodies.
Description
This function returns a total count of Rigid Bodies involved in the project.
This can be used within a loop to set required number iterations and access each of the Rigid Bodies.
Function Input
None
Function Output
Total Rigid Body count (int)
C++ Example
Returns the User Data ID value of a Rigid Body.
Description
This function returns the User Data ID number of a Rigid Body.
User ID is a user definable ID for the Rigid Body. When working with capture data in external pipelines, this value can be used to address specific Rigid Bodies in the scene.
Function Input
Rigid body index (int)
Function Output
User Data ID (int)
C++ Example
Assigns a User Data ID number to a Rigid Body.
Description
Assigns a User Data ID number to a Rigid Body.
The User Data ID numbers can be used to point to particular assets when processing the data in external applications.
Function Input
Rigid body index (int)
Desired User Data ID (int)
Function Output
Void
C++ Example
Returns a mean error of the Rigid Body tracking data.
Description
Returns a mean error value of the respective Rigid Body data for the current frame.
Function Input
Rigid body index (int)
Function Output
Mean error (meters)
Returns the name for the Rigid Body.
Description
These functions are used to obtain name of a Rigid Body.
Returns the assigned name of the Rigid Body.
Function Input
Rigid body index (int)
Function Output
Rigid body name (const char*, const w_chart*)
C++ Example
Enables/disables tracking of a Rigid Body.
Description
This function enables, or disables, tracking of the selected Rigid Body.
All Rigid Bodies are enabled by default. Disabled Rigid Bodies will not be tracked, and no data will be received from it.
Function Input
Rigid body index (int)
Tracking status (bool)
Function Output
Void
C++ Example
Checks whether a Rigid Body is enabled.
Description
This function checks whether tracking of the Rigid Body is enabled or not.
The function returns true is the tracking is enabled.
Function Input
Rigid body index (int)
Function Output
True / False (bool)
C++ Example
Translates the pivot point of a Rigid Body.
Description
This function translates a Rigid Body.
3D position of a Rigid Body will be displaced in x/y/z directions by inputted amount (meters).
Translation is applied in respect to the local Rigid Body coordinate axis, not the global axis.
Returns a NPRESULT integer value. If the operation was successful, it returns 0 (NPRESULT_SUCCESS).
Function Input
Rigid body index (int)
Translation along x-axis, in meters. (float)
Translation along y-axis, in meters. (float)
Translation along z-axis, in meters. (float)
Function Output
NPRESULT
C++ Example
Resets orientation of a Rigid Body.
Description
This function resets orientation of the Rigid Body and re-aligns its orientation axis with the global coordinate system.
Additional Note: When creating a Rigid Body, its zero orientation is set by aligning its axis with the global axis at the moment of creation. Calling this function essentially does the same thing on an existing Rigid Body asset.
Returns true if the Rigid Body orientation was reset.
Function Input
Rigid body index (int)
Function Input
True / False (bool)
C++ Example
Gets total number of markers in a Rigid Body.
Description
This function returns total number of markers involved in a Rigid Body.
Function Input
Rigid body index (int)
Function Output
Total number of marker in the Rigid Body (int)
C++ Example
Saves 3D coordinates of a solved Rigid Body marker in respect to respective Rigid Body's local space.
Description
This function gets 3D position of a solved Rigid Body marker and saves them in designated addresses. Rigid body marker positions from this function represents solved (or expected) location of the Rigid Body markers. For actual reconstructed marker positions, use the TT_RigidBodyPointCloudMarker function.
Note that the 3D coordinates obtained by this function is represented in respect to Rigid Body's local coordinate axis. For obtaining 3D coordinate in respect to global coordinates, use TT_RigidBodyPointCloudMarker function.
Function Input
Rigid body index (int)
Marker index (int)
Three declared variable addresses for saving x, y, z coordinates of the marker (float)
Function Output
Void
C++ Example
Changes and updates the Rigid Body marker positions.
Description
This function is used to change the expected positions of a single Rigid Body marker.
Rigid body markers are expected marker positions. Read about marker types in Motive.
Function Input
Rigid body index (int)
Marker index (int)
New x-position of the Rigid Body marker in respect to the local coordinate system.
New y-position of the Rigid Body marker in respect to the local coordinate system.
New z-position of the Rigid Body marker in respect to the local coordinate system.
Function Output
Returns true if marker locations have been successfully updated.
Saves 3D coordinates of a Rigid Body marker in respect to the global space.
Description
This function saves 3D coordinates of each Rigid Body marker in designated addresses.
3D coordinates are saved in respect to global coordinate system.
Function Input
Rigid body index (int)
Marker index (int)
Tracked status, True or False (bool)
Three declared variable addresses for saving x, y, z coordinates of the marker (float).
Function Output
Void
C++ Example
Saves 3D coordinates of a Rigid Body solved marker positions in respect to the global space. Unlike TT_RigidBodyPointCloudMarker function, it does not report point cloud solved positions, but it reports the expected marker positions in respect to Rigid Body position and orientation.
Description
This function saves 3D coordinates of each expected Rigid Body marker positions in designated variable addresses.
3D coordinates are saved in respect to global coordinate system.
Function Input
Rigid body index (int)
Marker index (int)
Tracked status, True or False (bool)
Three declared variable addresses for saving x, y, z coordinates of the marker (float).
Function Output
Void
C++ Example
This function is used for obtaining unique identifiers for a specific Rigid Body indicated by the Rigid Body index number.
Function Input
Rigid body index (int)
Function Output
Rigid body unique ID (Core::cUID)
Creates a Rigid Body asset from a set of reconstructed 3D markers.
Description
This functions creates a Rigid Body from the marker list and marker count provided in its argument.
The marker list is expected to contain a list of marker coordinates in the following order: (x1, y1, z1, x2, y2, z2, …, xN, yN, zN). The x/y/z coordinates must be in respect to the Rigid Body pivot point, in meters.
Inputted 3D locations are taken as Rigid Body marker positions about the Rigid Body pivot point. If you are using TT_FrameMarkerX/Y/Z functions to obtain the marker coordinates, you will need to subtract the pivot point location from the global marker locations when creating a Rigid Body. This is shown in the below example. If this is not done, created Rigid Body will have its pivot point at the global origin.
Returns an NPRESULT integer value. If the Rigid Body was successfully created, it returns 0 or NPRESULT_SUCCESS.
Function Input
Rigid body name (char)
User Data ID (int)
Marker Count (int)
Marker list (float list)
Function Output
NPRESULT
C++ Example
Obtains Rigid Body settings for a given asset, and saves them in a cRigidBodySettings instance.
Description
This function obtains Rigid Body settings for a given Rigid Body asset and saves them into a declared cRigidBodySetting instance address.
Rigid body settings are saved into an instance of the cRigidBodySettings class.
For detailed information on member function and variables in the cRigidBodySettings class, refer to its declaration in the RigidBodySettings.h header file.
Returns a NPRESULT integer value.
Function Input
Rigid body index (int)
declared instance address (cRigidBodySettings)
Function Output
NPRESULT
C++ Example
Changes property settings of a Rigid Body.
Description
This function assigns a set of Rigid Body settings to a Rigid Body asset.
An instance of cRigidBodySettings will be attached to the provided Rigid Body.
Returns a NPRESULT integer value. If the marker was successfully created, it returns 0 (NPRESULT_SUCCESS).
Function Input
Rigid body index (int)
Function Output
NPRESULT
C++ Example
Initiates the Rigid Body refinement process. Input the number of samples and the ID of the Rigid Body you wish to refine. After starting the process, TT_RigidBodyRefineSample bust be called on everyframe in order to collect samples.
Description
This function is used to start Rigid Body refinement.
Function Input
Target Rigid Body ID
Sample count (int)
Function Output
Returns true if the refinement process has successfully initiated.
This function collects samples for Rigid Body refinement started by calling the TT_RigidBodyRefineStart function. Call this function for every frame; within the update loop. You can check the progress of calibration by calling the TT_RigidBodyRefineProgress function.
Description
This function collects sample Rigid Body tracking data for refining the definition of corresponding Rigid Body.
Function Input
None. Samples frames for the initialized refine process.
Function Output
Returns true if the refinement process has successfully collected a sample. This function does not collect samples if Rigid Body is not tracked on the frame.
This function inquiries the state of the refinement process. It returns TT_RigidBodyRefineStates enum as a result.
Description
This function queries the state of the Rigid Body refinement process. It returns an enum value for indicating whether the proess is intialized, sampling, solving, complete, or uninitialized.
<source> enum TT_RigidBodyRefineStates {
};
</source>
Function Input
None. Checks the state on the ongoing refinement process.
Function Output
Returns TT_RigidBodyRefineStates enum value.
This function inquiries the progress of the refinement sampling process.
Description
When the refinement process is under the sampling state, calling this function returns the sampling progress. It will return a percentage value representing the sampling progress in respect to the total number of samples given in the TT_RigidBodyRefineStart parameter.
Function Input
None. Checks the progress on the ongoing refinement process.
Function Output
Returns percentage completness of the sampling process (float).
These two functions returns error values of the Rigid Body definition before and after the refinement.
Description
Once the refinement process has reached complete stage, these two functions can be called to compare the error values from corresponding Rigid Body defintion before and after the refinement.
Function Input
None.
Function Output
Average error value of the target Rigid Body defintion prior (TT_RigidBodyRefineInitialError) and after (TT_RigidBodyRefineResultError) the refinement.
This function applies the refined result to the corresponding Rigid Body definition.
Description
This function applies the refined Rigid Body definition. After comparing the error values before and after the refinement using TT_RigidBodyRefineInitialError and TT_RigidBodyRefineResultError functions, use this function to apply if the results are satisfying.
Function Input
None.
Function Output
Returns true if the refined results have been successfully applied.
This function discards the final refinement result and resets the refinement process.
Description
If the final refinement result from the TT_RigidBodyRefineResultError call is not satisfying, you can call this function to discard the result and start over from the sampling process again.
Function Input
None.
Function Output
Returns true if the refined results have been successfully resetted.
Returns pointer to the CameraManager instance.
Description
This function returns a pointer to the CameraManager instance from the Camera SDK.
Camera SDK must be installed to use this function.
The version number of Motive and the Camera SDK must match.
Corresponding headers and libraries must be included in the program.
Function Input
None
Function Output
Pointer to the CameraManager instance (CameraLibrary::CameraManager*)
C++ Example
Returns Motive build number.
Description
This function returns corresponding Motive build number.
Function Input
None
Function Output
Build number (int)
C++ Example
Returns camera group count.
Description
This function returns total count of camera groups that are involved in the project.
Function Input
None
Function Output
Camera group count (int)
C++ Example
Creates a new camera group.
Description
This function adds an additional camera group (empty) to a project.
Note: Creating an additional camera group is unnecessary for most applications. Most common case is to group cameras to set them as a reference group for recording grayscale videos.
Function Input
None
Function Output
True/False (bool)
C++ Example
Removes a camera group.
Description
This function removes a camera group, specified by its index number.
The camera group must contain no cameras in order to be removed.
Returns true if the group was successfully removed.
Function Input
Camera group index (int)
Function Output
True/False (bool)
C++ Example
Returns an index value of a camera group that a camera is involved in.
Description
This function takes an index value of a camera and returns corresponding camera group index which the camera is involved in.
Function Input
Camera index (int)
Function Output
Camera group index (int)
C++ Example
Introduces shutter delay to a camera group.
Description
This function sets a shutter delay (in microseconds) to a camera group, which is designated by its index number.
After assigning the delay, all of the cameras involved in the camera group will shutter at a delayed timing when recording.
Function Input
Camera group index (int)
Delay in microseconds (int)
Function Output
Void
C++ Example
Moves a camera to a different camera group.
Description
This function assigns/moves a camera to a different camera group
Function Input
Camera index (int)
Camera group index (int)
Function Output
Void
C++ Example
Obtains the camera group's filter settings.
Description
This function fetches configured 2D filter settings from a camera group and saves the settings in the declared cCameraGroupFilterSettings instance.
Returns a NPRESULT integer value. When the function successfully assigns the filter settings, it returns 0 (or NPRESULT_SUCCESS).
Function Input
Camera group index (int)
Group filter settings instance (cCameraGroupFilterSettings)
Function Output
NPRESULT
C++ Example
Assigns camera group filter settings to a camera group.
Description
This function assigns inputted filter settings (cCameraGroupFilterSettings) instance to a camera group designated by its index number.
Returns a NPRESULT integer value. When the function successfully assigns the filter settings, it returns 0 (or NPRESULT_SUCCESS).
Function Input
Camera group index (int)
Filter settings instance (cCameraGroupFilterSettings)
Function Output
NPRESULT
C++ Example
Obtains marker size settings of a camera group
Description
This function fetches currently configured marker size settings from a camera group, and saves them onto a declared cCameraGroupMarkerSizeSettings class instance.
The marker size settings determine display properties of the 3D markers reconstructed from a specific group of cameras.
Returns a NPRESULT integer value. When the function successfully obtains the settings, it returns 0 (or NPRESULT_SUCCESS).
Function Input
Camera group index (int)
Marker size settings (cCameraGroupMarkerSizeSettings)
Function Output
NPRESULT
C++ Example
Applies given marker size settings to a camera group.
Description
This function applies an instance cCameraGroupMarkerSizeSettings to a camera group.
The marker size settings determine display properties of 3D markers reconstructed from a specific group of cameras.
Marker sizes are represented by corresponding diameter in millimeters.
Returns a NPRESULT integer value. When the function successfully applies the settings, it returns 0 (or NPRESULT_SUCCESS).
Function Input
Camera group index (int)
Marker size settings (cCameraGroupMarkerSizeSettings)
Function Output
NPRESULT
C++ Example
Enables or disables marker reconstruction contribution from a camera group.
Description
Enables or disables marker reconstruction contribution from a camera group.
Input TRUE for enable argument in order to allow the camera group to reconstruct markers.
Returns a NPRESULT integer value. When the function successfully enables/disables the reconstruction, it returns 0 (or NPRESULT_SUCCESS).
Function Input
Camera group index (int)
Boolean argument for enabling (true) and disabling (false) the mode.
Function Output
NPRESULT
C++ Example
Enables or disables filter switchers.
Description
This function enables or disables filter switches for all of the connected cameras.
Returns a NPRESULT integer value. When the function successfully changes the setting, it returns 0 (or NPRESULT_SUCCESS).
Function Input
Boolean argument for enabling (true) or disabling (false) the filter.
Function Output
NPRESULT
C++ Example
Checks whether filter switches are enabled or not.
Description
This function checks whether filter switch is enabled in all of the cameras,
It returns true if the switches are enabled.
Function Input
Void
Function Output
Enabled/disabled (bool)
C++ Example
Returns a total number of cameras connected to the system.
Description
This function returns a total camera count.
Function Input
None
Function Output
Total number of cameras (int)
C++ Example
Returns x-position of a camera.
Description
This function returns camera's X position in respect to the global coordinate system
Function Input
Camera index (int)
Function Output
Camera's X position. Measured in meters with reference to global coordinate system. (float)
C++ Example
Returns y-position of a camera.
Description
This function returns camera's Y position in respect to the global coordinate system
Function Input
Camera index (int)
Function Output
Camera Y-position. Measured in meters with reference to global coordinate system. (float)
C++ Example
Returns z-position of a camera.
Description
This function returns camera's Z position in respect to the global coordinate system
Function Input
Camera index (int)
Function Output
Camera's Z position. Measured in meters with reference to global coordinate system. (float)
C++ Example
Gets a components of the camera's orientation matrix.
Sample output from a program displaying the rotation matrix.
Description
This function returns a single constant from camera's orientation matrix in respect to the global coordinate axis.
The camera index input (int) determines which camera to obtain the matrix from.
The matrix index determines which component of the rotation matrix to return.
Function Input
Camera index (int)
Matrix index (int)
Function Output
Single component of the rotation matrix (float)
C++ Example
Returns coresponding camera's model name and serial number
Description
This function returns corresponding camera's name and serial number.
Function Input
Camera index (int)
Function Output
Camera name and serial number (const char)
C++ Example
Returns coresponding camera's serial number as an integer.
Description
This function returns corresponding camera's serial number.
Function Input
Camera index (int)
Function Output
Camera serial number (int)
C++ Example
Returns a total number of centroids detected by a camera.
Description
This function returns a total number of centroids detected by a camera.
A centroid is defined for every group of contiguous pixels that forms a shape that encloses the thresholded pixels.
Size and roundness filter (cCameraGroupFilterSettings) is not applied in this data.
Function Input
Camera index (int)
Function Output
Number of centroids (int)
C++ Example
Returns 2D location of the centroid as seen by a camera.
Description
This function saves 2D location of the centroid as detected by a camera's imager.
Returns true if the function successfully saves the x and y locations.
Function Input
Camera index (int)
Centroid index (int)
Declared variables for saving x and y (float)
Function Output
True/False (bool)
C++ Example
Saves camera's pixel resolution.
Description
This function saves camera's pixel resolutions (width x height) into declared integer variables.
Returns true when successfully saving the values.
Function Input
Camera index (int)
Declared integer variable for saving width (int)
Declared integer variable for saving height (int)
Function Output
True/False (bool)
C++ Example
Saves predistorted 2D location of a centroid.
Description
This function saves predistorted 2D location of a centroid.
This data is basically where the camera would see a marker if there were no effects from lens distortions. For most of our cameras/lenses, this location is only a few pixels different from the distorted position obtained by the TT_CameraMarker function.
Returns true when successfully saving the values.
Function Input
Camera index (int)
Marker (centroid) index (int)
Declared variable for saving x location (float)
Declared variable for saving y location (float)
Function Output
True/False (bool)
C++ Example
Configures camera settings.
Description
This function sets camera settings for a camera device specified by its index number.
Input setting parameters must agree with the supported ranges (or video types) of the camera model.
A negative return value indicates the function did not complete the task.
Each of the video types is indicated with the following integers. Supported video types may vary for different camera models. Please check the Data Recording page for more information on which image processing modes are available in different models.
Segment Mode: 0
Raw Grayscale Mode: 1
Object Mode: 2
Precision Mode: 4
MJPEG Mode: 6
Valid exposure ranges depend on the framerate settings:
Prime series and Flex 13: 1 ~ maximum time gap between the frames, which is approximately (1 / framerate) - 200 microseconds with about 200 microseconds gap for protection.
Flex3 and Duo/Trio tracking bars: 1 ~ 480 scanlines.
Valid threshold ranges: 0 - 255
Valid intensity ranges: 0 - 15
Function Input
Camera index (int)
Video type (int)
Camera exposure (int)
Pixel threshold (int)
IR light intensity (int)
For more information on the camera settings, refer to the Devices pane page.
Function Output
True/False (bool)
C++ Example
Sets camera frame rate.
Description
This function sets the frame rate of a camera.
Returns true if it successfully adjusts the settings.
Note that this function may assign a frame rate setting that is out of the supported range. Check to make sure inputted frame rates are supported.
Function Input
Camera index (int)
Frame rate (int)
Function Output
True/False (bool).
C++ Example
Gets configured frame rate of a camera.
Description
This function returns frame rate of a camera.
Function Input
Camera index (int)
Function Output
Camera frame rate (int)
C++ Example
Gets configured video type of a camera.
Description
This function checks and returns configured video type (image processing mode) of a camera.
It returns an integer value which represents a video type:
Function Input
Camera index (int)
Function Output
Video type (int)
C++ Example
Gets exposure setting of a camera.
Description
This function returns exposure setting of a camera.
Exposure values are measured in microseconds in Prime series and Flex 13 camera models, and they are measured in scanlines for the Duo/Trio tracking bars and Flex 3 cameras.
To change exposure setting, use the TT_SetCameraSettings function.
For more information on camera settings in Motive, read through the Devices pane page.
Function Input
Camera index (int)
Function Output
Camera exposure (int)
C++ Example
Gets configured threshold (THR) setting of a camera.
Description
This function returns pixel brightness threshold setting of a camera.
When processing the frames, pixels with brightness higher than the configured threshold will be processed, and pixels with lower brightness will be discarded.
To change the threshold setting, use the TT_SetCameraSettings function.
For more information on camera settings in Motive, read through the Devices pane page.
Valid range: 1 - 255.
Function Input
Camera index (int)
Function Output
Pixel brightness threshold (int)
C++ Example
Gets configured intensity (LED) setting of a camera.
Description
This function returns configured IR illumination intensity setting of a camera.
To change the intensity setting, use the TT_SetCameraSettings function.
For more information on camera settings in Motive, read through the Devices pane page.
Valid range: 1 - 15.
Function Input
Camera index (int)
Function Output
Camera IR intensity (int)
C++ Example
Measures image board temperature of a camera.
Description
This function returns temperature (in celsius) of a camera's image board.
Temperature sensors are featured only in Prime series camera models.
Function Input
Camera index (int)
Function Output
Image board temperature (float)
C++ Example
Measures IR LED board temperature of a camera.
Description
This function returns temperature (in celsius) of a camera's IR LED board.
Temperature sensors are featured only in Prime series camera models.
Function Input
Camera index (int)
Function Output
IR LED board temperature (float)
C++ Example
Gets configured grayscale image frame rate decimation ratio of a camera.
Description
This feature is available only in Flex 3 and Trio/Duo tracking bars, and it has been deprecated for other camera models.
This function returns grayscale frame rate decimation ratio of a camera.
Valid decimation ratios are 0, 2, 4, 8. (e.g. When the decimation setting is set to 4, a camera will capture one grayscale frame for four frames of the tracking data)
To set the decimation ratio, use the TT_SetCameraGrayscaleDecimation function.
Grayscale images require more load on data processing. For this reason, you may want to decimate the grayscale frame images and capture the frames at a lower frame rate.
Function Input
Camera index (int)
Function Output
Decimation ratio (int)
C++ Example
Sets frame rate decimation ratio for processing grayscale images.
Description
This feature is available only in Flex 3 and Trio/Duo tracking bars, and it has been deprecated for other camera models.
This functions sets the frame decimation ratio for processing grayscale images in a camera.
Depending on the decimation ratio, a fewer number of grayscale frames will be captured. This can be beneficial when reducing the processing loads.
Supported decimation ratios: 0, 2, 4, 6, 8. (e.g. When the decimation setting is set to 4, a camera will capture one grayscale frame for 4 frames of the tracking data)
Returns true when it successfully sets the decimation value
Function Input
Camera index (int)
Decimation value (int)
Function Output
True/False (bool)
C++ Example
Enables or disables IR filter switch of a camera.
Description
This function enables, or disables, integrated camera filter switch for detecting IR lights.
Different camera models may have different filter switches. Refer to the camera model specifications for detailed information on the type and allowed wavelengths for the filter switch.
Returns true when it successfully enables/disables the filter switch.
Function Input
Camera index (int)
A boolean argument for enabling (true) or disabling (false) the filter.
Function Output
True/False (bool)
C++ Example
Enables and disables automatic gain control.
Description
This function enables/disables automatic gain control (AGC).
Automatic Gain Control feature adjusts the camera gain level automatically for best tracking.
AGC is only available in Flex 3's and Duo/Trio tracking bars.
Returns true when the operation was done successfully.
Function Input
Camera index (int)
Enabled (true) / disabled (false) status (bool)
Function Output
True/False (bool)
C++ Example
Enables or disables automatic exposure control.
Description
This function enables, or disables, Automatic Exposure Control (AEC) for featured camera models.
This feature is only available in Flex 3 and Duo/Trio tracking bars.
It allows cameras to automatically adjust its exposure setting by looking at the properties of the incoming frames.
Returns true if the operation was successful.
Function Input
Camera index (int)
A boolean argument for enabling (true) or disabling (false) the filter.
Function Output
True/false (bool)
C++ Example
Enables or disables the high power IR illumination mode.
Description
This function enables or disables, the high power mode for featured cameras.
The high power mode allows brighter IR LED illumination using more power source.
Returns true if the function successfully enables/disables the feature.
Function Input
Camera index (int)
A boolean argument for enabling (true) or disabling (false) the filter.
Function Output
True/False (bool)
C++ Example
Sets compression quality of MJPEG images.
Description
This function sets the quality of MJPEG images captured by a camera. More specifically, it changes the compression quality of MJPEG frames.
Compression quality is indicated by an integer number between 0 - 100 (no loss).
Lower MJPEG compression quality setting can reduce the processing load for the cameras and reduce latency, but doing so will result in low-quality images.
Returns true when the function successfully enables or disables, the mode.
Function Input
Camera index (int)
MJPEG compression quality (int)
Function Output
True/false (bool)
C++ Example
Gets configured imager gain setting of a camera.
Description
This function is used to check the imager gain setting of a camera.
It returns configured gain setting as an integer value.
Function Input
Camera index (int)
Function Output
Gain setting (int)
C++ Example
Gets total number of gain levels available in a camera.
Description
This function returns a total number of available gain levels in a camera.
Different camera models may have different gain level settings. This function can be used to check the number of available gain levels.
Function Input
Camera index (int)
Function Output
Number of gain levels available (int)
C++ Example
Sets the imager gain level.
Description
This function sets the gain level of a camera's imager.
Using high gain levels may be beneficial for long range tracking. However, note that increasing gain levels may also result in amplified noise signal, which can result in false reconstructions.
Check available gain levels for the camera model using the TT_CameraImagerGainLevels function.
Function Input
Camera index (int)
Function Output
Void
C++ Example
Checks if the continuous IR mode is supported.
Description
This function checks whether the continuous IR illumination mode is available in the camera model.
In the continuous IR mode, the IR LEDs will not strobe but will illuminate continuously instead.
Continuous IR modes are available only in the Flex 3 camera model and the Duo/Trio tracking bars.
Returns true if continuous IR mode is available.
Function Input
Camera index (int)
Function Output
True / False (bool)
C++ Example
Checks if the continuous IR mode is enabled.
Description
This function checks if the continuous IR mode is enabled or disabled in a camera.
Returns true if the continuous IR mode is already enabled.
Function Input
Camera index (int)
Function Output
True / False (bool)
C++ Example
Enables/disables continuous IR.
Description
This function enables, or disables, continuous IR illumination in a camera.
Continuous IR mode outputs less light when compared to Strobed (non-continuous) illumination, but this mode could be beneficial in situations where there are extraneous IR reflections in the volume.
Use TT_IsContinuousIRAvailable function to check whether if this mode is supported.
Function Input
Camera index (int)
A boolean argument for enabling (true) or disabling (false)
Function Output
Void
C++ Example
Clears masking from camera's 2D view.
Description
This function clears existing masks from the 2D camera view.
Returns true when it successfully removes pixel masks.
Function Input
Camera index (int)
Function Output
True / False (bool)
C++ Example
Description
This function allows a user-defined image mask to be applied to a camera.
A mask is an array of bytes, one byte per mask pixel block.
Returns true when masks are applied.
Function Input
Camera index (int)
Buffer
BufferSize
Function Output
True / False (bool)
C++ Example
Description
This function returns memory block of the mask.
One bit per a pixel of the mask.
Masking pixels are rasterized from left to right and from top to bottom of the camera's view.
Function Input
Camera index (int)
Buffer
Buffer size
Function Output
True / False (bool)
C++ Example
Description
This function retrieves the width, height, and grid size of the mask for the camera at the given index.
One byte per pixel of the mask. Masking width * masking height gives the required size of the buffer.
Returns true when the information is successfully obtained and saved.
Function Input
Camera index (int)
Declared variables:
Masking width (int)
Masking height (int)
Masking grid (int)
Function Output
True / False (bool)
C++ Example
Description
Auto-mask all cameras.
This is additive to any existing masking.
To clear masks on a camera, call TT_ClearCameraMask prior to auto-masking.
Function Input
none
Function Output
Auto masks all cameras
C++ Example
Sets camera state of a camera.
Description
This function configures camera state of a camera. Different camera states are defined in the eCameraStates enumeration.
Returns true when it successfully sets the camera state.
Function Input
Camera index (int)
Camera state (eCameraStates)
Function Output
True / False (bool)
C++ Example
Checks camera states.
Description
This function obtains and saves the camera state of a camera onto the declared variables.
Returns true if it successfully saves configured state.
Function Input
Camera index (int)
Declared variable for camera state (eCameraState)
Function Output
True / False (bool)
C++ Example
Returns the Camera ID.
Description
This function takes in a camera index number and returns the camera ID number.
Camera ID numbers are the numbers that get displayed on the devices.
The Camera ID number is different from the camera index number. On Prime camera systems, Camera IDs are assigned depending on where the cameras are positioned within the calibrated volume. On Flex camera systems, Camera IDs are assigned according to the order in which devices connected to the OptiHub(s).
Function Input
Camera index (int)
Function Output
Camera ID (int)
C++ Example
Fills a buffer with image from camera's view.
Description
This function fetches raw pixels from a single frame of a camera and fills the provided memory block with the frame buffer.
The resulting image depends on what video mode the camera is in. For example, if the camera is in grayscale mode, a grayscale image will be saved from this function call.
For obtaining buffer pixel width and height, you can use TT_CameraPixelResolution function to obtain respective camera resolution.
Byte span: Byte span is the number of bytes for each row of the frame. In a case of 8-bit pixel images (one byte per pixel), the number of pixels in the frame width will equal to the byte size of the span.
Buffer pixel bit depth: Pixel bit size for the image buffer that will be stored in the memory. If the imagers on the OptiTrack cameras capture 8-bit grayscale pixels, you will need to input 8 for this input.
Buffer: make sure enough memory is allocated for the frame buffer. A frame buffer will require memory of at least (Byte span * pixel height * Bytes per pixel) bytes. For example, on a 640 x 480 image with 8-bit black and white pixels, you will need (640 * 480 * 1) bytes allocated for the frame buffer.
Returns true if it successfully saves the image in the buffer.
Function Input
Camera index (int)
Buffer pixel width (int)
Buffer pixel height (int)
Buffer byte span (int)
Buffer pixel bit depth (int)
Buffer address (unsigned char*)
Function Output
True / False (bool)
C++ Example
Saves image buffer of a camera into a BMP file.
Description
This function saves image frame buffer of a camera into a BMP file.
Video type of the saved image depends on configured camera settings
Attach *.bmp at the end of the filename.
Returns true if it successfully saves the file.
Function Input
Camera index (int)
Filename (const char*)
Function Output
True / False (bool)
C++ Example
Obtains 2D position, of a 3D marker as seen by one of the cameras.
Description
This function reverts 3D data into 2D data. If you input a 3D location (in meters) and a camera, it will return where the point would be seen from the 2D view of the camera (in pixels) using the calibration information. In other words, it locates where in the camera's FOV a point would be located.
If a 3D marker is reconstructed outside of the camera's FOV, saved 2D location may be beyond the camera resolution range.
Respective 2D location is saved in the declared X-Y address, in pixels.
Function Input
Camera index (int)
3D x-position (float)
3D y-position (float)
3D z-position (float)
Declared variable for x and y location from camera's 2D view (float)
Function Output
Void
C++ Example
Removes lens distortion.
Description
This function removes the effect of the lens distortion filter and obtains undistorted raw x and y coordinates (as seen by the camera) and saves in the declared variables.
Lens distortion is measured during the camera calibration process.
If you want to apply the lens distortion filter back again, you can use the TT_CameraDistort2DPoint.
Function Input
Camera index (int)
Declared variables for x and y position in respect to camera's view (float)
Function Ouput
Void
C++ Example
Reapplies lens distortion model.
Description
This function restores the effect of default model for accommodating effects of the camera lens.
Note all reported 2D coordinates are already distorted to accommodate for effects of the camera lens. Apply this function to coordinates that are undistorted by using the TT_CameraUndistort2DPoint function.
This can be used to obtain raw data for 2D points that have been undistorted using the TT_CameraUndistort2DPoint function.
Function Input
Camera index (int)
Declared variables for x and y position in respect to camera's view (float)
Function Input
Void
C++ Example
Obtains 3D vector from a camera to a 3D point.
Description
This function takes in an undistorted 2D centroid location seen by a camera's imager and creates a 3D vector ray connecting the point and the camera.
Use TT_CameraUndistort2DPoint to undistort the 2D location before obtaining the 3D vector.
XYZ locations of both the start point and end point are saved into the referenced variables.
Returns true when it successfully saves the ray vector components.
Function Input
Camera index (int)
x location, in pixels, of a centroid (float)
y location, in pixels, of a centroid (float)
Three reference variables for X/Y/Z location, in meters, of the start point (float)
Three reference variables for X/Y/Z location, in meters, of the end point (float)
Function Output
True / False (bool)
C++ Example
Gets camera parameters for the OpenCV intrinsic model.
Description
This function sets camera's extrinsic (position & orientation) and intrinsic (lens distortion) parameters with values compatible with the OpenCV intrinsic model.
For retaining the extrinsic parameters, you can use the TT_CameraXLocation, TT_CameraYLocation, TT_CameraZLocation, and TT_CameraOrientationMatrix functions.
Returns true if the operation was successful.
Function Input
Camera index (int)
Three arguments for camera x,y,z-position, in mm, within the global space (float)
Camera orientation (float)
Lens center location, principleX and principleY, in pixels (float)
Lens focal length, in pixels. (float)
Barrel distortion coefficients: kc1, kc2, kc3 (float)
Tangential distortion (float)
Function Output
True / False (bool)
C++ Example
Gets pointer to the camera object from Camera SDK.
Description
This function returns a pointer to the Camera SDK's camera pointer.
While the API takes over the data path which prohibits fetching the frames directly from the camera, it is still very useful to be able to communicate with the camera directly for setting camera settings or attaching modules.
The Camera SDK must be installed to use this function.
Camera SDK libraries and the camera library header file (cameralibrary.h) must be included.
Returns Camera SDK Camera.
Function Input
Camera index (int)
Function Output
Camera SDK camera pointer (CameraLibrary::Camera*)
C++ Example
Changes position and orientation of the tracking bars.
Description
This function makes changes to the position and orientation of the tracking bar within the global space.
Note that this function will shift or rotate the entire global space, and the effects will be reflected in other tracking data as well.
By default, center location and orientation of a Tracking bar (Duo/Trio) determines the origin of the global coordinate system. Using this function, you can set a Tracking Bar to be placed in a different location within the global space instead of origin.
Function Input
X position (float)
Y position (float)
Z position (float)
Quaternion orientation X (float)
Quaternion orientation Y (float)
Quaternion orientation Z (float)
Quaternion orientation W (float)
Function Output
NPRESULT
C++ Example
Attaches/detaches cCameraModule instance to a camera object.
Description
This function attaches/detaches the cCameraModule class to a camera defined by its index number.
This function requires the project to be compiled against both the Motive API and the Camera SDK.
The cCameraModule class is inherited from the Camera SDK, and this class is used to inspect raw 2D data from a camera. Use this function to attach the module to a camera. For more details on the cCameraModule class, refer to the cameramodulebase.h header file from the Camera SDK.
The Camera SDK must be installed.
Function Input
Camera index (int)
cCameraModule instance (CameraLibrary::cCameraModule)
Function Output
Void
C++ Example
Attaches/detaches cRigidBodySolutionTest class to a Rigid Body.
Description
This function attaches/detaches the cRigidBodySolutionTest class onto a Rigid Body.
Once an instance of cRigidBodySolutionTest to a Rigid Body, it will evaluate the Rigid Body solution and return false if the solution does not qualify the provided condition.
The cRigidBodySolutionTest class uses the C++ inheritance design model. Inherit this class into your project with same function and class names, then attach the inherited class.
Function Input
Rigid body index (int)
Rigid body test module (cRigidBodySolutionTest*)
Function Output
Void
C++ Example
Attaches/detaches cTTAPIListener onto a TTAPI project.
Description
This function attaches/detaches a cTTAPIListener inherited class onto a TTAPI project.
The cTTAPIListener class uses the C++ inheritance design model. Inherit this class into your project with the same function and class names, then attach the inherited class.
This listener class includes useful callback functions that can be overrided. Including TTAPIFrameAvailable, TTAPICameraConnected, TTAPICameraDisconnected, InitialPointCloud, ApplyContinuousCalibrationResult.
Function Input
cTTAPIListener
Function Output
Void
C++ Example
Returns plain text message that corresponds to a NPRESULT value.
Description
Returns plain text message that corresponds to a result that a NPRESULT value indicates.
Function Input
NPRESULT
Function Output
Result text (const char)
C++ Example
Checks whether there is another OptiTrack software using the devices.
Description
Checks whether there is another OptiTrack software using the devices. Only one software should be occupying the devices at a time.
Function Input
None
Function Output
NPRESULT
Enumerator | Value |
---|---|
Camera_Enabled
0
Camera_Disabled_For_Reconstruction
1
Camera_Disabled
2
CameraStatesCount
3