# Webcam Capture API
This library allows you to use your build-in or external webcam directly from Java. It's designed to abstract commonly used camera features and support various capturing frameworks.
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.sarxos/webcam-capture/badge.svg)](http://search.maven.org/#artifactdetails|com.github.sarxos|webcam-capture|0.3.10|bundle)
[![Build Status](https://img.shields.io/travis/sarxos/webcam-capture.svg?branch=master)](http://travis-ci.org/sarxos/webcam-capture)
[![Coverage Status](https://img.shields.io/coveralls/sarxos/webcam-capture.svg?branch=master)](https://coveralls.io/r/sarxos/webcam-capture?branch=master)
## Rationale
Assume situation when your code depends on some capturing framework, but suddenly you have to drop it and use different, maybe newer one (e.g. replace archaic JMF with newest GStreamer). By doing this you will have to rewrite significant piece of your code because these frameworks are completely different and not compatible at all. This is where Webcam Capture API comes to save the world - it was created to remove the burden of such situations so you do not have to rewrite your code never again, but instead you can simply switch the driver class to different one.
## Features
* Simple, thread-safe and non-blocking API,
* No additional software required,
* Supports multiple platforms (Windows, Linux, Mac OS, etc) and various architectures (32-bit, 64-bit, ARM),
* Get images from build-in or USB-connected PC webcams,
* Get images from IP / network cameras (as MJPEG or JPEG),
* Offers ready to use motion detector,
* All required JARs Available in Maven Central,
* Offers possibility to expose images as MJPEG stream,
* It is available as Maven dependency or standalone ZIP binary (with all dependencies included),
* Swing component to display video feed from camera,
* Swing component to choose camera (drop down),
* Multiple capturing frameworks are supported:
* [OpenIMAJ][];
* [LTI CIVIL][LTI-CIVIL];
* [Java Media Framework (JMF)][JMF];
* [Freedom for Media in Java (FMJ)][FMJ];
* [OpenCV][] via [JavaCV][];
* [VLC][] via [vlcj][];
* [V4L][] via [v4l4j][V4L4j];
* [GStreamer][] (0.10.x only) via [gstreamer-java][gstreamerj];
* [FFmpeg][];
* MJPEG IP Cameras;
The latest stable version is: **```0.3.12```**
The latest development version is: **```0.3.13-SNAPSHOT```**
## Raspberry PI
_(and other ARM devices)_
The lates version (0.3.10) does not work on ARM just out of the box. To make it working you need to replace version 0.6.2 of BridJ JAR by the [0.6.3-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.nativelibs4java&a=bridj&v=0.6.3-SNAPSHOT) or newer [bridj-0.7-20140918](http://maven.ecs.soton.ac.uk/content/groups/maven.openimaj.org/com/nativelibs4java/bridj/0.7-20140918/bridj-0.7-20140918.jar). Moreover, lately Jonathon Hare from OpenIMAJ team, found a problem described in [bridj #525](https://github.com/ochafik/nativelibs4java/issues/525) which causes problems on armhf architecture.
## Maven
The latest stable version is [available](http://search.maven.org/#artifactdetails|com.github.sarxos|webcam-capture|0.3.12|bundle) in Maven Central:
```xml
<dependency>
<groupId>com.github.sarxos</groupId>
<artifactId>webcam-capture</artifactId>
<version>0.3.12</version>
</dependency>
```
Snapshot version:
```xml
<repository>
<id>Sonatype OSS Snapshot Repository</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
```
```xml
<dependency>
<groupId>com.github.sarxos</groupId>
<artifactId>webcam-capture</artifactId>
<version>0.3.13-SNAPSHOT</version>
</dependency>
```
## Download
The newest stable version can be downloaded as separated ZIP binary. This ZIP file contains Webcam Capture API itself and all required dependencies (in ```libs``` directory). Click on the below link to download it:
[webcam-capture-0.3.12-dist.zip](https://github.com/sarxos/webcam-capture/releases/download/webcam-capture-parent-0.3.12/webcam-capture-0.3.12-dist.zip)
The latest development version JAR (aka SNAPSHOT) can be downloaded [here](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.github.sarxos&a=webcam-capture&v=0.3.13-SNAPSHOT).
## Contribution
If you have strong will, spare time, knowledge or even some small amount of money you would like to spent for good purpose you can help developing this awesome Webcam Capture API and make it even better! Several kinds of contributions are very welcome:
##### Star Project
If you think this project is great, you would like to help, but you don't know how - you can become project's stargazer. By starring you're making project more popular. Visit [this](https://github.com/blog/1204-notifications-stars) link if you would like to learn more about how notifications and stars works on Github.
##### Report Bug or Feature
If you've found a bug or you've came-up with some fantastic feature which can make Webcam Capture a better API to use, don't hesitate to [create new issue](https://github.com/sarxos/webcam-capture/issues/new) where you can describe in details what the problem is, or what would you like to improve.
##### Perform Tests
Since Webcam Capture use some part of native code, it's very hard to cover all supported operating systems. I'm always testing it on 64-bit Ubuntu Linux, Windows XP and Vista (both 32-bit), but I have no possibility to test on Raspberry Pi, Mac OS and 32-bit Linux. Please help and test on those systems if you have such possibility.
##### Write Code
If you know Java or C++ you can help developing Webcam Capture by forking repository and sending pull requests. Please visit [this](http://stackoverflow.com/questions/4384776/how-do-i-contribute-to-others-code-in-github) link if you don't know how to contribute to other's code at Github.
##### Donate
People have expressed a wish to donate a little money. Donating won't get you anything special, other than a warm feeling inside, and possibly urge me to produce more freely available material for Webcam Capture project. You can donate via [PayPal](https://www.paypal.com), just click [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYMENK76CSYZU) button available below - it will redirect you to the secured PayPal page where you can provide donation amount (there is no minimal value).
[![Donate via PayPal](https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYMENK76CSYZU)
## Hello World
Code below will capture image from your default webcam and save it in ```hello-world.png``` file:
```java
Webcam webcam = Webcam.getDefault();
webcam.open();
ImageIO.write(webcam.getImage(), "PNG", new File("hello-world.png"));
```
## More Examples!
Below are the very pretty basic examples demonstrating of how Webcam Capture API can be used in the Java code. All can be found in the project source code. Please note that some of those examples may use the newest API which has not yet been released to maven Central. In such a case please make sure you are using the newest Webcam Capture API SNAPSHOT.
* [How to detect webcam](https://github.com/sarxos/webcam-capture/blob/master/webcam-capture/src/example/java/DetectWebcamExample.java)
* [How to take picture and save to file](https://github.com/sarxos/webcam-capture/blob/master/webcam-capture/src/example/java/TakePictureExample.java)
* [How to display image from webcam in Swing panel (basic)](https://github.com/sarxos/webcam-capture/blob/master/webcam-capture/src/example/java/WebcamPanelExample.java)
* [How to display image from webcam in Swing panel (more advanced)](https://github.com/sarxos/webcam-capture/blob/master/webcam-capture/src/example/java/WebcamVi
没有合适的资源?快使用搜索试试~ 我知道了~
webcam-capture, 这个项目允许头直接从Java访问USB连接的网络摄像头.zip
共506个文件
java:273个
xml:55个
png:50个
需积分: 50 8 下载量 52 浏览量
2019-09-18
14:51:18
上传
评论
收藏 9.02MB ZIP 举报
温馨提示
webcam-capture, 这个项目允许头直接从Java访问USB连接的网络摄像头 Webcam Capture API 这个库允许你直接在Java中使用内置的或外部的摄像头,它的设计目的是抽象常用的相机功能,并支
资源推荐
资源详情
资源评论
收起资源包目录
webcam-capture, 这个项目允许头直接从Java访问USB连接的网络摄像头.zip (506个子文件)
COPYING 34KB
styles.css 19KB
normalize.css 8KB
pygment_trac.css 4KB
style.css 321B
OpenIMAJGrabber.dll 186KB
OpenIMAJGrabber.dll 158KB
civil.dll 131KB
civil.dll 131KB
webcam-capture-handbook.doc 682KB
libOpenIMAJGrabber.dylib 83KB
WebCamPreview.fxml 3KB
hr.gif 1KB
.gitignore 498B
README.html 33KB
header.html 2KB
index.html 359B
index.html 352B
footer.html 331B
Security-Camera.ico 422KB
Webcam.java 37KB
WebcamPanel.java 30KB
PNGDecoder.java 16KB
VlcjDevice.java 12KB
WebcamComposite.java 12KB
WebcamDefaultDevice.java 12KB
WebcamMotionDetector.java 11KB
V4l4jDevice.java 11KB
FsWebcamDevice.java 11KB
IpCamDevice.java 11KB
Gst1Device.java 10KB
GStreamerDevice.java 10KB
WebcamDiscoveryService.java 9KB
Constants.java 9KB
ParallelGetImageBytesExample.java 9KB
WebcamMotionDetectorDefaultAlgorithm.java 9KB
IPCDevice.java 9KB
JHBlurFilter.java 8KB
JmfDevice.java 8KB
WebcamUpdater.java 8KB
WebcamLock.java 8KB
WebCamAppLauncher.java 7KB
CustomPainterExample.java 7KB
SpycamMain.java 7KB
H264StreamDecoder.java 7KB
WebcamStreamer.java 7KB
FFmpegCliDriver.java 7KB
WebcamResolution.java 7KB
IpCamDriver.java 6KB
DoubleVideoPannel.java 6KB
ScreenImage.java 6KB
JavaCvDevice.java 6KB
IpCamDeviceRegistry.java 6KB
FFmpegCliDevice.java 5KB
OptionsPanel.java 5KB
LtiCivilDevice.java 5KB
WebCamPreviewController.java 5KB
WebcamStaticsTest.java 5KB
StreamServerAgent.java 5KB
GStreamerDriver.java 5KB
VlcjDriver.java 5KB
IpCamDeviceRegistryTest.java 5KB
LignanoBeachPushModeIpCameraExample.java 4KB
MultipointMotionDetectionExample.java 4KB
WebcamViewerExample.java 4KB
IPCDriver.java 4KB
LtiCivilLoader.java 4KB
WebcamProcessor.java 4KB
VlcjDeviceTest.java 4KB
H264StreamEncoder.java 4KB
MjpegInputStream.java 4KB
Device.java 4KB
RaspividDevice.java 4KB
VlcjDirectTest.java 4KB
RaspividYUVDevice.java 4KB
WebcamDriverUtils.java 4KB
WebcamViewer.java 4KB
AdaptiveSizeWriterExample.java 4KB
WebcamDefaultDriver.java 3KB
OpenIMAJGrabber.java 3KB
WebcamDummyDevice.java 3KB
TakeSnapshotFromVideoExample.java 3KB
JHFilter.java 3KB
CommanderUtil.java 3KB
DeviceList.java 3KB
DetectMotionDoNotEngageZoneExample.java 3KB
GsUtils.java 3KB
FacePainterExample.java 3KB
OptionsBuilder.java 3KB
WebcamMotionEvent.java 3KB
JHFlipFilter.java 3KB
WebcamDevice.java 3KB
WebcamWebSocketHandler.java 3KB
WebcamPanelWithImageSupllierExample.java 3KB
OpenImajDevice.java 3KB
VideoPanel.java 3KB
JHFilterTest.java 3KB
ScreenCaptureDevice.java 3KB
Gst1Driver.java 3KB
WebcamPanelExample.java 3KB
共 506 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
weixin_38744207
- 粉丝: 343
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功