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

39
LINES

< > BotCompany Repo | #1010064 // Test Felzenszwalb-Huttenlocher Segmenter on live screenshot [OK]

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

Uses 18844K of libraries. Click here for Pure Java version (5627L/41K/143K).

1  
!7
2  
3  
lib 1010061 // OpenIMAJ feature extraction (1.3.5)
4  
lib 1009074 // trove
5  
6  
import org.openimaj.image.segmentation.*;
7  
import org.openimaj.image.pixel.*;
8  
9  
static float sigma = 0.5f;
10  
static float k = 2500f / 255f;
11  
static int minSize = 20;
12  
13  
static float scale = 0.25f; // scale image
14  
static int repetitions = 1; // Test HotSpot
15  
16  
p-subst {
17  
  hideConsole();
18  
  sleep(500);
19  
  time "Make MBFImage" {
20  
    MBFImage image = readMBF(scaleImage(shootScreen2(), scale));
21  
  }
22  
  showConsole();
23  
  for (int i = 0; i < repetitions; i++) {
24  
    time "Segment" {
25  
      FelzenszwalbHuttenlocherSegmenter segmenter = new(sigma, k, minSize );
26  
      L<ConnectedComponent> components = segmenter.segment(image);
27  
    }
28  
    if (i == 0) {
29  
      S n = n(components, "component");
30  
      print("Have " + n);
31  
      setFrameTitle(n, centerFrame(showMBFZoomed(SegmentationUtilities.renderSegments(image, components), 2)));
32  
      //printStruct(map(f getClassName, components);
33  
      //Set<Pixel> pixels = first(components).getPixels();
34  
      print(join(", ", map(func(ConnectedComponent c) {
35  
        className(c.getPixels()) + "/" + l(c.getPixels()) }, components)));
36  
      //print(getClassName(pixels) + ", " + l(pixels));
37  
    }
38  
  } 
39  
}

Author comment

Began life as a copy of #1010062

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010064
Snippet name: Test Felzenszwalb-Huttenlocher Segmenter on live screenshot [OK]
Eternal ID of this version: #1010064/16
Text MD5: 1d837e521d3f80a501d0236ec9aa0c42
Transpilation MD5: 3784919e7338a3751d982aa2e557cd3f
Author: stefan
Category: javax / imaging
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-02 14:20:41
Source code size: 1238 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 436 / 1234
Version history: 15 change(s)
Referenced in: [show references]