Code covered by the BSD License  

Highlights from
Simple Tracker

5.0

5.0 | 1 rating Rate this file 103 Downloads (last 30 days) File Size: 96.12 KB File ID: #34040
image thumbnail

Simple Tracker

by Jean-Yves Tinevez

 

01 Dec 2011 (Updated 22 May 2012)

Simple multiple particle tracker with gap closing.

| Watch this File

File Information
Description

  SIMPLETRACKER a simple particle tracking algorithm that can deal with gaps
 
  *Tracking* , or particle linking, consist in re-building the trajectories
  of one or several particles as they move along time. Their position is
  reported at each frame, but their identity is yet unknown: we do not know
  what particle in one frame corresponding to a particle in the previous
  frame. Tracking algorithms aim at providing a solution for this problem.
 
  |simpletracker.m| is - as the name says - a simple implementation of a
  tracking algorithm, that can deal with gaps. A gap happens when one
  particle that was detected in one frame is not detected in the subsequent
  one. If not dealt with, this generates a track break, or a gap, in the
  frame where the particle disappear, and a false new track in the frame
  where it re-appear.
 
  |simpletracker| first do a frame-to-frame linking step, where links are
  first created between each frame pair, using the hungarian algorithm of
  |hungarianlinker|. Links are created amongst particle paris found to be
  the closest (euclidean distance). By virtue of the hungarian algorithm,
  it is ensured that the sum of the pair distances is minimized over all
  particles between two frames.
 
  Then a second iteration is done through the data, investigating track
  ends. If a track beginning is found close to a track end in a subsequent
  track, a link spanning multiple frame can be created, bridging the gap
  and restoring the track. The gap-closing step uses the nearest neighbor
  algorithm provided by |nearestneighborlinker|.
 
  INPUT SYNTAX
 
  tracks = SIMPLETRACKER(points) rebuilds the tracks generated by the
  particle whose coordinates are in |points|. |points| must be a cell
  array, with one cell per frame considered. Each cell then contains the
  coordinates of the particles found in that frame in the shape of a
  |n_points x n_dim| double array, where |n_points| is the number of points
  in that frame (that can vary a lot from one frame to another) and |n_dim|
  is the dimensionality of the problem (1 for 1D, 2 for 2D, 3 for 3D,
  etc...).
 
  tracks = SIMPLETRACKER(points, max_linking_distance) defines a maximal
  value in particle linking. Two particles will not be linked (even if they
  are the remaining closest pair) if their distance is larger than this
  value. By default, it is infinite, not preventing nay linking.
  
  tracks = SIMPLETRACKER(points, max_linking_distance, max_gap_closing)
  defines a maximal frame distance in gap-closing. Frames further way than
  this value will not be investigated for gap closing. By default, it has
  the value of 3.
 
  track = SIMPLETRACKER(points, max_linking_distance, max_gap_closing, debug)
  adds some printed information about the tracking process.
 
  OUTPUT SYNTAX
 
  track = SIMPLETRACKER(...) return a cell array, with one cell per found
  track. Each track is made of a |n_frames x 1| integer array, containing
  the index of the particle belonging to that track in the corresponding
  frame. NaN values report that for this track at this frame, a particle
  could not be found (gap).
  
  Example output: |track{1} = [ 1 2 1 NaN 4 ]| means that the first track
  is made of the particle 1 in the first frame, the particle 2 in the
  second frame, the particle 1 in the 3rd frame, no particle in the 4th
  frame, and the 4th particle in the 5th frame.
 
  [ tracks adjacency_tracks ] = SIMPLETRACKER(...) return also a cell array
  with one cell per track, but the indices in each track are the global
  indices of the concatenated points array, that can be obtained by
  |all_points = vertcat( points{:} );|. It is very useful for plotting
  applications.
 
  [ tracks adjacency_tracks A ] = SIMPLETRACKER(...) return the sparse
  adjacency matrix. This matrix is made everywhere of 0s, expect for links
  between a source particle (row) and a target particle (column) where
  there is a 1. Rows and columns indices are for points in the concatenated
  points array. Only forward links are reported (from a frame to a frame
  later), so this matrix has no non-zero elements in the bottom left
  diagonal half. Reconstructing a crude trajectory using this matrix can be
  as simple as calling |gplot( A, vertcat( points{:} ) )|

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Hungarian Algorithm for Linear Assignment Problems (V2.3), Nearest-neighbor linker, Hungarian based particle linking

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
02 Dec 2011 Sebastien PARIS  
Please login to add a comment or rating.
Updates
02 Dec 2011

Added proper acknowledgements

30 Jan 2012

Modified the code to have it running o older MATLAB versions, at the very least R2007b. Following a request by Bill Betz.

14 May 2012

v1.1 - May 2012
- Solve memory problems for large number of points.
- Considerable speed improvment using properly the sparse matrices.
- Use the key/value pair syntax to configure the function.

22 May 2012

Fix a bug preventing from using the 'NearestNeighbor' option.

Tag Activity for this File
Tag Applied By Date/Time
tracking Jean-Yves Tinevez 02 Dec 2011 09:19:02
image processing Jean-Yves Tinevez 02 Dec 2011 09:19:02
particle linking Jean-Yves Tinevez 02 Dec 2011 09:19:02
image processing robert 29 May 2012 15:04:03

Contact us at files@mathworks.com