Markers

These routines facilitate the calculation of 3d movement kinematics for marker-based video recordings.

Functions

Optical Systems

Details

Utilities for analyzing movement data recorded with marker-based video systems.

markers.analyze_3Dmarkers(MarkerPos, ReferencePos)[source]

Take recorded positions from 3 markers, and calculate center-of-mass (COM) and orientation Can be used e.g. for the analysis of Optotrac data.

Parameters:
  • MarkerPos (ndarray, shape (N,9)) – x/y/z coordinates of 3 markers

  • ReferencePos (ndarray, shape (1,9)) – x/y/z coordinates of markers in the reference position

Returns:

  • Position (ndarray, shape (N,3)) – x/y/z coordinates of COM, relative to the reference position

  • Orientation (ndarray, shape (N,3)) – Orientation relative to reference orientation, expressed as quaternion

Example

>>> (PosOut, OrientOut) = analyze_3Dmarkers(MarkerPos, ReferencePos)
markers.find_trajectory(r0, Position, Orientation)[source]

Movement trajetory of a point on an object, from the position and orientation of a sensor, and the relative position of the point at t=0.

Parameters:
  • r0 (ndarray (3,)) – Position of point relative to center of markers, when the object is in the reference position.

  • Position (ndarray, shape (N,3)) – x/y/z coordinates of COM, relative to the reference position

  • Orientation (ndarray, shape (N,3)) – Orientation relative to reference orientation, expressed as quaternion

Returns:

mov – x/y/z coordinates of the position on the object, relative to the reference position of the markers

Return type:

ndarray, shape (N,3)

Notes

\[\vec C(t) = \vec M(t) + \vec r(t) = \vec M(t) + {{\bf{R}}_{mov}}(t) \cdot \vec r({t_0})\]

Examples

>>> t = np.arange(0,10,0.1)
>>> translation = (np.c_[[1,1,0]]*t).T
>>> M = np.empty((3,3))
>>> M[0] = np.r_[0,0,0]
>>> M[1]= np.r_[1,0,0]
>>> M[2] = np.r_[1,1,0]
>>> M -= np.mean(M, axis=0)
>>> q = np.vstack((np.zeros_like(t), np.zeros_like(t),quat.deg2quat(100*t))).T
>>> M0 = vector.rotate_vector(M[0], q) + translation
>>> M1 = vector.rotate_vector(M[1], q) + translation
>>> M2 = vector.rotate_vector(M[2], q) + translation
>>> data = np.hstack((M0,M1,M2))
>>> (pos, ori) = signals.analyze_3Dmarkers(data, data[0])
>>> r0 = np.r_[1,2,3]
>>> movement = find_trajectory(r0, pos, ori)