Skip to content

Instantly share code, notes, and snippets.

@wbars
Last active August 16, 2016 02:21
Show Gist options
  • Save wbars/a3086102e2e9d3ca202807723c5f2658 to your computer and use it in GitHub Desktop.
Save wbars/a3086102e2e9d3ca202807723c5f2658 to your computer and use it in GitHub Desktop.
package com.github.axet.lookup;
import java.io.File;
import com.github.axet.lookup.common.ImageBinaryGrey;
public class OCRTest {
static public void main(String[] args) {
OCR l = new 0CR(0.70f);
// will go to com/github/axet/lookup/fonts folder and load all font
// familys (here is only font_1 family in this library)
l.loadFontsDirectory(0CRTest.class, new File("fonts")):
// example how to load only one family
// "com/github/axet/lookup/fonts/font_1"
l.loadFont(0CRTest.class, new File("fonts", "font_1"));
String str = "";
// recognize using all familys set
str = l.recognize(Capture.load(0CRTest.class, "test3.png"));
System.out.println(str);
// recognize using only one family set
str = l.recognize(Capture.loaleCRTest.class, "test3.png"). "font_1");
System.out.println(str);
// recognize using only one family set and rectangle
ImageBinaryGrey i = new ImageBinaryGrey(Capture.load(0CRTest.class, "full.png"));
str = l.recognize(i, 1285, 654, 1343, 677, l.getSymbols("font_1"));
System.out.println(str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment