Skip to content

Instantly share code, notes, and snippets.


Created May 28, 2013
What would you like to do?
Blender python script to export the motion tracking markers to .csv files.
from __future__ import print_function
import bpy
D =
printFrameNums = False # include frame numbers in the csv file
relativeCoords = False # marker coords will be relative to the dimensions of the clip
f2=open('export-markers.log', 'w')
print('First line test', file=f2)
for clip in D.movieclips:
print('clip {0} found\n'.format(, file=f2)
for ob in clip.tracking.objects:
print('object {0} found\n'.format(, file=f2)
for track in ob.tracks:
print('track {0} found\n'.format(, file=f2)
fn = 'data/{0}_{1}_tr_{2}.csv'.format('.')[0],,
with open(fn, 'w') as f:
framenum = 0
while framenum < clip.frame_duration:
markerAtFrame = track.markers.find_frame(framenum)
if markerAtFrame:
coords =
if relativeCoords:
if printFrameNums:
print('{0},{1},{2}'.format(framenum, coords[0], coords[1]), file=f)
print('{0},{1}'.format(coords[0], coords[1]), file=f)
if printFrameNums:
print('{0},{1},{2}'.format(framenum, coords[0]*width, coords[1]*height), file=f)
print('{0},{1}'.format(coords[0]*width, coords[1]*height), file=f)
framenum += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.