21 #pragma warning(disable:4244) // Conversion warnings
45 #ifndef GRAPHICS_DISABLED
46 #define ASC_HEIGHT (2 * kBlnBaselineOffset + kBlnXHeight)
47 #define X_HEIGHT (kBlnBaselineOffset + kBlnXHeight)
48 #define BL_HEIGHT kBlnBaselineOffset
50 #define MAXSPACING 128
111 FILE *debug_window =
NULL;
130 "Editor image window name");
135 "Word bounding box colour");
137 "Blob bounding box colour");
139 "Correct text colour");
142 "Editor debug window name");
160 bln_word_window =
NULL;
173 if (bln_word_window ==
NULL) {
217 maxx, y_offset + scale_factor * DESC_HEIGHT);
219 maxx, y_offset + scale_factor * BL_HEIGHT);
221 maxx, y_offset + scale_factor * X_HEIGHT);
223 maxx, y_offset + scale_factor * ASC_HEIGHT);
241 if (strcmp(event->
parameter,
"true") == 0) { myval =
'T'; }
242 else if (strcmp(event->
parameter,
"false") == 0) { myval =
'F'; }
270 parent_menu = root_menu_item->
AddChild(
"DISPLAY");
289 parent_menu = root_menu_item->
AddChild(
"OTHER");
298 return root_menu_item;
315 image_win->
Image(pix_binary_, 0, 0);
337 current_page_res = page_res;
347 #ifndef GRAPHICS_DISABLED
385 image_win->
AddMessage(
"Pointing at(%d, %d)", event->
x, event->
y);
443 if (new_value[0] ==
'T')
450 if (new_value[0] ==
'T')
458 if (new_value[0] ==
'T')
465 if (new_value[0] ==
'T')
472 if (new_value[0] ==
'T')
479 if (new_value[0] ==
'T')
545 sprintf(msg,
"Unrecognised event " INT32FORMAT "(%s)",
546 cmd_event, new_value);
585 selection_box =
TBOX(down, up);
611 image_win->
AddMessage(
"Recogging selected words");
617 image_win->
AddMessage(
"Recogging selected blobs");
622 sprintf(msg,
"Mode %d not yet implemented",
mode);
657 msg_ptr += sprintf(msg_ptr,
"Pt:(%0.3f, %0.3f) ", x, y);
662 msg_ptr += sprintf(msg_ptr,
"BL(x)=%0.3f ",
665 if (word->word->bounding_box().contains(pt)) {
666 TBOX box = word->word->bounding_box();
667 msg_ptr += sprintf(msg_ptr,
"Wd(%d, %d)/(%d, %d) ",
670 C_BLOB_IT cblob_it(word->word->cblob_list());
671 for (cblob_it.mark_cycle_pt();
672 !cblob_it.cycled_list();
673 cblob_it.forward()) {
674 C_BLOB* cblob = cblob_it.data();
677 msg_ptr += sprintf(msg_ptr,
678 "CBlb(%d, %d)/(%d, %d) ",
708 #endif // GRAPHICS_DISABLED
710 #ifndef GRAPHICS_DISABLED
726 if (bln_word ==
NULL) {
734 1.0, 0.0
f, -1000.0
f, 1000.0
f);
757 int length = box_word->
length();
760 for (
int i = 0; i < length; ++i) {
762 switch (color_mode) {
800 image_win->
Pen(color);
816 editor_image_word_bb_color));
822 for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
823 c_it.data()->bounding_box().plot(image_win);
824 displayed_something =
TRUE;
829 word->
plot(image_win);
830 displayed_something =
TRUE;
837 tword->
plot(image_win);
839 displayed_something =
TRUE;
853 if (blamer_bundle ==
NULL) {
863 best_choice_str =
"NULL";
867 text += best_choice_str;
878 word_height = word_bb.
height();
879 int text_height = 0.50 * word_height;
880 if (text_height > 20) text_height = 20;
881 image_win->
TextAttributes(
"Arial", text_height,
false,
false,
false);
882 shift = (word_height < word_bb.
width()) ? 0.25 * word_height : 0.0
f;
883 image_win->
Text(word_bb.
left() + shift,
886 image_win->
Text(word_bb.
left() + shift,
887 word_bb.
bottom() + 0.25 * word_height - text_height,
891 displayed_something =
TRUE;
894 if (!displayed_something)
898 editor_image_word_bb_color));
901 #endif // GRAPHICS_DISABLED
919 tprintf(
"Current blamer debug: %s\n",
925 #ifndef GRAPHICS_DISABLED
942 #endif // GRAPHICS_DISABLED
bool SetupForTessRecognition(const UNICHARSET &unicharset_in, tesseract::Tesseract *tesseract, Pix *pix, bool numeric_mode, bool use_body_size, ROW *row, BLOCK *block)
BLOCK_RES * prev_block() const
BOOL8 recog_interactive(BLOCK *block, ROW *row, WERD_RES *word_res)
C_BLOB_LIST * cblob_list()
bool recog_all_words(PAGE_RES *page_res, ETEXT_DESC *monitor, const TBOX *target_word_box, const char *word_config, int dopasses)
BOOL8 process_cmd_win_event(inT32 cmd_event, char *new_value)
static TWERD * PolygonalCopy(WERD *src)
IncorrectResultReason incorrect_result_reason
PAGE_RES * current_page_res
BLOCK_RES_LIST block_res_list
const FontInfo * fontinfo
void print(FILE *fp, BOOL8 dump)
dump whole table
void build_image_window(int width, int height)
bool contains(const FCOORD pt) const
#define STRING_VAR(name, val, comment)
void Notify(const SVEvent *sve)
void pgeditor_show_point(SVEvent *event)
BOOL8 word_set_display(BLOCK *block, ROW *row, WERD_RES *word_res)
void show_point(PAGE_RES *page_res, float x, float y)
void pgeditor_msg(const char *msg)
void plot(ScrollView *fd) const
const char * text() const
void display_bln_lines(ScrollView *window, ScrollView::Color colour, float scale_factor, float y_offset, float minx, float maxx)
int editor_image_menuheight
void process_image_event(const SVEvent &event)
BOOL8 display_flag(uinT8 flag) const
bool is_fixed_pitch() const
BLOCK_RES * block() const
BOOL8 word_blank_and_set_display(BLOCK *block, ROW *row, WERD_RES *word_res)
void Notify(const SVEvent *sv_event)
#define INT_VAR(name, val, comment)
float base_line(float xpos) const
void recog_pseudo_word(PAGE_RES *page_res, TBOX &selection_box)
BOOL8 word_dumper(BLOCK *block, ROW *row, WERD_RES *word_res)
void set_y(inT16 yin)
rewrite function
const ERRCODE EMPTYBLOCKLIST
void ResetAdaptiveClassifier()
GenericVector< STRING > truth_text
int editor_image_word_bb_color
const char * string() const
BOOL8 word_display(BLOCK *block, ROW *row, WERD_RES *word_res)
int editor_image_blob_bb_color
DLLSYM void tprintf(const char *format,...)
bool wordrec_debug_blamer
static const char * IncorrectReasonName(IncorrectResultReason irr)
void Notify(const SVEvent *sve)
ScriptPos BlobPosition(int index) const
void plot(ScrollView *window, inT32 serial, ScrollView::Color colour)
ROW_RES * prev_row() const
BOOL8 word_bln_display(BLOCK *block, ROW *row, WERD_RES *word_res)
void set_x(inT16 xin)
rewrite function
void process_selected_words(PAGE_RES *page_res, TBOX &selection_box, BOOL8(tesseract::Tesseract::*word_processor)(BLOCK *block, ROW *row, WERD_RES *word_res))
void plot(ScrollView *window)
void plot_baseline(ScrollView *window, ScrollView::Color colour)
TBOX bounding_box() const
tesseract::BoxWord * box_word
const TBOX & BlobBox(int index) const
void turn_off_bit(uinT8 bit_num)
void turn_on_bit(uinT8 bit_num)
void do_re_display(BOOL8(tesseract::Tesseract::*word_painter)(BLOCK *block, ROW *row, WERD_RES *word_res))
char * editor_debug_config_file
bool textord_use_cjk_fp_model
SVMenuNode * build_menu_new()
BOOL8 bit(uinT8 bit_num) const
int editor_image_text_color
char * editor_image_win_name
void pgeditor_main(int width, int height, PAGE_RES *page_res)
ScrollView * bln_word_window_handle()
void string_and_lengths(STRING *word_str, STRING *word_lengths_str) const
void plot(ScrollView *window, ScrollView::Color colour)
void debug_word(PAGE_RES *page_res, const TBOX &selection_box)
BlamerBundle * blamer_bundle
void set_display_flag(uinT8 flag, BOOL8 value)
WERD_CHOICE * best_choice
ScrollView * bln_word_window