Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

37
LINES

< > BotCompany Repo | #1013489 // JavaX Live WebCam - Show live webcam image in frame v4 [with cam selection]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 6490K of libraries. Click here for Pure Java version (9056L/64K).

1  
!7
2  
3  
static WebcamPanel panel;
4  
static bool savingOn = true;
5  
static double saveEvery = 10.0;
6  
static volatile File latestSaved;
7  
8  
p {
9  
  restartWith128MBHeap();
10  
  outBuf(50000);
11  
  substance();
12  
  selectWebCam(voidfunc(Webcam cam) {
13  
    panel = new WebcamPanel(cam, true);
14  
    panel.setFPSDisplayed(true);
15  
    frameIcon(#1009177, exitProgramOnFrameClose(alwaysOnTop(showPackedFrame("JavaX Live WebCam", panel)));
16  
    bot("WebCam.");
17  
    doEvery_daemon_now(saveEvery, f saveDefault);
18  
  });
19  
  hideConsole();
20  
}
21  
22  
answer {
23  
  if "save jpeg at *" {
24  
    saveJPEG(newFile($1), imageFromWebcamPanel(panel));
25  
    ret "OK";
26  
  }
27  
  if "latest file"
28  
    ret latestSaved == null ? "Not saved yet"
29  
      : "OK " + quote(f2s(latestSaved));
30  
}
31  
32  
svoid saveDefault {
33  
  if (!savingOn) ret;
34  
  File file = newFile(javaxDataDir(), "WebCam", ("webcam-" + dateWithSecondsForFile() + ".jpg");
35  
  saveJPEG(file, imageFromWebcamPanel(panel));
36  
  latestSaved = file;
37  
}

Author comment

Began life as a copy of #1010735

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: #1013489
Snippet name: JavaX Live WebCam - Show live webcam image in frame v4 [with cam selection]
Eternal ID of this version: #1013489/7
Text MD5: 63792d1c767f46c5965e4280c1d9b50e
Transpilation MD5: e09e16961ba8694b4cc2653e8a1fb931
Author: stefan
Category: javax / desktop / camera
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-30 17:05:51
Source code size: 963 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 403 / 1383
Version history: 6 change(s)
Referenced in: [show references]