[mocaptoolbox] Re: data structure of c3d.-files / export from Motive

  • From: Tommi Himberg <tommi.himberg@xxxxxxxxx>
  • To: jesper.hohagen@xxxxxxxxxxxxxx
  • Date: Tue, 14 Apr 2015 18:08:56 +0300

Hi Jesper,

we have Optitrack as well and it can be made to work with the MoCapToolbox,
although the experience is not quite as seamless as with Qualisys, for
example.

First, the problem of having nCameras as 0 is a simple issue, Motive
doesn't export that information with the c3d data. But you can fix this
very easily if you want, although I don't think it influences anything in
the toolbox, so leaving it as 0 would probably be fine, too.

When you import your datafile with the command

mydata = mcread('myfile.c3d')

you can then just assign a value to the nCameras field by:

mydata.nCameras = 12;

When you type the name of your data structure (in the above example,
mydata) on the command line it displays a list of the data fields that were
created when you loaded the data into your Matlab. The first field is type,
which should say 'MoCap Data'. Check also that the field mydata.data is not
empty but actually has the actual data in it. It should say e.g. [3001x123
double] , where the first number matches with your mydata.nFrames (it's how
many frames of data you have) and the second number is three times
mydata.nMarkers (it's the xyz coordinates of each of your markers). If
something looks wrong here (e.g. it says data: [] , then probably something
has gone wrong in Motive when exporting measurement data. I've been tripped
by choosing the wrong file format, not having the measurement unit set as
mm, and only exporting a fraction of the data, as whatever time window you
have selected in the editor will be the default range to export. Also, if
your markers are not named and part of a model, you need to check the
"export unnamed markers" box.

Often the error message you mentioned comes up when trying to input a
"normal" Matlab variable into a function rather than inputting a MoCap
structure. So check the input arguments of whatever function spits that
error message out, and make sure that e.g. when you do

partial_data = mcgetmarker(mydata, [1:4])

mydata of course needs to be a MoCap structure.

Here, partial_data will also automatically be a MoCap structure, and you
can feed it in to another MoCap toolbox function. But if you do

names = mcgetmarkername(mydata)

names will be just a cell matrix containing the names of your markers, and
therefore you'd get the warning you mentioned if you'd then try to do e.g.

headwidth = mcmarkerdist(names, 1, 2)

because when calculating the distance between two markers, the first input
argument needs to be the MoCap structure itself (mydata or partial_data)
and not something else, like a cell matrix as names is here. Often, if you
need to process your data with functions that are not a part of the MoCap
toolbox, you'll end up editing the data directly, possibly saving it to a
different variable, and then it is easy to forget that when using the
Toolbox functions, the data needs to be inside a MoCap data structure.

Hope these help,

Tommi

--

Tommi Himberg

Post-doctoral researcher

Department of Neuroscience and Biomedical Engineering

School of Science, Aalto University

Espoo, Finland







On 14 April 2015 at 16:56, Jesper Hohagen <jesper.hohagen@xxxxxxxxxxxxxx>
wrote:

Hi,

I´m new to MATLAB and the MoCapToolbox as you will read out the following
post, so I have to apologise in advance for this "rookie" questions.

I´d like to use the MoCapToolbox to analyse c3d.-tracking data exported
from Motive Software (12-camera Optitrack System). Unfortunately I have two
questions although I have not even started to work with the Toolbox:
I´d try to apply a few of the simple functions explained within the manual
but it seems as if the data of my files somehow have the wrong structure.
Error messages like "This function only works with MoCap, norm, or segment
data structures." or e.g. "Error in ..." displayed on the screen.
Furthermore, on the data structure view of my file it says "0" in the row
"nCameras" but I used 12.

Perhaps someone could give me a short response, how I can fix that basic
problems... Thank you so much!

Best regards,
Jesper Hohagen

--
Jesper Hohagen, M.A.
Institut für Systematische Musikwissenschaft
Universität Hamburg
Neue Rabenstr. 13
D-20354 Hamburg









--
Tommi Himberg

Other related posts: