Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building OpenCV with Java Support on Mac OS X (64-bit)

Tags:

opencv

Following directions from http://docs.opencv.org/2.4.4-beta/doc/tutorials/introduction/desktop_java/java_dev_intro.html, I am running into the this:

make -j8
...
...
Linking CXX shared library ../../lib/libopencv_java244.dylib
ld: unknown option: -whole-archive
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: * [lib/libopencv_java244.dylib] Error 1
make[1]: *
[modules/java/CMakeFiles/opencv_java.dir/all] Error 2
make: *** [all] Error 2

Any suggestions?

like image 631
mantithetical Avatar asked Apr 01 '13 21:04

mantithetical


People also ask

Can I use Java with OpenCV?

4, OpenCV supports desktop Java development using nearly the same interface as for Android development. This guide will help you to create your first Java (or Scala) application using OpenCV.

How to build OpenCV for Java?

Set up OpenCV for Java in EclipseFrom the menu navigate under Java > Build Path > User Libraries and choose New... . Enter a name for the library (e.g., opencv) and select the newly created user library. Choose Add External JARs... , browse to select opencv-3xx. jar from your computer.


1 Answers

One of the easiest solution to install OpenCV is to use Homebrew.

All what you need to do is just type:

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

It will automaticaly load needed libs and build opencv.

When it will be done, you will be able to find a jar file in

/usr/local/Cellar/opencv/2.4.9/share/OpenCV/java/

opencv path

like image 128
Alexander Avatar answered Sep 30 '22 18:09

Alexander