javaopencvnetbeansubuntu-15.04

How to Use OpenCV for Java in Netbeans-Ubuntu


I am trying to develop a small project in java for image keypoint recognition and matching to compare images using OpenCv library in Netbeans. i installed openCV-3.1.0 and add a New Library in netbeans named as OpenCV giving classpathas "/home/shoaib/opencv-3.1.0/build/bin/opencv-310.jar". Then i right click on my netbeans project and add opencv library in "Libraries". In Run opton i gave VM Options as "java -Djava.library.path="/home/shoaib/opencv-3.1.0/build/bin/opencv-310.jar" also tried java -Djava.library.path="/home/shoaib/opencv-3.1.0/build/bin/"

when i compile my programme it compiled successfullly and shows

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar

but when i run my java programme it gives error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java310 in java.library.path

error is at line System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

i googled it a lot but couldn't resolve my problem.Can anyone help me?? i am beginner to java and openCV.


Solution

  • finally resolved it. Issue was in native library installation and path. i reinstall opencv and set native library path as

    /home/user/opencv-3.1.0/build/lib
    

    that contains .so files. i fllowed following tutorial foe opencv installation http://milq.github.io/install-opencv-ubuntu-debian/ and for using it in eclipse i followed this link http://docs.opencv.org/2.4/doc/tutorials/introduction/java_eclipse/java_eclipse.html