Search code examples
javaocrtess4j

tess4j Set only to identify numbers and letters


I want to set tess4j to only identify numbers and letters

Tesseract instance = new Tesseract();
instance.setDatapath("C:\\Users\\qyw\\Desktop\\tessdata");
String s = instance.doOCR(img);
System.out.println(s);

Solution

  • instance.setTessVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz");
    

    See doc.