textord/topitch.h

Go to the documentation of this file.
00001 
00019 #ifndef           TOPITCH_H
00020 #define           TOPITCH_H
00021 
00022 #include          "blobbox.h"
00023 #include          "notdll.h"
00024 
00067 extern BOOL_VAR_H (textord_debug_pitch_test, FALSE,
00068 "Debug on fixed pitch test");
00069 extern BOOL_VAR_H (textord_debug_pitch_metric, FALSE,
00070 "Write full metric stuff");
00071 extern BOOL_VAR_H (textord_show_row_cuts, FALSE, "Draw row-level cuts");
00072 extern BOOL_VAR_H (textord_show_page_cuts, FALSE, "Draw page-level cuts");
00073 extern BOOL_VAR_H (textord_pitch_cheat, FALSE,
00074 "Use correct answer for fixed/prop");
00075 extern BOOL_VAR_H (textord_blockndoc_fixed, TRUE,
00076 "Attempt whole doc/block fixed pitch");
00077 extern BOOL_VAR_H (textord_fast_pitch_test, FALSE,
00078 "Do even faster pitch algorithm");
00079 extern double_VAR_H (textord_projection_scale, 0.125,
00080 "Ding rate for mid-cuts");
00081 extern double_VAR_H (textord_balance_factor, 2.0,
00082 "Ding rate for unbalanced char cells");
00083 extern double_VAR_H (textord_repch_width_variance, 0.2,
00084 "Max width change of gap/blob");
00087 void compute_fixed_pitch(                             //determine pitch
00088                          ICOORD page_tr,              //top right
00089                          TO_BLOCK_LIST *port_blocks,  //input list
00090                          float gradient,              //page skew
00091                          FCOORD rotation,             //for drawing
00092                          BOOL8 testing_on             //correct orientation
00093                         );
00094 void fix_row_pitch(                        //get some value
00095                    TO_ROW *bad_row,        //row to fix
00096                    TO_BLOCK *bad_block,    //block of bad_row
00097                    TO_BLOCK_LIST *blocks,  //blocks to scan
00098                    INT32 row_target,       //number of row
00099                    INT32 block_target      //number of block
00100                   );
00101 void compute_block_pitch(                    //process each block
00102                          TO_BLOCK *block,    //input list
00103                          FCOORD rotation,    //for drawing
00104                          INT32 block_index,  //block number
00105                          BOOL8 testing_on    //correct orientation
00106                         );
00107 BOOL8 compute_rows_pitch(                    //find line stats
00108                          TO_BLOCK *block,    //block to do
00109                          INT32 block_index,  //block number
00110                          BOOL8 testing_on    //correct orientation
00111                         );
00112 BOOL8 try_doc_fixed(                             //determine pitch
00113                     ICOORD page_tr,              //top right
00114                     TO_BLOCK_LIST *port_blocks,  //input list
00115                     float gradient               //page skew
00116                    );
00117 BOOL8 try_block_fixed(                   //find line stats
00118                       TO_BLOCK *block,   //block to do
00119                       INT32 block_index  //block number
00120                      );
00121 BOOL8 try_rows_fixed(                    //find line stats
00122                      TO_BLOCK *block,    //block to do
00123                      INT32 block_index,  //block number
00124                      BOOL8 testing_on    //correct orientation
00125                     );
00126 void print_block_counts(                   //find line stats
00127                         TO_BLOCK *block,   //block to do
00128                         INT32 block_index  //block number
00129                        );
00130 void count_block_votes(                   //find line stats
00131                        TO_BLOCK *block,   //block to do
00132                        INT32 &def_fixed,  //add to counts
00133                        INT32 &def_prop,
00134                        INT32 &maybe_fixed,
00135                        INT32 &maybe_prop,
00136                        INT32 &corr_fixed,
00137                        INT32 &corr_prop,
00138                        INT32 &dunno);
00139 BOOL8 row_pitch_stats(                  //find line stats
00140                       TO_ROW *row,      //current row
00141                       INT32 maxwidth,   //of spaces
00142                       BOOL8 testing_on  //correct orientation
00143                      );
00144 BOOL8 find_row_pitch(                    //find lines
00145                      TO_ROW *row,        //row to do
00146                      INT32 maxwidth,     //max permitted space
00147                      INT32 dm_gap,       //ignorable gaps
00148                      TO_BLOCK *block,    //block of row
00149                      INT32 block_index,  //block_number
00150                      INT32 row_index,    //number of row
00151                      BOOL8 testing_on    //correct orientation
00152                     );
00153 BOOL8 fixed_pitch_row(                   //find lines
00154                       TO_ROW *row,       //row to do
00155                       INT32 block_index  //block_number
00156                      );
00157 BOOL8 count_pitch_stats(                       //find lines
00158                         TO_ROW *row,           //row to do
00159                         STATS *gap_stats,      //blob gaps
00160                         STATS *pitch_stats,    //centre-centre stats
00161                         float initial_pitch,   //guess at pitch
00162                         float min_space,       //estimate space size
00163                         BOOL8 ignore_outsize,  //discard big objects
00164                         BOOL8 split_outsize,   //split big objects
00165                         INT32 dm_gap           //ignorable gaps
00166                        );
00167 float tune_row_pitch(                             //find fp cells
00168                      TO_ROW *row,                 //row to do
00169                      STATS *projection,           //vertical projection
00170                      INT16 projection_left,       //edge of projection
00171                      INT16 projection_right,      //edge of projection
00172                      float space_size,            //size of blank
00173                      float &initial_pitch,        //guess at pitch
00174                      float &best_sp_sd,           //space sd
00175                      INT16 &best_mid_cuts,        //no of cheap cuts
00176                      ICOORDELT_LIST *best_cells,  //row cells
00177                      BOOL8 testing_on             //inidividual words
00178                     );
00179 float tune_row_pitch2(                             //find fp cells
00180                       TO_ROW *row,                 //row to do
00181                       STATS *projection,           //vertical projection
00182                       INT16 projection_left,       //edge of projection
00183                       INT16 projection_right,      //edge of projection
00184                       float space_size,            //size of blank
00185                       float &initial_pitch,        //guess at pitch
00186                       float &best_sp_sd,           //space sd
00187                       INT16 &best_mid_cuts,        //no of cheap cuts
00188                       ICOORDELT_LIST *best_cells,  //row cells
00189                       BOOL8 testing_on             //inidividual words
00190                      );
00191 float compute_pitch_sd (         //find fp cells
00192 TO_ROW * row,                    //row to do
00193 STATS * projection,              //vertical projection
00194 INT16 projection_left,           //edge
00195 INT16 projection_right,          //edge
00196 float space_size,                //size of blank
00197 float initial_pitch,             //guess at pitch
00198 float &sp_sd,                    //space sd
00199 INT16 & mid_cuts,                //no of free cuts
00200 ICOORDELT_LIST * row_cells,      //list of chop pts
00201 BOOL8 testing_on,                //inidividual words
00202 INT16 start = 0,                 //start of good range
00203 INT16 end = 0                    //end of good range
00204 );
00205 float compute_pitch_sd2 (        //find fp cells
00206 TO_ROW * row,                    //row to do
00207 STATS * projection,              //vertical projection
00208 INT16 projection_left,           //edge
00209 INT16 projection_right,          //edge
00210 float initial_pitch,             //guess at pitch
00211 INT16 & occupation,              //no of occupied cells
00212 INT16 & mid_cuts,                //no of free cuts
00213 ICOORDELT_LIST * row_cells,      //list of chop pts
00214 BOOL8 testing_on,                //inidividual words
00215 INT16 start = 0,                 //start of good range
00216 INT16 end = 0                    //end of good range
00217 );
00218 void print_pitch_sd(                        //find fp cells
00219                     TO_ROW *row,            //row to do
00220                     STATS *projection,      //vertical projection
00221                     INT16 projection_left,  //edges //size of blank
00222                     INT16 projection_right,
00223                     float space_size,
00224                     float initial_pitch     //guess at pitch
00225                    );
00226 int sort_floats2(                   //qsort function
00227                  const void *arg1,  //ptrs to floats
00228                  const void *arg2);
00229 void find_repeated_chars(                  //search for equal chars
00230                          TO_BLOCK *block,  //block to search
00231                          BOOL8 testing_on  //dbug mode
00232                         );
00233 void plot_fp_word(                  //draw block of words
00234                   TO_BLOCK *block,  //block to draw
00235                   float pitch,      //pitch to draw with
00236                   float nonspace    //for space threshold
00237                  );
00238 #endif

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