如何将网络摄像头与java集成? [英] How to integrate webcam with java?

查看:326
本文介绍了如何将网络摄像头与java集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我使用java swing创建了一个项目。我想在生成按钮点击事件时使用网络摄像头拍摄照片。



我得到了一些信息,因为JMF是将java与网络摄像头集成的最佳方式。但是我对jmf没有任何了解。所以请帮助我的朋友。



如果你知道另一种方法将java swing与web cam集成,请告知我。



否则,如果你知道如何使用jmf意味着请帮帮我... :)

Hi i create one project using java swing. i want to take a snap picture using web cam when the button click event get generated.

I got some info as JMF is the best way to integrate java with web cam. But i cant have any knowledge in jmf. so please help me friends.

if you know another way to integrate java swing with web cam means please inform me.

else if you know how to use jmf means please help me... :)

推荐答案

JMF太糟糕了!它已经过时了,不再维护,而且非常复杂。我能说的唯一好处就是它非常快。



我是开源的作者 网络摄像头捕获 项目可在Github上获得。它的目标是让用户直接从Java代码访问内置或USB连接的网络摄像头,与网络或IP摄像头相同。您不需要实现任何其他软件(如果是JMF必须这样做),它可以独立运行。它非常快 - 在我的情况下,我能够在BufferedImage对象中传输250 FPS。



我在网络摄像头捕获中提供的API非常简单,有很多例子,因此,您可以开始开发您的应用程序,并且不关心它是否适用于Linux,Windows或Mac OS。网络摄像头捕获将在任何地方运行。



这是一个简单的代码。假设您有两台摄像机连接到您的PC(当然,您只能有一台)。



JMF sucks! It's completely outdated, not maintained any more and terribly complicated. The only good thing I can say about it is the fact it is pretty fast.

I'm the author of open source Webcam Capture project available on Github. It s goal is to give users access to build-in or USB connected webcams, same as for network or IP cameras, directly from Java code. You don't need to implement any additional software (as you have to do in case of JMF), it works standalone. It's pretty fast - in my case I was able t stream 250 FPS in BufferedImage objects.

The API I provided in Webcam Capture is really simple, there are many examples, so you can start developing your app and don;t care if it will be working on Linux, Windows, or Mac OS. Webcam Capture will run everywhere.

Here is a simple code. Assume you have two cameras connected to your PC (but of course, you can have only one).

Webcam buildin = Webcam.getWebcams().get(0); // build-in laptop camera
Webcam usb = Webcam.getWebcams().get(1); // usb camera
BufferedImage image1 = buildin.getImage();
BufferedImage image2 = usb.getImage();
// do with image1 and image2 whatever you want


希望 this [ ^ ]会给你一个想法。
Hope this[^] will give you an idea.


这篇关于如何将网络摄像头与java集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆