I want to get the list of all tracking markers for the active clip in the clip editor and loop through each marker, so that I can do something with the markers, like get the (x,y) co-ordinate or delete it or change any other values like weight of the marker using python
1 Answer
$\begingroup$
$\endgroup$
This script
import bpy
D = bpy.data
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]))
from Blender: exporting camera tracking markers to CSV contains code to do what you're looking for. You'll have to adapt it, of course.