OpenCV is a cross platform computer vision library written in c / c++ with a Java interface. The first thing to solve is the generation and compilation of the sources using CMake and Maven. The Maven plugin cmake-maven-project does great things here. Now we can add this as a dependency to our OpenCV Maven project and use it for cross platform compilation.
Download the OpenCV sources from github and add them to your OpenCV Maven project. The OpenCV-CMake make-files produce, depending on platform compiling, a .dll or .so file and the Java source files. These are copied into src/main/resources and src/main/java respectively. Now we are ready for the Maven Bundle plugin.
OSGi has a easy way to resolve dependencies on native code called the bundle native code tag. Point this to the .dll / .so file in resources. Add a bundle activate class to the package, calling System.loadLibrary, and your of deploying OpenCV to OSGi.
No comments:
Post a Comment