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

33
LINES

< > BotCompany Repo | #1019563 // Live Eyebrow Finder [Dyn Module, OK with the right lighting & trained recognizers]

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

Uses 108K of libraries. Click here for Pure Java version (17069L/122K).

1  
!7
2  
3  
module LiveEyebrowFinder > DynImageSurface {
4  
  transient BufferedImage lastImage;
5  
  EyebrowFinder1 finder;
6  
  transient ReliableSingleThread rstUpdateImage = dm_rst(this, r updateImage);
7  
  transient S eyebrowState;
8  
9  
  start {
10  
    if (finder == null)
11  
      finder = defaultEyebrowFinder();
12  
    doEvery(100, rstUpdateImage);
13  
  }
14  
  
15  
  visualize {
16  
    JComponent c = super.visualize();
17  
    imageSurface_pixelated(imageSurface);
18  
    ret centerAndSouth(c, withMargin(setFontSize(30, makeBold(jCenteredLiveValueLabel(dm_fieldLiveValue('eyebrowState))))));
19  
  }
20  
  
21  
  void updateImage enter {
22  
    if (imageSurface == null) ret;
23  
    final BufferedImage img = dm_webCamImage();
24  
    temp tempAfterwards(r { lastImage = img });
25  
    if (img == null || img == lastImage) ret;
26  
    RectAndState found = finder.get(RGBImage(img));
27  
    if (setField(eyebrowState := found == null ? null : found.state))
28  
      vmBus_send('eyebrows, eyebrowState);
29  
    setModuleName("Live Eyebrow Finder" + (found == null ? "" : " - " + found.state));
30  
    setSelection(rectAndStateToRect(found));
31  
    setImage(img);
32  
  }
33  
}

Author comment

Began life as a copy of #1019539

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019563
Snippet name: Live Eyebrow Finder [Dyn Module, OK with the right lighting & trained recognizers]
Eternal ID of this version: #1019563/7
Text MD5: 875cab6866364498fa073700f4aa4bc8
Transpilation MD5: 6bf08949d58b602c381a7dd736c0f8e6
Author: stefan
Category: javax / stefan's os / web cam
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-14 17:29:47
Source code size: 1116 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 351 / 616
Version history: 6 change(s)
Referenced in: [show references]