Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building mediapipe with custom OpenCV path #3848

Closed
siquus opened this issue Nov 11, 2022 · 3 comments
Closed

Building mediapipe with custom OpenCV path #3848

siquus opened this issue Nov 11, 2022 · 3 comments
Assignees
Labels
task::all All tasks of MediaPipe type:build/install For Build and Installation issues

Comments

@siquus
Copy link

siquus commented Nov 11, 2022

I am using Archlinux with OpenCV in /usr/local/include, /usr/local/lib. I haven't found documentation on how to change the OpenCV default directories used by mediapipe. The build error says that the <opencv2/...> include files can't be found. The solutions I found online, like adding

copts = ["-I/usr/local/include/opencv4/"]

to opencv_linux.BUILD do not work. Using --define=OPENCV=source fails because some enums are not defined.

Could you please add some documentation on how to set the OpenCV path manually? Thanks!

@kuaashish kuaashish added type:build/install For Build and Installation issues task::all All tasks of MediaPipe labels Nov 11, 2022
@ghost
Copy link

ghost commented Nov 14, 2022

Did you check https://google.github.io/mediapipe/getting_started/install.html, there are multiple options to setting up OpenCV.

@siquus
Copy link
Author

siquus commented Nov 15, 2022

Ah..sorry about that. For what it's worth, here are the steps necessary to build mediapipe on Archlinux:

OpenCV

  1. Some special opencv_contrib modules are required which are not built by default by OpenCV. Following the commands from mediapipe/setup_opencv.sh works. I used OpenCV's default "4.x" branches for both repositories rather than the "3.4" from the file.
  2. In mediapipe's install instructions, scroll down to "OpenCV 4 setup" and change mediapipe/WORKSPACE and mediapipe/thirdparty/opencv_linux.BUILD accordingly.

Bazel

  1. change mediapipe/.bazelversion to contain the version your system is using (I used 5.3.2)
  2. Bazel has known issues with openjdk17. The workaround mentioned in that issue, adding --host_jvm_args="--add-opens=java.base/java.lang=ALL-UNNAMED", works for me.

Compiling

bazel --host_jvm_args="--add-opens=java.base/java.lang=ALL-UNNAMED" build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu

@siquus siquus closed this as completed Nov 15, 2022
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task::all All tasks of MediaPipe type:build/install For Build and Installation issues
Projects
None yet
Development

No branches or pull requests

3 participants