Mediapipe 安裝教學
1 min readSep 28, 2020
Ubuntu 18.04
- Clone mediapipe
git clone https://github.com/google/mediapipe.git2. go to the folder 進入到下載好的目錄
cd mediapipe3-1. 安裝bazel
sudo apt install bazel-3.0.03–2. 檢查安裝版本
bazel --version4. 建立symlink
sudo ln -sf /usr/bin/bazel-3.0.0 /usr/bin/bazel5. 安裝opencv, FFmpeg
sudo apt-get install libopencv-core-dev libopencv-highgui-dev \
libopencv-calib3d-dev libopencv-features2d-dev \
libopencv-imgproc-dev libopencv-video-dev安裝完成
測試example
Example 1: Hello World
1–1. Build
sudo apt-get install mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev1–2. CPU version
export GLOG_logtostderr=1
bazel run --define MEDIAPIPE_DISABLE_GPU=1 \
mediapipe/examples/desktop/hello_world:hello_world1–3. GPU version
export GLOG_logtostderr=1
bazel run --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 \
mediapipe/examples/desktop/hello_world:hello_worldExample 2: hand tracking CPU version
2–1. Build
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu2–2. Run
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.pbtxtExample 3: hand tracking GPU version
3–1. Build
bazel build -c opt --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 \
mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu 3–2. Run
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_gpu \
--calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_mobile.pbtxt