問題描述
我需要使用 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 訪問網絡攝像頭的最佳方式的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!