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

31
LINES

< > BotCompany Repo | #1010172 // cycleSegmentedComponents2 - shows original-size images

JavaX fragment (include)

//static int cycleSegmentedComponents2_outline = 4;

static void cycleSegmentedComponents2(final BufferedImage img, final BufferedImage bigImg, final L<ConnectedComponent> components) {
  final new Var<ImageSurface> is;
  final Var<int> iComponent = new(-1);
  
  Runnable nextImage = r {
    iComponent.set(mod(iComponent!+1, l(components));
    ConnectedComponent c = components.get(iComponent!);
    print("Bounding box: " + pixelSetBounds(c) + ", rectangleness: " + pixelSetRectangleness(c)); 
    is.set(packFrameInTopRightCorner(showZoomedImage(is!,
      cutOutPixelSet_scale(img, bigImg, c/*, cycleSegmentedComponents2_outline*/),
      "Cut out " + (iComponent!+1) + "/" + l(components)));
  };
  
  callF(nextImage);
  packInTopRightCorner(addToWindow(is!, jcenteredbuttons(
    "Next", nextImage,
    "Save", r {
      final JTextField tf = jtextfield();
      showTitledForm("Save image",
        "Name", tf,
        r {
          ConnectedComponent c = components.get(iComponent!);
          BufferedImage cut = cutOutPixelSet(img, c);
          print("Cut: " + cut.getWidth() + "*" + cut.getHeight() + " - " + l(toPNG(cut)) + " bytes");
          S imageID = uploadToLocalImageDB(cut, getTextTrim(tf));
          infoBoxTopLeftCorner("Image saved as " + imageID);
        });
    })));
}

Author comment

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: 429 / 480
Version history: 10 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)