3

After installing opencv 2.4.8.2 with homebrew, I can't seem to find the jar file in /usr/local/Cellar/opencv/2.4.8.2/share/OpenCV

I'm using Mavericks, any ideas?

2
  • I'm seeing the same behaviour - annoying! Commented Apr 8, 2014 at 9:54
  • I installed it (2.4.9) using --with-java and the jar file is there. Commented Sep 8, 2014 at 6:34

4 Answers 4

8

Probably you forgot to specify --with-java parameter

brew tap homebrew/science
brew install opencv --with-java

After compiling a jar file is in the path

/usr/local/Cellar/opencv/2.4.9/share/OpenCV/java/opencv-249.jar
Sign up to request clarification or add additional context in comments.

1 Comment

I get an "error:invalid option" when I choose --with-java. Any idea what to do ? I am using macOS Monterey and openjdk11
3

I solved the question by installing ant (and the other dependencies of opencv) using homebrew and then using cmake to install opencv instead of homebrew. I downloaded opencv from the website then used the following commands:

cd opencv-2.4.8/
mkdir build
cd build/
cmake -DBUILD_SHARED_LIBS=OFF ..
cmake -G "Unix Makefiles" ..
make -j8

The jar will pop out in the following directory:

opencv-2.4.8/build/bin/opencv-248.jar

Comments

1

I had this issue and tried with the --with-java option and it didn't work.

I had to edit the formula (brew edit opencv3) and insert this options myself:

option "with-contrib", "With contrib"
option "with-java", "With java"

Just above the dependency declarations.

You will also have to ensure that -DBUILD_opencv_java=ON is in your args. Note that the value is set to ON not OFF

After you've done this. Uninstall opencv then install it again.

1 Comment

When I try this I get an error saying "invalid-option: --with-java". Did you do anything else ? I am on Mac OS Monterey and using OpenJDK 11
0

The error could just be because -DBUILD_opencv_java is not enabled. Enable it using brew edit opencv3

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.