transformOFcoords: Transform OpenFace coordinates

View source: R/transformOFcoords.R

transformOFcoordsR Documentation

Transform OpenFace coordinates

Description

OpenFace (https://github.com/TadasBaltrusaitis/OpenFace/) allows to export and save x, y, and z-coordinates per frame of a given set of markers. However, these coordinates are confounded by head movements and head turns. The function 'transformOFcoords' allows to transform the OpenFace coordinate system into the R coordinate system (flip y and z axes, so that the face is looking at you) and controls for head movements and rotations (using pose_Tx, pose_Ty, pose_Tz, pose_Rx, pose_Ry, pose_Rz; see https://github.com/TadasBaltrusaitis/OpenFace).

Usage

transformOFcoords(
  df,
  x,
  y,
  z,
  pose_Tx,
  pose_Ty,
  pose_Tz,
  pose_Rx,
  pose_Ry,
  pose_Rz,
  transfToRcoord = TRUE,
  transpose = TRUE,
  rotate = TRUE
)

Arguments

df

Data frame containing OpenFace output CSV with x,y,z marker columns and framerows.

x

String containing the name of the column containig the x-coordinate values of the marker (e.g., X_48).

y

String containing the name of the column containig the y-coordinate values of the marker (e.g., Y_48).

z

String containing the name of the column containig the z-coordinate values of the marker (e.g., Z_48).

pose_Tx

String containing the name of the column containig the x-coordinate values of the head movement (e.g., pose_Tx).

pose_Ty

String containing the name of the column containig the y-coordinate values of the head movement (e.g., pose_Ty).

pose_Tz

String containing the name of the column containig the z-coordinate values of the head movement (e.g., pose_Tz).

pose_Rx

String containing the name of the column containig the x-values of the head rotation in radiant (e.g., pose_Rx).

pose_Ry

String containing the name of the column containig the y-values of the head rotation in radiant (e.g., pose_Ry).

pose_Rz

String containing the name of the column containig the z-values of the head rotation in radiant (e.g., pose_Rz).

transfToRcoord

Logical value if OpenFace coordinates should be transformed into the R coordinate system. This means that the Y and the Z axis are reverted. Default is TRUE.

transpose

Logical value if the head movements should be controlled for. The coordinates of the head pose_Tx, pose_Ty and pose_Tz are subtracted from the marker coordinates. Default is TRUE.

rotate

Logical value if the head rotation should be controlled for. The rotation of the head pose_RTx, pose_Ry and pose_Rz are eleminated from the marker coordinates. Default is TRUE.

Value

Dataframe with transformed OpenFace coordinates.

Author(s)

Axel Zinkernagel zinkernagel@uni-wuppertal.de

Examples

## Not run: 
axtestRot <- transformOFcoords(axtest, x = "X_48", y = "Y_48", z = "Z_48",
pose_Tx = "pose_Tx", pose_Ty = "pose_Ty", pose_Tz = "pose_Tz", 
pose_Rx = "pose_Rx", pose_Ry = "pose_Ry", pose_Rz = "pose_Rz")

## End(Not run)
  

axzinker/blenderFace documentation built on Feb. 27, 2024, 10:25 a.m.