I am trying to export markers from the Blender motion tracker and found the following script that will do exactly that:
for clip in D.movieclips:
for track in clip.tracking.tracks:
fn = 'data/tr_{0}_{1}.csv'.format(clip.name.split('.')[0], track.name)
with open(fn, 'w') as f:
frameno = 0
while True:
markerAtFrame = track.markers.find_frame(frameno)
if not markerAtFrame:
break
frameno += 1
coords = markerAtFrame.co.xy
f.write('{0} {1}\n'.format(coords[0], coords[1]))
It works but I have two questions:
How can I save the data on my Desktop rather than in folder in MacOS blender content where it saved right now. The following won't work:
fn = '/User/me/Desktop/data/tr_{0}_{1}.csv'.format(clip.name.split('.')[0], track.name)
The resulting values I get do not represent the more user friendly marker values in den Blender GUI. Instead of x/y coordinates in screen coordinates, I get a value between 0/1. How can I convert them to those screen coordinates ?
Thanks for your help
C:\\users\\user\\Desktop\\tr_{0}_{1}...
. To get screen coords multiply the values with the height and width of your clip. For what application you'd like to export the data? $\endgroup$/Users/username/Desktop/
. Also make sure there is adata
folder... $\endgroup$