Introducing Google AI Edge Portal: Benchmark Edge AI at scale. Sign-up to request access during private preview.

MediaPipe Framework in C++

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++.

Building C++ command-line example apps

Option 1: Running on CPU

  1. To build, for example, the C++ example app of the legacy MediaPipe Hand Detection solution with CPU, run:

    bazelbuild-copt--defineMEDIAPIPE_DISABLE_GPU=1mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
    
  2. To run the application:

    GLOG_logtostderr=1bazel-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

  1. To build, for example, the C++ example app of the legacy MediaPipe Hand Detection solution with GPU, run:

    bazelbuild-copt--copt-DMESA_EGL_NO_X11_HEADERS--copt-DEGL_NO_X11\
    mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu
    
  2. To run the application:

    GLOG_logtostderr=1bazel-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.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024年04月24日 UTC.