Uses 762K of libraries. Click here for Pure Java version (1411L/10K/33K).
!752 lib 1003721 // lookup lib 1003724 // commons io lib 1003727 // commons lang import com.github.axet.lookup.*; import com.github.axet.lookup.common.ImageBinaryGrey; import org.apache.commons.io.FilenameUtils; static void loadFontsDirectory(OCR ocr, File dir) { for (File f : listFiles(dir)) loadFont(ocr, f); } static void loadFont(OCR ocr, File path) ctex { for (File f : listFiles(path)) { InputStream is = new FileInputStream(f); String symbol = FilenameUtils.getBaseName(f.getName()); try { symbol = URLDecoder.decode(symbol, "UTF-8"); } catch (UnsupportedEncodingException ee) { throw new RuntimeException(ee); } String name = path.getName(); ocr.loadFontSymbol(name, symbol, is); } } p { unzipSnippet("#1003720", programDir()); File dir = getProgramFile("lookup-examples"); OCR l = new OCR(0.70f); // will load all font // familys (here is only font_1 family in this library) loadFontsDirectory(l, new File(dir, "fonts")); // example how to load only one family //l.loadFont(OCRTest.class, new File(dir, "fonts/font_1")); String str = ""; // recognize using all familys set str = l.recognize(loadBufferedImage(new File(dir, "test3.png"))); print(str); // recognize using only one family set str = l.recognize(loadBufferedImage(new File(dir, "test3.png")), "font_1"); print(str); // recognize using only one family set and rectangle ImageBinaryGrey i = new ImageBinaryGrey(loadBufferedImage(new File(dir, "full.png"))); str = l.recognize(i, 1285, 654, 1343, 677, l.getSymbols("font_1")); print(str); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
1267 | stefan | https://github.com/axet/lookup/ | 2016-07-26 15:28:13 |
1266 | stefan | Works!! | 2016-07-26 15:27:27 |
Snippet ID: | #1003722 |
Snippet name: | Test "Lookup" (On-Screen OCR) - WORKS |
Eternal ID of this version: | #1003722/1 |
Text MD5: | 747a455f6de970417a485857921e7e90 |
Transpilation MD5: | 91faadb97fb1ef1c4b971bf9ccb03c1a |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-17 00:49:13 |
Source code size: | 1681 bytes / 60 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 756 / 921 |
Referenced in: | [show references] |