Mediapipe

This tutorial takes usb no-drive camera as an example. All codes run in docker. When entering docker, you need to mount the camera. For details, please refer to docker tutorial [5、Enter the docker Container].

1、Introduction to Mediapipe

2、Use Cases

2.1、Program Running Example

Source code path reference (in docker)

docker终端输入,

Taking hand detection as an example, the screenshot of the operation is as follows

image-20230426142447158

In addition, you can also view point cloud data and input it through the Docker termina

Follow these steps to add a point cloud topic to rviz

image-20230426143745998

image-20230426143910215

Above is running palm detection, which is 01_ Point cloud diagram of HandDetector program.

Point cloud viewing only supports demos from 01 to 04.

 

You can use rqt_ Graph View Node Topic Communication Graph

image-20230426144926684

2.2、Other fun gameplay

Docker terminal input

image-20230426150628799

image-20230426150648608

3、Mediapipe Hands

MediaPipe Hands is a high-fidelity hand and finger tracking solution. It uses machine learning (ML) to infer the 3D coordinates of 21 hands from a single frame.

After palm detection is performed on the entire image, accurate key point positioning is performed on the 21 3D hand joint coordinates in the detected hand region by regression according to the hand marker model, that is, direct coordinate prediction. The model learns consistent internal hand pose representations and is robust to even partially visible hands and self-occlusion. To obtain ground truth data, about 30K real-world images were manually annotated with 21 3D coordinates as shown below (Z-values are obtained from the image depth map, if there is a Z value for each corresponding coordinate). To better cover the possible hand poses and provide additional supervision on the nature of the hand geometry, high-quality synthetic hand models in various contexts are also drawn and mapped to the corresponding 3D coordinates.

image-20230426150946816

4、Mediapipe Pose

MediaPipe Pose is an ML solution for high-fidelity body pose tracking that infers 33 3D coordinates and a full-body background segmentation mask from RGB video frames using the BlazePose research that also powers the ML Kit pose detection API.

The landmark model in MediaPipe pose predicts the location of 33 pose coordinates (see figure below).

image-20230426151103245

5、dlib

The corresponding case is the face effect.

DLIB is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real-world problems. It is widely used by industry and academia in fields such as robotics, embedded devices, mobile phones, and large-scale high-performance computing environments .

The dlib library uses 68 points to mark important parts of the face, such as 18-22 points to mark the right eyebrow and 51-68 points to mark the mouth. Use the get_frontal_face_detector module of the dlib library to detect the face, and use the shape_predictor_68_face_landmarks.dat feature data to predict the face feature value.