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

32
LINES

< > BotCompany Repo | #1021153 // Grab Occasional WebCam Images [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 2724K of libraries. Click here for Pure Java version (11178L/82K).

!7

module OccasionalWebCam > DynSCP {
  transient ImageSurface imageSurface;
  transient Webcam cam;

  JComponent visualize2() {
    ret jcenteredbutton("Start", rThread startIt);
  }
  
  void startIt {
    selectWebCam_withPreferred(vf<Webcam> selectCam);
  }
  
  void selectCam(Webcam _cam) enter {
    cleanMeUp();
    cam = _cam;
    print("Cam opened: " + cam.open()); // blocking mode (no background thread)
    setComponent(jscroll_center(imageSurface = doubleBufferedImageSurface_noAlpha()));
    awtCalcEvery(imageSurface, 0.0, 1.0, r {
      time "Get image from webcam" {
        BufferedImage img = cam.getImage();
      }
      imageSurface.setImage(img);
    });
  }
  
  void cleanMeUp {
    if (cam != null) cam.close();
    cam = null;
  }
}

Author comment

Began life as a copy of #1016673

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1021153
Snippet name: Grab Occasional WebCam Images [dev.]
Eternal ID of this version: #1021153/9
Text MD5: 9adb7b330ead81eb0e75ffde9c852389
Transpilation MD5: efc613e9bd63a6dfff3d3ff9f31748c9
Author: stefan
Category: javax / desktop / camera
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-28 01:44:52
Source code size: 793 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 363 / 644
Version history: 8 change(s)
Referenced in: