Uses 1434K of libraries. Click here for Pure Java version (4731L/26K).
1 | !include once #1013490 // sarxos webcam [include] |
2 | |
3 | // allow camera warm-up (light adjustment) |
4 | static double singleImageFromWebcam_delayBeforeShoot = 1; |
5 | |
6 | |
7 | // take first webcam, open & close |
8 | static BufferedImage singleImageFromWebcam() { |
9 | ret singleImageFromWebcam(first(listWebCams()), true); |
10 | } |
11 | |
12 | static BufferedImage singleImageFromWebcam(Webcam webcam, bool openAndClose) { |
13 | if (webcam == null) null; |
14 | if (openAndClose) webcam.open(true); |
15 | |
16 | if (singleImageFromWebcam_delayBeforeShoot > 0) { |
17 | print("Camera warm-up (" + formatDouble(singleImageFromWebcam_delayBeforeShoot, 1) + " seconds)"); |
18 | sleepSeconds(singleImageFromWebcam_delayBeforeShoot); |
19 | } |
20 | |
21 | try { |
22 | print("Grabbing image"); |
23 | BufferedImage img = webcam.getImage(); |
24 | print("Got image"); |
25 | ret img; |
26 | } finally { |
27 | if (openAndClose) webcam.close(); |
28 | } |
29 | } |
Began life as a copy of #1009017
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: | #1009041 |
Snippet name: | singleImageFromWebcam |
Eternal ID of this version: | #1009041/5 |
Text MD5: | 0ea08f45e960b91db1e88d5cb307b541 |
Transpilation MD5: | 962169c208154e5e5b6e32a387e244bf |
Author: | stefan |
Category: | javax / desktop / camera |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-25 17:31:31 |
Source code size: | 867 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 481 / 579 |
Version history: | 4 change(s) |
Referenced in: | [show references] |