1

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)

tacaswell
  • 84,579
  • 22
  • 210
  • 199
len
  • 749
  • 1
  • 8
  • 23

1 Answers1

2

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.

ppaulojr
  • 3,579
  • 4
  • 29
  • 56
  • Is this a binary format? To be able to exchange the found trajectories with e.g. mathematica to save tracks as in asci format. For example: Particle name, frame number, x, y. Is this possible? – len Feb 16 '16 at 12:49
  • 1
    `Pickle` is a serialization for Python objects. It's not a fully binary but it's not easily readable either. Maybe `TrackPy` Panda matrix would be better to exchange data with Mathematica – ppaulojr Feb 16 '16 at 12:54