0

我正在尝试使用 tess-two API 识别 android 中的随机字符。我有一张带有字符串的打印纸:“5XqaLB”
当我向相机显示字符串的部分以识别它时,我得到以下示例:

 original -> result
  "5XqaLB" -> "5anLB"  
  "XqaLB" -> "anLB"  
  "qaLB" -> "qaLB"  
  "5Xq" -> "5Xq"

我想这是因为 tesseract 试图用已识别的字符猜测一个单词。我搜索了很多,但找不到解决方案。任何人都有避免这种 tesseract 替换的想法?

已经尝试过白名单、黑名单和 confs,例如:

baseApi.setVariable("load_system_dawg", "0");
baseApi.setVariable("load_freq_dawg", "0");
baseApi.setVariable("load_punc_dawg", "0");
baseApi.setVariable("load_number_dawg", "0");
baseApi.setVariable("load_unambig_dawg", "0");
baseApi.setVariable("load_bigram_dawg", "0");
baseApi.setVariable("load_fixed_length_dawgs", "0");
baseApi.setVariable("segment_penalty_garbage", "0");
baseApi.setVariable("segment_penalty_dict_nonword", "0");
baseApi.setVariable("segment_penalty_dict_frequent_word", "0");
baseApi.setVariable("segment_penalty_dict_case_ok", "0");
baseApi.setVariable("segment_penalty_dict_case_bad", "0");

谁能猜出如何让 tesseract 只识别普通字符?

4

1 回答 1

-1

我设法解决了我遇到的类似问题。就我而言,我正在识别车牌字符。我没有在整个车牌图像中使用 tesseract,而是做了一个预处理来分离字符,这样我就可以分别对每个字符使用 tesseract。我的配置变量:

final TessBaseAPI baseApi = new TessBaseAPI();
    baseApi.init(TESSBASE_PATH, DEFAULT_DIC, TessBaseAPI.OEM_DEFAULT);
    baseApi.setDebug(true);
    baseApi.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST, "ABCDEFGHIJKLMNOPQRSTUVXWYZ1234567890");

    baseApi.setPageSegMode(TessBaseAPI.PageSegMode.PSM_SINGLE_CHAR);
    baseApi.setVariable("load_system_dawg", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("load_freq_dawg", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("load_punc_dawg", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("load_number_dawg", TessBaseAPI.VAR_TRUE);
    baseApi.setVariable("load_unambig_dawg", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("load_bigram_dawg", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("load_fixed_length_dawgs", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("segment_penalty_garbage", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("segment_penalty_dict_nonword", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("segment_penalty_dict_frequent_word", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("segment_penalty_dict_case_ok", TessBaseAPI.VAR_FALSE);
    baseApi.setVariable("segment_penalty_dict_case_bad", TessBaseAPI.VAR_FALSE);
    return baseApi;
于 2015-12-14T11:07:31.250 回答