I followed the official mediapipe page but without any result so can someone help to install mediapipe in raspberry pi 4 in windows it is easy to install it and use it but in arm device like raspberry pi i did not find any resources.
a useful package to install mediapipe fastly in raspberry
for raspberry pi 3 and raspberry pi 4
//FFmpeg and OpenCV
sudo apt install ffmpeg python-opencv
// dependency packages
sudo apt install libxcb-shm0 libcdio-paranoia-dev libsdl2-2.0-0 libxv1 libtheora0 libva-drm2 libva-x11-2 libvdpau1 libharfbuzz0b libbluray2 libatlas-base-dev libhdf5-103 libgtk-3-0 libdc1394-22 libopenexr23
finally for raspberry pi 3 use :
sudo pip install mediapipe-rpi3
or for raspberry pi 4 use :
sudo pip install mediapipe-rpi4
the commands were taken from :
for raspberrypi 3: https://pypi.org/project/mediapipe-rpi3/
for raspberry pi 4: https://pypi.org/project/mediapipe-rpi4/
if you use python3 you can try sudo pip3 install mediapipe-rpi4
I can run Hello world cpu/gpu on Raspberry Pi 4 (2gb) with Ubuntu 21.04. 64 bit. I'm still messing with hand tracking but I will share the my steps.
Install pip3: sudo apt install python3-pip
Install Python six library: pip3 install --user six
Install Go: sudo apt install golang-go
Install Bazelisk: go get github.com/bazelbuild/bazelisk
Copy it to bin: sudo mv ./go/bin/bazelisk /usr/bin/bazel
Download Mediapipe: git clone https://github.com/google/mediapipe.git
Install OpenCv: sudo bash ./mediapipe/setup_opencv.sh
In the next step you have to set the path correctly in WORKSPACE, opencv_linux.BUILD, ffmpeg_linux.BUILD.
Like this:
mediapipe/WORKSPACE
new_local_repository(
name = "linux_opencv",
build_file = "@//third_party:opencv_linux.BUILD",
path = "/usr/local",
)
new_local_repository(
name = "linux_ffmpeg",
build_file = "@//third_party:ffmpeg_linux.BUILD",
path = "/usr"
)
mediapipe/third_party/opencv_linux.BUILD
cc_library(
name = "opencv",
srcs = glob(
[
"lib/aarch64-linux-gnu/libopencv_core.so",
"lib/aarch64-linux-gnu/libopencv_calib3d.so",
"lib/aarch64-linux-gnu/libopencv_features2d.so",
"lib/aarch64-linux-gnu/libopencv_highgui.so",
"lib/aarch64-linux-gnu/libopencv_imgcodecs.so",
"lib/aarch64-linux-gnu/libopencv_imgproc.so",
"lib/aarch64-linux-gnu/libopencv_video.so",
"lib/aarch64-linux-gnu/libopencv_videoio.so",
],
),
hdrs = glob([
# For OpenCV 3.x
#"include/opencv2/**/*.h*",
# For OpenCV 4.x
"include/opencv4/opencv2/**/*.h*",
]),
includes = [
# For OpenCV 3.x
#"include/",
# For OpenCV 4.x
"include/opencv4/",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
mediapipe/third_party/ffmpeg_linux.BUILD
cc_library(
name = "libffmpeg",
srcs = glob(
[
"lib/aarch64-linux-gnu/libav*.so",
],
),
hdrs = glob(["include/aarch64-linux-gnu/libav*/*.h"]),
includes = ["include"],
linkopts = [
"-lavcodec",
"-lavformat",
"-lavutil",
],
linkstatic = 1,
visibility = ["//visibility:public"],
)
After this you can build and then run Hello world application.
© 2022 - 2025 — McMap. All rights reserved.
sudo pip3 install pathlib
. And I run the code again withpip3
:sudo pip install mediapipe-rpi3
. Thanks – Colan