43 #include <allheaders.h>
45 #ifndef DISABLED_LEGACY_ENGINE
55 "Take segmentation and labeling from box file", this->params())
56 ,
BOOL_MEMBER(tessedit_resegment_from_line_boxes, false,
57 "Conversion of word/line box file to char box file", this->params())
58 ,
BOOL_MEMBER(tessedit_train_from_boxes, false,
"Generate training data from boxed chars",
60 ,
BOOL_MEMBER(tessedit_make_boxes_from_boxes, false,
"Generate more boxes from boxed chars",
62 ,
BOOL_MEMBER(tessedit_train_line_recognizer, false,
63 "Break input into lines and remap boxes if present", this->params())
65 "Dump intermediate images made during page segmentation", this->params())
66 ,
BOOL_MEMBER(tessedit_do_invert, true,
"Try inverting the image in `LSTMRecognizeWord`",
72 "Page seg mode: 0=osd only, 1=auto+osd, 2=auto_only, 3=auto, "
74 " 5=block_vert, 6=block, 7=line, 8=word, 9=word_circle, 10=char,"
75 "11=sparse_text, 12=sparse_text+osd, 13=raw_line"
76 " (Values from PageSegMode enum in tesseract/publictypes.h)",
80 "Thresholding method: 0 = Otsu, 1 = LeptonicaOtsu, 2 = "
84 "Debug the thresholding process",
87 "Window size for measuring local statistics (to be "
88 "multiplied by image DPI). "
89 "This parameter is used by the Sauvola thresolding method",
92 "Factor for reducing threshold due to variance. "
93 "This parameter is used by the Sauvola thresolding method."
94 " Normal range: 0.2-0.5",
97 "Desired tile size (to be multiplied by image DPI). "
98 "This parameter is used by the LeptonicaOtsu thresolding "
102 "Size of convolution kernel applied to threshold array "
103 "(to be multiplied by image DPI). Use 0 for no smoothing. "
104 "This parameter is used by the LeptonicaOtsu thresolding "
108 "Fraction of the max Otsu score. "
109 "This parameter is used by the LeptonicaOtsu thresolding "
111 "For standard Otsu use 0.0, otherwise 0.1 is recommended",
114 "Which OCR engine(s) to run (Tesseract, LSTM, both)."
115 " Defaults to loading and running the most accurate"
118 ,
STRING_MEMBER(tessedit_char_blacklist,
"",
"Blacklist of chars not to recognize",
120 ,
STRING_MEMBER(tessedit_char_whitelist,
"",
"Whitelist of chars to recognize", this->params())
122 "List of chars to override tessedit_char_blacklist", this->params())
123 ,
BOOL_MEMBER(tessedit_ambigs_training, false,
"Perform training for ambiguities",
126 "Whether to use the top-line splitting process for Devanagari "
127 "documents while performing page-segmentation.",
130 "Whether to use the top-line splitting process for Devanagari "
131 "documents while performing ocr.",
133 ,
STRING_MEMBER(tessedit_write_params_to_file,
"",
"Write all parameters to the given file.",
136 "Generate and print debug"
137 " information for adaption",
139 ,
INT_MEMBER(bidi_debug, 0,
"Debug level for BiDi", this->params())
140 ,
INT_MEMBER(applybox_debug, 1,
"Debug level", this->params())
141 ,
INT_MEMBER(applybox_page, 0,
"Page number to apply boxes from", this->params())
143 "Exposure value follows"
144 " this pattern in the image filename. The name of the image"
145 " files are expected to be in the form"
146 " [lang].[fontname].exp[num].tif",
148 ,
BOOL_MEMBER(applybox_learn_chars_and_char_frags_mode, false,
149 "Learn both character fragments (as is done in the"
150 " special low exposure mode) as well as unfragmented"
155 " is assumed to contain ngrams. Only learn the ngrams"
156 " whose outlines overlap horizontally.",
158 ,
BOOL_MEMBER(tessedit_display_outwords, false,
"Draw output words", this->params())
159 ,
BOOL_MEMBER(tessedit_dump_choices, false,
"Dump char choices", this->params())
160 ,
BOOL_MEMBER(tessedit_timing_debug, false,
"Print timing stats", this->params())
161 ,
BOOL_MEMBER(tessedit_fix_fuzzy_spaces, true,
"Try to improve fuzzy spaces", this->params())
162 ,
BOOL_MEMBER(tessedit_unrej_any_wd, false,
"Don't bother with word plausibility",
164 ,
BOOL_MEMBER(tessedit_fix_hyphens, true,
"Crunch double hyphens?", this->params())
165 ,
BOOL_MEMBER(tessedit_enable_doc_dict, true,
"Add words to the document dictionary",
167 ,
BOOL_MEMBER(tessedit_debug_fonts, false,
"Output font info per char", this->params())
168 ,
INT_MEMBER(tessedit_font_id, 0,
"Font ID to use or zero", this->params())
169 ,
BOOL_MEMBER(tessedit_debug_block_rejection, false,
"Block and Row stats", this->params())
170 ,
BOOL_MEMBER(tessedit_enable_bigram_correction, true,
171 "Enable correction based on the word bigram dictionary.", this->params())
172 ,
BOOL_MEMBER(tessedit_enable_dict_correction, false,
173 "Enable single word correction based on the dictionary.", this->params())
174 ,
INT_MEMBER(tessedit_bigram_debug, 0,
"Amount of debug output for bigram correction.",
177 "Remove and conditionally reassign small outlines when they"
178 " confuse layout analysis, determining diacritics vs noise",
180 ,
INT_MEMBER(debug_noise_removal, 0,
"Debug reassignment of small outlines", this->params())
185 double_MEMBER(noise_cert_basechar, -8.0,
"Hingepoint for base char certainty", this->params())
189 double_MEMBER(noise_cert_disjoint, -1.0,
"Hingepoint for disjoint certainty", this->params())
193 double_MEMBER(noise_cert_punc, -3.0,
"Threshold for new punc char certainty", this->params())
196 double_MEMBER(noise_cert_factor, 0.375,
"Scaling on certainty diff from Hingepoint",
198 ,
INT_MEMBER(noise_maxperblob, 8,
"Max diacritics to apply to a blob", this->params())
199 ,
INT_MEMBER(noise_maxperword, 16,
"Max diacritics to apply to a word", this->params())
200 ,
INT_MEMBER(debug_x_ht_level, 0,
"Reestimate debug", this->params())
201 ,
STRING_MEMBER(chs_leading_punct,
"('`\"",
"Leading punctuation", this->params())
202 ,
STRING_MEMBER(chs_trailing_punct1,
").,;:?!",
"1st Trailing punctuation", this->params())
203 ,
STRING_MEMBER(chs_trailing_punct2,
")'`\"",
"2nd Trailing punctuation", this->params())
204 ,
double_MEMBER(quality_rej_pc, 0.08,
"good_quality_doc lte rejection limit", this->params())
205 ,
double_MEMBER(quality_blob_pc, 0.0,
"good_quality_doc gte good blobs limit", this->params())
206 ,
double_MEMBER(quality_outline_pc, 1.0,
"good_quality_doc lte outline error limit",
208 ,
double_MEMBER(quality_char_pc, 0.95,
"good_quality_doc gte good char limit", this->params())
209 ,
INT_MEMBER(quality_min_initial_alphas_reqd, 2,
"alphas in a good word", this->params())
210 ,
INT_MEMBER(tessedit_tess_adaption_mode, 0x27,
"Adaptation decision algorithm for tess",
212 ,
BOOL_MEMBER(tessedit_minimal_rej_pass1, false,
"Do minimal rejection on pass 1 output",
214 ,
BOOL_MEMBER(tessedit_test_adaption, false,
"Test adaption criteria", this->params())
215 ,
BOOL_MEMBER(test_pt, false,
"Test for point", this->params())
216 ,
double_MEMBER(test_pt_x, 99999.99,
"xcoord", this->params())
217 ,
double_MEMBER(test_pt_y, 99999.99,
"ycoord", this->params())
218 ,
INT_MEMBER(multilang_debug_level, 0,
"Print multilang debug info.", this->params())
219 ,
INT_MEMBER(paragraph_debug_level, 0,
"Print paragraph debug info.", this->params())
221 "Run paragraph detection on the post-text-recognition "
224 ,
BOOL_MEMBER(lstm_use_matrix, 1,
"Use ratings matrix/beam search with lstm", this->params())
225 ,
STRING_MEMBER(outlines_odd,
"%| ",
"Non standard number of outlines", this->params())
226 ,
STRING_MEMBER(outlines_2,
"ij!?%\":;",
"Non standard number of outlines", this->params())
227 ,
BOOL_MEMBER(tessedit_good_quality_unrej, true,
"Reduce rejection on good docs",
229 ,
BOOL_MEMBER(tessedit_use_reject_spaces, true,
"Reject spaces?", this->params())
230 ,
double_MEMBER(tessedit_reject_doc_percent, 65.00,
"%rej allowed before rej whole doc",
232 ,
double_MEMBER(tessedit_reject_block_percent, 45.00,
"%rej allowed before rej whole block",
234 ,
double_MEMBER(tessedit_reject_row_percent, 40.00,
"%rej allowed before rej whole row",
237 "Number of row rejects in whole word rejects"
238 " which prevents whole row rejection",
240 ,
BOOL_MEMBER(tessedit_preserve_blk_rej_perfect_wds, true,
241 "Only rej partially rejected words in block rejection", this->params())
242 ,
BOOL_MEMBER(tessedit_preserve_row_rej_perfect_wds, true,
243 "Only rej partially rejected words in row rejection", this->params())
244 ,
BOOL_MEMBER(tessedit_dont_blkrej_good_wds, false,
"Use word segmentation quality metric",
246 ,
BOOL_MEMBER(tessedit_dont_rowrej_good_wds, false,
"Use word segmentation quality metric",
248 ,
INT_MEMBER(tessedit_preserve_min_wd_len, 2,
"Only preserve wds longer than this",
250 ,
BOOL_MEMBER(tessedit_row_rej_good_docs, true,
"Apply row rejection to good docs",
253 "rej good doc wd if more than this fraction rejected", this->params())
254 ,
BOOL_MEMBER(tessedit_reject_bad_qual_wds, true,
"Reject all bad quality wds", this->params())
255 ,
BOOL_MEMBER(tessedit_debug_doc_rejection, false,
"Page stats", this->params())
256 ,
BOOL_MEMBER(tessedit_debug_quality_metrics, false,
"Output data to debug file",
258 ,
BOOL_MEMBER(bland_unrej, false,
"unrej potential with no checks", this->params())
259 ,
double_MEMBER(quality_rowrej_pc, 1.1,
"good_quality_doc gte good char limit", this->params())
260 ,
BOOL_MEMBER(unlv_tilde_crunching, false,
"Mark v.bad words for tilde crunch", this->params())
261 ,
BOOL_MEMBER(hocr_font_info, false,
"Add font info to hocr output", this->params())
262 ,
BOOL_MEMBER(hocr_char_boxes, false,
"Add coordinates for each character to hocr output",
264 ,
BOOL_MEMBER(crunch_early_merge_tess_fails, true,
"Before word crunch?", this->params())
265 ,
BOOL_MEMBER(crunch_early_convert_bad_unlv_chs, false,
"Take out ~^ early?", this->params())
266 ,
double_MEMBER(crunch_terrible_rating, 80.0,
"crunch rating lt this", this->params())
267 ,
BOOL_MEMBER(crunch_terrible_garbage, true,
"As it says", this->params())
268 ,
double_MEMBER(crunch_poor_garbage_cert, -9.0,
"crunch garbage cert lt this", this->params())
269 ,
double_MEMBER(crunch_poor_garbage_rate, 60,
"crunch garbage rating lt this", this->params())
270 ,
double_MEMBER(crunch_pot_poor_rate, 40,
"POTENTIAL crunch rating lt this", this->params())
271 ,
double_MEMBER(crunch_pot_poor_cert, -8.0,
"POTENTIAL crunch cert lt this", this->params())
272 ,
double_MEMBER(crunch_del_rating, 60,
"POTENTIAL crunch rating lt this", this->params())
273 ,
double_MEMBER(crunch_del_cert, -10.0,
"POTENTIAL crunch cert lt this", this->params())
274 ,
double_MEMBER(crunch_del_min_ht, 0.7,
"Del if word ht lt xht x this", this->params())
275 ,
double_MEMBER(crunch_del_max_ht, 3.0,
"Del if word ht gt xht x this", this->params())
276 ,
double_MEMBER(crunch_del_min_width, 3.0,
"Del if word width lt xht x this", this->params())
277 ,
double_MEMBER(crunch_del_high_word, 1.5,
"Del if word gt xht x this above bl", this->params())
278 ,
double_MEMBER(crunch_del_low_word, 0.5,
"Del if word gt xht x this below bl", this->params())
279 ,
double_MEMBER(crunch_small_outlines_size, 0.6,
"Small if lt xht x this", this->params())
280 ,
INT_MEMBER(crunch_rating_max, 10,
"For adj length in rating per ch", this->params())
281 ,
INT_MEMBER(crunch_pot_indicators, 1,
"How many potential indicators needed", this->params())
282 ,
BOOL_MEMBER(crunch_leave_ok_strings, true,
"Don't touch sensible strings", this->params())
283 ,
BOOL_MEMBER(crunch_accept_ok, true,
"Use acceptability in okstring", this->params())
284 ,
BOOL_MEMBER(crunch_leave_accept_strings, false,
"Don't pot crunch sensible strings",
286 ,
BOOL_MEMBER(crunch_include_numerals, false,
"Fiddle alpha figures", this->params())
287 ,
INT_MEMBER(crunch_leave_lc_strings, 4,
"Don't crunch words with long lower case strings",
289 ,
INT_MEMBER(crunch_leave_uc_strings, 4,
"Don't crunch words with long lower case strings",
291 ,
INT_MEMBER(crunch_long_repetitions, 3,
"Crunch words with long repetitions", this->params())
292 ,
INT_MEMBER(crunch_debug, 0,
"As it says", this->params())
293 ,
INT_MEMBER(fixsp_non_noise_limit, 1,
"How many non-noise blbs either side?", this->params())
294 ,
double_MEMBER(fixsp_small_outlines_size, 0.28,
"Small if lt xht x this", this->params())
295 ,
BOOL_MEMBER(tessedit_prefer_joined_punct, false,
"Reward punctuation joins", this->params())
296 ,
INT_MEMBER(fixsp_done_mode, 1,
"What constitutes done for spacing", this->params())
297 ,
INT_MEMBER(debug_fix_space_level, 0,
"Contextual fixspace debug", this->params())
298 ,
STRING_MEMBER(numeric_punctuation,
".,",
"Punct. chs expected WITHIN numbers", this->params())
300 "Max allowed deviation of blob top outside of font data", this->params())
301 ,
INT_MEMBER(x_ht_min_change, 8,
"Min change in xht before actually trying it", this->params())
302 ,
INT_MEMBER(superscript_debug, 0,
"Debug level for sub & superscript fixer", this->params())
304 "How many times worse "
305 "certainty does a superscript position glyph need to be for "
306 "us to try classifying it as a char with a different "
311 "badness do we think sufficient to choose a superscript "
312 "over what we'd thought. For example, a value of 0.6 means "
313 "we want to reduce badness of certainty by at least 40%",
316 "A superscript scaled down more than this is unbelievably "
317 "small. For example, 0.3 means we expect the font size to "
318 "be no smaller than 30% of the text line font size.",
321 "Maximum top of a character measured as a multiple of "
322 "x-height above the baseline for us to reconsider whether "
326 "Minimum bottom of a character measured as a multiple of "
327 "x-height above the baseline for us to reconsider whether "
328 "it's a superscript.",
330 ,
BOOL_MEMBER(tessedit_write_block_separators, false,
"Write block separators in output",
332 ,
BOOL_MEMBER(tessedit_write_rep_codes, false,
"Write repetition char code", this->params())
333 ,
BOOL_MEMBER(tessedit_write_unlv, false,
"Write .unlv output file", this->params())
334 ,
BOOL_MEMBER(tessedit_create_txt, false,
"Write .txt output file", this->params())
335 ,
BOOL_MEMBER(tessedit_create_hocr, false,
"Write .html hOCR output file", this->params())
336 ,
BOOL_MEMBER(tessedit_create_alto, false,
"Write .xml ALTO file", this->params())
337 ,
BOOL_MEMBER(tessedit_create_lstmbox, false,
"Write .box file for LSTM training",
339 ,
BOOL_MEMBER(tessedit_create_tsv, false,
"Write .tsv output file", this->params())
340 ,
BOOL_MEMBER(tessedit_create_wordstrbox, false,
"Write WordStr format .box output file",
342 ,
BOOL_MEMBER(tessedit_create_pdf, false,
"Write .pdf output file", this->params())
343 ,
BOOL_MEMBER(textonly_pdf, false,
"Create PDF with only one invisible text layer",
345 ,
INT_MEMBER(jpg_quality, 85,
"Set JPEG quality level", this->params())
346 ,
INT_MEMBER(user_defined_dpi, 0,
"Specify DPI for input image", this->params())
347 ,
INT_MEMBER(min_characters_to_try, 50,
"Specify minimum characters to try during OSD",
349 ,
STRING_MEMBER(unrecognised_char,
"|",
"Output char for unidentified blobs", this->params())
350 ,
INT_MEMBER(suspect_level, 99,
"Suspect marker level", this->params())
351 ,
INT_MEMBER(suspect_short_words, 2,
"Don't suspect dict wds longer than this", this->params())
352 ,
BOOL_MEMBER(suspect_constrain_1Il, false,
"UNLV keep 1Il chars rejected", this->params())
353 ,
double_MEMBER(suspect_rating_per_ch, 999.9,
"Don't touch bad rating limit", this->params())
354 ,
double_MEMBER(suspect_accept_rating, -999.9,
"Accept good rating limit", this->params())
355 ,
BOOL_MEMBER(tessedit_minimal_rejection, false,
"Only reject tess failures", this->params())
356 ,
BOOL_MEMBER(tessedit_zero_rejection, false,
"Don't reject ANYTHING", this->params())
357 ,
BOOL_MEMBER(tessedit_word_for_word, false,
"Make output have exactly one word per WERD",
359 ,
BOOL_MEMBER(tessedit_zero_kelvin_rejection, false,
"Don't reject ANYTHING AT ALL",
361 ,
INT_MEMBER(tessedit_reject_mode, 0,
"Rejection algorithm", this->params())
362 ,
BOOL_MEMBER(tessedit_rejection_debug, false,
"Adaption debug", this->params())
363 ,
BOOL_MEMBER(tessedit_flip_0O, true,
"Contextual 0O O0 flips", this->params())
364 ,
double_MEMBER(tessedit_lower_flip_hyphen, 1.5,
"Aspect ratio dot/hyphen test", this->params())
365 ,
double_MEMBER(tessedit_upper_flip_hyphen, 1.8,
"Aspect ratio dot/hyphen test", this->params())
366 ,
BOOL_MEMBER(rej_trust_doc_dawg, false,
"Use DOC dawg in 11l conf. detector", this->params())
367 ,
BOOL_MEMBER(rej_1Il_use_dict_word, false,
"Use dictword test", this->params())
368 ,
BOOL_MEMBER(rej_1Il_trust_permuter_type, true,
"Don't double check", this->params())
369 ,
BOOL_MEMBER(rej_use_tess_accepted, true,
"Individual rejection control", this->params())
370 ,
BOOL_MEMBER(rej_use_tess_blanks, true,
"Individual rejection control", this->params())
371 ,
BOOL_MEMBER(rej_use_good_perm, true,
"Individual rejection control", this->params())
372 ,
BOOL_MEMBER(rej_use_sensible_wd, false,
"Extend permuter check", this->params())
373 ,
BOOL_MEMBER(rej_alphas_in_number_perm, false,
"Extend permuter check", this->params())
374 ,
double_MEMBER(rej_whole_of_mostly_reject_word_fract, 0.85,
"if >this fract", this->params())
375 ,
INT_MEMBER(tessedit_image_border, 2,
"Rej blbs near image edge limit", this->params())
376 ,
STRING_MEMBER(ok_repeated_ch_non_alphanum_wds,
"-?*\075",
"Allow NN to unrej", this->params())
377 ,
STRING_MEMBER(conflict_set_I_l_1,
"Il1[]",
"Il1 conflict set", this->params())
378 ,
INT_MEMBER(min_sane_x_ht_pixels, 8,
"Reject any x-ht lt or eq than this", this->params())
379 ,
BOOL_MEMBER(tessedit_create_boxfile, false,
"Output text with boxes", this->params())
380 ,
INT_MEMBER(tessedit_page_number, -1,
"-1 -> All pages, else specific page to process",
382 ,
BOOL_MEMBER(tessedit_write_images, false,
"Capture the image from the IPE", this->params())
383 ,
BOOL_MEMBER(interactive_display_mode, false,
"Run interactively?", this->params())
384 ,
STRING_MEMBER(file_type,
".tif",
"Filename extension", this->params())
385 ,
BOOL_MEMBER(tessedit_override_permuter, true,
"According to dict_word", this->params())
386 ,
STRING_MEMBER(tessedit_load_sublangs,
"",
"List of languages to load with this one",
388 ,
BOOL_MEMBER(tessedit_use_primary_params_model, false,
389 "In multilingual mode use params model of the"
392 ,
double_MEMBER(min_orientation_margin, 7.0,
"Min acceptable orientation margin",
394 ,
BOOL_MEMBER(textord_tabfind_show_vlines, false,
"Debug line finding", this->params())
395 ,
BOOL_MEMBER(textord_use_cjk_fp_model, false,
"Use CJK fixed pitch model", this->params())
397 "Allow feature extractors to see the original outline", this->params())
399 "Only initialize with the config file. Useful if the "
400 "instance is not going to be used for OCR but say only "
401 "for layout analysis.",
403 #ifndef DISABLED_LEGACY_ENGINE
404 ,
BOOL_MEMBER(textord_equation_detect, false,
"Turn on equation detector", this->params())
406 ,
BOOL_MEMBER(textord_tabfind_vertical_text, true,
"Enable vertical detection", this->params())
407 ,
BOOL_MEMBER(textord_tabfind_force_vertical_text, false,
"Force using vertical text page mode",
410 "Fraction of textlines deemed vertical to use vertical page "
414 "Fraction of height used as a minimum gap for aligned blobs.", this->params())
415 ,
INT_MEMBER(tessedit_parallelize, 0,
"Run in parallel where possible", this->params())
416 ,
BOOL_MEMBER(preserve_interword_spaces, false,
"Preserve multiple interword spaces",
418 ,
STRING_MEMBER(page_separator,
"\f",
"Page separator (default is form feed control character)",
421 "Allows to include alternative symbols choices in the hOCR output. "
422 "Valid input values are 0, 1 and 2. 0 is the default value. "
423 "With 1 the alternative symbol choices per timestep are included. "
424 "With 2 alternative symbol choices are extracted from the CTC "
425 "process instead of the lattice. The choices are mapped per "
429 "Sets the number of cascading iterations for the Beamsearch in "
430 "lstm_choice_mode. Note that lstm_choice_mode must be set to a "
431 "value greater than 0 to produce results.",
434 "Sets the rating coefficient for the lstm choices. The smaller the "
435 "coefficient, the better are the ratings for each choice and less "
436 "information is lost due to the cut off at 0. The standard value is "
440 "Detect music staff and remove intersecting components", this->params())
443 backup_config_file_(nullptr)
444 , pix_binary_(nullptr)
446 , pix_original_(nullptr)
447 , pix_thresholds_(nullptr)
448 , source_resolution_(0)
450 , right_to_left_(false)
451 , scaled_color_(nullptr)
453 , deskew_(1.0f, 0.0f)
454 , reskew_(1.0f, 0.0f)
455 , most_recently_used_(this)
456 , font_table_size_(0)
457 #ifndef DISABLED_LEGACY_ENGINE
458 , equ_detect_(nullptr)
460 , lstm_recognizer_(nullptr)
461 , train_line_page_num_(0) {}
467 for (
auto *
lang : sub_langs_) {
470 delete lstm_recognizer_;
471 lstm_recognizer_ =
nullptr;
476 if (lstm_recognizer_ && lstm_recognizer_->
GetDict()) {
477 return *lstm_recognizer_->
GetDict();
485 pixa_debug_.
WritePDF(debug_name.c_str());
490 deskew_ =
FCOORD(1.0f, 0.0f);
491 reskew_ =
FCOORD(1.0f, 0.0f);
494 for (
auto &sub_lang : sub_langs_) {
499 #ifndef DISABLED_LEGACY_ENGINE
502 equ_detect_ = detector;
509 for (
auto &sub_lang : sub_langs_) {
510 sub_lang->ResetAdaptiveClassifierInternal();
519 for (
auto &sub_lang : sub_langs_) {
520 sub_lang->getDict().ResetDocumentDictionary();
527 tessedit_char_whitelist.c_str(),
528 tessedit_char_unblacklist.c_str());
529 if (lstm_recognizer_) {
532 tessedit_char_whitelist.c_str(),
533 tessedit_char_unblacklist.c_str());
536 for (
auto &sub_lang : sub_langs_) {
537 sub_lang->unicharset.set_black_and_whitelist(tessedit_char_blacklist.c_str(),
538 tessedit_char_whitelist.c_str(),
539 tessedit_char_unblacklist.c_str());
540 if (sub_lang->lstm_recognizer_) {
541 UNICHARSET &lstm_unicharset = sub_lang->lstm_recognizer_->GetUnicharset();
543 tessedit_char_whitelist.c_str(),
544 tessedit_char_unblacklist.c_str());
555 static_cast<int32_t
>(pageseg_devanagari_split_strategy));
556 for (
auto &sub_lang : sub_langs_) {
558 static_cast<int32_t
>(sub_lang->pageseg_devanagari_split_strategy));
559 if (pageseg_strategy > max_pageseg_strategy) {
560 max_pageseg_strategy = pageseg_strategy;
562 sub_lang->pix_binary_.destroy();
569 if (splitter_.
Split(
true, &pixa_debug_)) {
584 static_cast<int32_t
>(ocr_devanagari_split_strategy));
585 for (
auto &sub_lang : sub_langs_) {
587 static_cast<int32_t
>(sub_lang->ocr_devanagari_split_strategy));
588 if (ocr_strategy > max_ocr_strategy) {
589 max_ocr_strategy = ocr_strategy;
596 bool split_for_ocr = splitter_.
Split(
false, &pixa_debug_);
605 BLOCK block(
"",
true, 0, 0, 0, 0, pixGetWidth(pix_binary_), pixGetHeight(pix_binary_));
#define INT_MEMBER(name, val, comment, vec)
#define INT_INIT_MEMBER(name, val, comment, vec)
#define BOOL_INIT_MEMBER(name, val, comment, vec)
#define double_MEMBER(name, val, comment, vec)
#define STRING_MEMBER(name, val, comment, vec)
#define BOOL_MEMBER(name, val, comment, vec)
@ PSM_SINGLE_BLOCK
Assume a single uniform block of text. (Default.)
void extract_edges(Image pix, BLOCK *block)
void SetLangTesseract(Tesseract *lang_tesseract)
void SetEquationDetect(EquationDetect *detector)
void SetBlackAndWhitelist()
Dict & getDict() override
void PrepareForTessOCR(BLOCK_LIST *block_list, Tesseract *osd_tess, OSResults *osr)
void ResetAdaptiveClassifier()
void ResetDocumentDictionary()
void WritePDF(const char *filename)
C_BLOB_LIST * blob_list()
get blobs
std::string imagebasename
void set_black_and_whitelist(const char *blacklist, const char *whitelist, const char *unblacklist)
void ResetAdaptiveClassifierInternal()
void ResetDocumentDictionary()
const UNICHARSET & GetUnicharset() const
const Dict * GetDict() const
void set_pageseg_split_strategy(SplitStrategy strategy)
void set_orig_pix(Image pix)
bool HasDifferentSplitStrategies() const
void RefreshSegmentationWithNewBlobs(C_BLOB_LIST *new_blobs)
bool Split(bool split_for_pageseg, DebugPixa *pixa_debug)
void set_segmentation_block_list(BLOCK_LIST *block_list)
void set_ocr_split_strategy(SplitStrategy strategy)
void set_use_cjk_fp_model(bool flag)