how to restrict the results of tess-two (Tesseract and Leptonica library),
I want Tesseract limiting the results:
- Only take 8 digits, calculated from letter D
- Don't take LowerCase, Enter, Space, and Symbol
- Only Take Uppercase and Numbers.
For Example:
The recognition result is "asn*&bhDK 1234 UDaks&%^jdg", then simply take is "DK1234UD".
so, don't take LowerChase, Enter, Space. Only take UperChase and numbers.
I use Java source code
this is the recognition code:
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.setPageSegMode(TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED);
baseApi.setPageSegMode(PageSegMode.PSM_AUTO_OSD);
baseApi.setPageSegMode(PageSegMode.PSM_SINGLE_LINE);
baseApi.setDebug(true);
baseApi.init(DATA_PATH, lang);
//setImage
baseApi.setImage(bmpOtsu);
//set whitelist
String whitelist = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
baseApi.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST, whitelist);
//variable for recognizing
String recognizedText = baseApi.getUTF8Text();
String resultTxt = recognizedText;
baseApi.end();
if ( lang.equalsIgnoreCase("eng") ) {
recognizedText = recognizedText.replaceAll("[^A-Z0-9]", " ");
}
Can somebody tell me how can i do that? What should be added in here?