min_detection_confidence: Minimum confidence value (between 0 and 1) for the hand detection to be considered successful.Although this parameter defaults to 2, we will explicitly set this field to the same value, to illustrate its usage. max_num_hands: Maximum number of hands to be detected.We are going to set the value to False, which means that, after a successful detection of hands in the video frame, the algorithm will localize the landmarks and, in subsequent frames, it will simply track the landmarks without invoking another detection, until it loses track of any of the hands. static_image_mode: Indicates if the input images should be treated as independent and non related ( True) or should be treated as a video stream ( False).We will make use of the optional parameters of the constructor: Next we will instantiate an object of class Hands, which we will use to perform the hand tracking and landmarks estimation. The cv2 module will allow us to obtain the frames from the camera, over which we will perform the hand landmarks estimation by using the functionality exposed by the mediapipe module.įor convenience, we will also access the drawing_utils and hands modules from mediapipe, so we don’t need to use the complete path every time we want to use a functionality they expose. We will start our code by importing the cv2 and the mediapipe modules. In this first section, we are going to check the basics on how to grab video from a camera and perform the hand tracking and landmarks estimation. Real-time hand tracking and landmark estimation This tutorial was tested on Windows 8.1, with version 4.1.2 of OpenCV and version 0.8.3.1 of MediaPipe (alpha version). The code we are going to cover here is the continuation of the tutorial where we have learned how to perform detection and landmarks estimation of hands on a static image (link here). We will be reading the video from a webcam using OpenCV and perform the hand tracking and landmarks estimation using MediaPipe and its Hands solution. In this tutorial we will learn how to perform real-time hand tracking and landmarks estimation using Python, OpenCV and MediaPipe.
0 Comments
Leave a Reply. |