From FourMs

Jump to: navigation, search


Exporting C3D from OptiTrack and importing in the Jyväskylä MoCap Toolbox

To export C3D from OptiTrack, your recording must be "Trajectorized". To do this, you need to have at least one rigid body or one skeleton in your project.

In the mocap toolbox, you will most likely encounter an error when you try to import the C3D file with mcread, something similar to:

??? Error using ==> fread
Invalid size.

To fix this, you must edit line 200 of the readc3d.m script from:

numdatapts = numFrames*inc*-1


numdatapts = abs(numFrames*inc);

Then you should be able to import your file.


We have 2 different OptiTrack systems. 8 flex-v100 Optitrack cameras + various extra equipment.

The information below refers to the newest one. Look under the Important heading below for information about the old system.

Streaming from the newest system

In the desktop folder on the pc that runs Arena, there is a shortcut called ConnectNatNet that opens the command window (terminal) with the ip-information needed to stream from the optitrack-pc to the iMac standing next to it. When the command window (terminal) has opened and says that it is ready to stream packets, go into Arena and start streaming from the "Stream" panel on the right side of the Arena window.

Select what you want to stream in the "Stream" panel, and look for data in the max patch called receive-from-pc on the iMac.

If there is no data coming into the max patch:

  • Check that the two computers are connected via ethernet-cable.
  • Check that the ip-address in the "Stream" panel in Arena is set to
  • Check that the ip-address on the iMac is set to If not go to Network Preferences (cmd-space and type network, select network.prefpane and hit enter). Select advanced and and "Manually" in the menu called "Configure IPv4". Then in the text field called IPv4 Adress, type, select OK and then Apply.

Important information regarding the old OptiTrack system

  • Remember to unplug the USB cables before turning off the power, otherwise the cameras will try to draw all the power from the computer (which has caused a couple of our cameras to break).
  • Use the D-link USB hubs, with 3A power supply. The cameras draw 500 mA each.
  • Split up the cameras on two or more USB busses to prevent dropouts (using extra USB pcmcia card).


We have access to the different software (comparison):

  • SDK: basic tracking features that can be embedded elsewhere.
  • Point Cloud Toolkit: the most basic software for finding 3D positions from the 2D cameras.
  • RigidBody Toolkit: defining rigid bodies that can be tracked in 3D or 6D
  • Arena: the full package for recording and playback.


There are several different streaming options available in NaturalPoint software:

  • NatNet: NaturalPoint Streaming Sample Distribution Files. This is NaturalPoint's own implementation, and is the one that is implemented in the streaming application we are using.
  • VRPN: Virtual Reality Peripheral Network. This seems to be the most widely accepted streaming format, and there is an SDK available.
  • TrackD: VR streaming format. This is a proprietary format and it requires Trackd to be licensed and installed.

We have tested various command line applications for connecting to the cameras and transmit the data to other applications. We have ended up using the OSCNatNetClient application developed by Nuno Diniz at IPEM in Ghent. This works fine for streaming both rigid body data and data from single markers.


Basic usage

  • Download and install the latest "Arena" software, found on the Optitrack website. There is no need to validate the license if you just want to use the camera.
  • Before connecting the cameras, turn on the USB hub power supply.
  • Connect the cameras
  • Start Arena.
  • Choose Cameras -> Calibrate and follow the instructions on the screen.
  • When the cameras are calibrated, you are ready to make simple recordings of marker data in the Arena software
  • Remember to unplug the USB cables before turning off the power to the USB hubs, otherwise the cameras will try to draw all the power from the computer.

Using cameras with Max/MSP

Use the standard jit.qt/dx.grab object and send a "setting" message. This will pop up the optitrack camera properties. If this window does not appear, something went wrong with the installation. Select the camera reference number in the "camera" field. There are no more steps needed.

Streaming data with natnet2osc

natnet2osc translates streaming NatNet into OSC messages. It has been tested with OptiTrack Arena.

NatNet data is received from the multicast address You must enter 1511 in the Data Port field on the Stream tab in Arena and select the Multicast option; however, for some strange reason the Multicast Address field must be left blank.

OSC messages are sent by default to To send OSC to a different address, specify it on the command line.

The IP Address and Command Port fields don't matter as natnet2osc only listens for data and neither sends nor receives commands.

The source (written in Go) for natnet2osc is in C:\src\natnet2osc. To build it, enter this directory and type 'go build'.

Streaming data with the OSCNatNetClient (old version)

Data can be streamed from the Arena software or the RigidBody software. It seems that the data from the Arena software has slightly less jitter. The OSCNatNetClient streams Open Sound Control data from Optitrack rigid bodies.

Naturalpoint Arena

The basic work flow is:

  • Load up your project, and calibrate cameras and define rigid bodies if that hasn't been done yet.
  • Start the OSCNatNetClient with the command OSCNatNetClient.exe [Server IP] [Local IP] [Destination IP] [Destination port]
- Server IP should be a valid address for the computer that Arena is running on.
- Local IP should be an address of the machine the OSCNatNetClient is running on. This address should be on the same network as that of the server IP. If both programs are running on the same machine you can always set both server and local IPs to '' .
- The destination IP and port is the IP address of the machine you want to stream to and the port that your program is expecting to recieve the data on.
  • In the stream tab/dialog in Arena, make sure that:
- The IP address is set to the same address as the server IP in OSCNatNetClient.
- The Command Port and Data Port is set to 1510 and 1511 respectively
  • Press 'Start Streaming Frames'.

When done multiple times it is often convenient to make a simple .bat script to start the OSCNatNetClient for you and place a shortcut to it on the desktop. Several examples of this can be found on the Dell machine in the lab.

If this doesn't work, you can try the following procedure:

  • Calibrate the cameras and define the rigid bodies for which you want to stream data.
  • Enable broadcasting frame data in the Arena software, and disable it right away.
  • Start OSCNatNetClient client as described above.
  • Enable broadcasting frame data again.

Naturalpoint RigidBody

  • Calibrate the cameras, start Optitrack Rigid Body Tool, and define the rigid bodies for which you want to stream data.
  • Start OSCNatNetClient client using the syntax described above
  • Make sure that the cameras are not paused (e.g. due to any markers being selected)
  • Mark the checkbox "Broadcast Frame Data" in the Rigid Body Software to start streaming data

Example of syntax for starting the OSCNatNetClient

Let us say that:

  • OSCNatNetClient.exe is running on the same computer as Arena, on ip
  • We want to receive data in a udpreceive object in Max/MSP, running on a computer on ip
  • We want to stream to port 5678

Then we would type the following in a command line prompt to start the application:

OSCNatNetClient.exe 5678

Exporting data from Arena to c3d

C3D-files may be exported. Trajectorize the recording (need a skeleton or rigid body for this), right click on the trajectorized recording in the Assets window, and select "Export c3d".

The exported data is as follows:

  • X is along the short edge of the L frame, positive axis from the corner to the tip
  • Y is along the long edge of the L frame, positive axis from the corner to the tip
  • Z is perpendicular to the L-frame, positive axis up from the frame (i.e. floor to ceiling with the usual setup)

This means that the "Z-axis" drawn on the L-frame is actually the Y-axis when exporting to c3d. We need to have a closer look at the axes in Arena, to see if this issue only concerns exporting to c3d or if it concerns Arena as well.

Use Cases

Background subtraction normally involves the someone behind the computer constantly capturing the background, whenever conditions change. For automatic background subtraction system, a few reflective markers and one Optitrack camera will do.

1) Put "n" number of markers on the wall that is meant to be subtracted; 2) set the brightness threshold in what ever software your using so that you only see the markers; 3) set up a counter for the markers; 4) When the counter = "n" the software should capture the background.

What this does, is that it captures the background every time the wall is empty. But when someone goes to the wall, it performs only background subtraction, and holds the capture until the subject leaves.


Personal tools