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).

1  
!7
2  
3  
static float scale = 0.25f; // scale image down
4  
static BufferedImage img;
5  
static L<ConnectedComponent> components;
6  
static ImageSurface isCutOut;
7  
static int iComponent;
8  
9  
p-subst {
10  
  img = loadImage2(#1010143);
11  
  img = scaleImage(img, scale);
12  
  MBFImage image = readMBF(img);
13  
14  
  time "Segment" {  
15  
    components = fhSegment(image);
16  
  }
17  
  
18  
  S n = n(components, "component");
19  
  print("Have " + n);
20  
  setFrameTitle(n, centerFrame(showZoomedImage(renderSegments(image, components), 2)));
21  
  
22  
  // Show bounding boxes
23  
  // showImageWithSelections("Bounding boxes", img, openImajRectanglesToRects(mapMethod('calculateRegularBoundingBox, components)));
24  
  
25  
  pnl(md5sOfImageComponents(img, components));
26  
  
27  
  //printStruct(pixelSetBoundsByLine(first(components)));
28  
  nextImage();
29  
  packInTopRightCorner(addToWindow(isCutOut, jcenteredbutton("Next", f nextImage)));
30  
31  
  // Compare with my own segmenter
32  
  // showAutoSegmentedImage(new RGBImage(img));
33  
}
34  
35  
svoid nextImage {
36  
  isCutOut = packFrameInTopRightCorner(showZoomedImage(isCutOut, cutOutPixelSet(img, components.get(iComponent)), "Cut out " + (iComponent+1) + "/" + l(components)));
37  
  iComponent = mod(iComponent+1, l(components));
38  
}

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: 561 / 797
Version history: 17 change(s)
Referenced in: [show references]