LogoLogo
WebsiteSupportDownloadsForumsQuick LinksContact Us
v3.1
v3.1
  • OptiTrack Documentation
  • WHAT'S NEW
    • What's New in Motive 3.1
  • QUICK START GUIDES
    • Quick Start Guide: Getting Started
    • Quick Start Guide: Prime Color Camera Setup
    • Quick Start Guide: Precision Capture
    • Quick Start Guide: Tutorial Videos
    • Quick Start Guide: Active Marker Tracking
    • Quick Start Guide: Outdoor Tracking Setup
  • HARDWARE
    • Cameras
      • Ethernet Cameras
        • PrimeX 120
        • PrimeX 41
        • PrimeX 22
        • PrimeX 13
        • PrimeX 13W
        • SlimX 13
        • Prime Color
      • USB Cameras
        • Slim 3U
        • Flex 13
        • Flex 3
        • Duo 3
        • Trio 3
        • Adjusting Global Origin for Tracking Bars
    • Prepare Setup Area
    • Camera Mount Structures
    • Camera Placement
    • Ethernet Camera Network Setup
      • General Overview and Specs
      • Windows 10 Network Settings
      • Cabling and Load Balancing
      • Switch Configuration for PrimeX 120
      • NETGEAR ProSafe GSM7228S: Disabling the Broadcast Storm Control
      • White/Blacklisting Cameras
    • USB Camera System Setup
      • USB Camera Network Overview and Specs
      • Duo 3 and Trio 3 Setup
      • Tracking Bar Coordinate System
        • Transforming Coordinate System: Global to Local
    • Aiming and Focusing
    • Camera Status Indicators
  • MOTIVE
    • Installation and License Activation
    • Motive Basics
    • Calibration
      • Continuous Calibration
      • Continuous Calibration (Info Pane)
      • Calibration Squares
    • Markers
    • Assets
      • Gizmo Tool: Translate, Rotate, and Scale
    • Rigid Body Tracking
      • Aligning Rigid Body Pivot Point with a Replicated 3D Model
    • Skeleton Tracking
    • Trained Markersets
    • IMU Sensor Fusion
    • Data Recording
      • Data Types
    • Labeling
    • Data Editing
    • Data Export
      • Data Export: BVH
      • Data Export: C3D
      • Data Export: CSV
      • Data Export: FBX
      • Data Export: TRC
    • Data Streaming
    • Camera Video Types
    • Audio Recording
    • Motive HotKeys
    • Measurement Probe Kit Guide
    • Motive Batch Processor
    • Reconstruction and 2D Mode
  • MOTIVE UI PANES
    • Settings
      • Settings: General
      • Settings: Assets
      • Settings: Live Pipeline
      • Settings: Streaming
      • Settings: Views
      • Settings: Mouse and Keyboard
      • Settings: Audio
    • Assets Pane
    • Builder Pane
    • Constraints Pane
      • Constraints XML Files
    • Calibration Pane
    • Data Pane
    • Devices Pane
    • Edit Tools Pane
    • Graph View Pane
    • Info Pane
    • Labels Pane
    • Log Pane
    • Probe Pane
    • Properties Pane
      • Properties Pane: Camera
      • Properties Pane: Force Plates
      • Properties Pane: NI-DAQ
      • Properties Pane: OptiHub2
      • Properties Pane: Rigid Body
      • Properties Pane: Skeleton
      • Properties Pane: Take
      • Properties Pane: Trained Markerset
      • Properties Pane: eSync2
    • Status Panel
    • Toolbar/Command Bar
    • Control Deck
    • Viewport
  • PLUGINS
    • OptiTrack Blender Plugin
      • OptiTrack Blender Plugin
    • OptiTrack Unreal Engine Plugin
      • Unreal Engine: OptiTrack Streaming Client Plugin
      • Unreal Engine: OptiTrack Live Link Plugin
        • Quick Start Guide: Real-Time Retargeting in Unreal Engine with Live Link Content
        • Unreal Editor for Fortnite (UEFN): OptiTrack Plugin for Live Link Hub
        • Unreal Engine: Live Link Camera Stream Setup
        • Live Link Content: Active Puck Static Meshes
      • Unreal Engine: MotionBuilder Workflow
      • Unreal Engine: HMD Setup
      • Unreal Engine VCS Inputs
    • OptiTrack Unity Plugin
      • Unity: HMD Setup
    • OptiTrack OpenVR Driver
    • Autodesk Maya
      • Autodesk Maya: OptiTrack Insight VCS Plugin
    • Autodesk MotionBuilder
      • Autodesk MotionBuilder Plugin
      • Autodesk MotionBuilder: OptiTrack Skeleton Plugin
      • Autodesk MotionBuilder: OptiTrack Optical Plugin
      • Autodesk MotionBuilder: OptiTrack Insight VCS Plugin
      • Autodesk MotionBuilder: Timecode Data
    • OptiTrack Peripheral API
    • External Plugins
      • Houdini 19 Integration
  • ACTIVE COMPONENTS
    • Active Components Hardware
      • Active Puck
      • CinePuck
      • BaseStation
      • Information for Assembling the Active Tags
      • Manus Glove Setup
    • Configuration
      • Active Batch Programmer
      • Active Hardware Configuration: PuTTY
      • Active Component Firmware Compatibility
    • Active Marker Tracking
      • Active Finger Marker Set
  • SYNCHRONIZATION
    • Synchronization Hardware
      • External Device Sync Guide: eSync 2
      • External Device Sync Guide: OptiHub2
    • Synchronization Setup
    • OptiTrack Timecode
  • VIRTUAL PRODUCTION
    • Unreal Engine: OptiTrack InCamera VFX
    • Entertainment Marker Sets
    • PrimeX 41
  • MOVEMENT SCIENCES
    • Movement Sciences Hardware
      • General Motive Force Plate Setup
      • AMTI Force Plate Setup
      • Bertec Force Plate Setup
      • Kistler Force Plate Setup
      • Delsys EMG Setup
      • NI-DAQ Setup
      • Multiple Device Setup
    • Movement Sciences Marker Sets
      • Biomechanics Marker Sets
      • Biomech (57)
      • Rizzoli Marker Sets
    • For Visual3D Users
    • Prime Color Camera Setup
      • Prime Color Setup: Required Components
      • Prime Color Setup: Hardware Setup
      • Prime Color Camera Setup: Camera Settings
      • Prime Color Camera Setup: Prime Color FS Calibration
      • Prime Color Setup: Data Recording / Export
      • Prime Color Camera Setup: FAQ / Troubleshooting
      • Prime Color Camera Setup: Windows Network Settings
  • VIRTUAL REALITY
    • VR Plugins
      • VR Unreal Engine
        • OptiTrack Unreal Engine Plugin
        • Unreal Engine: OptiTrack Live Link Plugin
          • UE5.1 Live Link Retarget External Workaround
        • Unreal Engine: Using the OptiTrack Streaming Client Plugin
        • Unreal Engine VCS Inputs
      • VR Unity
        • OptiTrack Unity Plugin
      • VR OpenVR
        • OptiTrack OpenVR Driver
    • VR HMD Setup
      • Unreal Engine: HMD Setup
      • Unity: HMD Setup
      • Manually Calibrating the HMD Pivot Point
      • Sync Configuration with an HTC Vive System
    • SlimX 13
    • Active Marker Tracking
      • Active Finger Marker Set
    • Synchronization Hardware
      • External Device Sync Guide: eSync 2
      • External Device Sync Guide: OptiHub2
  • ANIMATION
    • Autodesk Maya
      • Autodesk Maya: OptiTrack Insight VCS Plugin
    • Autodesk MotionBuilder
      • Autodesk MotionBuilder Plugin
      • Autodesk MotionBuilder: OptiTrack Skeleton Plugin
      • Autodesk MotionBuilder: OptiTrack Optical Plugin
      • Autodesk MotionBuilder: OptiTrack Insight VCS Plugin
      • Autodesk MotionBuilder: Timecode Data
  • ROBOTICS
    • MoCap4ROS2 Setup
    • OptiTrack Robot Applications
    • Outdoor Tracking Setup
  • DEVELOPER TOOLS
    • Developer Tools Overview
    • Camera SDK
      • Class: cCameraModule
      • Class: cUID
    • Motive API
      • Motive API: Quick Start Guide
      • Motive API Overview
      • Motive API: Function Reference
      • Motive API Camera Calibration
    • NatNet SDK
      • NatNet 4.1
      • NatNet: Class/Function Reference
      • NatNet: Creating a Managed (C sharp) Client Application
      • NatNet: Creating a Native (C++) Client Application
      • NatNet: Data Types
      • NatNet: Matlab Wrapper
      • NatNet: Migration to NatNet 3.0 libraries
      • NatNet: Remote Requests/Commands
      • NatNet: Sample Projects
      • NatNet: Unicast Data Subscription Commands
      • Latency Measurements
    • Peripheral API: Glove Devices
  • SKELETON MARKER SETS
    • Full Body
      • Baseline (41)
      • Core (50)
      • Biomech (57)
      • Conventional (39)
    • Full Body + Fingers
      • Baseline + Passive Fingers (49)
      • Baseline + Active Fingers (57)
      • Core + Passive Fingers (54)
      • Core + Active Fingers (62)
    • Upper
      • Baseline Upper (25)
      • Conventional Upper (27)
    • Lower
      • Baseline Lower (20)
      • Helen Hayes Lower (19)
      • Conventional Lower (16)
    • Hand and Fingers
      • Left/Right Hand (4) Active
      • Left/Right Hand (10) Active + Passive
      • Active Finger Marker Set
    • Glove Device Setup
      • Manus Glove Setup
      • StretchSense Glove Setup
    • Rizzoli Marker Sets
    • Entertainment Marker Sets
    • Rigid Body Skeleton Marker Set
  • GENERAL TROUBLESHOOTING
    • Licensing Troubleshooting
    • Windows 11 Optimization for Realtime Applications
    • Network Troubleshooting
    • Troubleshooting Q&A
    • Running Motive on High DPI Displays
    • Firewall Settings
Powered by GitBook
On this page
  • Use
  • Class Reference
  • C# Scripts
  • C# Script Format
  • C# Example
  • IronPython Scripts
  • IronPython Script Format
  • IronPython Script Example

Was this helpful?

Export as PDF
  1. MOTIVE

Motive Batch Processor

PreviousMeasurement Probe Kit GuideNextReconstruction and 2D Mode

Was this helpful?

The Motive Batch Processor is a separate stand-alone Windows application, built on the new NMotive scripting and programming API, that can be utilized to process a set of Motive Take files via IronPython or C# scripts. While the Batch Processor includes some example script files, it is primarily designed to utilize user-authored scripts.

Initial functionality includes scripting access to file I/O, reconstructions, high-level Take processing using many of Motive's existing editing tools, and data export. Upcoming versions will provide access to track, channel, and frame-level information, for creating cleanup and labeling tools based on individual marker reconstruction data.

Motive Batch Processor Scripts make use of the NMotive .NET class library, and you can also utilize the NMotive classes to write .NET programs and IronPython scripts that run outside of this application. The NMotive assembly is installed in the Global Assembly Cache and also located in the assemblies sub-directory of the Motive install directory. For example, the default location for the assembly included in the 64-bit Motive installer is:

C:\Program Files\OptiTrack\Motive\assemblies\x64

The full source code for the Motive Batch Processor is also installed with Motive, at:

C:\Program Files\OptiTrack\Motive\MotiveBatchProcessor\src

You are welcome to use the source code as a starting point to build your own applications on the NMotive framework.

Use

Requirements

  • A batch processor script using the NMotive API. (C# or IronPython)

  • Take files that will be processed.

Steps

  1. First, select and load a Batch Processor Script. Sample scripts for various pipelines can be found in the [Motive Directory]\MotiveBatchProcessor\ExampleScripts\ folder.

  2. Load the captured Takes (TAK) that will be processed using the imported scripts.

  3. Click Process Takes to batch process the Take files.

Reconstruction Pipeline

Class Reference

A class reference in Microsoft compiled HTML (.chm) format can be found in the Help sub-directory of the Motive install directory. The default location for the help file (in the 64-bit Motive installer) is:

C:\Program Files\OptiTrack\Motive\Help\NMotiveAPI.chm

C# Scripts

The Motive Batch Processor can run C# and IronPython scripts. Below is an overview of the C# script format, as well as an example script.

C# Script Format

A valid Batch Processor C# script file must contain a single class implementing the ItakeProcessingScript interface. This interface defines a single function:

Result ProcessTake( Take t, ProgressIndicator progress ).

Result, Take, and ProgressIndicator are all classes defined in the NMotive namespace. The Take object t is an instance of the NMotive Take class. It is the take being processed. The progress object is an instance of the NMotive ProgressIndicator and allows the script to update the Batch Processor UI with progress and messages. The general format of a Batch Processor C# script is:

   using NMotive;
   // any other using statements
   public class MyCSharpScript : ITakeProcessingScript
   {
      public Result ProcessTake(Take t, ProgressIndicator progress)
      {
         Result scriptResult;
         // Script processing code here
         progress.SetMessage(“Done processing take “ + t.Name);
         progress.SetProgress( 100 );
         return scriptResult;
      }
   }

C# Example

In the [Motive Directory]\MotiveBatchProcessor\ExampleScripts\ folder, there are multiple C# (.cs) sample scripts that demonstrate the use of the NMotive for processing various different pipelines including tracking data export and other post-processing tools. Note that your C# script file must have a '.cs' extension.

Included sample script pipelines:

  • ExporterScript - BVH, C3D, CSV, FBXAscii, FBXBinary, TRC

  • TakeManipulation - AddMarker, DisableAssets, GapFill, MarkerFilterSCript, ReconstructAutoLabel, RemoveUnlabeledMarkers, RenameAsset

Batch Processor Script C# Sample (ExporterScript-C3D.cs): Exporting a take to C3D format.
 using System;
 using System.IO;
 using NMotive;
 
 /// <summary>
 /// Motive Batch Processor script for exporting a take file to C3D format.
 /// </summary>
 public class C3DExportScript : ITakeProcessingScript
 {
     /// <summary>
     /// The <c>ProcessTake</c> function is from the <c>ITakeProcessingScript</c> interface.
     /// Exports the given take to C3D format. The exported file is in the same 
     /// directory as the take file, and has the same name, but with a '.c3d' file extension.
     /// </summary>
     /// <param name="take">The take to export.</param>
     /// <param name="progress">Progress indicator object.</param>
     /// <returns>The result of the export process.</returns>
 	public Result ProcessTake(Take take, ProgressIndicator progress)
 	{
         // Construct an NMotive C3D exporter object with the desired
         // options. We will write C3D data for markers and assets.
         C3DExporter exporter = new C3DExporter
         {
 			//-== C3DExporter Class ==-
          		ColonNameSeparator = false,
 			RenameUnlabeledMarkers = false,
 			Units = LengthUnits.Units_Centimeters,
 			UseTimeCode = true,
 			UseZeroBasedFrameIndex = true,
 			WriteFingerTipMarkers = false,
 			WriteUnlabeledMarkers = false,
 			XAxis = Axis.Axis_NegativeX,		// Axis_PositiveX, Axis_NegativeX
 			YAxis = Axis.Axis_PositiveZ,		// Axis_PositiveY, Axis_NegativeY
 			ZAxis = Axis.Axis_PositiveY		// Axis_PositiveZ, Axis_NegativeZ
 			
         };
         
         // Construct the output C3D file. The output file will be co-located with the
         // take file and have the same name as the take file, but with a '.c3d' extension.
 		string outputFileName = Path.GetFileNameWithoutExtension(take.FileName) + ".c3d";
 		string outputDirectory = Path.GetDirectoryName(take.FileName);
 		string outputFile = Path.Combine(outputDirectory, outputFileName);
 
         // Do the export and return the Export functions result object.
 		progress.SetMessage("Writing to File");
 		progress.SetProgress( (float)0.1 );
 		return exporter.Export(take, outputFile, true);
 	}
 }

IronPython Scripts

IronPython Script Format

Your IronPython script file must import the clr module and reference the NMotive assembly. In addition, it must contain the following function:

def ProcessTake(Take t, ProgressIndicator progress)

The following illustrates a typical IronPython script format.

   #import sys and clr modules
   import sys
   import clr

   # Add a reference to the NMotive assembly
   clr.AddReference("NMotive")
   # Import everything from sys and NMotive.
   from System import *
   from NMotive import *

   # Define the ProcessTake function.
   def ProcessTake(take, progress):
      # Take processing code here
      .
      .
      .
      # return result object

IronPython Script Example

In the [Motive Directory]\MotiveBatchProcessor\ExampleScripts\ folder, there are sample scripts that demonstrate the use of the NMotive for processing various different pipelines including tracking data export and other post-processing tools. Note that your IronPython script file must have a '.cs' extension.

Batch Processor Script IronPython Sample (TrimAndFilter.py):

The following script performs a trim tails operation followed by a filtering/smoothing operation. If both operations succeed, the resulting take is saved.

 import sys
 import clr
 
 
 # Add a reference to the NMotive assembly
 clr.AddReference("NMotive")
 
 from System import *
 # Import everything from NMotive.
 from NMotive import *
 
 
 def ProcessTake(take, progress):
    # Set the message to be displayed next to to the progress bar in the 
    # Motive Batch Processor UI. 
    progress.SetMessage('Triming tails...')

    # Create an NMotive TrimTails object to perform the tail trimming operation.
    tailTrimming = TrimTails()

    # pass the progress object to the trim tails object. It will update 
    # progress that will be rendered in the UI.
    tailTrimming.Progress = progress

    # Set trail trimming options.
    tailTrimming.Automatic = True
    tailTrimming.LeadingTrimSize = 4
    tailTrimming.TrailingTrimSize = 4

    # And execute the trimming process.
    trimResult = tailTrimming.Process(take)

    # If trimming failed for some reason the Success field of the returned
    # NMotive Result object will be false and the Message field will contain
    # information about the failure. The Message field of the returned Result
    # object will be displayed in the UI. 
    if not trimResult.Success: # If trimming failed, return without saving the take.
       return trimResult
   
    # Starting the filtering process...
    progress.SetMessage('Filtering...')

    # Create the NMotive filter object.
    filtering = Filter()

    # We are going to use the progress bar to display the progress of each 
    # individual operation, so reset the progress bar to zero and pass the
    # the progress object to the filtering object.
    progress.SetProgress(0)
    filtering.Progress = progress

    # Set the cutoff frequency and filter.
    filtering.CutOffFrequency = 8 # Hz
    filteringResult = filtering.Process(take)
    if not filteringResult.Success: # If filtering failed, return without saving the take.
    	return filteringResult
 
    # If we get here trimming and filtering succeeded. Save the take file.
    progress.SetMessage('Saving take...')
    fileSaveResult = take.Save()
    if fileSaveResult != FileResult.ResultOK:
    	return Result(False, 'File save failed')
    
    return Result(True, '')

Launch the Motive Batch Processor. It can be launched from either the start menu, Motive install directory, or from the in Motive.

When running the reconstruction pipeline in the batch processor, the reconstruction settings must be loaded using the ImportMotiveProfile method. From Motive, export out the and make sure it includes the reconstruction settings. Then, import this user profile file into the Batch Processor script before running the reconstruction, or trajectorizer, pipeline so that proper settings can be used for reconstructing the 3D data. For more information, refer to the sample scripts located in the TakeManipulation folder.

is an implementation of the Python programming language that can use the .NET libraries and Python libraries. The batch processor can execute valid IronPython scripts in addition to C# scripts.

Data pane
IronPython
user profile