mrz mrz - 1 year ago 68
Python Question

How to save trajectories of tracked objects with trackpy?

I am testing

You can access my image data here:

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
? (I am new to Python)

Answer Source

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

import pickle

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