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 112 FILE *debug_window = NULL;
131 "Editor image window name");
136 "Word bounding box colour");
138 "Blob bounding box colour");
140 "Correct text colour");
143 "Editor debug window name");
220 maxx, y_offset + scale_factor *
BL_HEIGHT);
222 maxx, y_offset + scale_factor *
X_HEIGHT);
242 if (strcmp(event->
parameter,
"true") == 0) { myval =
'T'; }
243 else if (strcmp(event->
parameter,
"false") == 0) { myval =
'F'; }
272 parent_menu = root_menu_item->
AddChild(
"DISPLAY");
291 parent_menu = root_menu_item->
AddChild(
"OTHER");
300 return root_menu_item;
320 (this->*word_painter)(&pr_it);
348 #ifndef GRAPHICS_DISABLED 445 if (new_value[0] ==
'T')
452 if (new_value[0] ==
'T')
460 if (new_value[0] ==
'T')
467 if (new_value[0] ==
'T')
474 if (new_value[0] ==
'T')
481 if (new_value[0] ==
'T')
547 sprintf(msg,
"Unrecognised event " INT32FORMAT "(%s)",
548 cmd_event, new_value);
587 selection_box =
TBOX(down, up);
627 sprintf(msg,
"Mode %d not yet implemented",
mode);
659 const int kBufsize = 512;
663 msg_ptr += sprintf(msg_ptr,
"Pt:(%0.3f, %0.3f) ", x, y);
668 msg_ptr += sprintf(msg_ptr,
"BL(x)=%0.3f ",
671 if (word->word->bounding_box().contains(pt)) {
672 TBOX box = word->word->bounding_box();
673 msg_ptr += sprintf(msg_ptr,
"Wd(%d, %d)/(%d, %d) ",
676 C_BLOB_IT cblob_it(word->word->cblob_list());
677 for (cblob_it.mark_cycle_pt();
678 !cblob_it.cycled_list();
679 cblob_it.forward()) {
680 C_BLOB* cblob = cblob_it.data();
683 msg_ptr += sprintf(msg_ptr,
684 "CBlb(%d, %d)/(%d, %d) ",
714 #endif // GRAPHICS_DISABLED 716 #ifndef GRAPHICS_DISABLED 742 1.0, 0.0f, -1000.0f, 1000.0f);
745 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
773 int length = box_word->
length();
774 if (word_res->
fontinfo == NULL)
return false;
776 for (
int i = 0; i < length; ++i) {
778 switch (color_mode) {
838 for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
839 c_it.data()->bounding_box().plot(
image_win);
840 displayed_something =
TRUE;
846 displayed_something =
TRUE;
855 displayed_something =
TRUE;
869 if (blamer_bundle == NULL) {
877 best_choice_str =
"NULL";
881 text += best_choice_str;
892 word_height = word_bb.
height();
893 int text_height = 0.50 * word_height;
894 if (text_height > 20) text_height = 20;
896 shift = (word_height < word_bb.
width()) ? 0.25 * word_height : 0.0f;
901 word_bb.
bottom() + 0.25 * word_height - text_height,
905 displayed_something =
TRUE;
908 if (!displayed_something)
915 #endif // GRAPHICS_DISABLED 934 tprintf(
"Current blamer debug: %s\n",
940 #ifndef GRAPHICS_DISABLED 961 const TBOX& selection_box) {
978 &cn_features, &fx_info, NULL);
982 for (
int f = 0; f < bl_features.
size(); ++f)
988 for (
int f = 0; f < cn_features.
size(); ++f)
998 #endif // GRAPHICS_DISABLED
ScrollView * CreateFeatureSpaceWindow(const char *name, int xpos, int ypos)
void Image(struct Pix *image, int x_pos, int y_pos)
void plot_baseline(ScrollView *window, ScrollView::Color colour)
BOOL8 word_bln_display(PAGE_RES_IT *pr_it)
void string_and_lengths(STRING *word_str, STRING *word_lengths_str) const
BOOL8 word_blank_and_set_display(PAGE_RES_IT *pr_its)
void process_image_event(const SVEvent &event)
TBOX bounding_box() const
int tessedit_ocr_engine_mode
GenericVector< TBLOB * > blobs
BOOL8 bit(uinT8 bit_num) const
BLOCK_RES * prev_block() const
float base_line(float xpos) const
void RenderIntFeature(ScrollView *window, const INT_FEATURE_STRUCT *Feature, ScrollView::Color color)
void pgeditor_main(int width, int height, PAGE_RES *page_res)
bool poly_allow_detailed_fx
ScrollView * bln_word_window_handle()
void Notify(const SVEvent *sve)
void show_point(PAGE_RES *page_res, float x, float y)
STRING TruthString() const
void Line(int x1, int y1, int x2, int y2)
BOOL8 process_cmd_win_event(inT32 cmd_event, char *new_value)
tesseract::ScriptPos BlobPosition(int index) const
TBOX bounding_box() const
void plot(ScrollView *window, ScrollView::Color colour)
static ScrollView::Color NextColor(ScrollView::Color colour)
const STRING & debug() const
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
BOOL8 recog_interactive(PAGE_RES_IT *pr_it)
void set_display_flag(uinT8 flag, BOOL8 value)
int editor_image_blob_bb_color
WERD_CHOICE * best_choice
char * ShowInputDialog(const char *msg)
BOOL8 display_flag(uinT8 flag) const
#define STRING_VAR(name, val, comment)
int editor_image_menuheight
void turn_off_bit(uinT8 bit_num)
BOOL8 word_display(PAGE_RES_IT *pr_it)
IncorrectResultReason incorrect_result_reason() const
void Text(int x, int y, const char *mystring)
int editor_image_word_bb_color
void recog_pseudo_word(PAGE_RES *page_res, TBOX &selection_box)
tesseract::BoxWord * box_word
const char * string() const
void Notify(const SVEvent *sv_event)
void debug_word(PAGE_RES *page_res, const TBOX &selection_box)
const FontInfo * fontinfo
void Notify(const SVEvent *sve)
void plot(ScrollView *window)
static const char * IncorrectReasonName(IncorrectResultReason irr)
bool contains(const FCOORD pt) const
void pgeditor_msg(const char *msg)
bool is_fixed_pitch() const
void plot(ScrollView *fd) const
void plot(ScrollView *window, inT32 serial, ScrollView::Color colour)
PAGE_RES_IT * make_pseudo_word(PAGE_RES *page_res, const TBOX &selection_box)
BlamerBundle * blamer_bundle
SVEvent * AwaitEvent(SVEventType type)
bool SetupForRecognition(const UNICHARSET &unicharset_in, tesseract::Tesseract *tesseract, Pix *pix, int norm_mode, const TBOX *norm_box, bool numeric_mode, bool use_body_size, bool allow_detailed_fx, ROW *row, const BLOCK *block)
void ClearFeatureSpaceWindow(NORM_METHOD norm_method, ScrollView *window)
void AddEventHandler(SVEventHandler *listener)
Add an Event Listener to this ScrollView Window.
bool classify_nonlinear_norm
void ResetAdaptiveClassifier()
void pgeditor_show_point(SVEvent *event)
int editor_image_text_color
char * editor_debug_config_file
ROW_RES * prev_row() const
BLOCK_RES * block() const
void BuildMenu(ScrollView *sv, bool menu_bar=true)
void do_re_display(BOOL8(tesseract::Tesseract::*word_painter)(PAGE_RES_IT *pr_it))
void Rectangle(int x1, int y1, int x2, int y2)
const ERRCODE EMPTYBLOCKLIST
BOOL8 word_set_display(PAGE_RES_IT *pr_it)
void process_selected_words(PAGE_RES *page_res, TBOX &selection_box, BOOL8(tesseract::Tesseract::*word_processor)(PAGE_RES_IT *pr_it))
void display_bln_lines(ScrollView *window, ScrollView::Color colour, float scale_factor, float y_offset, float minx, float maxx)
void print(FILE *fp, BOOL8 dump)
dump whole table
bool wordrec_debug_blamer
const TBOX & BlobBox(int index) const
bool recog_all_words(PAGE_RES *page_res, ETEXT_DESC *monitor, const TBOX *target_word_box, const char *word_config, int dopasses)
void set_y(inT16 yin)
rewrite function
const char * text() const
SVMenuNode * AddChild(const char *txt)
PAGE_RES * current_page_res
void set_x(inT16 xin)
rewrite function
char * editor_image_win_name
bool classify_bln_numeric_mode
void turn_on_bit(uinT8 bit_num)
void SetVisible(bool visible)
void blob_feature_display(PAGE_RES *page_res, const TBOX &selection_box)
C_BLOB_LIST * cblob_list()
static void ExtractFeatures(const TBLOB &blob, bool nonlinear_norm, GenericVector< INT_FEATURE_STRUCT > *bl_features, GenericVector< INT_FEATURE_STRUCT > *cn_features, INT_FX_RESULT_STRUCT *results, GenericVector< int > *outline_cn_counts)
BOOL8 word_dumper(PAGE_RES_IT *pr_it)
bool textord_use_cjk_fp_model
static TWERD * PolygonalCopy(bool allow_detailed_fx, WERD *src)
ScrollView * bln_word_window
TBOX bounding_box() const
#define INT_VAR(name, val, comment)
void build_image_window(int width, int height)
void AddMessage(const char *format,...)
BLOCK_RES_LIST block_res_list
SVMenuNode * build_menu_new()