问题描述
我需要使用 Java 访问网络摄像头.这就是我想做的事情
I need to access web camera using Java. This is what I want to do
访问网络摄像头
Access web cam
现在用户可以看到网络摄像头在工作,因为他的脸在屏幕上可见(听说有些库不显示网络摄像头的视频输出)
Now the user can see web cam working because his face is visible on screen (have heard some libs are there which doesn't show the video output of webcam)
当用户点击保存按钮时,拍摄快照并保存
when user click save button, take a snapshot and save it
长期以来,我已经尝试了多种方法来做到这一点.
I have tried number of ways to do this, from a long time.
- JMF - 现在它已经死了
- FMJ - 现在它也死了
- VLCJ - 太多了,因为我没有创建音乐/视频播放器,它希望安装 VLC
- Xuggler - 工作太辛苦了
- JMyron - 没用
- JavaFX - 我认为它可以做到,但似乎不能
如果图书馆只做上面提到的事情,我什至很满意,因为这对我来说已经足够了.但我希望它也很简单.如果它不使用 DLL,那就太好了,因为它不是独立于平台的.真的很感激它是否可以检测相机,而无需像 VLCJ 中那样手动传递相机名称和其他信息(因为可能有数千个相机品牌,所以我无法在其中创建一千个元素的列表).而且,我正在创建一个桌面应用程序,而不是网络应用程序.
I am even satisfied if the library is just ONLY doing the above mentioned, because that's enough for me. But I expect it to be simple too. Really great if it is not using DLLs, because it is not platform independent if it does. Really appreciate if it can DETECT the camera, without manually passing the camera name and other info as have do in VLCJ (because there might be thousands of camera brands, so I can't create a list of thousand elements in it). And, I am creating a desktop application, not web app.
如果你知道这样的图书馆,请告诉我.其他库(可能不适合我的所有要求,但适合基本要求)也欢迎.请帮忙
If you know a library like this, please be kind enough to let me know. Other libraries (which might not suit to all of my requirements, but suits to the basic requirement) also welcome. Please help
推荐答案
这个已经在 SO 上讨论过很多次了.以下是一些帮助您入门的链接:
This has been discussed on SO multiple times. Here are a few links to get you started:
SO:用java从网络摄像头捕获图像?
所以:从实时视频设备捕获图像以供基于 Java 的应用程序使用的最佳方法是什么?
openCVF 小程序:http://www.colorfulwolf.com/blog/2011/07/05/accessing-the-webcam-from-inside-a-java-applet/
openCVF applet: http://www.colorfulwolf.com/blog/2011/07/05/accessing-the-webcam-from-inside-a-java-applet/
配置:http://ganeshtiwaridotcomdotnp.blogspot.in/2011/12/opencv-javacv-eclipse-project.html
这篇关于用 Java 访问网络摄像头的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!