OpenCV is arguably the defacto free, open-source computer vision library, but setting it up for usage in a JVM project can be hard because OpenCV itself is written in C++, so there are a bunch of system-dependent things that you need to download/compile/install before you can use it.

JavaCV, written by Bytedeco is a library that makes it more bearable to use OpenCV from JVM projects by providing a bunch of wrapper classes and logic around OpenCV (there’s a lot more to it, see their page for details).

Still, because JavaCV depends on JavaCPP for common and OpenCV C++ wrappers, and JavaCPP requires you to set your target platform (what platform you want to run on), I thought getting started could be easier still.

After taking a look at this Github project, I created an SBT plugin, SBT-OpenCV, that allows you to add just one line to your project/plugins.sbt to begin playing around with OpenCV:

addSbtPlugin("com.beachape" % "sbt-opencv" % "1.4")

The following is a list of SBT setting keys that you can set in order to customise the behaviour of the plugin:

* `javaCVPlatform`: The platform that you want to compile for (defaults to the platform of the current computer). You can also set this via the "sbt.javacv.platform" System Property
* `javaCppVersion`: Version of Java CPP that you want to use
* `javaCppPresetsVersion`:  Version of Java CPP Presets that you want to use
* `javaCVVersion`: Version of Java CV that you want to use

I think javaCVPlatform is the one that will be most interesting, since you may want to compile JARs for different target platforms; for a list of supported strings, look at the classifiers supported by JavaCPP presets, or work out the different strings that can result from the JavaCPP Loader.

For example:

javaCppPlatform := "android-arm"

Feel free to try it out and submit issues, ideas, and PRs at the Github page :)