java - 网络摄像头捕获 - 请求图像时超时
问题描述
我正在使用网络摄像头捕获通过以下代码获取 Java 中的网络摄像头图像:
Webcam webcam = Webcam.getWebcamByName("VF0415 Live! Cam Vid. IM Ultra 1"); // USB webcam
webcam.open();
BufferedImage image = webcam.getImage();
ImageIO.write(image, "JPG", new File("test.jpg"));
不幸的是,我因以下错误而超时:
[main] INFO com.github.sarxos.webcam.Webcam - WebcamDefaultDriver capture driver will be used
[atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamOpenTask - Opening webcam VF0415 Live! Cam Vid. IM Ultra 1
[frames-refresher-[1]] ERROR com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice - Timeout when requesting image!
[shutdown-hook-1] INFO com.github.sarxos.webcam.WebcamShutdownHook - Automatic VF0415 Live! Cam Vid. IM Ultra 1 deallocation
[shutdown-hook-1] INFO com.github.sarxos.webcam.Webcam - Disposing webcam VF0415 Live! Cam Vid. IM Ultra 1
[frames-refresher-[1]] ERROR com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice - Timeout when requesting image!
我查看了 GitHub 上的相关问题,并尝试保持 USB 电源打开并拦截 OS 信号,但错误消息保持不变,给我一个基本上黑色的图像,如下所示:
还有什么我可以尝试解决的吗?
解决方案
推荐阅读
- php - 在 3 li 元素内循环 6 个帖子
- node.js - 如何让客户端从受密码保护的页面下载文件?
- python - Python PermissionError: [WinError 32] 进程无法访问文件.....但是我的文件已关闭
- ruby - 作为 Catalina 升级的一部分,“重新定位的项目”文件夹中的 RVM
- python - 将列表添加到具有未定义键的 for 循环中的字典键
- odoo - 如何在 Odoo 12 中拆解产品?
- php - PHP cUrl 和 cookie GX_SESSION_ID
- cmake - 无法在 Clion 中使用嵌入式 gdb 服务器进行调试
- php - 使用 cURL 保存图像
- python - 加载 Python 库“/tmp/_MEItueAuk/libpython3.7m.so.1.0”时出错:dlopen:/lib/x86_64-linux-gnu/libc.so.6:找不到版本“GLIBC_2.28”