How to export tracking coordinates?

G'day,


I have been using Motion5 to track 2 markers on an animal. The tracking has been going quite well. But to analyse the dataset, I need to extract the x,y coordinates at every frame. I gather the coordinates are stored in the keyframe editor which displays the data graphically in Motion. Is anybody aware of how the tracking coordinates can be exported?


cheers

OS X Mountain Lion (10.8)

Posted on Apr 27, 2013 5:43 AM

Reply
9 replies

May 1, 2013 4:52 PM in response to BenB

BenB,


Thanks for replying.


I am trying to record fine scale insect movement. For this, I have a few markers on the insect which I track. The tracking has been quite straightforward and is surprisingly quick in Motion. For my movement based analysis, I need to extract the tracker position (x,y coordinates) at every frame (25fps). The rest of the analysis will be done elsewhere.


Given that Motion actually does the tracking quite nicely, I was wondering if there might be a way to extract the pixel values.


I haven't tried Mocha, does it work only with Motion or is it standlone?

May 1, 2013 5:36 PM in response to BenB

I just had a look up on Mocha. I need the data in CSV or ASCII file format (.txt or .pos). And the export options for Mocha on the website suggest exporting it to Motion, After Effects etc., but not as text file.


I run the files through scripts in Matlab for movement based analysis.


Here is an example of what can be done with the data:

http://ecologicalneuroscience.files.wordpress.com/2013/01/lw.jpg


This is an example of a quiver plot with the arrow indicating where animals look and the line indicating body axis.

Jun 23, 2013 10:17 PM in response to aj_myrmex

If the data is important to you, and Motion makes tracking easy, then manual entry into a spreadsheet can be facilitated in this way:


[The following assumes you have an Object that Match Moves the Analyze Motion data. If you don't have one, draw a small shape and add a Motion Tracking > Match Move behavior to it. In the Match Move inspector, drop down the disclosure triangle next to the gear icon and select the Analyze Motion track (if there's more than one, you'll have a choice.) Make sure the Transform is set to Attach to Source and make sure you drag the center spot over the spot it is supposed to be at that frame -- within the track data frames (the entire track will follow the "offset"). Once you have the object matching move with the track then you can do the following:]


Select the object that tracks the animal, and go to the Object menu > Convert to Keyframes. (This will not affect the Analyze Motion data, it will only remove the Match Move behavior and convert the analyzed motion data into "hard keyframes.")


Draw a black rectangle on your screen in an out of the way corner.n [See sample below]


Add 2 Generator > Text Generators > Numbers generators and drag them into position onto the black rectangle and separate them to be easily readable as X and Y coordinates (stacked works pretty well.) Make the font large-ish and easy to read (and white).


For each Number Generator, in the Text Generator > Generator inspector, uncheck Animate. Set the number of decimal places you want to display (tracking data is not exact pixels, but the result of 32 bit floating point calculations.)


Add a Link behavior to the Value parameter (of each generator) and drag the tracking object into the source well.


For each Scale parameter, divide the dimensions of the canvas by 100 (1920 becomes 19.2 and 1080 becomes 10.8, etc.). [This weirdness is a combination of how numbers are stored internally for Number values and canvas measurements which are always -0.5 to 0.5 in both directions regardless of resolution. Scaling values in this way "restores" the magnitude of values to the resolution size of the tracked data within the pixel boundaries of the video, i.e, the same values you'd see in the Transform > Position values 😀.]


Keep in mind that (0, 0) is the center of the canvas. You can use the X Offset and Y Offset options in the Link Behaviors to offset a coordinate system (you could set your 0,0 at the starting point of the track -- or just handle coordinate translation in the spreadsheet.). [To use 0,0 as the bottom left corner of 1080 media, X offset = 960, Y offset = 540 -- then all values in the canvas will be upper right quadrant values [use 1/2 the frame sizes for your chosen project format].) [When you select a Source Parameter > Compatible Parameter value, the "offset" parameter will reflect the source parameter label.]


Position the playhead at the start of the track and use the right arrow key to advance frame by frame. (Might be easier to have someone do this on one machine and read the values out loud while a second person enters the values into a spreadsheet.)


Tedius? Very... but it will get the job done more easily than trying to select each track point x and y in the keyframe editor. (The keyframe editor "maintains" up to 5 visible decimal places which can be read when the value is double clicked on in the keyframe editor Parameter List; but only up to 2 are ever presented under normal selection. You could set up to 10 decimal places with a Number generator.)


HTH


(image below is a smaller portion of a 1080 canvas; offsets set at bottom left corner of canvas; values reflect the center position of the yellow rectangle which appears just to the left and below the canvas center point. Numbers represent X position over Y position. Font is ridiculously large... 🙂 )

User uploaded file

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to export tracking coordinates?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.