繁体   English   中英

网络摄像头捕获API-如何使其在Raspberry Pi上运行?

[英]Webcam Capture API -How to get it work on Raspberry Pi?

这是我在stackoverflows论坛上的第一篇文章。

我喜欢参考这个sarxos答案https://stackoverflow.com/a/31871593/5510077

我想我完全按照API的创建者Bartosz Firyns的说明进行操作,以使他的Webcam Capture 0.3.10 API可以在我的Raspberry Pi Model B +上使用。

我当前包含在类路径中的文件是:

  • SLF4J-API-1.7.2.jar
  • SLF4J-简单1.7.2.jar
  • v4l4j-0.9.1-r507.jar
  • 网络摄像头进行摄像0.3.10.jar
  • 摄像头捕获驱动-v4l4j-0.3.10-20140923.154112-11.jar

我使用这个sarxos的示例来测试API,但是使用V4l4jDriver,因为我无法在BrispJ上使用Raspberry Pi:

package webcam;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver;

public class WebCam {

    static {
        Webcam.setDriver(new V4l4jDriver()); // this is important
    }

    public static void main(String[] args) throws IOException {

        // get default webcam and open it
        Webcam webcam = Webcam.getDefault();
        webcam.open();

        // get image
        BufferedImage image = webcam.getImage();

        // save image to PNG file
        ImageIO.write(image, "PNG", new File("test.png"));
    }
}

并收到此错误:

[main] WARN com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver - Modified V4L4J has not been found in classpath
Exception in thread "main" com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:124)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:816)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:879)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:856)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:834)
    at webcam.WebCam.main(WebCam.java:34)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:116)
    ... 5 more
Caused by: java.lang.NullPointerException
    at com.github.sarxos.webcam.util.NixVideoDevUtils.getVideoFiles(NixVideoDevUtils.java:19)
    at com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver.getDevices(V4l4jDriver.java:46)
    at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:36)
    at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:26)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Java Result: 1

这些链接已失效,因此我无法测试以下jar文件:

摄像头捕捉-0.3.11-SNAPSHOT.jar

摄像头捕获驱动-v4l4j-0.3.11-20150713.101304-10.jar

如今,有什么措施可以使该API在Raspberry Pi上运行?

替换两个文件后,您将摆脱错误并运行应用程序:

    网络摄像头进行摄像0.3.10.jar

与此:

    网络摄像头进行摄像0.3.11.jar

    摄像头捕获驱动-v4l4j-0.3.10-20140923.154112-11.jar

与这个

    摄像头捕获驱动-v4l4j-0.3.11.jar

从Webcam Capture API作者到这些文件的链接和答复的票证,缺少链接。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM