26 #ifndef TESSERACT_CCMAIN_TESSERACTCLASS_H_ 27 #define TESSERACT_CCMAIN_TESSERACTCLASS_H_ 31 #include "allheaders.h" 33 #include "debugpixa.h" 34 #include "devanagari_processing.h" 36 #include "genericvector.h" 41 #include "publictypes.h" 44 #include "tessdatamanager.h" 109 class EquationDetect;
111 class LSTMRecognizer;
148 WordData() : word(nullptr), row(nullptr), block(nullptr), prev_word(nullptr) {}
150 : word(page_res_it.word()), row(page_res_it.row()->row),
151 block(page_res_it.block()->block), prev_word(nullptr) {}
153 : word(word_res), row(row_in), block(block_in), prev_word(nullptr) {}
179 Dict& getDict()
override;
185 void ResetAdaptiveClassifier();
187 void ResetDocumentDictionary();
198 pixDestroy(&pix_binary_);
208 pixDestroy(&pix_grey_);
209 pix_grey_ = grey_pix;
214 pixDestroy(&pix_original_);
215 pix_original_ = original_pix;
217 for (
int i = 0; i < sub_langs_.size(); ++i)
218 sub_langs_[i]->set_pix_original(original_pix ? pixClone(original_pix)
230 if (pixGetWidth(pix_original_) == ImageWidth())
231 return pix_original_;
232 else if (pix_grey_ !=
nullptr)
238 pixDestroy(&pix_thresholds_);
239 pix_thresholds_ = thresholds;
242 return source_resolution_;
245 source_resolution_ = ppi;
248 return pixGetWidth(pix_binary_);
251 return pixGetHeight(pix_binary_);
254 return scaled_color_;
257 return scaled_factor_;
260 scaled_factor_ = factor;
261 scaled_color_ = color;
271 return right_to_left_;
274 return sub_langs_.size();
277 return sub_langs_[index];
282 for (
int i = 0; i < sub_langs_.size(); ++i) {
283 if (sub_langs_[i]->tessedit_ocr_engine_mode !=
OEM_LSTM_ONLY)
return true;
290 for (
int i = 0; i < sub_langs_.size(); ++i) {
297 void SetBlackAndWhitelist();
303 void PrepareForPageseg();
310 void PrepareForTessOCR(BLOCK_LIST* block_list,
313 int SegmentPage(
const STRING* input_file, BLOCK_LIST* blocks,
315 void SetupWordScripts(BLOCK_LIST* blocks);
316 int AutoPageSeg(
PageSegMode pageseg_mode, BLOCK_LIST* blocks,
317 TO_BLOCK_LIST* to_blocks, BLOBNBOX_LIST* diacritic_blobs,
321 OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
322 Pix** music_mask_pix);
330 void TrainLineRecognizer(
const STRING& input_imagename,
331 const STRING& output_basename,
332 BLOCK_LIST *block_list);
338 BLOCK_LIST *block_list,
347 int start_box,
int end_box,
356 TBOX* revised_box)
const;
367 bool ProcessTargetWord(
const TBOX& word_box,
const TBOX& target_word_box,
368 const char* word_config,
int pass);
370 void SetupAllWordsPassN(
int pass_n,
371 const TBOX* target_word_box,
372 const char* word_config,
376 void SetupWordPassN(
int pass_n,
WordData* word);
378 bool RecogAllWordsPassN(
int pass_n,
ETEXT_DESC* monitor,
381 bool recog_all_words(
PAGE_RES* page_res,
383 const TBOX* target_word_box,
384 const char* word_config,
386 void rejection_passes(
PAGE_RES* page_res,
388 const TBOX* target_word_box,
389 const char* word_config);
390 void bigram_correction_pass(
PAGE_RES *page_res);
391 void blamer_pass(
PAGE_RES* page_res);
393 void script_pos_pass(
PAGE_RES* page_res);
403 bool ReassignDiacritics(
int pass,
PAGE_RES_IT* pr_it,
404 bool* make_next_word_fuzzy);
409 void AssignDiacriticsToOverlappingBlobs(
423 bool SelectGoodDiacriticOutlines(
int pass,
float certainty_threshold,
438 STRING* best_str,
float* c2);
439 void classify_word_and_language(
int pass_n,
PAGE_RES_IT* pr_it,
441 void classify_word_pass1(
const WordData& word_data,
444 void recog_pseudo_word(
PAGE_RES* page_res,
445 TBOX &selection_box);
449 ACCEPTABLE_WERD_TYPE acceptable_word_string(
const UNICHARSET& char_set,
451 const char *lengths);
453 void classify_word_pass2(
const WordData& word_data,
456 void ReportXhtFixResult(
bool accept_new_word,
float new_x_ht,
462 bool TestNewNormalization(
int original_misfits,
float baseline_shift,
468 void set_word_fonts(
WERD_RES *word);
469 void font_recognition_pass(
PAGE_RES* page_res);
470 void dictionary_correction_pass(
PAGE_RES* page_res);
471 bool check_debug_pt(
WERD_RES* word,
int location);
474 bool SubAndSuperscriptFix(
WERD_RES *word_res);
475 void GetSubAndSuperscriptCandidates(
const WERD_RES *word,
476 int *num_rebuilt_leading,
478 float *leading_certainty,
479 int *num_rebuilt_trailing,
481 float *trailing_certainty,
482 float *avg_certainty,
483 float *unlikely_threshold);
484 WERD_RES *TrySuperscriptSplits(
int num_chopped_leading,
485 float leading_certainty,
487 int num_chopped_trailing,
488 float trailing_certainty,
493 int *retry_trailing);
494 bool BelievableSuperscript(
bool debug,
496 float certainty_threshold,
498 int *right_ok)
const;
502 void output_pass(
PAGE_RES_IT &page_res_it,
const TBOX *target_word_box);
507 void set_unlv_suspects(
WERD_RES *word);
508 UNICHAR_ID get_rep_char(
WERD_RES *word);
509 bool acceptable_number_string(
const char* s,
510 const char* lengths);
519 int init_tesseract(
const char* arg0,
const char* textbase,
525 const char *language,
528 return init_tesseract(datapath,
nullptr, language, oem,
nullptr, 0,
nullptr,
nullptr,
547 int init_tesseract_internal(
const char* arg0,
const char* textbase,
549 char** configs,
int configs_size,
556 void SetupUniversalFontIds();
558 int init_tesseract_lm(
const char* arg0,
const char* textbase,
561 void recognize_page(
STRING& image_name);
562 void end_tesseract();
564 bool init_tesseract_lang_data(
const char* arg0,
const char* textbase,
566 char** configs,
int configs_size,
569 bool set_only_init_params,
572 void ParseLanguageString(
const char* lang_str,
578 #ifndef GRAPHICS_DISABLED 579 void pgeditor_main(
int width,
int height,
PAGE_RES* page_res);
580 #endif // GRAPHICS_DISABLED 581 void process_image_event(
583 bool process_cmd_win_event(
587 void debug_word(
PAGE_RES* page_res,
const TBOX &selection_box);
592 bool word_blank_and_set_display(
PAGE_RES_IT* pr_its);
597 void blob_feature_display(
PAGE_RES* page_res,
const TBOX& selection_box);
600 void make_reject_map(
WERD_RES *word,
ROW *row, int16_t pass);
601 bool one_ell_conflict(
WERD_RES* word_res,
bool update_map);
602 int16_t first_alphanum_index(
const char *word,
603 const char *word_lengths);
604 int16_t first_alphanum_offset(
const char *word,
605 const char *word_lengths);
606 int16_t alpha_count(
const char *word,
607 const char *word_lengths);
608 bool word_contains_non_1_digit(
const char* word,
609 const char* word_lengths);
610 void dont_allow_1Il(
WERD_RES *word);
611 int16_t count_alphanums(
614 bool non_0_digit(
const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
615 bool non_O_upper(
const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
616 bool repeated_nonalphanum_wd(
WERD_RES* word,
ROW* row);
624 int16_t safe_dict_word(
const WERD_RES *werd_res);
627 void reject_edge_blobs(
WERD_RES *word);
628 void reject_mostly_rejects(
WERD_RES *word);
635 void recog_word_recursive(
WERD_RES* word);
637 void split_and_recog_word(
WERD_RES* word);
646 bool digit_or_numeric_punct(
WERD_RES *word,
int char_position);
647 int16_t eval_word_spacing(WERD_RES_LIST &word_res_list);
648 void match_current_words(WERD_RES_LIST &words,
ROW *row,
BLOCK* block);
649 int16_t fp_eval_word_spacing(WERD_RES_LIST &word_res_list);
650 void fix_noisy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
651 void fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
652 void fix_sp_fp_word(WERD_RES_IT &word_res_it,
ROW *row,
BLOCK* block);
653 void fix_fuzzy_spaces(
657 void dump_words(WERD_RES_LIST &perm, int16_t score,
658 int16_t mode,
bool improved);
659 bool fixspace_thinks_word_done(
WERD_RES *word);
660 int16_t worst_noise_blob(
WERD_RES *word_res,
float *worst_noise_score);
661 float blob_noise_score(
TBLOB *blob);
662 void break_noisiest_blob_word(WERD_RES_LIST &words);
664 GARBAGE_LEVEL garbage_word(
WERD_RES *word, BOOL8 ok_dict_word);
665 bool potential_word_crunch(
WERD_RES* word,
666 GARBAGE_LEVEL garbage_level,
669 void unrej_good_quality_words(
671 void doc_and_block_rejection(
673 bool good_quality_doc);
674 void quality_based_rejection(
PAGE_RES_IT &page_res_it,
675 bool good_quality_doc);
676 void convert_bad_unlv_chs(
WERD_RES *word_res);
678 int16_t word_blob_quality(
WERD_RES *word,
ROW *row);
679 void word_char_quality(
WERD_RES *word,
ROW *row, int16_t *match_count,
680 int16_t *accepted_match_count);
682 int16_t count_outline_errs(
char c, int16_t outline_count);
683 int16_t word_outline_errs(
WERD_RES *word);
684 bool terrible_word_crunch(
WERD_RES* word, GARBAGE_LEVEL garbage_level);
685 CRUNCH_MODE word_deletable(
WERD_RES *word, int16_t &delete_mode);
686 int16_t failure_count(
WERD_RES *word);
687 bool noise_outlines(
TWERD* word);
690 process_selected_words(
696 void tess_add_doc_word(
699 void tess_segment_pass_n(
int pass_n,
WERD_RES *word);
700 bool tess_acceptable_word(
WERD_RES *word);
724 BLOCK_LIST *block_list);
728 void PreenXHeights(BLOCK_LIST *block_list);
733 BLOCK_LIST *block_list);
747 bool ResegmentCharBox(
PAGE_RES* page_res,
const TBOX* prev_box,
748 const TBOX& box,
const TBOX* next_box,
749 const char* correct_text);
756 bool ResegmentWordBox(BLOCK_LIST* block_list,
757 const TBOX& box,
const TBOX* next_box,
758 const char* correct_text);
761 void ReSegmentByClassification(
PAGE_RES* page_res);
764 bool ConvertStringToUnichars(
const char* utf8,
781 int choices_pos,
int choices_length,
792 void ReportFailedBox(
int boxfile_lineno,
TBOX box,
const char *box_ch,
793 const char *err_msg);
795 void CorrectClassifyWords(
PAGE_RES* page_res);
798 void ApplyBoxTraining(
const STRING& fontname,
PAGE_RES* page_res);
802 int CountMisfitTops(
WERD_RES *word_res);
807 float ComputeCompatibleXheight(
WERD_RES *word_res,
float* baseline_shift);
810 BOOL_VAR_H(tessedit_resegment_from_boxes,
false,
811 "Take segmentation and labeling from box file");
812 BOOL_VAR_H(tessedit_resegment_from_line_boxes,
false,
813 "Conversion of word/line box file to char box file");
815 "Generate training data from boxed chars");
816 BOOL_VAR_H(tessedit_make_boxes_from_boxes,
false,
817 "Generate more boxes from boxed chars");
818 BOOL_VAR_H(tessedit_train_line_recognizer,
false,
819 "Break input into lines and remap boxes if present");
820 BOOL_VAR_H(tessedit_dump_pageseg_images,
false,
821 "Dump intermediate images made during page segmentation");
823 "Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block," 824 " 5=line, 6=word, 7=char" 825 " (Values from PageSegMode enum in publictypes.h)");
827 "Which OCR engine(s) to run (Tesseract, LSTM, both). Defaults" 828 " to loading and running the most accurate available.");
829 STRING_VAR_H(tessedit_char_blacklist,
"",
830 "Blacklist of chars not to recognize");
831 STRING_VAR_H(tessedit_char_whitelist,
"",
832 "Whitelist of chars to recognize");
833 STRING_VAR_H(tessedit_char_unblacklist,
"",
834 "List of chars to override tessedit_char_blacklist");
836 "Perform training for ambiguities");
837 INT_VAR_H(pageseg_devanagari_split_strategy,
839 "Whether to use the top-line splitting process for Devanagari " 840 "documents while performing page-segmentation.");
841 INT_VAR_H(ocr_devanagari_split_strategy,
843 "Whether to use the top-line splitting process for Devanagari " 844 "documents while performing ocr.");
845 STRING_VAR_H(tessedit_write_params_to_file,
"",
846 "Write all parameters to the given file.");
848 "Generate and print debug information for adaption");
849 INT_VAR_H(bidi_debug, 0,
"Debug level for BiDi");
850 INT_VAR_H(applybox_debug, 1,
"Debug level");
851 INT_VAR_H(applybox_page, 0,
"Page number to apply boxes from");
852 STRING_VAR_H(applybox_exposure_pattern,
".exp",
853 "Exposure value follows this pattern in the image" 854 " filename. The name of the image files are expected" 855 " to be in the form [lang].[fontname].exp[num].tif");
856 BOOL_VAR_H(applybox_learn_chars_and_char_frags_mode,
false,
857 "Learn both character fragments (as is done in the" 858 " special low exposure mode) as well as unfragmented" 861 "Each bounding box is assumed to contain ngrams. Only" 862 " learn the ngrams whose outlines overlap horizontally.");
863 BOOL_VAR_H(tessedit_display_outwords,
false,
"Draw output words");
864 BOOL_VAR_H(tessedit_dump_choices,
false,
"Dump char choices");
865 BOOL_VAR_H(tessedit_timing_debug,
false,
"Print timing stats");
867 "Try to improve fuzzy spaces");
869 "Don't bother with word plausibility");
870 BOOL_VAR_H(tessedit_fix_hyphens,
true,
"Crunch double hyphens?");
871 BOOL_VAR_H(tessedit_redo_xheight,
true,
"Check/Correct x-height");
873 "Add words to the document dictionary");
874 BOOL_VAR_H(tessedit_debug_fonts,
false,
"Output font info per char");
875 BOOL_VAR_H(tessedit_debug_block_rejection,
false,
"Block and Row stats");
876 BOOL_VAR_H(tessedit_enable_bigram_correction,
true,
877 "Enable correction based on the word bigram dictionary.");
878 BOOL_VAR_H(tessedit_enable_dict_correction,
false,
879 "Enable single word correction based on the dictionary.");
880 INT_VAR_H(tessedit_bigram_debug, 0,
"Amount of debug output for bigram " 883 "Remove and conditionally reassign small outlines when they" 884 " confuse layout analysis, determining diacritics vs noise");
885 INT_VAR_H(debug_noise_removal, 0,
"Debug reassignment of small outlines");
888 double_VAR_H(noise_cert_basechar, -8.0,
"Hingepoint for base char certainty");
891 double_VAR_H(noise_cert_disjoint, -2.5,
"Hingepoint for disjoint certainty");
894 double_VAR_H(noise_cert_punc, -2.5,
"Threshold for new punc char certainty");
897 "Scaling on certainty diff from Hingepoint");
898 INT_VAR_H(noise_maxperblob, 8,
"Max diacritics to apply to a blob");
899 INT_VAR_H(noise_maxperword, 16,
"Max diacritics to apply to a word");
900 INT_VAR_H(debug_x_ht_level, 0,
"Reestimate debug");
901 BOOL_VAR_H(debug_acceptable_wds,
false,
"Dump word pass/fail chk");
902 STRING_VAR_H(chs_leading_punct,
"('`\"",
"Leading punctuation");
903 STRING_VAR_H(chs_trailing_punct1,
").,;:?!",
"1st Trailing punctuation");
904 STRING_VAR_H(chs_trailing_punct2,
")'`\"",
"2nd Trailing punctuation");
905 double_VAR_H(quality_rej_pc, 0.08,
"good_quality_doc lte rejection limit");
906 double_VAR_H(quality_blob_pc, 0.0,
"good_quality_doc gte good blobs limit");
908 "good_quality_doc lte outline error limit");
909 double_VAR_H(quality_char_pc, 0.95,
"good_quality_doc gte good char limit");
910 INT_VAR_H(quality_min_initial_alphas_reqd, 2,
"alphas in a good word");
911 INT_VAR_H(tessedit_tess_adaption_mode, 0x27,
912 "Adaptation decision algorithm for tess");
914 "Do minimal rejection on pass 1 output");
915 BOOL_VAR_H(tessedit_test_adaption,
false,
"Test adaption criteria");
916 BOOL_VAR_H(tessedit_matcher_log,
false,
"Log matcher activity");
917 INT_VAR_H(tessedit_test_adaption_mode, 3,
918 "Adaptation decision algorithm for tess");
922 INT_VAR_H(multilang_debug_level, 0,
"Print multilang debug info.");
923 INT_VAR_H(paragraph_debug_level, 0,
"Print paragraph debug info.");
925 "Run paragraph detection on the post-text-recognition " 927 BOOL_VAR_H(lstm_use_matrix, 1,
"Use ratings matrix/beam searct with lstm");
928 STRING_VAR_H(outlines_odd,
"%| ",
"Non standard number of outlines");
929 STRING_VAR_H(outlines_2,
"ij!?%\":;",
"Non standard number of outlines");
930 BOOL_VAR_H(docqual_excuse_outline_errs,
false,
931 "Allow outline errs in unrejection?");
933 "Reduce rejection on good docs");
934 BOOL_VAR_H(tessedit_use_reject_spaces,
true,
"Reject spaces?");
936 "%rej allowed before rej whole doc");
938 "%rej allowed before rej whole block");
940 "%rej allowed before rej whole row");
942 "Number of row rejects in whole word rejects" 943 "which prevents whole row rejection");
944 BOOL_VAR_H(tessedit_preserve_blk_rej_perfect_wds,
true,
945 "Only rej partially rejected words in block rejection");
946 BOOL_VAR_H(tessedit_preserve_row_rej_perfect_wds,
true,
947 "Only rej partially rejected words in row rejection");
948 BOOL_VAR_H(tessedit_dont_blkrej_good_wds,
false,
949 "Use word segmentation quality metric");
950 BOOL_VAR_H(tessedit_dont_rowrej_good_wds,
false,
951 "Use word segmentation quality metric");
952 INT_VAR_H(tessedit_preserve_min_wd_len, 2,
953 "Only preserve wds longer than this");
955 "Apply row rejection to good docs");
957 "rej good doc wd if more than this fraction rejected");
958 BOOL_VAR_H(tessedit_reject_bad_qual_wds,
true,
959 "Reject all bad quality wds");
960 BOOL_VAR_H(tessedit_debug_doc_rejection,
false,
"Page stats");
961 BOOL_VAR_H(tessedit_debug_quality_metrics,
false,
962 "Output data to debug file");
963 BOOL_VAR_H(bland_unrej,
false,
"unrej potential with no checks");
965 "good_quality_doc gte good char limit");
967 "Mark v.bad words for tilde crunch");
969 "Add font info to hocr output");
970 BOOL_VAR_H(crunch_early_merge_tess_fails,
true,
"Before word crunch?");
971 BOOL_VAR_H(crunch_early_convert_bad_unlv_chs,
false,
"Take out ~^ early?");
972 double_VAR_H(crunch_terrible_rating, 80.0,
"crunch rating lt this");
973 BOOL_VAR_H(crunch_terrible_garbage,
true,
"As it says");
975 "crunch garbage cert lt this");
976 double_VAR_H(crunch_poor_garbage_rate, 60,
"crunch garbage rating lt this");
977 double_VAR_H(crunch_pot_poor_rate, 40,
"POTENTIAL crunch rating lt this");
978 double_VAR_H(crunch_pot_poor_cert, -8.0,
"POTENTIAL crunch cert lt this");
979 BOOL_VAR_H(crunch_pot_garbage,
true,
"POTENTIAL crunch garbage");
980 double_VAR_H(crunch_del_rating, 60,
"POTENTIAL crunch rating lt this");
981 double_VAR_H(crunch_del_cert, -10.0,
"POTENTIAL crunch cert lt this");
982 double_VAR_H(crunch_del_min_ht, 0.7,
"Del if word ht lt xht x this");
983 double_VAR_H(crunch_del_max_ht, 3.0,
"Del if word ht gt xht x this");
984 double_VAR_H(crunch_del_min_width, 3.0,
"Del if word width lt xht x this");
986 "Del if word gt xht x this above bl");
987 double_VAR_H(crunch_del_low_word, 0.5,
"Del if word gt xht x this below bl");
988 double_VAR_H(crunch_small_outlines_size, 0.6,
"Small if lt xht x this");
989 INT_VAR_H(crunch_rating_max, 10,
"For adj length in rating per ch");
990 INT_VAR_H(crunch_pot_indicators, 1,
"How many potential indicators needed");
991 BOOL_VAR_H(crunch_leave_ok_strings,
true,
"Don't touch sensible strings");
992 BOOL_VAR_H(crunch_accept_ok,
true,
"Use acceptability in okstring");
993 BOOL_VAR_H(crunch_leave_accept_strings,
false,
994 "Don't pot crunch sensible strings");
995 BOOL_VAR_H(crunch_include_numerals,
false,
"Fiddle alpha figures");
996 INT_VAR_H(crunch_leave_lc_strings, 4,
997 "Don't crunch words with long lower case strings");
998 INT_VAR_H(crunch_leave_uc_strings, 4,
999 "Don't crunch words with long lower case strings");
1000 INT_VAR_H(crunch_long_repetitions, 3,
"Crunch words with long repetitions");
1001 INT_VAR_H(crunch_debug, 0,
"As it says");
1002 INT_VAR_H(fixsp_non_noise_limit, 1,
1003 "How many non-noise blbs either side?");
1004 double_VAR_H(fixsp_small_outlines_size, 0.28,
"Small if lt xht x this");
1005 BOOL_VAR_H(tessedit_prefer_joined_punct,
false,
"Reward punctuation joins");
1006 INT_VAR_H(fixsp_done_mode, 1,
"What constitues done for spacing");
1007 INT_VAR_H(debug_fix_space_level, 0,
"Contextual fixspace debug");
1008 STRING_VAR_H(numeric_punctuation,
".,",
1009 "Punct. chs expected WITHIN numbers");
1010 INT_VAR_H(x_ht_acceptance_tolerance, 8,
1011 "Max allowed deviation of blob top outside of font data");
1012 INT_VAR_H(x_ht_min_change, 8,
"Min change in xht before actually trying it");
1013 INT_VAR_H(superscript_debug, 0,
"Debug level for sub & superscript fixer");
1014 double_VAR_H(superscript_worse_certainty, 2.0,
"How many times worse " 1015 "certainty does a superscript position glyph need to be for us " 1016 "to try classifying it as a char with a different baseline?");
1017 double_VAR_H(superscript_bettered_certainty, 0.97,
"What reduction in " 1018 "badness do we think sufficient to choose a superscript over " 1019 "what we'd thought. For example, a value of 0.6 means we want " 1020 "to reduce badness of certainty by 40%");
1022 "A superscript scaled down more than this is unbelievably " 1023 "small. For example, 0.3 means we expect the font size to " 1024 "be no smaller than 30% of the text line font size.");
1026 "Maximum top of a character measured as a multiple of x-height " 1027 "above the baseline for us to reconsider whether it's a " 1030 "Minimum bottom of a character measured as a multiple of " 1031 "x-height above the baseline for us to reconsider whether it's " 1033 BOOL_VAR_H(tessedit_write_block_separators,
false,
1034 "Write block separators in output");
1036 "Write repetition char code");
1037 BOOL_VAR_H(tessedit_write_unlv,
false,
"Write .unlv output file");
1038 BOOL_VAR_H(tessedit_create_txt,
false,
"Write .txt output file");
1039 BOOL_VAR_H(tessedit_create_hocr,
false,
"Write .html hOCR output file");
1040 BOOL_VAR_H(tessedit_create_tsv,
false,
"Write .tsv output file");
1041 BOOL_VAR_H(tessedit_create_pdf,
false,
"Write .pdf output file");
1043 "Create PDF with only one invisible text layer");
1044 INT_VAR_H(jpg_quality, 85,
"Set JPEG quality level");
1045 INT_VAR_H(user_defined_dpi, 0,
"Specify DPI for input image");
1046 INT_VAR_H(min_characters_to_try, 50,
1047 "Specify minimum characters to try during OSD");
1048 STRING_VAR_H(unrecognised_char,
"|",
1049 "Output char for unidentified blobs");
1050 INT_VAR_H(suspect_level, 99,
"Suspect marker level");
1051 INT_VAR_H(suspect_space_level, 100,
1052 "Min suspect level for rejecting spaces");
1053 INT_VAR_H(suspect_short_words, 2,
"Don't Suspect dict wds longer than this");
1054 BOOL_VAR_H(suspect_constrain_1Il,
false,
"UNLV keep 1Il chars rejected");
1055 double_VAR_H(suspect_rating_per_ch, 999.9,
"Don't touch bad rating limit");
1056 double_VAR_H(suspect_accept_rating, -999.9,
"Accept good rating limit");
1057 BOOL_VAR_H(tessedit_minimal_rejection,
false,
"Only reject tess failures");
1058 BOOL_VAR_H(tessedit_zero_rejection,
false,
"Don't reject ANYTHING");
1060 "Make output have exactly one word per WERD");
1061 BOOL_VAR_H(tessedit_zero_kelvin_rejection,
false,
1062 "Don't reject ANYTHING AT ALL");
1063 BOOL_VAR_H(tessedit_consistent_reps,
true,
"Force all rep chars the same");
1064 INT_VAR_H(tessedit_reject_mode, 0,
"Rejection algorithm");
1065 BOOL_VAR_H(tessedit_rejection_debug,
false,
"Adaption debug");
1066 BOOL_VAR_H(tessedit_flip_0O,
true,
"Contextual 0O O0 flips");
1068 "Aspect ratio dot/hyphen test");
1070 "Aspect ratio dot/hyphen test");
1071 BOOL_VAR_H(rej_trust_doc_dawg,
false,
"Use DOC dawg in 11l conf. detector");
1072 BOOL_VAR_H(rej_1Il_use_dict_word,
false,
"Use dictword test");
1073 BOOL_VAR_H(rej_1Il_trust_permuter_type,
true,
"Don't double check");
1074 BOOL_VAR_H(rej_use_tess_accepted,
true,
"Individual rejection control");
1075 BOOL_VAR_H(rej_use_tess_blanks,
true,
"Individual rejection control");
1076 BOOL_VAR_H(rej_use_good_perm,
true,
"Individual rejection control");
1077 BOOL_VAR_H(rej_use_sensible_wd,
false,
"Extend permuter check");
1078 BOOL_VAR_H(rej_alphas_in_number_perm,
false,
"Extend permuter check");
1079 double_VAR_H(rej_whole_of_mostly_reject_word_fract, 0.85,
"if >this fract");
1080 INT_VAR_H(tessedit_image_border, 2,
"Rej blbs near image edge limit");
1081 STRING_VAR_H(ok_repeated_ch_non_alphanum_wds,
"-?*\075",
1082 "Allow NN to unrej");
1083 STRING_VAR_H(conflict_set_I_l_1,
"Il1[]",
"Il1 conflict set");
1084 INT_VAR_H(min_sane_x_ht_pixels, 8,
"Reject any x-ht lt or eq than this");
1085 BOOL_VAR_H(tessedit_create_boxfile,
false,
"Output text with boxes");
1086 INT_VAR_H(tessedit_page_number, -1,
1087 "-1 -> All pages, else specific page to process");
1088 BOOL_VAR_H(tessedit_write_images,
false,
"Capture the image from the IPE");
1089 BOOL_VAR_H(interactive_display_mode,
false,
"Run interactively?");
1090 STRING_VAR_H(file_type,
".tif",
"Filename extension");
1091 BOOL_VAR_H(tessedit_override_permuter,
true,
"According to dict_word");
1092 STRING_VAR_H(tessedit_load_sublangs,
"",
1093 "List of languages to load with this one");
1094 BOOL_VAR_H(tessedit_use_primary_params_model,
false,
1095 "In multilingual mode use params model of the primary language");
1099 "Min acceptable orientation margin");
1100 BOOL_VAR_H(textord_tabfind_show_vlines,
false,
"Debug line finding");
1101 BOOL_VAR_H(textord_use_cjk_fp_model, FALSE,
"Use CJK fixed pitch model");
1103 "Allow feature extractors to see the original outline");
1105 "Only initialize with the config file. Useful if the instance is " 1106 "not going to be used for OCR but say only for layout analysis.");
1107 BOOL_VAR_H(textord_equation_detect,
false,
"Turn on equation detector");
1108 BOOL_VAR_H(textord_tabfind_vertical_text,
true,
"Enable vertical detection");
1109 BOOL_VAR_H(textord_tabfind_force_vertical_text,
false,
1110 "Force using vertical text page mode");
1112 "Fraction of textlines deemed vertical to use vertical page " 1114 double_VAR_H(textord_tabfind_aligned_gap_fraction, 0.75,
1115 "Fraction of height used as a minimum gap for aligned blobs.");
1116 INT_VAR_H(tessedit_parallelize, 0,
"Run in parallel where possible");
1118 "Preserve multiple interword spaces");
1119 STRING_VAR_H(page_separator,
"\f",
1120 "Page separator (default is form feed control character)");
1121 INT_VAR_H(lstm_choice_mode, 0,
1122 "Allows to include alternative symbols choices in the hOCR output. " 1123 "Valid input values are 0, 1 and 2. 0 is the default value. " 1124 "With 1 the alternative symbol choices per timestep are included. " 1125 "With 2 the alternative symbol choices are accumulated per character.");
1128 FILE *init_recog_training(
const STRING &fname);
1129 void recog_training_segmented(
const STRING &fname,
1133 void ambigs_classify_and_output(
const char *label,
1187 #endif // TESSERACT_CCMAIN_TESSERACTCLASS_H_ int num_sub_langs() const
Definition: tesseractclass.h:273
Pix * pix_original() const
Definition: tesseractclass.h:211
TesseractStats()
Definition: tesseractclass.h:116
FCOORD reskew_
Definition: tesseractclass.h:1168
int init_tesseract(const char *datapath, const char *language, OcrEngineMode oem)
Definition: tesseractclass.h:524
BLOCK * block
Definition: tesseractclass.h:157
bool last_char_was_newline
Definition: tesseractclass.h:141
WordData * prev_word
Definition: tesseractclass.h:158
WordData(const PAGE_RES_IT &page_res_it)
Definition: tesseractclass.h:149
int train_line_page_num_
Definition: tesseractclass.h:1182
Definition: scrollview.h:61
EquationDetect * equ_detect_
Definition: tesseractclass.h:1178
void set_source_resolution(int ppi)
Definition: tesseractclass.h:244
Tesseract * most_recently_used_
Definition: tesseractclass.h:1174
Pix * pix_binary_
Definition: tesseractclass.h:1146
STRING dump_words_str
Definition: tesseractclass.h:138
Definition: publictypes.h:269
Definition: wordrec.h:192
int32_t word_count
Definition: tesseractclass.h:136
void set_pix_thresholds(Pix *thresholds)
Definition: tesseractclass.h:237
STRING word_config_
Definition: tesseractclass.h:1143
Definition: imagedata.h:105
void set_pix_original(Pix *original_pix)
Definition: tesseractclass.h:213
int16_t good_char_count
Definition: tesseractclass.h:134
Definition: tesseractclass.h:147
TesseractStats stats_
Definition: tesseractclass.h:1169
Definition: unicharset.h:146
Definition: osdetect.h:49
Pix ** mutable_pix_binary()
Definition: tesseractclass.h:197
Textord * mutable_textord()
Definition: tesseractclass.h:266
bool right_to_left() const
Definition: tesseractclass.h:270
WordData()
Definition: tesseractclass.h:148
bool AnyLSTMLang() const
Definition: tesseractclass.h:288
int ImageHeight() const
Definition: tesseractclass.h:250
void(Tesseract::* WordRecognizer)(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
Definition: tesseractclass.h:169
SetParamConstraint
Definition: params.h:36
void set_pix_grey(Pix *grey_pix)
Definition: tesseractclass.h:207
Pix * scaled_color_
Definition: tesseractclass.h:1165
Definition: baseapi.cpp:94
bool tilde_crunch_written
Definition: tesseractclass.h:140
int ImageWidth() const
Definition: tesseractclass.h:247
Definition: equationdetect.h:39
bool AnyTessLang() const
Definition: tesseractclass.h:280
int scaled_factor() const
Definition: tesseractclass.h:256
GenericVector< Tesseract * > sub_langs_
Definition: tesseractclass.h:1171
int32_t adaption_word_number
Definition: tesseractclass.h:130
const char * backup_config_file_
Definition: tesseractclass.h:1141
Pix * pix_thresholds_
Definition: tesseractclass.h:1152
int16_t doc_outline_errs
Definition: tesseractclass.h:132
LSTMRecognizer * lstm_recognizer_
Definition: tesseractclass.h:1180
const FCOORD & reskew() const
Definition: tesseractclass.h:193
DebugPixa pixa_debug_
Definition: tesseractclass.h:1154
int source_resolution_
Definition: tesseractclass.h:1157
Tesseract * get_sub_lang(int index) const
Definition: tesseractclass.h:276
ROW * row
Definition: tesseractclass.h:156
ScriptPos
Definition: ratngs.h:262
double_VAR_H(textord_tabvector_vertical_gap_fraction, 0.5, "Max fraction of mean blob width allowed for vertical gaps in vertical text")
const Textord & textord() const
Definition: tesseractclass.h:263
Definition: pageres.h:675
Definition: ocrblock.h:30
int source_resolution() const
Definition: tesseractclass.h:241
int16_t doc_good_char_quality
Definition: tesseractclass.h:135
Definition: tessdatamanager.h:126
Definition: debugpixa.h:10
BOOL_VAR_H(textord_tabfind_find_tables, false, "run table detection")
Definition: tesseractclass.h:115
Definition: stepblob.h:37
bool last_char_was_tilde
Definition: tesseractclass.h:142
FCOORD deskew_
Definition: tesseractclass.h:1167
Pix * BestPix() const
Definition: tesseractclass.h:229
int16_t doc_char_quality
Definition: tesseractclass.h:133
Pix * pix_binary() const
Definition: tesseractclass.h:201
bool right_to_left_
Definition: tesseractclass.h:1164
Definition: pageres.h:169
Pix * pix_grey_
Definition: tesseractclass.h:1148
Pix * pix_original_
Definition: tesseractclass.h:1150
Definition: tesseractclass.h:173
void SetScaledColor(int factor, Pix *color)
Definition: tesseractclass.h:259
Pix * pix_grey() const
Definition: tesseractclass.h:204
Definition: lstmrecognizer.h:53
Definition: imagedata.h:205
WordData(BLOCK *block_in, ROW *row_in, WERD_RES *word_res)
Definition: tesseractclass.h:152
int16_t doc_blob_quality
Definition: tesseractclass.h:131
bool write_results_empty_block
Definition: tesseractclass.h:143
WERD_RES * word
Definition: tesseractclass.h:155
Definition: devanagari_processing.h:72
Definition: devanagari_processing.h:75
Textord textord_
Definition: tesseractclass.h:1162
Definition: ocrclass.h:119
OcrEngineMode
Definition: publictypes.h:268
ShiroRekhaSplitter splitter_
Definition: tesseractclass.h:1160
Assume a single uniform block of text. (Default.)
Definition: publictypes.h:172
int font_table_size_
Definition: tesseractclass.h:1176
int32_t dict_words
Definition: tesseractclass.h:137
PointerVector< WERD_RES > lang_words
Definition: tesseractclass.h:159
Definition: publictypes.h:274
Pix * scaled_color() const
Definition: tesseractclass.h:253
PageSegMode
Definition: publictypes.h:163
Definition: publictypes.h:270
int scaled_factor_
Definition: tesseractclass.h:1166