Skip to content

Commit

Permalink
partial merge of doxygen branch (stuff without conflicts, basically)
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@441 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
joregan committed Jul 27, 2010
1 parent 4acaabd commit a18816f
Show file tree
Hide file tree
Showing 65 changed files with 4,742 additions and 2,585 deletions.
584 changes: 339 additions & 245 deletions api/baseapi.h

Large diffs are not rendered by default.

63 changes: 41 additions & 22 deletions api/tesseractmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,52 @@ extern BOOL_VAR_H(tessedit_write_images, FALSE,
"Capture the image from the IPE");
extern BOOL_VAR_H(tessedit_debug_to_screen, FALSE, "Dont use debug file");

inT32 api_main( //run from api
const char *arg0, //program name
uinT16 lang //language
);
inT16 setup_info( //setup dummy engine info
uinT16 lang, //user language
const char *name, //of engine
const char *version //of engine
);
inT16 read_image( //read dummy image info
IMAGE *im_out //output image
);
/**
* run from api
* @param arg0 program name
* @param lang language
*/
inT32 api_main(const char *arg0,
uinT16 lang);
/**
* setup dummy engine info
* @param lang user language
* @param name of engine
* @param version of engine
*/
inT16 setup_info(uinT16 lang,
const char *name,
const char *version);
/**
* read dummy image info
* @param im_out read dummy image info
*/
inT16 read_image(IMAGE *im_out);
#ifdef __MSW32__
int WINAPI WinMain( //main for windows //command line
HINSTANCE hInstance,
/**
* main for windows command line
*/
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow);
LONG WINAPI WndProc( //message handler
HWND hwnd, //window with message
UINT msg, //message typ
/**
* message handler
* @param hwnd window with message
* @param msg message type
*/
LONG WINAPI WndProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
int parse_args ( /*refine arg list */
int argc, /*no of input args */
char *argv[], /*input args */
char *arglist[] /*output args */
);
/**
* refine argument list
* @param argc number of input arguments
* @param argv input arguments
* @param arglist output arguments
*/
int parse_args (int argc,
char *argv[],
char *arglist[]);
#endif
#endif
7 changes: 5 additions & 2 deletions ccmain/callnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
#define CALLNET_H

// extern "C" {
void init_net(); /* Initialise net */
void callnet( /* Apply image to net */
/** Initialise net */
void init_net();

/** Apply image to net */
void callnet(
float *input_vector,
char *top,
float *top_score,
Expand Down
121 changes: 79 additions & 42 deletions ccmain/charcut.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
** limitations under the License.
*
**********************************************************************/
/**
* @file charcut.h
* @note Formerly charclip.h
* @brief Code for character clipping
* @author Phil Cheatle
* @date Created Wed Nov 11 08:35:15 GMT 1992
*
*/

#ifndef CHARCUT_H
#define CHARCUT_H
Expand All @@ -25,69 +33,95 @@
#include "notdll.h"
class ScrollView;

/*************************************************************************
* CLASS PIXROW
/**
* @class PIXROW
*
* This class describes the pixels occupied by a blob. It uses two arrays, (min
* and max), each with one element per row, to identify the min and max x
* coordinates of the black pixels in the character on that row of the image.
* The number of rows used to describe the blob is held in row_count - note that
* some rows may be unoccupied - signified by max < min. The page coordinate of
* the row defined by min[0] and max[0] is held in row_offset.
*************************************************************************/
*/

class PIXROW:public ELIST_LINK
{
public:
inT16 row_offset; //y coord of min[0]
inT16 row_count; //length of arrays
inT16 *min; //array of min x
inT16 *max; //array of max x

PIXROW() { //empty constructor
inT16 row_offset; ///< y coord of min[0]
inT16 row_count; ///< length of arrays
inT16 *min; ///< array of min x
inT16 *max; ///< array of max x
/** empty constructor */
PIXROW() {
row_offset = 0;
row_count = 0;
min = NULL;
max = NULL;
}
PIXROW( //specified size
/** specified size */
PIXROW(
inT16 pos,
inT16 count,
PBLOB *blob);

~PIXROW () { //destructor
/** destructor */
~PIXROW () {
if (min != NULL)
free_mem(min);
if (max != NULL)
free_mem(max);
max = NULL;
}

void plot( //use current settings
ScrollView* fd) const; //where to paint
/**
* use current settings
* @param fd where to paint
*/
void plot(ScrollView* fd) const;

/**
* return bounding box
* @return true if box exceeds image
*/
TBOX bounding_box() const;

TBOX bounding_box() const; //return bounding box
//return true if box exceeds image
bool bad_box(int xsize, int ysize) const;

void contract( //force end on black
IMAGELINE *imlines, //image array
inT16 x_offset, //of pixels[0]
inT16 foreground_colour); //0 or 1
/**
* force end on black
* @param imlines image array
* @param x_offset of pixels[0]
* @param foreground_colour 0 or 1
*/
void contract(
IMAGELINE *imlines,
inT16 x_offset,
inT16 foreground_colour);

//image array
/**
* @param imlines image array
* @param imbox image box
* @param prev for prev blob
* @param next for next blob
* @param foreground_colour 0 or 1
*/
BOOL8 extend(IMAGELINE *imlines,
TBOX &imbox,
PIXROW *prev, //for prev blob
PIXROW *next, //for next blob
inT16 foreground_colour); //0 or 1
PIXROW *prev,
PIXROW *next,
inT16 foreground_colour);

//box of imlines extnt
/**
* @param imlines box of imlines extnt
* @param imbox image box
* @param row row containing word
* @param clip_image unscaled char image
* @param baseline_pos baseline ht in image
*/
void char_clip_image(IMAGELINE *imlines,
TBOX &im_box,
ROW *row, //row containing word
IMAGE &clip_image, //unscaled char image
float &baseline_pos); //baseline ht in image
ROW *row,
IMAGE &clip_image,
float &baseline_pos);

};

Expand All @@ -97,24 +131,27 @@ extern BOOL_VAR_H (show_char_clipping, TRUE, "Show clip image window?");
extern INT_VAR_H (net_image_width, 40, "NN input image width");
extern INT_VAR_H (net_image_height, 36, "NN input image height");
extern INT_VAR_H (net_image_x_height, 22, "NN input image x_height");
void char_clip_word( //
WERD *word, //word to be processed
IMAGE &bin_image, //whole image
PIXROW_LIST *&pixrow_list, //pixrows built
IMAGELINE *&imlines, //lines cut from image
TBOX &pix_box //box defining imlines
void char_clip_word(
WERD *word, ///< word to be processed
IMAGE &bin_image, ///< whole image
PIXROW_LIST *&pixrow_list, ///< pixrows built
IMAGELINE *&imlines, ///< lines cut from image
TBOX &pix_box ///< box defining imlines
);
IMAGELINE *generate_imlines( //get some imagelines
IMAGE &bin_image, //from here
/** get some imagelines */
IMAGELINE *generate_imlines(
IMAGE &bin_image, ///< from here
TBOX &pix_box);
//word to be processed
ScrollView* display_clip_image(WERD *word,
IMAGE &bin_image, //whole image
PIXROW_LIST *pixrow_list, //pixrows built
TBOX &pix_box //box of subimage

ScrollView* display_clip_image(WERD *word, ///< word to be processed
IMAGE &bin_image, ///< whole image
PIXROW_LIST *pixrow_list, ///< pixrows built
TBOX &pix_box ///< box of subimage
);
void display_images(IMAGE &clip_image, IMAGE &scaled_image);
void plot_pixrows( //plot for all blobs

/** plot for all blobs */
void plot_pixrows(
PIXROW_LIST *pixrow_list,
ScrollView* win);
#endif
84 changes: 54 additions & 30 deletions ccmain/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
*
**********************************************************************/

/**
* @file control.h
* Module-independent matcher controller.
*/

#ifndef CONTROL_H
#define CONTROL_H

Expand All @@ -34,12 +39,12 @@

enum ACCEPTABLE_WERD_TYPE
{
AC_UNACCEPTABLE, //Unacceptable word
AC_LOWER_CASE, //ALL lower case
AC_UPPER_CASE, //ALL upper case
AC_INITIAL_CAP, //ALL but initial lc
AC_LC_ABBREV, //a.b.c.
AC_UC_ABBREV //A.B.C.
AC_UNACCEPTABLE, ///< Unacceptable word
AC_LOWER_CASE, ///< ALL lower case
AC_UPPER_CASE, ///< ALL upper case
AC_INITIAL_CAP, ///< ALL but initial lc
AC_LC_ABBREV, ///< a.b.c.
AC_UC_ABBREV ///< A.B.C.
};

typedef BOOL8 (*BLOB_REJECTOR) (PBLOB *, BLOB_CHOICE_IT *, void *);
Expand Down Expand Up @@ -139,38 +144,57 @@ void classify_word_pass1( //recog one word
*/
//word to do
void classify_word_pass2(WERD_RES *word, ROW *row);
void match_word_pass2( //recog one word
WERD_RES *word, //word to do
/**
* recognize one word
* @param word word to do
*/
void match_word_pass2(
WERD_RES *word,
ROW *row,
float x_height);
void fix_hyphens( //crunch double hyphens
WERD_CHOICE *choice, //string to fix
WERD *word, //word to do //char choices
/**
* crunch double hyphens
* @param choice string to fix
* @param word word to do
* @param blob_choices char choices
*/
void fix_hyphens(
WERD_CHOICE *choice,
WERD *word,
BLOB_CHOICE_LIST_CLIST *blob_choices);
void merge_blobs( //combine 2 blobs
PBLOB *blob1, //dest blob
PBLOB *blob2 //source blob

/**
* combine 2 blobs
* @param blob1 dest blob
* @param blob2 source blob
*/
void merge_blobs(
PBLOB *blob1,
PBLOB *blob2
);
void choice_dump_tester( //dump chars in word
PBLOB *, //blob
DENORM *, //de-normaliser
BOOL8 correct, //ly segmented
char *text, //correct text
inT32 count, //chars in text
BLOB_CHOICE_LIST *ratings //list of results
/** dump chars in word */
void choice_dump_tester(
PBLOB *, ///< blob
DENORM *, ///< de-normaliser
BOOL8 correct, ///< ly segmented
char *text, ///< correct text
inT32 count, ///< chars in text
BLOB_CHOICE_LIST *ratings ///< list of results
);
WERD *make_bln_copy(WERD *src_word, ROW *row, BLOCK* block,
float x_height, DENORM *denorm);
BOOL8 check_debug_pt(WERD_RES *word, int location);
void add_in_one_row( //good chars in word
ROW_RES *row, //current row
STATS *fonts, //font stats
inT8 *italic, //output count
inT8 *bold //output count
/** good chars in word */
void add_in_one_row(
ROW_RES *row, ///< current row
STATS *fonts, ///< font stats
inT8 *italic, ///< output count
inT8 *bold ///< output count
);
void find_modal_font( //good chars in word
STATS *fonts, //font stats
inT8 *font_out, //output font
inT8 *font_count //output count
/** good chars in word */
void find_modal_font(
STATS *fonts, ///< font stats
inT8 *font_out, ///< output font
inT8 *font_count ///< output count
);
#endif
2 changes: 1 addition & 1 deletion ccmain/fixspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extern BOOL_VAR_H (tessedit_test_uniform_wd_spacing, FALSE,
"Limit context word spacing");
extern BOOL_VAR_H (tessedit_prefer_joined_punct, FALSE,
"Reward punctation joins");
extern INT_VAR_H (fixsp_done_mode, 1, "What constitues done for spacing");
extern INT_VAR_H (fixsp_done_mode, 1, "What constitutes done for spacing");
extern INT_VAR_H (debug_fix_space_level, 0, "Contextual fixspace debug");
extern STRING_VAR_H (numeric_punctuation, ".,",
"Punct. chs expected WITHIN numbers");
Expand Down
Loading

0 comments on commit a18816f

Please sign in to comment.