ccmain/tessedit.h File Reference

#include "tessclas.h"
#include "ocrclass.h"
#include "pgedit.h"
#include "notdll.h"

Go to the source code of this file.

Functions

Variables


Function Documentation

void end_tesseract (  ) 

Definition at line 133 of file tessedit.cpp.

References end_recog().

Referenced by TessBaseAPI::End().

00133                      {
00134   end_recog();
00135 }

void extend_menu ( RADIO_MENU modes_menu,
INT16  modes_id_base,
NON_RADIO_MENU other_menu,
INT16  other_id_base 
)

Called by pgeditor to let you extend the command menu.

Parameters:
modes_menu handle for "MODES"
modes_id_base mode cmd ids offset
other_menu handle for "OTHER"
other_id_base mode cmd ids offset
Returns:
none
Items can be added to the "MODES" and "OTHER" menus. The modes_id_base and other_id_base parameters are required to offset your command event ids from those of pgeditor, and to let the pgeditor which commands are mode changes and which are unmoded commands. (Sorry if you think these offsets are a bit kludgy, the alternative would be to duplicate all the menu constructor modes within pgeditor so that the offsets could be hidden.)

Items for the "MODES" menu may only be simple menu items (just a name and id). Items for the "OTHER" menu can be editable parameters or boolean toggles. Refer to menu.h to see how to build different types.

Definition at line 216 of file tessedit.cpp.

00221                   {
00222   /* Example new mode */
00223 
00224   modes_menu->add_child (new RADIO_MENU_LEAF ("Recog Words",
00225     modes_id_base + RECOG_WERDS));
00226   modes_menu->add_child (new RADIO_MENU_LEAF ("Recog Blobs",
00227     modes_id_base + RECOG_PSEUDO));
00228 
00229   /* Example toggle
00230 
00231   other_menu->add_child(
00232     new TOGGLE_MENU_LEAF( "Action 2",              //Display string
00233             other_id_base + ACTION_2_CMD_EVENT, //offset command id
00234             FALSE ) );                    //Initial value
00235 
00236    Example text parm  (commented out)
00237 
00238     other_menu->add_child(
00239     new VARIABLE_MENU_LEAF( "Parm change",            //Display string
00240             other_id_base + ACTION_3_CMD_EVENT, //offset command id
00241             "default value" ) );          //default value string
00242   */
00243 }

void extend_moded_commands ( INT32  mode,
BOX  selection_box 
)

Called by pgeditor when the user is in one of the extended modes defined by extend_menu() and the user has selected an area in the image window.

Parameters:
mode current mode
selection_box area selected
Returns:
none

Definition at line 255 of file tessedit.cpp.

00258                             {
00259   char msg[MAX_CHARS + 1];
00260 
00261   switch (mode) {
00262     case RECOG_WERDS:
00263       command_window->msg ("Recogging selected words");
00264 
00265       /* This is how to apply a "word processor" function to each selected word */
00266 
00267       process_selected_words(current_block_list,
00268                              selection_box,
00269                              &recog_interactive);
00270       break;
00271     case RECOG_PSEUDO:
00272       command_window->msg ("Recogging selected blobs");
00273 
00274       /* This is how to apply a "word processor" function to each selected word */
00275 
00276       recog_pseudo_word(current_block_list, selection_box);
00277       break;
00278     default:
00279       sprintf (msg, "Unexpected extended mode " INT32FORMAT, mode);
00280       command_window->msg (msg);
00281   }
00282 }

void extend_unmoded_commands ( INT32  cmd_event,
char *  new_value 
)

Called by pgeditor() when user has selected one of the unmoded extended menu options.

Definition at line 289 of file tessedit.cpp.

00292                               {
00293   char msg[MAX_CHARS + 1];
00294 
00295   switch (cmd_event) {
00296     case ACTION_2_CMD_EVENT:     //a toggle event
00297       if (new_value[0] == 'T')
00298                                  //Display message
00299         command_window->msg ("Extended Action 2 ON!!");
00300       else
00301         command_window->msg ("Extended Action 2 OFF!!");
00302       break;
00303     default:
00304       sprintf (msg, "Unrecognised extended command " INT32FORMAT " (%s)",
00305         cmd_event, new_value);
00306       command_window->msg (msg);
00307       break;
00308   }
00309 }

int init_tesseract ( const char *  arg0,
const char *  textbase,
const char *  configfile,
int  configc,
const char *const *  configv 
)

Initialize everything tess needs to run.

Parameters:
arg0 for main_setup()
textbase for main_setup()
configfile configuration file
configc for main_setup()
configv for main_setup()
Note:
Global: tessedit_use_nn, tessedit_write_vars, tweak_ReliableConfigThreshold
Returns:
status code

Definition at line 100 of file tessedit.cpp.

References _XSTR, ABORT, CANTOPENFILE, datadir, DBG, demodir, ERRCODE::error(), FALSE, FORCE_VAR_DUMP, getpath(), imagebasename, init_net(), main_setup(), MAX_PATH, NO_PATH, NULL, print_variables(), read_variables_file(), ReliableConfigThreshold, set_tess_tweak_vars(), start_recog(), STRING::string(), TESSDATA_PREFIX, and VARDIR.

00104                                                {
00105   FILE *var_file;
00106   static char c_path[MAX_PATH];  //path for c code
00107 
00108   // Set the basename, compute the data directory and read C++ configs.
00109   main_setup(arg0, textbase, configc, configv);
00110   debug_window_on.set_value (FALSE);
00111 
00112   if (tessedit_write_vars) {
00113     var_file = fopen ("edited.cfg", "w");
00114     if (var_file != NULL) {
00115       print_variables(var_file);
00116       fclose(var_file);
00117     }
00118   }
00119   strcpy (c_path, datadir.string ());
00120   c_path[strlen (c_path) - strlen (m_data_sub_dir.string ())] = '\0';
00121   demodir = c_path;
00122   start_recog(configfile, textbase);
00123 
00124   ReliableConfigThreshold = tweak_ReliableConfigThreshold;
00125 
00126   set_tess_tweak_vars();
00127 
00128   if (tessedit_use_nn)           //phils nn stuff
00129     init_net();
00130   return 0;                      //Normal exit
00131 }

void recognize_page ( STRING image_name  ) 

void set_tess_tweak_vars (  ) 

Set TESS vars from the tweak value.

Parameters:
none 
Returns:
none
Note:
Global: tessedit_tweaking_tess_vars, tweak_garbage, tweak_ok_word, tweak_good_word, tweak_freq_word, tweak_ok_number, tweak_good_number, tweak_non_word, tweak_CertaintyPerChar, tweak_NonDictCertainty, tweak_RejectCertaintyOffset, tweak_GoodAdaptiveMatch, tweak_GreatAdaptiveMatch, tweak_AdaptProtoThresh, tweak_AdaptFeatureThresh, tweak_min_outline_points, tweak_min_outline_area, tweak_good_split, and tweak_ok_split
Really only use during search of the space of tess configs, othertimes the default values are set

Definition at line 330 of file tessedit.cpp.

References AdaptFeatureThresh, AdaptProtoThresh, CertaintyPerChar, freq_word, garbage, good_number, good_split, good_word, GoodAdaptiveMatch, GreatAdaptiveMatch, min_outline_area, min_outline_points, non_word, NonDictCertainty, ok_number, ok_split, ok_word, and RejectCertaintyOffset.

Referenced by init_tesseract().

00330                            { 
00331   if (tessedit_tweaking_tess_vars) {
00332     garbage = tweak_garbage;
00333     ok_word = tweak_ok_word;
00334     good_word = tweak_good_word;
00335     freq_word = tweak_freq_word;
00336     ok_number = tweak_ok_number;
00337     good_number = tweak_good_number;
00338     non_word = tweak_non_word;
00339     CertaintyPerChar = tweak_CertaintyPerChar;
00340     NonDictCertainty = tweak_NonDictCertainty;
00341     RejectCertaintyOffset = tweak_RejectCertaintyOffset;
00342     GoodAdaptiveMatch = tweak_GoodAdaptiveMatch;
00343     GreatAdaptiveMatch = tweak_GreatAdaptiveMatch;
00344     AdaptProtoThresh = tweak_AdaptProtoThresh;
00345     AdaptFeatureThresh = tweak_AdaptFeatureThresh;
00346     min_outline_points = tweak_min_outline_points;
00347     min_outline_area = tweak_min_outline_area;
00348     good_split = tweak_good_split;
00349     ok_split = tweak_ok_split;
00350   }
00351   //   if (expiry_day * 24 * 60 * 60 < time(NULL))
00352   //         err_exit();
00353 }


Variable Documentation

ETEXT_DESC* global_monitor

progress monitor

Definition at line 98 of file tessedit.cpp.


Generated on Wed Feb 28 19:49:15 2007 for Tesseract by  doxygen 1.5.1