Search code examples
javamavenopencv

Java OpenCV from Maven


Is there any way to get OpenCV from repository? Which artifact should I add to pom.xml? Every tutorial I'd found is from '14 and it seems like something changed - they say it is'nt in official Maven repository yet, but I've found entry:

<!-- https://mvnrepository.com/artifact/nu.pattern/opencv -->
<dependency>
   <groupId>nu.pattern</groupId>
   <artifactId>opencv</artifactId>
   <version>2.4.9-7</version>
</dependency>

Sadly, I get error

Caused by: java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path

when I'm using System.loadLibrary(Core.NATIVE_LIBRARY_NAME). Can I add this library in a way that would make my project include it and 'forget' about manually adding it to classpath?


Solution

  • This worked for me.

    nu.pattern.OpenCV.loadLibrary();
    

    I'm using following maven dependency

    <dependency>
      <groupId>nu.pattern</groupId>
      <artifactId>opencv</artifactId>
      <version>2.4.9-4</version>
    </dependency>