環境
Ubuntu 18.04
ビルドツール bazelをインストール
bazel
Installing Bazel on Ubuntu - Bazel
$ sudo apt install apt-transport-https curl gnupg $ curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg $ sudo mv bazel.gpg /etc/apt/trusted.gpg.d/ $ echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
$ sudo apt update && sudo apt install bazel
インストール
$ git clone https://github.com/google/mediapipe.git $ cd mediapipe
$ sudo apt-get install libopencv-core-dev libopencv-highgui-dev \ libopencv-calib3d-dev libopencv-features2d-dev \ libopencv-imgproc-dev libopencv-video-dev
ビルド
とりあえず、CPUのみ
$ bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world
ERROR: The project you're trying to build requires Bazel 3.7.2
Bazel 3.7.2を入れる。
$ sudo apt install bazel-3.7.2
再実行
$ bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world
実行
$ bazel-bin/mediapipe/examples/desktop/hello_world/hello_world
ログを表示させたい場合は
$ export GLOG_logtostderr=1
を追加することによって、hello_world実行時にHello World!と表示されるようになる。