net.sourceforge.tess4j
Class TessDllAPI1

java.lang.Object
  extended by net.sourceforge.tess4j.TessDllAPI1
All Implemented Interfaces:
com.sun.jna.Library
Direct Known Subclasses:
Tesseract1

public class TessDllAPI1
extends java.lang.Object
implements com.sun.jna.Library

A Java wrapper for Tesseract OCR DLL using JNA Direct Mapping.


Nested Class Summary
static interface TessDllAPI1.CANCEL_FUNC
          Callback for cancel_func.
 
Nested classes/interfaces inherited from interface com.sun.jna.Library
com.sun.jna.Library.Handler
 
Field Summary
static java.lang.String LIB_NAME
          DLL library name.
 
Fields inherited from interface com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
 
Constructor Summary
TessDllAPI1()
           
 
Method Summary
static int TessDllBeginPage(int xsize, int ysize, java.nio.ByteBuffer buf)
          BeginPage assumes the first memory address is the bottom of the image (MS DIB format).
static int TessDllBeginPageBPP(int xsize, int ysize, java.nio.ByteBuffer buf, byte bpp)
          BeginPage assumes the first memory address is the bottom of the image (MS DIB format).
static int TessDllBeginPageLang(int xsize, int ysize, java.nio.ByteBuffer buf, java.lang.String lang)
          BeginPage assumes the first memory address is the bottom of the image (MS DIB format).
static int TessDllBeginPageLangBPP(int xsize, int ysize, java.nio.ByteBuffer buf, java.lang.String lang, byte bpp)
          BeginPage assumes the first memory address is the bottom of the image (MS DIB format).
static int TessDllBeginPageUpright(int xsize, int ysize, java.nio.ByteBuffer buf, java.lang.String lang)
          BeginPageUpright assumes the first memory address is the top of the image (TIFF format).
static int TessDllBeginPageUprightBPP(int xsize, int ysize, java.nio.ByteBuffer buf, java.lang.String lang, byte bpp)
          BeginPageUpright assumes the first memory address is the top of the image (TIFF format).
static void TessDllEndPage()
          Ends page.
static ETEXT_DESC TessDllRecognize_a_Block(int left, int right, int top, int bottom)
          Recognizes one word or section from the bitmap or the whole page.
static ETEXT_DESC TessDllRecognize_all_Words()
          Recognizes the whole page.
static void TessDllRelease()
          Releases any memory associated with the recognize class object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIB_NAME

public static final java.lang.String LIB_NAME
DLL library name.

See Also:
Constant Field Values
Constructor Detail

TessDllAPI1

public TessDllAPI1()
Method Detail

TessDllBeginPage

public static int TessDllBeginPage(int xsize,
                                   int ysize,
                                   java.nio.ByteBuffer buf)
BeginPage assumes the first memory address is the bottom of the image (MS DIB format).

Parameters:
xsize - width of image
ysize - height of image
buf - a buffer of bytes for a 1 bit per pixel bitmap
Returns:

TessDllBeginPageLang

public static int TessDllBeginPageLang(int xsize,
                                       int ysize,
                                       java.nio.ByteBuffer buf,
                                       java.lang.String lang)
BeginPage assumes the first memory address is the bottom of the image (MS DIB format).

Parameters:
xsize - width of image
ysize - height of image
buf - a buffer of bytes for a 1 bit per pixel bitmap
lang - the code of the language for which the data will be loaded. Codes follow ISO 639-3 standard. If it is null, English (eng) will be loaded.
Returns:

TessDllBeginPageUpright

public static int TessDllBeginPageUpright(int xsize,
                                          int ysize,
                                          java.nio.ByteBuffer buf,
                                          java.lang.String lang)
BeginPageUpright assumes the first memory address is the top of the image (TIFF format).

Parameters:
xsize - width of image
ysize - height of image
buf - a buffer of bytes for a 1 bit per pixel bitmap
lang - the code of the language for which the data will be loaded. Codes follow ISO 639-3 standard. If it is null, English (eng) will be loaded.
Returns:

TessDllBeginPageBPP

public static int TessDllBeginPageBPP(int xsize,
                                      int ysize,
                                      java.nio.ByteBuffer buf,
                                      byte bpp)
BeginPage assumes the first memory address is the bottom of the image (MS DIB format).

Parameters:
xsize - width of image
ysize - height of image
buf - a buffer of bytes for a bitmap
bpp - bit depth (bits per pixel): 1 for binary bitmap; 8 for gray; 24 for color RGB
Returns:

TessDllBeginPageLangBPP

public static int TessDllBeginPageLangBPP(int xsize,
                                          int ysize,
                                          java.nio.ByteBuffer buf,
                                          java.lang.String lang,
                                          byte bpp)
BeginPage assumes the first memory address is the bottom of the image (MS DIB format).

Parameters:
xsize - width of image
ysize - height of image
buf - a buffer of bytes for a bitmap
lang - the code of the language for which the data will be loaded. Codes follow ISO 639-3 standard. If it is null, English (eng) will be loaded.
bpp - bit depth (bits per pixel): 1 for binary bitmap; 8 for gray; 24 for color RGB
Returns:

TessDllBeginPageUprightBPP

public static int TessDllBeginPageUprightBPP(int xsize,
                                             int ysize,
                                             java.nio.ByteBuffer buf,
                                             java.lang.String lang,
                                             byte bpp)
BeginPageUpright assumes the first memory address is the top of the image (TIFF format).

Parameters:
xsize - width of image
ysize - height of image
buf - a buffer of bytes for a bitmap
lang - the code of the language for which the data will be loaded. Codes follow ISO 639-3 standard. If it is null, English (eng) will be loaded.
bpp - bit depth (bits per pixel): 1 for binary bitmap; 8 for gray; 24 for color RGB
Returns:

TessDllEndPage

public static void TessDllEndPage()
Ends page.


TessDllRecognize_a_Block

public static ETEXT_DESC TessDllRecognize_a_Block(int left,
                                                  int right,
                                                  int top,
                                                  int bottom)
Recognizes one word or section from the bitmap or the whole page. To extract the whole page, just enter zeros for left, right, top, bottom. Limit of 32000 characters can be returned.
Note: Getting one word at time is not yet optimized for speed.

Parameters:
left - left of block
right - right of block
top - top of block
bottom - bottom of block
Returns:

TessDllRecognize_all_Words

public static ETEXT_DESC TessDllRecognize_all_Words()
Recognizes the whole page. Limit of 32000 characters can be returned.

Returns:

TessDllRelease

public static void TessDllRelease()
Releases any memory associated with the recognize class object.