scripts.head_module

class HeadGesture(name: str, position_checker: Callable[[scripts.core.position.Position], bool], tracker: scripts.core.position_tracker.PositionTracker)

Bases: scripts.core.gesture.Gesture

Author: Andrzej Szablewski Author: Rakshita Kumar Partially based on the Head module in the MotionInput v2 code

class HeadLandmarkDetector

Bases: scripts.core.module.LandmarkDetector

HEAD_MODEL_PATH = 'C:\\Users\\Carme\\Desktop\\SysEng\\MI_Windows_App\\MI_Windows\\scripts\\head_module\\..\\..\\data\\ml_models\\head\\shape_predictor_68_face_landmarks.dat'
get_raw_data(raw_data: scripts.core.raw_data.RawData, image: numpy.ndarray) None

Adds the xy(z) coordinates of all the landmarks detected on the image into the RawData instance.

Parameters
  • raw_data (RawData) – RawData instance to add the landmarks to

  • image (ndarray) – Image to process with mediapipe and read the landmarks locations from

Author: Andrzej Szablewski Author: Rakshita Kumar Partially based on the Head module in the MotionInput v2 code

class HeadPosition(raw_data: Dict[str, numpy.ndarray], used_primitives: Optional[Set[str]] = None)

Bases: scripts.core.position.Position

CALIBRATION = False
get_primitives_names() Set[str]
Returns

Names of all primitives that are calculated by the specific modules Position class on initialization

Return type

List[str]

get_primitive(name: str) Optional[bool]
Returns the state of the given primitive in the Position if it has

been calculated. Returns None If the primitive has not been calculated, hence if it either is not defined for current module or landmarks needed to calculate it were not provided.

Parameters

name (str) – name of the primitive (e.g. “palm_facing_camera” or “index_pinched”)

Returns

state of the primitive

Return type

Optional[bool]

get_landmark(name: str) Optional[numpy.ndarray]

Returns the coordinates of the landmark. Returns None if the landmarks was not provided to the Position on initialization

Parameters

name (str) – name of the landmark (e.g. “index_tip” or “wrist”)

Returns

coordinates of the landmark

Return type

Optional[np.ndarray]

Module contents

class HeadModule

Bases: scripts.core.module.Module