mrz mrz - 3 months ago 21
Python Question

How to save trajectories of tracked objects with trackpy?

I am testing http://soft-matter.github.io/trackpy/stable/

You can access my image data here: http://goo.gl/fMv5oE

My code for tracking objects in subsequent video images is:

import matplotlib.pyplot as plt
plt.rcParams['image.cmap'] = 'gray' # Set grayscale images as default.

import trackpy as tp
import pims

v = pims.ImageSequence('F:/*.png')

f = tp.batch(v[:100],diameter=21,threshold=25)

t = tp.link_df(f, 5)


How can I save
t
? (I am new to Python)

Answer

As a rule of thumb you can serialize objects using Pickle.

import pickle
pickle.dump(t,open("filename.pck","wb"))

Also looking at the documentation o TrackPy you can find some ways to store data as a Panda matrix.

Comments