OpenCV 2.4.4 Java - Grab Webcam picture/stream (OSX)

可紊 提交于 2019-11-30 21:28:26

The problem was simply that camera need time to initialize. I've added

Thread.sleep(1000);

after

VideoCapture camera = new VideoCapture(0);

I've tried this code in MacOS, and found another error.

System.loadLibrary("opencv_java244");

Above line returns this error

java.lang.UnsatisfiedLinkError: org.opencv.highgui.VideoCapture.VideoCapture_2(I)J

To overcome it, I replaced that line with this one

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

and the code works!

I'm using opencv 2.4.8, including it as user library in my eclipse project

Replace
System.loadLibrary("opencv_java244");
with
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!