API¶
This page provides the API documentation of EdiHeadyTrack.
video¶
- class EdiHeadyTrack.video.Video(filename=None)[source]¶
A class representing a Video
…
- cap¶
- filename¶
path to video file
- Type:
str
- fps¶
framerate in frames per second
- Type:
int
- height¶
pixel height of video
- Type:
int
- total_frames¶
length of video in frames
- Type:
int
- width¶
pixel width of video
- Type:
int
- writer¶
calibration¶
camera¶
- class EdiHeadyTrack.camera.Calibrator(checkerboard, video=<EdiHeadyTrack.video.Video object>, show=True)[source]¶
A class used to represent a camera Calibrator
…
- checkerboard¶
- Type:
- criteria¶
tuple of criteria for successful camera calibration
- Type:
tuple
- distortion¶
ndarray of distortion parameters
- Type:
ndarray
- frame¶
ndarray representing video frame
- Type:
ndarray
- gray_frame¶
ndarray representing grayscale video frame
- Type:
ndarray
- matrix¶
ndarray representing camera intrinsic matrix
- Type:
ndarray
- r_vecs¶
ndarray of rotational vectors
- Type:
ndarray
- t_vecs¶
ndarray of translation vectors
- Type:
ndarray
- calibrate()[source]¶
Performs the camera calibration procedure outlined here:
https://docs.opencv.org/4.x/dc/dbb/tutorial_py_calibration.html
- draw_corners(corners)[source]¶
Draws corners of checkerboard onto frame to verify calibration is working
- Parameters:
corners (ndarray) – ndarray of the corners found for a given frame
- Returns:
complete (bool) – bool representing whether search for corners is complete
frame (ndarray) – new video frame with corners drawn
- class EdiHeadyTrack.camera.Camera[source]¶
A class used to represent a Camera.
…
- focal_length¶
float representing the focal length of the Camera in mm
- Type:
float
- internal_matrix¶
array representing the Camera’s intrinsic parameters
- Type:
ndarray
- distortion_matrix¶
array representing the Camera’s lens distortion parameters
- Type:
ndarray
- calibrator¶
Calibrator object used for camera calibration
- Type:
- calibrated¶
bool for quick checking if camera has been calibrated
- Type:
bool
- calibrate(checkerboard=(9,6), video=Video()):
Performs calibration on the camera
- calibrate(checkerboard=(9, 6), video=<EdiHeadyTrack.video.Video object>, show=True)[source]¶
Creates a calibrator object and calibrates the Camera.
If arguments checkerboard and video aren’t passed in, the default checkerboard pattern and an empty video are used.
- Parameters:
checkerboard (tuple, optional) – Checkerboard pattern used in camera calibration (default is 9x6)
video (Video, optional) – Video used to calibrate camera
- class EdiHeadyTrack.camera.Checkerboard(dimensions=(9, 6))[source]¶
A class used to represent a calibration Checkerboard
…
- dimensions¶
tuple of checkerboard pattern dimensions
- Type:
tuple
- min_points¶
integer threshold of minimum detected points for checkerboard to be considered found
- Type:
int
- objectp3d¶
array of checkerboard points in three dimensions
- Type:
ndarray
- threedpoints¶
list of checkerboard points in three dimensions for each frame where a checkerboard is found
- Type:
list
- twodpoints¶
list of detected checkerboard points in two dimensions for each frame
- Type:
list
- get_corners(gray_frame)[source]¶
Looks for checkerboard corners in a given grayscale video frame.
- Parameters:
gray_frame (ndarray) – ndarray representing grayscale frame from video
- Returns:
ret (bool) – bool representing if corner search was successful
corners (ndarray) – ndarray containing coordinates of corners
facedetector¶
head¶
imu¶
- class EdiHeadyTrack.imu.Wax9(filename, time_offset=0, id=False)[source]¶
A class representing a Wax9 IMU: https://axivity.com/downloads/wax9
…
- columns¶
list of sensor data column headings
- Type:
list
filter¶
- class EdiHeadyTrack.filter.Filter[source]¶
A class used to represent a Filter for data
…
- a¶
denominator polynomial of the IIR filter
- Type:
ndarray
- b¶
numerator polynomial of the IIR filter
- Type:
ndarray
- More information on IIR filters here
- https¶
- Type:
//en.wikipedia.org/wiki/Infinite_impulse_response
- apply(signal)[source]¶
Applies filter to a signal
- Parameters:
signal (list) – signal for filter to be applied to
- Returns:
filtered_signal – new filtered signal
- Return type:
list
- low_pass_butterworth(fs=4000, lowcut=160, order=4)[source]¶
Creates a low pass butterworth filter
- Parameters:
fs (float, optional) – sampling frequency (default 4000Hz)
lowcut (float, optional) – lowcut frequency (default 160Hz)
order (int, optional) – order of the filter (default 4)
- Return type:
self
sensordata¶
- class EdiHeadyTrack.sensordata.Head(posedetector=<EdiHeadyTrack.posedetector.PoseDetector object>, id=0)[source]¶
A class used to represent a Head obtained using head pose estimation techniques
…
- posedetector¶
the PoseDetector object used to find the Head
- Type:
PoseDetector
- id¶
unique identifier given to Head
- Type:
str, int, float
- pose¶
dict containing Head pose time history
- Type:
dict
- calculate_pose()¶
computes HeadPose from detected facial landmarks
- class EdiHeadyTrack.sensordata.IMU(filename=None, time_offset=0, id=0)[source]¶
A class used to represent an IMU
…
- filename¶
file containing IMU sensor data
- Type:
str
- id¶
unique identifier given to IMU
- Type:
int, float, str
- time_offset¶
time offset applied to IMU data to sync with head pose data
- Type:
float
plot¶
- class EdiHeadyTrack.plot.Plot(*sensors)[source]¶
A class representing a Plot
…
- colors¶
list of colors used in plots
- Type:
list
- sensors¶
list of SensorData objects to be plotted
- Type:
list, SensorData
- lines¶
list of dicts containing data of each line being plotted
- Type:
list, dict
- plot_property(self, property='velocity', xlim=None, ylim=None, key_times=[], show=True):
plots a time comparison between sensor data
- plot_property(xproperty='frame', yproperty='velocity', xlim=None, ylim=None, key_times=[], key_frames=[], show=True)[source]¶
Plots comparison between sensor data
- Parameters:
xproperty (str) – specifies which property to be plotted on x axis from (‘frame’, ‘time’)
yproperty (str) – specifies which property to be plotted on y axis from (‘pose’, ‘velocity’, ‘acceleration’)
xlim (tuple, float) – range of times to be plotted over (lower limit, upper limit)
ylim (tuple, float) – range of y values to be plotted over (lower limit, upper limit)
key_times (list, float, optional) – key time points to display frame images for
key_frames (list, float, optional) – key frame numbers to display frame images for
*sensors (SensorData) – sensor data objects to be added to plot