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

66
LINES

< > BotCompany Repo | #1003728 // Test "Lookup" (On-Screen OCR) 2

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

Uses 1092K of libraries. Click here for Pure Java version (1361L/9K/32K).

1  
!752
2  
3  
lib 1003721 // lookup
4  
lib 1003724 // commons io
5  
lib 1003727 // commons lang
6  
lib 1003729 // jhlabs filters
7  
8  
import com.github.axet.lookup.*;
9  
import com.github.axet.lookup.common.GFirst;
10  
import com.github.axet.lookup.common.GPoint;
11  
import com.github.axet.lookup.common.ImageBinaryGreyScale;
12  
13  
p {
14  
  unzipSnippet("#1003720", programDir());
15  
  
16  
  File dir = getProgramFile("lookup-examples");
17  
  
18  
  BufferedImage image = loadBufferedImage(new File(dir, "desktop.png"));
19  
  BufferedImage templateSmall = loadBufferedImage(new File(dir, "desktop_feature_small.png"));
20  
  BufferedImage templateBig = loadBufferedImage(new File(dir, "desktop_feature_big.png"));
21  
22  
  LookupScale s = new LookupScale(0.2f, 10, 0.65f, 0.95f);
23  
24  
  ImageBinaryGreyScale si = new ImageBinaryGreyScale(image);
25  
26  
  ImageBinaryGreyScale stBig = new ImageBinaryGreyScale(templateBig);
27  
  ImageBinaryGreyScale stSmall = new ImageBinaryGreyScale(templateSmall);
28  
29  
  twice { time {
30  
    print("big");
31  
    {
32  
        List<GPoint> pp = (L) s.lookupAll(si, stBig);
33  
  
34  
        Collections.sort(pp, new GFirst());
35  
  
36  
        for (GPoint p : pp) {
37  
            System.out.println(p);
38  
        }
39  
    }
40  
  }}
41  
42  
  twice { time {
43  
    print("small");
44  
    {
45  
        List<GPoint> pp = (L) s.lookupAll(si, stSmall);
46  
  
47  
        Collections.sort(pp, new GFirst());
48  
  
49  
        for (GPoint p : pp) {
50  
            System.out.println(p);
51  
        }
52  
    }
53  
  }}
54  
55  
  print("big");
56  
  twice { time {
57  
      List<GPoint> pp = (L) s.lookupAll(si, stBig);
58  
59  
      Collections.sort(pp, new GFirst());
60  
61  
      for (GPoint p : pp) {
62  
          System.out.println(p);
63  
      }
64  
  }}
65  
66  
}

Author comment

Better with -server!

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003728
Snippet name: Test "Lookup" (On-Screen OCR) 2
Eternal ID of this version: #1003728/1
Text MD5: 4282575025bfd77644f6c8ede38c2a46
Transpilation MD5: 229db5612530f78675b398ca6199bab2
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-26 16:26:11
Source code size: 1663 bytes / 66 lines
Pitched / IR pitched: No / No
Views / Downloads: 504 / 588
Referenced in: [show references]