1 | //static int cycleSegmentedComponents2_outline = 4; |
2 | |
3 | static void cycleSegmentedComponents2(final BufferedImage img, final BufferedImage bigImg, final L<ConnectedComponent> components) { |
4 | final new Var<ImageSurface> is; |
5 | final Var<int> iComponent = new(-1); |
6 | |
7 | Runnable nextImage = r { |
8 | iComponent.set(mod(iComponent!+1, l(components)); |
9 | ConnectedComponent c = components.get(iComponent!); |
10 | print("Bounding box: " + pixelSetBounds(c) + ", rectangleness: " + pixelSetRectangleness(c)); |
11 | is.set(packFrameInTopRightCorner(showZoomedImage(is!, |
12 | cutOutPixelSet_scale(img, bigImg, c/*, cycleSegmentedComponents2_outline*/), |
13 | "Cut out " + (iComponent!+1) + "/" + l(components))); |
14 | }; |
15 | |
16 | callF(nextImage); |
17 | packInTopRightCorner(addToWindow(is!, jcenteredbuttons( |
18 | "Next", nextImage, |
19 | "Save", r { |
20 | final JTextField tf = jtextfield(); |
21 | showTitledForm("Save image", |
22 | "Name", tf, |
23 | r { |
24 | ConnectedComponent c = components.get(iComponent!); |
25 | BufferedImage cut = cutOutPixelSet(img, c); |
26 | print("Cut: " + cut.getWidth() + "*" + cut.getHeight() + " - " + l(toPNG(cut)) + " bytes"); |
27 | S imageID = uploadToLocalImageDB(cut, getTextTrim(tf)); |
28 | infoBoxTopLeftCorner("Image saved as " + imageID); |
29 | }); |
30 | }))); |
31 | } |
Began life as a copy of #1010170
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: | #1010172 |
Snippet name: | cycleSegmentedComponents2 - shows original-size images |
Eternal ID of this version: | #1010172/11 |
Text MD5: | b91e49e168a6eda2d120803687b7b3b2 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-06 00:40:19 |
Source code size: | 1331 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 428 / 479 |
Version history: | 10 change(s) |
Referenced in: | [show references] |