docs/getting_started/cpp.md
{: .no_toc }
Attention: Thanks for your interest in MediaPipe! We have moved to https://developers.google.com/mediapipe as the primary developer documentation site for MediaPipe as of April 3, 2023.
Please follow instructions below to build C++ command-line example apps in the supported MediaPipe solutions. To learn more about these example apps, start from Hello World! in C++.
To build, for example, MediaPipe Hands, run:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
To run the application:
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.
Note: This currently works only on Linux, and please first follow OpenGL ES Setup on Linux Desktop.
To build, for example, MediaPipe Hands, run:
bazel build -c opt --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 \
mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu
To run the application:
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.