Skip to contents

Processes midlines from many frames of a video

Usage

get_primary_swimming_axis_df(
  .data,
  t,
  x,
  y,
  .out = NULL,
  .frame = frame,
  .point = point,
  cutoff = NULL,
  overwrite = TRUE,
  check_reasonableness = TRUE
)

Arguments

.data

Data frame containing the midline data

t

Column containing the time data. If a cutoff frequency is passed in, then this variable will be used to get the sampling frequency.

x, y

Columns containing the x and y coordinates of each point along the midline.

.out

Names of the output columns. Needs to have four elements specifying the names for the x and y coordinates of the swim axis and the parallel and perpendicular components of the excursion, in that order. Or it can be a named list containing at least some of the elements swimaxis_x, swimaxis_y, exc_x, exc, in any order. If the return elements aren't in the named list, the defaults are 'swimaxis_x', 'swimaxis_y', 'exc_x', and 'exc_y')

.frame, .point

Columns identifying frames and points (defaults are frame and point)

cutoff

(optional) If this parameter is included, smooth the swimming axis data with a low-pass filter with a cutoff at this frequency.

Value

A data frame containing the original variables along with

  • XX_ctr,YY_ctr: The center of each midline at each time, where XX and YY are the original names of the x and y coordinates.

  • a,b: The new midlines centered and projected on to the swimming direction and the perpendicular axis. b is useful as the lateral excursion of the swimming undulation.

Details

Uses get_primary_swimming_axis() to compute the swimming axis for a midline. Then optionally smooths the axis using a Butterworth filter, and then projects the midlines on to the new time-varying axes.