ccmain/tessedit.cpp File Reference

#include "mfcpch.h"
#include "tfacep.h"
#include "stderr.h"
#include "basedir.h"
#include "tessvars.h"
#include "control.h"
#include "imgs.h"
#include "reject.h"
#include "pageres.h"
#include "mainblk.h"
#include "nwmain.h"
#include "pgedit.h"
#include "ocrshell.h"
#include "tprintf.h"
#include "tessedit.h"
#include "permute.h"
#include "permdawg.h"
#include "permnum.h"
#include "stopper.h"
#include "adaptmatch.h"
#include "intmatcher.h"
#include "chop.h"
#include "globals.h"
#include "callnet.h"
#include "notdll.h"

Go to the source code of this file.

Defines

Enumerations

Functions

Variables


Define Documentation

#define API_CONFIG   "configs/api_config"

Definition at line 62 of file tessedit.cpp.

#define EXTERN

Definition at line 63 of file tessedit.cpp.

#define VARDIR   "configs/"

Note:
File: tessedit.cpp (Formerly tessedit.c)
Main program for merge of tess and editor.
Author:
Ray Smith
Date:
Tue Jan 07 15:21:46 GMT 1992
 * (C) Copyright 1992, Hewlett-Packard Ltd.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.

Definition at line 60 of file tessedit.cpp.

Referenced by build_main_var_menu(), init_tesseract(), and main_setup().


Enumeration Type Documentation

enum CMD_EVENTS

Command Events recognized.

Enumerator:
ACTION_1_CMD_EVENT 
RECOG_WERDS 
RECOG_PSEUDO 
ACTION_2_CMD_EVENT 
NULL_CMD_EVENT 
DELETE_CMD_EVENT 
COPY_CMD_EVENT 
CHANGE_DISP_CMD_EVENT 
CHANGE_TEXT_CMD_EVENT 
TOGGLE_SEG_CMD_EVENT 
DUMP_WERD_CMD_EVENT 
SHOW_POINT_CMD_EVENT 
ROW_SPACE_STAT_CMD_EVENT 
BLOCK_SPACE_STAT_CMD_EVENT 
SHOW_BLN_WERD_CMD_EVENT 
SEGMENT_WERD_CMD_EVENT 
BOUNDING_BOX_CMD_EVENT 
CORRECT_TEXT_CMD_EVENT 
POLYGONAL_CMD_EVENT 
BL_NORM_CMD_EVENT 
BITMAP_CMD_EVENT 
TIDY_CMD_EVENT 
VIEW_CMD_EVENT 
IMAGE_CMD_EVENT 
BLOCKS_CMD_EVENT 
BASELINES_CMD_EVENT 
WRITE_CMD_EVENT 
SMD_CMD_EVENT 
NEW_SOURCE_CMD_EVENT 
UNIFORM_DISP_CMD_EVENT 
REFRESH_CMD_EVENT 
QUIT_CMD_EVENT 

Definition at line 188 of file tessedit.cpp.

00189 {
00190   ACTION_1_CMD_EVENT,
00191   RECOG_WERDS,
00192   RECOG_PSEUDO,
00193   ACTION_2_CMD_EVENT
00194 };


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.

References RADIO_MENU::add_child(), RECOG_PSEUDO, and RECOG_WERDS.

Referenced by build_menu().

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.

References command_window, current_block_list, INT32FORMAT, MAX_CHARS, COMMAND_WINDOW::msg(), process_selected_words(), recog_interactive(), RECOG_PSEUDO, recog_pseudo_word(), and RECOG_WERDS.

Referenced by process_image_event().

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.

References command_window, INT32FORMAT, MAX_CHARS, and COMMAND_WINDOW::msg().

Referenced by process_cmd_win_event().

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 
)

Definition at line 100 of file tessedit.cpp.

Referenced by TessBaseAPI::Init().

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 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 = NULL

progress monitor

Definition at line 98 of file tessedit.cpp.

Referenced by edges_and_textord(), make_words(), and textord_page().

int NO_BLOCK

Definition at line 53 of file output.cpp.

INT16 XOFFSET

Definition at line 56 of file output.cpp.

INT16 YOFFSET

Definition at line 57 of file output.cpp.


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