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

38
LINES

< > BotCompany Repo | #1010146 // Play with Felzenszwalb-Huttenlocher Segmenter [OK]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 18844K of libraries. Click here for Pure Java version (5212L/37K/137K).

!7

static float scale = 0.25f; // scale image down
static BufferedImage img;
static L<ConnectedComponent> components;
static ImageSurface isCutOut;
static int iComponent;

p-subst {
  img = loadImage2(#1010143);
  img = scaleImage(img, scale);
  MBFImage image = readMBF(img);

  time "Segment" {  
    components = fhSegment(image);
  }
  
  S n = n(components, "component");
  print("Have " + n);
  setFrameTitle(n, centerFrame(showZoomedImage(renderSegments(image, components), 2)));
  
  // Show bounding boxes
  // showImageWithSelections("Bounding boxes", img, openImajRectanglesToRects(mapMethod('calculateRegularBoundingBox, components)));
  
  pnl(md5sOfImageComponents(img, components));
  
  //printStruct(pixelSetBoundsByLine(first(components)));
  nextImage();
  packInTopRightCorner(addToWindow(isCutOut, jcenteredbutton("Next", f nextImage)));

  // Compare with my own segmenter
  // showAutoSegmentedImage(new RGBImage(img));
}

svoid nextImage {
  isCutOut = packFrameInTopRightCorner(showZoomedImage(isCutOut, cutOutPixelSet(img, components.get(iComponent)), "Cut out " + (iComponent+1) + "/" + l(components)));
  iComponent = mod(iComponent+1, l(components));
}

Author comment

Began life as a copy of #1010064

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, ishqpsrjomds, iveijnkanddl, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1010146
Snippet name: Play with Felzenszwalb-Huttenlocher Segmenter [OK]
Eternal ID of this version: #1010146/18
Text MD5: 1cdff3070a98c5fa1eb29bacf0f9171c
Transpilation MD5: 26c3af5dcefeadf477582edd36ca20d9
Author: stefan
Category: javax / imaging
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-05 18:36:49
Source code size: 1219 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 562 / 797
Version history: 17 change(s)
Referenced in: