top of page

Export Discreet Ascii Trackers

  • Writer: Simon Gibson
    Simon Gibson
  • Aug 26
  • 1 min read

Updated: 6 days ago

ree

What does it do?

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



Downloads:


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()

Links:

Head back to PFTrack Resources. Or check out our Learning Articles for a deeper look at camera tracking and matchmoving concepts. Or visit our PFTrack Tutorials for step-by-step video guides covering the fundamentals of camera tracking and matchmoving in PFTrack.


bottom of page