我在运行程序时遇到错误,错误如下

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抓手= 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抓取器= new VideoInputFrameGrabber(0);”行。 //下一台相机为1”

到'FrameGrabber抓取器=新的OpenCVFrameGrabber(0); //下一台相机为1”

现在它每次都对我有用。

希望能帮助到你!

关于java - 在javacv中使用高像素摄像头时出错?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21113970/

10-12 18:57