简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM