Description

trackter is an R package for semiautomated tracking and analysis of 2D kinematics from video and image data. The core functions of trackter automatically detect a region of interest (ROI) and compute important kinematic and shape parameters based on the ROI’s contour. These functions use thresholding and segmentation to identify ROIs and, thus, moderately contrasted images are required. Presented below is some of trackter’s functionality in the context of fish locomotion.

Please report any bugs or performance issues.

Getting started

For tutorial and tips on usage, please check out trackter’s github page

Installation

The release version of trackter can be installed with:

install.packages("trackter")

The current development version can be installed with:

    require(devtools)
    install_github("ckenaley/trackter")
    require(trackter)

External dependencies

The core functions of trackter that extract shape and contour data from images ( kin.simple and kin.search) depend upon EBImage, available on the Bioconductor repository. The current build and development versions of trackter install this dependency. If it does not install, it can be done so easily with just a few lines of code:

  if (!requireNamespace("BiocManager", quietly = TRUE))
   install.packages("BiocManager")
   BiocManager::install("EBImage")

trackter also contains several functions for image and video processing. These functions depend on the popular FFmpeg package and it must be installed if the user intends to use them. Installation is platform-dependent. I found the FFmpeg wiki installation and compilation guide to be quite useful.

Features

Automated kinematic analysis

  • Fast and accurate contour and shape analysis of ROIs.
  • ROI detection with search parameters including position and size.
  • Relevant functions: kin.search and kin.simple.

Tools for kinematic analysis of swimming animals

  • Calculate midline (propulsive) wavelength, trailing-edge frequency, paired-fin position.
  • Relevant functions: amp.freq, halfwave, wave, and fin.kin

Tools for image and video processing using FFmpeg

  • Access FFmpeg functionality, including filters and codecs, to extract frames, stitch videos, and edit images and videos.

  • Relevant functions: images.to.videos, images.to.videos2, vid.to.images, and vid.to.images2

Other miscellaneous, low-level tools for kinematic analysis

  • Compute distances in 2d space, angles, heading/bearing, convert radians to degrees and vice versa.
  • Relevant functions: dist.2d, cosine.ang, bearing.xy, deg, rad