Main Page   Compound List   File List   Compound Members   File Members  

gocr.h File Reference

This is the main header. More...

Go to the source code of this file.

GOCR attributes

typedef enum attributetype gocrAttributeType
 Typedef encapsulation.

enum  attributetype {
  VERBOSE,
  BLOCK_OVERLAP,
  NO_BLOCK,
  ERROR_FILE,
  PRINT,
  PRINT_IMAGE
}
 Attributes of GOCR API that can be set by the user. More...

int gocr_setAttribute ( gocrAttributeType t, void *value )
 Sets an attribute value. See enum for list. More...

void* gocr_getAttribute ( gocrAttributeType t )
 Gets an attribute value. More...


Module system

typedef enum moduletype gocr_moduleType
 Typedef encapsulation.

enum  moduletype {
  grayImageFilter,
  grayToBW,
  bwImageFilter,
  blockFinder,
  charFinder,
  charRecognizer,
  contextCorrection,
  outputFormatter,
  allModules
}
 This is the module type list. More...

int gocr_moduleLoad ( char *filename )
 opens a module. More...

void gocr_moduleClose ( int id )
 closes a module. More...

int gocr_moduleSetAttribute ( int id, void *a, void *b )
 sets the attribute of a module. More...

int gocr_functionInsertBefore ( gocr_moduleType t, char *functionname, void *data, int id )
 inserts a module function in the list. More...

int gocr_functionAppend ( gocr_moduleType t, char *functionname, void *data )
 appends a module function to the list. More...

void* gocr_functionDeleteById ( int id )
 deletes a module function of the list. More...

int gocr_runAllModules ( void )

Initialization/finalization

int gocr_init ( int argc, char **argv )
 Inits the library. More...

void gocr_finalize ( void )
 Close library. More...


Image

int gocr_imageLoad ( const char *filename )
 Loads an image. More...

void gocr_imageClose ( void )
 Closes an image. More...


Detailed Description

This is the main header.


Enumeration Type Documentation

enum attributetype
 

Attributes of GOCR API that can be set by the user.

Enumeration values:
VERBOSE   Sets the verbose level.\ Minimum = 0, Maximum = 3.\ Default: 1.
BLOCK_OVERLAP   If true, allows blocks to overlap.\ Default: 0.
NO_BLOCK   If true, and no block was found, creates a block covering the entire image.\ Default: 1.
ERROR_FILE   A (FILE *) pointer, to which all error messages will be output.\ Default: stderr.
PRINT   An integer from 0 to 6, that..
PRINT_IMAGE   If set to 1, when a gocr_print* function is called it prints the image too.\ Default: 1.

enum moduletype
 

This is the module type list.

Enumeration values:
grayImageFilter   operations done to the gray image.
grayToBW   gray to bw conversor.
bwImageFilter   operations done to the B&W image.
blockFinder   operations to separate image in blocks, detect pictures, layout, font type, etc.
charFinder   find individual characters in blocks.
charRecognizer   recognize characters individually.
contextCorrection   works on unrecognized characters.
outputFormatter   outputs the recognized text.
allModules   number of modules.


Function Documentation

int gocr_init ( int argc,
char ** argv )
 

Inits the library.

This function must be called before any other GOCR function.

Parameters:
argc   number of arguments.
argv   the arguments.
Returns:
0 if OK, -1 if error occurred.

void gocr_finalize ( void )
 

Close library.

This function must be called when you don't intend to use GOCR lib anymore.

int gocr_setAttribute ( gocrAttributeType t,
void * value )
 

Sets an attribute value. See enum for list.

Parameters:
t   Attribute type.
value   Attribute value, cast to void *.
See also:
gocr_getAttribute().
Returns:
0 if OK, -1 if error occurred.

void * gocr_getAttribute ( gocrAttributeType t )
 

Gets an attribute value.

Parameters:
t   Attribute type.
See also:
gocr_setAttribute().
Returns:
The attribute value, cast to (void *).

int gocr_imageLoad ( const char * filename )
 

Loads an image.

This function loads an image to the currentimage structure.

Parameters:
filename   The file name.
Returns:
0 if OK, or -1 if error.

void gocr_imageClose ( void )
 

Closes an image.

This function closes the image in currentimage, freeing all memory.

int gocr_moduleLoad ( char * filename )
 

opens a module.

Long description.

Parameters:
filename   The name of the module file.
See also:
gocr_moduleClose()
Returns:
the module id (an integer >= 0), or -1 if error.

void gocr_moduleClose ( int id )
 

closes a module.

Given the library id, closes the module and frees every module function associated with it.

Parameters:
id   The module id.
See also:
gocr_moduleLoad()

int gocr_moduleSetAttribute ( int id,
void * a,
void * b )
 

sets the attribute of a module.

Sets the attribute of a module, if the module exports a function to set its attributes. Refer to the module documentation.

Parameters:
id   The module id.
a   A parameter to pass to the module.
b   A second parameter to pass to the module.
Returns:
what the module attribute function returned, or -1 if there was not such function or module.

int gocr_functionInsertBefore ( gocr_moduleType t,
char * functionname,
void * data,
int id )
 

inserts a module function in the list.

Inserts a function of module type t and name functionname before function id, and with user supplied data.

Parameters:
t   The module type.
functionname   The name of the function.
data   A pointer to the data to be passed to this function.
id   The function that will be after the inserted one.
See also:
gocr_functionAppend()
Returns:
the module function id (integer >= 0), or -1 if an error occurred.

int gocr_functionAppend ( gocr_moduleType t,
char * functionname,
void * data )
 

appends a module function to the list.

Appends a function of module type t, name functionname and with user supplied data to the end of the module function list.

Parameters:
t   The module type.
functionname   The name of the function.
data   A pointer to the data to be passed to this function.
See also:
gocr_functionInsertBefore()
Returns:
The module function id (integer >= 0), or -1 if an error occurred.

void * gocr_functionDeleteById ( int id )
 

deletes a module function of the list.

Deletes a module function, given its id, of the list, and returns the associated data.

Parameters:
id   The module function id.
See also:
gocr_functionDeleteByName?
Returns:
The associated data, which should be freed by the user.


Generated at Thu Mar 1 10:05:33 2001 for GOCR API by doxygen1.2.2 written by Dimitri van Heesch, © 1997-2000