predactor
predactor

Reputation: 1092

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

i am trying to capture camera with opencv version 2410 but this exception appear although path is right
iam try to open camera and capture video from camera but this exception appear
iam searched in many sites but nothing same words

netbeans 8.0.2

how can i solve it ?

output
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at videocap.VideoCap.main(VideoCap.java:20)
Java Result: 1

code here

VideoCap.java
package videocap;
import org.opencv.core.*;
import org.opencv.highgui.Highgui;        
import org.opencv.highgui.VideoCapture;     

 public class VideoCap {


 public static void main (String args[]){
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    VideoCapture camera = new VideoCapture(0);

    if(!camera.isOpened()){
        System.out.println("Error");
    }
    else {
        Mat frame = new Mat();
        while(true){
            if (camera.read(frame)){
                System.out.println("Frame Obtained");
                System.out.println("Captured Frame Width " + frame.width() + " Height " + frame.height());
                Highgui.imwrite("camera.jpg", frame);
                System.out.println("OK");
                break;
            }
        }   
    }
    camera.release();
}

}

enter image description here enter image description here enter image description here enter image description here

Upvotes: 1

Views: 3193

Answers (1)

sandy
sandy

Reputation: 26

In order to include native library we need to add following steps in netbeans

 ==>Right click on the Project
 ==>Properties
 ==>Click on RUN
 ==>VM Options : -Djava.library.path="C:\Your Directory where Dll is present"
 ==>Ok

Upvotes: 1

Related Questions