MediaPipe Framework in C++
C++语言中的MediaPipe框架
Please follow instructions below to build C++ command-line example apps with MediaPipe Framework. To learn more about these example apps, start from Hello World! in C++.
请按照以下说明使用MediaPipe Framework构建C++命令行示例应用程序。要了解更多关于这些示例应用程序的信息,请从Hello World在C++中开始!。
Building C++ command-line example apps
构建C++命令行示例应用程序
Option 1: Running on CPU
选项1:在CPU上运行
1.To build, for example, the C++ example app of the legacy MediaPipe Hand Detection solution with CPU, run:
1.例如,要使用CPU构建传统MediaPipe手动检测解决方案的C++示例应用程序,请运行:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
2.To run the application:
2.要运行应用程序:
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_cpu \
--calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt
This will open up your webcam as long as it is connected and on. Any errors is likely due to your webcam being not accessible.
只要网络摄像头已连接并打开,它就会打开。任何错误都可能是由于无法访问网络摄像头造成的。
Option 2: Running on GPU
选项2:在GPU上运行
Note: This currently works only on Linux, and please first follow OpenGL ES Setup on Linux Desktop.
注意:这目前仅适用于Linux,请首先在Linux桌面上执行OpenGL ES设置。
1.To build, for example, the C++ example app of the legacy MediaPipe Hand Detection solution with GPU, run:
1.例如,要使用GPU构建传统MediaPipe手动检测解决方案的C++示例应用程序,请运行:
bazel build -c opt --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 \
mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu
2.To run the application:
2.要运行应用程序:
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_gpu \
--calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live_gpu.pbtxt
This will open up your webcam as long as it is connected and on. Any errors is likely due to your webcam being not accessible, or GPU drivers not setup properly.
只要网络摄像头已连接并打开,它就会打开。任何错误都可能是由于网络摄像头无法访问,或者GPU驱动程序设置不正确。