Download Jar. Uses 2596K of libraries. Click here for Pure Java version (716L/6K).
!7 lib 1008985 // webcam lib 1008987 // bridj lib 1004016 // slf4j api import com.github.sarxos.webcam.Webcam; /** * @author Bartosz Firyn (SarXos) */ p { List<Webcam> webcams = Webcam.getWebcams(); // NOTE! /* * Yes, I know we could do this in one loop, but I wanted to prove here * that it's possible to have many native webcams open in the same time. * I tested this example with 4 webcams simultaneously connected to the * USB bus - 1 x PC embedded device, and 3 x UVC devices connected to * the USB concentration hub, which was connected to the USB 2.0 port. * It's working like a charm. */ // USB BANDWIDTH! /* * As you probably know the USB has limited bandwidth and therefore it * may not be possible to transfer images from as many cameras as you * would like to wish. This example works when I'm using QQVGA (176x144) * but fails with the error message when I want to fetch VGA (640x480). */ // open all at once (this is the most time-consuming operation, all // others are executed instantly) for (Webcam webcam : webcams) { System.out.format("Opening %s\n", webcam.getName()); webcam.open(); } // capture picture from all of them for (int i = 0; i < webcams.size(); i++) { Webcam webcam = webcams.get(i); System.out.format("Capturing %s\n", webcam.getName()); ImageIO.write(webcam.getImage(), "PNG", print(prepareProgramFile(String.format("test-%d.png", i)))); } // close all for (Webcam webcam : webcams) { System.out.format("Closing %s\n", webcam.getName()); webcam.close(); } }
See https://github.com/sarxos/webcam-capture
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008989 |
Snippet name: | Take screenshot from all web cams & save [WORKS] |
Eternal ID of this version: | #1008989/6 |
Text MD5: | 977b55d78221986b2555668a91dbd52e |
Transpilation MD5: | b8f866e366bd1ac8d9ffe3040556db1f |
Author: | stefan |
Category: | javax / desktop / camera |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-06-24 18:36:18 |
Source code size: | 1652 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 592 / 1270 |
Version history: | 5 change(s) |
Referenced in: | #1008996 - Take screenshot from all web cams & display [WORKS] |