SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
CVTrackedMediaPipeHands.h
Go to the documentation of this file.
1 /**
2  * \file CVTrackedMediaPipeHands.h
3  * \date December 2022
4  * \authors Marino von Wattenwyl
5  * \copyright http://opensource.org/licenses/GPL-3.0
6  * \remarks Please use clangformat to format the code. See more code style on
7  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
8 */
9 
10 #ifdef SL_BUILD_WITH_MEDIAPIPE
11 # ifndef CVTRACKEDMEDIAPIPEHANDS_H
12 # define CVTRACKEDMEDIAPIPEHANDS_H
13 
14 # include <CVTracked.h>
15 # include <mediapipe.h>
16 
17 //-----------------------------------------------------------------------------
18 //! MediaPipe hand tracking class derived from CVTracked
19 /*! Tracking class for MediaPipe hand tracking. MediaPipe is a machine
20 learning framework from google with various built-in solutions for face
21 tracking, hand tracking and much more. We use our custom C wrapper
22 [libmediapipe](https://github.com/cpvrlab/libmediapipe) to integrate the
23 framework. See mediapipe.h for more information about the MediaPipe data types
24 and functions. This tracker tracks two hands and draws the detected landmarks
25 over the image.
26 
27 Link to the hand landmarker solution:
28 https://developers.google.com/mediapipe/solutions/vision/hand_landmarker
29 
30 Online examples:
31 https://mediapipe-studio.webapps.google.com/demo/hand_landmarker
32 */
33 class CVTrackedMediaPipeHands : public CVTracked
34 {
35 public:
36  CVTrackedMediaPipeHands(SLstring dataPath);
37  ~CVTrackedMediaPipeHands();
38 
39  bool track(CVMat imageGray,
40  CVMat imageBgr,
41  CVCalibration* calib) final;
42 
43 private:
44  void processImageInMediaPipe(CVMat imageBgr);
45  void drawResults(mp_multi_face_landmark_list* landmarks,
46  CVMat imageBgr);
47 
48  mp_instance* _instance;
49  mp_poller* _landmarksPoller;
50  CVMat _imageRgb;
51 };
52 //-----------------------------------------------------------------------------
53 
54 # endif // CVTRACKEDMEDIAPIPEHANDS_H
55 #endif // SL_BUILD_WITH_MEDIAPIPE
cv::Mat CVMat
Definition: CVTypedefs.h:38
string SLstring
Definition: SL.h:158
Live video camera calibration class with OpenCV an OpenCV calibration.
Definition: CVCalibration.h:71
CVTracked is the pure virtual base class for tracking features in video.
Definition: CVTracked.h:50
virtual bool track(CVMat imageGray, CVMat imageBgr, CVCalibration *calib)=0