Java Webcam Capture
Hello,
I'm trying to learn openCV (java). I have started with simple project (capture video with webcam). Here is a code (I'm using eclipse).
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.VideoCapture;
public class Main {
public static void main(String[] args) {
//System.loadLibrary("opencv-246.jar");
VideoCapture cap = new VideoCapture(0);
Mat frame = new Mat();
cap.retrieve(frame);
}
}
When I run my code I'm get this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.highgui.VideoCapture.n_VideoCapture(I)J
at org.opencv.highgui.VideoCapture.n_VideoCapture(Native Method)
at org.opencv.highgui.VideoCapture.<init>(VideoCapture.java:113)
at Main.main(Main.java:10)
Can please someone help me.
Thank you very much.
Best
I reset my lib. But still get the same error.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv-246.jar in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1874) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1087) at Main.main(Main.java:9)
//System.loadLibrary("opencv-246.jar");
why did you comment it ? you need it !
also, make sure that the opencv dlls are on the PATH env var
If I uncomment this out. I get this error Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv-246.jar in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1874) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1087) at Main.main(Main.java:8)
berak, can you please show hot to set this "also, make sure that the opencv dlls are on the PATH env var" thanks
http://exintopro.net/blog/2013/10/02/setting-up-eclipse-for-using-opencv-java-in-ubuntu/