Build OpenCV Java for Linux, MacOS and Windows

asked 2019-07-18 08:14:46 -0500

Rafutek gravatar image

Hey,

Is it possible to build OpenCV Java for Linux, MacOS and Windows and optain a single jar file containing libraries for each OS ?

I was using a Maven repository but its jar does not contain the tracking module, so I'd like to make my own.

Thank you!

edit retag flag offensive close merge delete

Comments

and optain a single jar file

that's what you get, anyway. the jar file contains only shallow wrappers around the opencv c++ code (in so's/dll's) , which has to get conpiled per architecture / toolchain.

please try at least for your os, using opencv_contrib.

make sure you have some version of python, the java ant tool and some current jdk around.

I was using a Maven repository

opencv does not maintain anything there.

berak gravatar imageberak ( 2019-07-18 08:36:59 -0500 )edit

Thanks, It's compiling on a MacOS, but can this jar be used in a Windows and a Linux environment ?

Rafutek gravatar imageRafutek ( 2019-07-18 09:19:30 -0500 )edit

no, the jar file can't be used without a platform specific c++ binary, an so/dll.

so you need to recompile opencv. for each platform..

berak gravatar imageberak ( 2019-07-18 11:05:20 -0500 )edit

I see, so is it possible to compile it on each platform,obtain 3 jars, and make a unique jar with every lib? As the one in the Maven repository?

Thank you in advance

Rafutek gravatar imageRafutek ( 2019-07-19 03:39:02 -0500 )edit

you don't get it. opencv is a c++ library. the jar file containing the java wrappers around it is irrelevant.

berak gravatar imageberak ( 2019-07-19 04:15:20 -0500 )edit

Sorry to insist, but what do you recomend me to do considering that the java opencv code will be used/implemented in different OSs.

Compile OpenCV (with contrib) on each OS in order to have the necessary c++ libs (so/dll) and one of the jars ?

Rafutek gravatar imageRafutek ( 2019-07-19 07:33:41 -0500 )edit

Compile OpenCV (with contrib) on each OS in order to have the necessary c++ libs (so/dll) and one of the jars ?

yes, exactly. it will also autogenerate the java code / jar file.

berak gravatar imageberak ( 2019-07-19 08:26:26 -0500 )edit