Main Page | Class List | Directories | File List | Class 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 gocr_attributetype gocr_AttributeType
 Typedef encapsulation.
enum  gocr_attributetype {
  LIBVERSION, VERBOSE, BLOCK_OVERLAP, NO_BLOCK,
  CHAR_OVERLAP, CHAR_RECTANGLES, FIND_ALL, ERROR_FILE,
  PRINT, PRINT_IMAGE
}
 Attributes of GOCR API that can be set by the user. More...
int gocr_setAttribute (gocr_AttributeType t, void *value)
 Sets an attribute value.
void * gocr_getAttribute (gocr_AttributeType t)
 Gets an attribute value.

Module system

typedef enum gocr_moduletype gocr_ModuleType
 Typedef encapsulation.
typedef int gocr_ModuleId
typedef int gocr_ModuleFunctionId
enum  gocr_moduletype {
  imageLoader = 0, imageFilter, blockFinder, charFinder,
  charRecognizer, contextCorrection, outputFormatter, allModules
}
 This is the module type list. More...
gocr_ModuleId gocr_moduleLoad (char *filename)
 opens a module package
void gocr_moduleClose (gocr_ModuleId id)
 closes a module
int gocr_moduleSetAttribute (gocr_ModuleId id, char *a, char *b)
 sets the attribute of a module.
const struct gocr_moduleattributeinfogocr_moduleGetAttributeList (gocr_ModuleId id)
 gets the attribute list of a module package.
const struct gocr_modulefunctioninfogocr_moduleGetFunctionList (gocr_ModuleId id)
 gets the function list of a module package.
gocr_ModuleFunctionId gocr_functionInsertBefore (char *functionname, gocr_ModuleId mid, void *data, gocr_ModuleFunctionId func)
 inserts a module function in the list.
gocr_ModuleFunctionId gocr_functionAppend (char *functionname, gocr_ModuleId mid, void *data)
 appends a module function to the list.
void * gocr_functionDeleteById (gocr_ModuleFunctionId id)
 deletes a module function of the list.
int gocr_runAllModules (void)
 process the image.

GUI functions

typedef enum gocr_guifunction gocr_GUIFunction
enum  gocr_guifunction {
  gocr_BeginWindow, gocr_EndWindow, gocr_DisplayCheckButton, gocr_DisplayImage,
  gocr_DisplayRadioButtons, gocr_DisplaySpinButton, gocr_DisplayText, gocr_DisplayTextField
}
int gocr_guiSetFunction (gocr_GUIFunction type, void *func)
 sets a GUI wrapper function.

Initialization/finalization

*int gocr_init (int argc, char **argv)
 Inits the library.
void gocr_finalize (void)
 Close library.

Image

void gocr_imageClose (void)
 Closes an image.
*int(* gocr_imageLoad )(const char *filename, void *data)

Defines

#define GOCR_FALSE   0
 FALSE value.
#define GOCR_TRUE   1
 TRUE value.


Detailed Description

This is the main header.

Author:
Bruno Barberi Gnecco <brunobg@sourceforge.net>

Enumeration Type Documentation

enum gocr_attributetype
 

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

Enumerator:
LIBVERSION  Library version.
VERBOSE  Sets the verbose level. Minimum = 0, Maximum = 3. Default: 1.
BLOCK_OVERLAP  If true, allows blocks to overlap. Default: FALSE.
NO_BLOCK  If true, and no block was found, creates a block covering the entire image. Default: TRUE.
CHAR_OVERLAP  If true, allows characters to overlap. Default: TRUE.
CHAR_RECTANGLES  If true, all characters are rectangles. Default: TRUE.
FIND_ALL  If true, first find all characters, saving in memory, and then process.

Default: FALSE

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 true, when a gocr_print* function is called it prints the image too. Default: TRUE.

enum gocr_moduletype
 

This is the module type list.

Enumerator:
imageLoader  loads image
imageFilter  operations done to 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.
See also:
gocr_finalize.
Return values:
0 OK
-1 error.

void gocr_finalize void   ) 
 

Close library.

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

int gocr_setAttribute gocr_AttributeType  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.
Return values:
0 OK
-1 error.
-2 Cannot change currently.

void* gocr_getAttribute gocr_AttributeType  t  ) 
 

Gets an attribute value.

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

void gocr_imageClose void   ) 
 

Closes an image.

This function closes the image in currentimage, freeing all memory associated with it (except block structures).

gocr_ModuleId gocr_moduleLoad char *  filename  ) 
 

opens a module package

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 gocr_ModuleId  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 gocr_ModuleId  id,
char *  a,
char *  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.

const struct gocr_moduleattributeinfo* gocr_moduleGetAttributeList gocr_ModuleId  id  ) 
 

gets the attribute list of a module package.

Parameters:
id The module id.
Returns:
A pointer to a gocr_ModuleAttributeInfo structure, or NULL if the module wasn't found.

const struct gocr_modulefunctioninfo* gocr_moduleGetFunctionList gocr_ModuleId  id  ) 
 

gets the function list of a module package.

Parameters:
id The module id.
Returns:
A pointer to a gocr_ModuleFunctionInfo structure, or NULL if the module wasn't found.

gocr_ModuleFunctionId gocr_functionInsertBefore char *  functionname,
gocr_ModuleId  mid,
void *  data,
gocr_ModuleFunctionId  func
 

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:
functionname The name of the function.
m The id of the module package that contains this function.
data A pointer to the data to be passed to this function.
func The id of the function that will be after the inserted one. If -1, appends.
See also:
gocr_functionAppend
Returns:
the module function id (integer >= 0), or -1 if an error occurred.

gocr_ModuleFunctionId gocr_functionAppend char *  functionname,
gocr_ModuleId  mid,
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 gocr_ModuleFunctionId  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.

int gocr_runAllModules void   ) 
 

process the image.

This function calls every module function that were added, in correct order, taking care of all internal problems.

Return values:
0 OK
-1 error.

int gocr_guiSetFunction gocr_GUIFunction  f,
void *  func
 

sets a GUI wrapper function.

long description

Parameters:
f The function type.
func A pointer to the function.
Return values:
0 OK
-1 error.


Generated on Sun Jul 31 13:19:14 2005 for GOCR API by  doxygen 1.4.3-20050530