I have an issue in setting native library path for opencv in eclipse-ubuntu.i am using ubuntu 15.04.installed opencv 3.1.0 following this link http://milq.github.io/install-opencv-ubuntu-debian/ and add new library(OpenCV) in eclipse and set it's jar path as
/home/user/opencv-3.1.0/build/bin/opencv-310.jar
and native library path as
/home/user/opencv-3.1.0/build/lib
lib
folder contains .so
and .a
files. But when i try to use Mat object it gives me error:here is Main Method
System.out.println("Welcome to OpenCV hhhh " + Core.VERSION);
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat img=new Mat();
and here is screenshot of my code and console it gives me error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat()J
at org.opencv.core.Mat.n_Mat(Native Method)
at org.opencv.core.Mat.<init>(Mat.java:24)
if i use mat like this
Mat m1 =Imgcodecs.imread("/home/zed/Desktop/img.png");
then it gives me diff error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_1(Ljava/lang/String;)J
at org.opencv.imgcodecs.Imgcodecs.imread_1(Native Method)
at org.opencv.imgcodecs.Imgcodecs.imread(Imgcodecs.java:102)
am i giving right path for native library? If not then what is the right path for Native Library to use Opencv3.1.0 in eclipse-ubuntu
you should add
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
public static void main(String[] args) {
System.out.println("Welcome to OpenCV hhhh " + Core.VERSION);
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat m1 =Imgcodecs.imread("/home/zed/Desktop/img.png");
Mat m2=new Mat();
}
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With