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

!752

lib 1003721 // lookup
lib 1003724 // commons io
lib 1003727 // commons lang
lib 1003729 // jhlabs filters

import com.github.axet.lookup.*;
import com.github.axet.lookup.common.GFirst;
import com.github.axet.lookup.common.GPoint;
import com.github.axet.lookup.common.ImageBinaryGreyScale;

p {
  unzipSnippet("#1003720", programDir());
  
  File dir = getProgramFile("lookup-examples");
  
  BufferedImage image = loadBufferedImage(new File(dir, "desktop.png"));
  BufferedImage templateSmall = loadBufferedImage(new File(dir, "desktop_feature_small.png"));
  BufferedImage templateBig = loadBufferedImage(new File(dir, "desktop_feature_big.png"));

  LookupScale s = new LookupScale(0.2f, 10, 0.65f, 0.95f);

  ImageBinaryGreyScale si = new ImageBinaryGreyScale(image);

  ImageBinaryGreyScale stBig = new ImageBinaryGreyScale(templateBig);
  ImageBinaryGreyScale stSmall = new ImageBinaryGreyScale(templateSmall);

  twice { time {
    print("big");
    {
        List<GPoint> pp = (L) s.lookupAll(si, stBig);
  
        Collections.sort(pp, new GFirst());
  
        for (GPoint p : pp) {
            System.out.println(p);
        }
    }
  }}

  twice { time {
    print("small");
    {
        List<GPoint> pp = (L) s.lookupAll(si, stSmall);
  
        Collections.sort(pp, new GFirst());
  
        for (GPoint p : pp) {
            System.out.println(p);
        }
    }
  }}

  print("big");
  twice { time {
      List<GPoint> pp = (L) s.lookupAll(si, stBig);

      Collections.sort(pp, new GFirst());

      for (GPoint p : pp) {
          System.out.println(p);
      }
  }}

}

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: 505 / 588
Referenced in: #1003732 - Try Finding Peppermint Logo On Screen
#1006075 - Use "Lookup" (On-Screen OCR) For Finding Chess Board (might work, but very slow)