我在运行程序错误时遇到错误,如下所示
com.googlecode.javacv.FrameGrabber$Exception: videoInput.getPixels() Error: Could not get pixels.
at com.googlecode.javacv.VideoInputFrameGrabber.grab(VideoInputFrameGrabber.java:168)
at Robot.run(Robot.java:107)
at java.lang.Thread.run(Unknown Source)
***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****
SETUP: Setting up device 0
SETUP: HD Pro Webcam C920
SETUP: Couldn't find preview pin using SmartTee
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.
和错误显示在下面的行中
rameGrabber grabber = new VideoInputFrameGrabber(0); // 1用于下一个相机
grabber.start();
IplImage img = null;
while (true) {
long sleepTime= (long)((100000 / 60));
Thread.sleep(sleepTime);
img = grabber.grab();//gettin error on this line..
我遇到了类似的问题。答案是在这个论坛(https://groups.google.com/forum/#!msg/javacv/yD99RSl7oCI/KQIRoOIqcK4J)
尝试使用javaCV.OpenCVFrameGrabber而不是VideoInputFrameGrabber。
改变'FrameGrabber grabber = new VideoInputFrameGrabber(0); // 1为下一个相机'
'Frame Grabber grabber = new OpenCVFrameGrabber(0); // 1 for nest camera'
现在它每次都适合我。
希望能帮助到你!