Module src.util.landmark_utils

Landmark utils

Collection of functions related to landmarks, specifically hand landmarks and collections of hand landmarks.

Functions

def thumb_index_intersection(hand_landmarks: Iterable[mediapipe.framework.formats.landmark_pb2.NormalizedLandmark]) ‑> Tuple[float, float]

Finds intersection between thumb and index finger.

Creates a 2d-line for both thumb and index finger, and returns the intersection of the two lines

Args

hand_landmarks
landmarks for a single hand.

Returns

(x, y) coordinate for the point of intersection

def get_fingertip(hand_landmarks: mediapipe.framework.formats.landmark_pb2.NormalizedLandmarkList) ‑> Tuple[float, float, float]

Fingertip coordinates of the provided hand landmarks.

Args

hand_landmarks
A list of landmarks for one hand.

Returns

(x, y, z) fingertip coordinates of the provided hand.

def calc_palm_center(hand_landmarks: mediapipe.framework.formats.landmark_pb2.NormalizedLandmarkList) ‑> numpy.ndarray

Approximates center of palm by way of a triangle centroid.

Args

hand_landmarks
A list of landmarks for one hand.

Returns

A 3d-vector of x-y-z coordinates representing the palm center.