Tracking

particletracker.track.tracking_methods.contours(pp_frame, frame, parameters=None)

Implementation of OpenCVs contours.

Notes

To use contours you must have preprocessed the image to produce a black and white binary image with separated object. Contours stores: the centroid x, y, area enclosed by contour, the bounding rectangle (not rotated) which is used with contour to generate mask so that you can extract pixels from original image and perform some analysis.

area_min

Minimum contour area to store object

area_max

Maximum contour area to store object

aspect_min

Minimum contour aspect ratio to store object

aspect_max

Maximum contour aspect ratio to store object

get_intensities

If not False results in the software extracting a region around each particle. Pixels outside the contour are masked. The remaining particle image is processed using get_intensities method. Select the method by writing its name in the get_intensities box.

Parameters
  • ppframe – The preprocessed frame upon which tracking is to be performed.

  • frame – The unprocessed frame on which get_intensities is run.

  • parameters – Nested dictionary specifying the tracking parameters

Return type

Dataframe containing data from a single frame

particletracker.track.tracking_methods.hough(ppframe, frame, params=None)

Performs the opencv hough circles transform to locate circles in an image.

Notes

This method uses the opencv hough circles algorithm to look for circles in an image. It works well provided you constrain the radii searched to reasonably tight range. It is particularly good for tightly bunched large particles. To estimate the appropriate range of radii double left click on the image will give you a coordinate or you can use the circular crop tool to start off with about the right values. Set min dist that the centre of two circles can approach (a bit less than diameter). You then need to use P1 and P2 which are different gradient terms associated with the image. P1 is usually bigger than P2. Annotation with circles will automatically pick up the radii from the tracking so can be used to help get the settings right.

min_dist

minimum distance in pixels between two particles

min_rad

minimum radius of particles in pixels

max_rad

maximum radius of particles in pixels

p1

Control parameter

p2

Control parameter

remove_masked

Some circles have centres under the masked region. Selecting true removes this

get_intensities

If not False results in the software extracting a circular region around each particle of radius set by tracking and running a method in intensity_methods. Select the method by writing its name in the get_intensities box.

Parameters
  • ppframe – The preprocessed frame upon which tracking is to be performed.

  • frame – The unprocessed frame on which get_intensities is run.

  • parameters – Nested dictionary specifying the tracking parameters

Return type

Dataframe containing data from a single frame

particletracker.track.tracking_methods.trackpy(ppframe, frame, params=None)

Trackpy implementation

Notes

This method uses the trackpy python library which can be found here: http://soft-matter.github.io/trackpy/v0.5.0 If you use this method in a research publication be sure to cite according to the details given here: http://soft-matter.github.io/trackpy/v0.5.0/generated/trackpy.locate.html

using get_intensities will seriously slow down the processing so optimise everything else first.

Parameters
  • information (First five parameters expose trackpy options. For more) –

  • http (see) –

  • diameter – An estimate of the objects to be tracked feature size in pixels

  • minmass – The minimum integrated brightness.

  • percentile – Features must have a peak brighter than pixels in this percentile. This helps eliminate spurious peaks.

  • invert – Set True if looking for dark objects on bright background

  • max_iterations – max number of loops to refine the center of mass, default 10

  • get_intensities – If not False results in the software extracting a circular region around each particle of radius set by intensity radius and running a method in intensity_methods. Select the method by writing its name in the get_intensities box.

  • intensity_radius – The radius of the extracted intensity around each particle centre, see get_intensities.

  • show_output' – print tracked data to terminal window.

x

x location of particle

y

y location of particle

mass

total integrated brightness of the blob

size

radius of gyration of its Gaussian-like profile

ecc

eccentricity

signal

?!

raw_mass

total integrated brightness in raw_image

Parameters
  • ppframe – The preprocessed frame upon which tracking is to be performed.

  • frame – The unprocessed frame on which get_intensities is run.

  • parameters – Nested dictionary specifying the tracking parameters

Return type

Dataframe containing data from a single frame