1

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

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

This isn't working for me. For some reason it's still trying to look in the default location. Any ideas what I could be doing wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.