View source: R/transformOFcoords.R
transformOFcoords | R Documentation |
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).
transformOFcoords(
df,
x,
y,
z,
pose_Tx,
pose_Ty,
pose_Tz,
pose_Rx,
pose_Ry,
pose_Rz,
transfToRcoord = TRUE,
transpose = TRUE,
rotate = TRUE
)
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. |
Dataframe with transformed OpenFace coordinates.
Axel Zinkernagel zinkernagel@uni-wuppertal.de
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.