top of page

PFTrack Support Community

Public·54 Users

Export Scripts: Discreet Ascii Trackers

What does it do?

Exports the trackers as 2D points (one tracker per file).


Download


Script

# Discreet ASCII trackers export

#

# Generates one file for each exported tracker

#


import pfpy


def pfExportName():

return 'Discreet ASCII trackers'


def pfExportExtension():

return 'ascii'


def pfExportSupport():

return ('trackers')


def main():

# set desired coordinate system

pfpy.setExportCoordinateSystem('left', 'y')


# check each group

numGroups= pfpy.getNumGroups()

for j in range(0, numGroups, 1):

g= pfpy.getGroupRef(j)


# export each tracker

numTrackers= g.getNumTrackers()

for i in range(0, numTrackers, 1):

t= g.getTrackerRef(i)


if (t.getExport()):


# construct a filename for this tracker

fname= pfpy.getExportFilename().replace(".ascii", "-"+t.getName()+".ascii")

fobj= open(fname, 'w')


# tracked frame range

firstFrame= t.getInPoint()

lastFrame= t.getOutPoint()


# frame number padding

padding= 1+len('%d'%(lastFrame-1))


# export each valid track position

for j in range(firstFrame, lastFrame+1, 1):

if (t.validPosition(j)):


# fetch the tracker position

pos= t.getTrackPosition(j)


# pad the frame number

fn= '%d'%j

fn= fn.rjust(padding)+'.0'


# x and y coordinates

xp= '%+.2f'%pos[0]

yp= '%+.2f'%pos[1]


# write to file

fobj.write(fn+' : '+xp+', '+yp+'\n')


# finished this tracker

fobj.close()

79 Views
bottom of page