mediapipe教程2:linux桌面程序编译与运行
作者:互联网
一、前言
mediapipe教程1中写了python相关代码,但是因为我最终是安卓系统,不能用python去运行,因此需要继续研究mediapipe;
但是我对安卓系统也一点都没接触过,因此这一个博客主要熟悉mediapipe,研究如何编译与运行mediapipe的linux桌面程序;
二、准备
两个重要网址:
(1)https://github.com/google/mediapipe(官网的代码)
(2)https://google.github.io/mediapipe/(官网的教程)
三、安装bazel和其他依赖库
(1)首先,我的mediapipe的版本是ae05ad04b3ae43d475ccb2868e23f1418fea8746
(2)安装bazel,参考:https://blog.csdn.net/qq_41204464/article/details/95333396
步骤为:
./bazel-3.7.2-installer-linux-x86_64.sh --user
sudo gedit ~/.bashrc
export PATH="$PATH:/home/lzc/bin"
source ~/.bashrc
(3)其他依赖库
sudo apt-get install libopencv-core-dev libopencv-highgui-dev libopencv-calib3d-dev libopencv-features2d-dev libopencv-imgproc-dev libopencv-video-dev
(4)gpu,参考:https://google.github.io/mediapipe/getting_started/gpu_support.html
sudo apt-get install mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev
sudo apt-get install mesa-utils
#查看 OpenGL ES 版本为 3.1及以上才行
glxinfo | grep -i opengl
四、mediapipe helloworld
网址:https://google.github.io/mediapipe/getting_started/hello_world_cpp.html
cd mediapipe
export GLOG_logtostderr=1
bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world
编译过程中可能同时在下载一些必要的包,最终终端中打印十行helloworld
五、
(1)hand-cpu
编译
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
运行
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
(2)hand-gpu(gles)
编译
bazel build -c opt --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu
运行
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
(3)pose-cpu
编译
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/pose_tracking:pose_tracking_cpu
运行
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/pose_tracking/pose_tracking_cpu --calculator_graph_config_file=mediapipe/graphs/pose_tracking/pose_tracking_cpu.pbtxt
(4)pose-gpu(gles)
编译
bazel build -c opt --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 mediapipe/examples/desktop/pose_tracking:pose_tracking_gpu
运行
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/pose_tracking/pose_tracking_gpu --calculator_graph_config_file=mediapipe/graphs/pose_tracking/pose_tracking_gpu.pbtxt
其他的例子如holistic的也是类似,运行时保证你有usb相机即可。
标签:mediapipe,教程,tracking,--,pose,hand,bazel,linux 来源: https://blog.csdn.net/luozhichengaichenlei/article/details/117263003