March 2020
Intermediate to advanced
366 pages
9h 8m
English
What remains to be done is to actually classify the hand gesture based on the number of instances of extended fingers. The classification is done using the following function:
def detect_num_fingers(contour: np.ndarray, defects: np.ndarray, img_draw: np.ndarray, thresh_deg: float = 80.0) -> Tuple[int, np.ndarray]:
The function accepts the detected contour (contour), the convexity defects (defects), a canvas to draw on (img_draw), and a cutoff angle that can be used as a threshold to classify whether convexity defects are caused by extended fingers or not (thresh_deg).
Except for the angle between the thumb and the index finger, it is rather hard to get anything close to 90 ...