Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build OpenCV with contrib modules and Java wrapper

Tags:

java

opencv

build

I'm trying to build OpenCV on my Windows 7 machine. To include the contrib modules I have added the OPENCV_EXTRA_MODULES_PATH in CMake-gui. The opencv-300.jar and opencv-300.dll have been created but I can not find the Java classes to use the extra modules. Am I missing an option in the make configuration? Is it possible to use these extra modules from Java?

like image 459
Kenny Avatar asked Jul 29 '15 20:07

Kenny


1 Answers

i've the same problem and i resolved in this way. I imagine that you had downloaded from contrib repo the specific version match with the opencv version if you want to build. So go in directory and enter, for example, face module directory; in this directory there is a file called CMakeLists.txt that you have to edit. This file should be like this:

set(the_description "Face recognition etc")
ocv_define_module(face opencv_core opencv_imgproc opencv_objdetect WRAP python)
# NOTE: objdetect module is needed for one of the samples

If you want to have the org.opencv.face package in your opencv-3xx.jar library you have to modify the 2nd line of the file in this way:

ocv_define_module(face opencv_core opencv_imgproc opencv_objdetect WRAP python java)

Then you have to compile opencv as depicted in the Readme.md of the contrib repo https://github.com/itseez/opencv_contrib

Obviously the same thing is valid for all the contrib modules if you want to add to your opencv-3xx.jar library.

I hope that this solution works for you, bye!

like image 114
asdASD Avatar answered Oct 17 '22 02:10

asdASD