首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >com.github.sarxos.webcam.WebcamException:无法启动本机抓取器

com.github.sarxos.webcam.WebcamException:无法启动本机抓取器
EN

Stack Overflow用户
提问于 2014-01-07 12:29:26
回答 1查看 1K关注 0票数 0

在这里,我编写了一些代码来使用java从USBcam捕获图像。

下面是代码:

代码语言:javascript
复制
Webcam webcam = Webcam.getDefault();
        webcam.open();
        try {
            ImageIO.write(webcam.getImage(), "PNG", new File("d:/hello-world1.png"));
            System.out.println(Thread.currentThread().getName());

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

我已经添加了3罐任何时候都需要的,但是当运行应用程序时,图像没有得到,异常会被引发。

下面的是例外:

代码语言:javascript
复制
Exception in thread "main" com.github.sarxos.webcam.WebcamException: Cannot execute task
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.process(WebcamProcessor.java:57)
    at com.github.sarxos.webcam.WebcamProcessor.process(WebcamProcessor.java:120)
    at com.github.sarxos.webcam.WebcamTask.process(WebcamTask.java:35)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.open(WebcamOpenTask.java:20)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:187)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:147)
    at ImageCapture.main(ImageCapture.java:16)
Caused by: com.github.sarxos.webcam.WebcamException: Cannot start native grabber!
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice.open(WebcamDefaultDevice.java:220)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.handle(WebcamOpenTask.java:38)
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:66)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

请告诉我什么地方出了问题。

EN

回答 1

Stack Overflow用户

发布于 2014-01-07 13:16:58

如果查看源代码,如果Cannot start native grabber返回false where grabber=new OpenIMAJGrabber(); (原生Bridj代理),则会引发消息Bridj。这个陷阱使得诊断变得困难,因为真正的异常是隐藏的。似乎存在一个本机库访问问题,因此应该检查.so.dll是否确实在您的类路径中。您应该考虑调试以查看grabber是否有良好的实例化..。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20971664

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档