Uses 911K of libraries. Click here for Pure Java version (6269L/34K).
1 | !7 |
2 | |
3 | cmodule ImageSegmenter > DynImageSurface { |
4 | float contrastThreshold = 0.5f; |
5 | int gridSize = 2; |
6 | transient ReliableSingleThread rst = dm_rst(this, r segmentIt); |
7 | |
8 | visualize { |
9 | JSlider slider = jLiveValueSlider(dm_fieldLiveValue('contrastThreshold)); |
10 | main.onChange(slider, rst); |
11 | JSpinner spinner = liveValueSpinner(dm_fieldLiveValue('gridSize), 2, 10); |
12 | main.onChange(spinner, rst); |
13 | ret withCenteredLineBelow(super.visualize(), |
14 | withLabel("Contrast Threshold:", slider), |
15 | withLabel("Grid size:", spinner), |
16 | jbutton("Segment", rst)); |
17 | } |
18 | |
19 | start { |
20 | if (!hasImage()) setImage(whiteImage(100, 100)); |
21 | dm_vmBus_onMessage('newClipboardContents, voidfunc(O o) { |
22 | if (o cast BufferedImage) thread { |
23 | setImage(o); |
24 | rst.trigger(); |
25 | } |
26 | }); |
27 | } |
28 | |
29 | void segmentIt enter { |
30 | if (!hasImage()) ret; |
31 | new AutoSegmenter as; |
32 | as.g = gridSize; |
33 | as.contrastThreshold = contrastThreshold; |
34 | overlaySelectionsOnImageSurface(imageSurface, as.go(BWImage(getImage()))); |
35 | } |
36 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018876 |
Snippet name: | Image Segmenter [Dyn Module] |
Eternal ID of this version: | #1018876/14 |
Text MD5: | 540b59b60ecad59aded4e4c3129bcfd0 |
Transpilation MD5: | 7087ddf656e64fefed603e8084ce1535 |
Author: | stefan |
Category: | javax / image analysis |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-22 01:32:51 |
Source code size: | 1075 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 401 / 1649 |
Version history: | 13 change(s) |
Referenced in: | [show references] |