Package org.bytedeco.tesseract
Class TessBaseAPI
- java.lang.Object
-
- org.bytedeco.javacpp.Pointer
-
- org.bytedeco.tesseract.TessBaseAPI
-
- All Implemented Interfaces:
AutoCloseable
@Namespace("tesseract") @NoOffset @Properties(inherit=tesseract.class) public class TessBaseAPI extends Pointer
Base class for all tesseract APIs. Specific classes can add ability to work on different inputs or produce different outputs. This class is mostly an interface layer on top of the Tesseract instance class to hide the data types so that users of this class don't have to include any other Tesseract headers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bytedeco.javacpp.Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
-
-
Constructor Summary
Constructors Constructor Description TessBaseAPI()TessBaseAPI(long size)Native array allocator.TessBaseAPI(Pointer p)Pointer cast constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanAdaptToWordStr(int mode, String wordstr)booleanAdaptToWordStr(int mode, BytePointer wordstr)Applies the given word to the adaptive classifier if possible.IntPointerAllWordConfidences()Returns all word confidences (between 0 and 100) in an array, terminated by -1.PageIteratorAnalyseLayout()Runs page layout analysis in the mode set by SetPageSegMode.PageIteratorAnalyseLayout(boolean merge_similar_words)voidClear()Free up recognition results and any stored image data, without actually freeing any recognition data that would be time-consuming to reload.voidClearAdaptiveClassifier()Call between pages or documents etc to free up memory and forget adaptive data.static voidClearPersistentCache()Clear any library-level memory caches.booleanDetectOrientationScript(int[] orient_deg, float[] orient_conf, byte[] script_name, float[] script_conf)booleanDetectOrientationScript(IntBuffer orient_deg, FloatBuffer orient_conf, ByteBuffer script_name, FloatBuffer script_conf)booleanDetectOrientationScript(IntPointer orient_deg, FloatPointer orient_conf, BytePointer script_name, FloatPointer script_conf)booleanDetectOrientationScript(IntPointer orient_deg, FloatPointer orient_conf, PointerPointer script_name, FloatPointer script_conf)Detect the orientation of the input image and apparent script (alphabet).booleanDetectOS(OSResults arg0)Estimates the Orientation And Script of the image.voidEnd()Close down tesseract and free up all memory.BytePointerGetAltoText(int page_number)Make an XML-formatted string with Alto markup from the internal data structures.BytePointerGetAltoText(ETEXT_DESC monitor, int page_number)Make an XML-formatted string with Alto markup from the internal data structures.voidGetAvailableLanguagesAsVector(StringVector langs)Returns the available languages in the sorted vector of std::string.voidGetBlockTextOrientations(int[] block_orientation, boolean[] vertical_writing)voidGetBlockTextOrientations(int[] block_orientation, BoolPointer vertical_writing)voidGetBlockTextOrientations(IntBuffer block_orientation, boolean[] vertical_writing)voidGetBlockTextOrientations(IntBuffer block_orientation, BoolPointer vertical_writing)voidGetBlockTextOrientations(IntPointer block_orientation, boolean[] vertical_writing)voidGetBlockTextOrientations(IntPointer block_orientation, BoolPointer vertical_writing)voidGetBlockTextOrientations(PointerPointer block_orientation, PointerPointer vertical_writing)Return text orientation of each block as determined by an earlier run of layout analysis.booleanGetBoolVariable(String name, boolean[] value)booleanGetBoolVariable(BytePointer name, BoolPointer value)BytePointerGetBoxText(int page_number)The recognized text is returned as a char* which is coded in the same format as a box file used in training.org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, boolean raw_image, int raw_padding, PointerPointer pixa, PointerPointer blockids, PointerPointer paraids)Get the given level kind of components (block, textline, word etc.) as a leptonica-style Boxa, Pixa pair, in reading order.org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, boolean raw_image, int raw_padding, org.bytedeco.leptonica.PIXA pixa, int[] blockids, int[] paraids)org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, boolean raw_image, int raw_padding, org.bytedeco.leptonica.PIXA pixa, IntBuffer blockids, IntBuffer paraids)org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, boolean raw_image, int raw_padding, org.bytedeco.leptonica.PIXA pixa, IntPointer blockids, IntPointer paraids)org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, PointerPointer pixa, PointerPointer blockids)org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, org.bytedeco.leptonica.PIXA pixa, int[] blockids)org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, org.bytedeco.leptonica.PIXA pixa, IntBuffer blockids)org.bytedeco.leptonica.BOXAGetComponentImages(int level, boolean text_only, org.bytedeco.leptonica.PIXA pixa, IntPointer blockids)org.bytedeco.leptonica.BOXAGetConnectedComponents(PointerPointer cc)Gets the individual connected (text) components (created after pages segmentation step, but before recognition) as a leptonica-style Boxa, Pixa pair, in reading order.org.bytedeco.leptonica.BOXAGetConnectedComponents(org.bytedeco.leptonica.PIXA cc)BytePointerGetDatapath()DawgGetDawg(int i)Return the pointer to the i-th dawg loaded into tesseract_ object.booleanGetDoubleVariable(String name, double[] value)booleanGetDoubleVariable(String name, DoubleBuffer value)booleanGetDoubleVariable(String name, DoublePointer value)booleanGetDoubleVariable(BytePointer name, double[] value)booleanGetDoubleVariable(BytePointer name, DoubleBuffer value)booleanGetDoubleVariable(BytePointer name, DoublePointer value)floatGetGradient()Return average gradient of lines on page.BytePointerGetHOCRText(int page_number)Make a HTML-formatted string with hOCR markup from the internal data structures.BytePointerGetHOCRText(ETEXT_DESC monitor, int page_number)Make a HTML-formatted string with hOCR markup from the internal data structures.BytePointerGetInitLanguagesAsString()Returns the languages string used in the last valid initialization.org.bytedeco.leptonica.PIXGetInputImage()BytePointerGetInputName()These functions are required for searchable PDF output.booleanGetIntVariable(String name, int[] value)booleanGetIntVariable(String name, IntBuffer value)booleanGetIntVariable(String name, IntPointer value)booleanGetIntVariable(BytePointer name, int[] value)booleanGetIntVariable(BytePointer name, IntBuffer value)booleanGetIntVariable(BytePointer name, IntPointer value)Returns true if the parameter was found among Tesseract parameters.ResultIteratorGetIterator()Get a reading-order iterator to the results of LayoutAnalysis and/or Recognize.voidGetLoadedLanguagesAsVector(StringVector langs)Returns the loaded languages in the vector of std::string.BytePointerGetLSTMBoxText(int page_number)Make a box file for LSTM training from the internal data structures.MutableIteratorGetMutableIterator()Get a mutable iterator to the results of LayoutAnalysis and/or Recognize.BytePointerGetOsdText(int page_number)The recognized text is returned as a char* which is coded as UTF8 and must be freed with the delete [] operator.intGetPageSegMode()Return the current page segmentation mode.BytePointerGetPAGEText(int page_number)Make an XML-formatted string with PAGE markup from the internal data structures.BytePointerGetPAGEText(ETEXT_DESC monitor, int page_number)Make an XML-formatted string with PAGE markup from the internal data structures.TessBaseAPIgetPointer(long i)org.bytedeco.leptonica.BOXAGetRegions(PointerPointer pixa)Get the result of page layout analysis as a leptonica-style Boxa, Pixa pair, in reading order.org.bytedeco.leptonica.BOXAGetRegions(org.bytedeco.leptonica.PIXA pixa)intGetSourceYResolution()StringGetStringVariable(String name)BytePointerGetStringVariable(BytePointer name)Returns the pointer to the string that represents the value of the parameter if it was found among Tesseract parameters.org.bytedeco.leptonica.BOXAGetStrips(PointerPointer pixa, PointerPointer blockids)Get textlines and strips of image regions as a leptonica-style Boxa, Pixa pair, in reading order.org.bytedeco.leptonica.BOXAGetStrips(org.bytedeco.leptonica.PIXA pixa, int[] blockids)org.bytedeco.leptonica.BOXAGetStrips(org.bytedeco.leptonica.PIXA pixa, IntBuffer blockids)org.bytedeco.leptonica.BOXAGetStrips(org.bytedeco.leptonica.PIXA pixa, IntPointer blockids)booleanGetTextDirection(int[] out_offset, float[] out_slope)booleanGetTextDirection(IntBuffer out_offset, FloatBuffer out_slope)booleanGetTextDirection(IntPointer out_offset, FloatPointer out_slope)org.bytedeco.leptonica.BOXAGetTextlines(boolean raw_image, int raw_padding, PointerPointer pixa, PointerPointer blockids, PointerPointer paraids)Get the textlines as a leptonica-style Boxa, Pixa pair, in reading order.org.bytedeco.leptonica.BOXAGetTextlines(boolean raw_image, int raw_padding, org.bytedeco.leptonica.PIXA pixa, int[] blockids, int[] paraids)org.bytedeco.leptonica.BOXAGetTextlines(boolean raw_image, int raw_padding, org.bytedeco.leptonica.PIXA pixa, IntBuffer blockids, IntBuffer paraids)org.bytedeco.leptonica.BOXAGetTextlines(boolean raw_image, int raw_padding, org.bytedeco.leptonica.PIXA pixa, IntPointer blockids, IntPointer paraids)org.bytedeco.leptonica.BOXAGetTextlines(PointerPointer pixa, PointerPointer blockids)org.bytedeco.leptonica.BOXAGetTextlines(org.bytedeco.leptonica.PIXA pixa, int[] blockids)org.bytedeco.leptonica.BOXAGetTextlines(org.bytedeco.leptonica.PIXA pixa, IntBuffer blockids)org.bytedeco.leptonica.BOXAGetTextlines(org.bytedeco.leptonica.PIXA pixa, IntPointer blockids)org.bytedeco.leptonica.PIXGetThresholdedImage()Get a copy of the internal thresholded image from Tesseract.intGetThresholdedImageScaleFactor()Returns the scale factor of the thresholded image that would be returned by GetThresholdedImage() and the various GetX() methods that call GetComponentImages().BytePointerGetTSVText(int page_number)Make a TSV-formatted string from the internal data structures.BytePointerGetUnichar(int unichar_id)This method returns the string form of the specified unichar.BytePointerGetUNLVText()The recognized text is returned as a char* which is coded as UNLV format Latin-1 with specific reject and suspect codes.BytePointerGetUTF8Text()The recognized text is returned as a char* which is coded as UTF8 and must be freed with the delete [] operator.booleanGetVariableAsString(String name, BytePointer val)booleanGetVariableAsString(BytePointer name, BytePointer val)Get value of named variable as a string, if it exists.org.bytedeco.leptonica.BOXAGetWords(PointerPointer pixa)Get the words as a leptonica-style Boxa, Pixa pair, in reading order.org.bytedeco.leptonica.BOXAGetWords(org.bytedeco.leptonica.PIXA pixa)BytePointerGetWordStrBoxText(int page_number)The recognized text is returned as a char* which is coded in the same format as a WordStr box file used in training.intInit(String data, int data_size, String language, int mode, byte[] configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params, FileReader reader)intInit(String data, int data_size, String language, int mode, ByteBuffer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params, FileReader reader)intInit(String data, int data_size, String language, int mode, BytePointer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params, FileReader reader)intInit(String datapath, String language)intInit(String datapath, String language, int oem)intInit(String datapath, String language, int mode, byte[] configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params)intInit(String datapath, String language, int mode, ByteBuffer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params)intInit(String datapath, String language, int mode, BytePointer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params)intInit(BytePointer data, int data_size, BytePointer language, int mode, byte[] configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params, FileReader reader)intInit(BytePointer data, int data_size, BytePointer language, int mode, ByteBuffer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params, FileReader reader)intInit(BytePointer data, int data_size, BytePointer language, int mode, BytePointer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params, FileReader reader)intInit(BytePointer data, int data_size, BytePointer language, int mode, PointerPointer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params, FileReader reader)intInit(BytePointer datapath, BytePointer language)intInit(BytePointer datapath, BytePointer language, int oem)intInit(BytePointer datapath, BytePointer language, int mode, byte[] configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params)intInit(BytePointer datapath, BytePointer language, int mode, ByteBuffer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params)intInit(BytePointer datapath, BytePointer language, int mode, BytePointer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params)intInit(BytePointer datapath, BytePointer language, int mode, PointerPointer configs, int configs_size, StringVector vars_vec, StringVector vars_values, boolean set_only_non_debug_params)Instances are now mostly thread-safe and totally independent, but some global parameters remain.voidInitForAnalysePage()Init only for page layout analysis.booleanIsValidCharacter(String utf8_character)booleanIsValidCharacter(BytePointer utf8_character)intIsValidWord(String word)intIsValidWord(BytePointer word)Check whether a word is valid according to Tesseract's language modelintMeanTextConf()Returns the (average) confidence value between 0 and 100.intNumDawgs()Return the number of dawgs loaded into tesseract_ object.intoem()TessBaseAPIposition(long position)voidPrintFontsTable(Pointer fp)Print Tesseract fonts table to the given file.voidPrintVariables(Pointer fp)Print Tesseract parameters to the given file.booleanProcessPage(org.bytedeco.leptonica.PIX pix, int page_index, String filename, String retry_config, int timeout_millisec, TessResultRenderer renderer)booleanProcessPage(org.bytedeco.leptonica.PIX pix, int page_index, BytePointer filename, BytePointer retry_config, int timeout_millisec, TessResultRenderer renderer)Turn a single image into symbolic text.booleanProcessPages(String filename, String retry_config, int timeout_millisec, TessResultRenderer renderer)booleanProcessPages(BytePointer filename, BytePointer retry_config, int timeout_millisec, TessResultRenderer renderer)Turns images into symbolic text.booleanProcessPagesInternal(String filename, String retry_config, int timeout_millisec, TessResultRenderer renderer)booleanProcessPagesInternal(BytePointer filename, BytePointer retry_config, int timeout_millisec, TessResultRenderer renderer)voidReadConfigFile(String filename)voidReadConfigFile(BytePointer filename)Read a "config" file containing a set of param, value pairs.voidReadDebugConfigFile(String filename)voidReadDebugConfigFile(BytePointer filename)Same as above, but only set debug params from the given config file.intRecognize(ETEXT_DESC monitor)Recognize the image from SetAndThresholdImage, generating Tesseract internal structures.voidset_min_orientation_margin(double margin)booleanSetDebugVariable(String name, String value)booleanSetDebugVariable(BytePointer name, BytePointer value)voidSetDictFunc(DictFunc f)Sets Dict::letter_is_okay_ function to point to the given function.voidSetImage(byte[] imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)voidSetImage(ByteBuffer imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)voidSetImage(BytePointer imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)Provide an image for Tesseract to recognize.voidSetImage(org.bytedeco.leptonica.PIX pix)Provide an image for Tesseract to recognize.voidSetInputImage(org.bytedeco.leptonica.PIX pix)voidSetInputName(String name)voidSetInputName(BytePointer name)Set the name of the input file.voidSetOutputName(String name)voidSetOutputName(BytePointer name)Set the name of the bonus output files.voidSetPageSegMode(int mode)Set the current page segmentation mode.voidSetProbabilityInContextFunc(ProbabilityInContextFunc f)Sets Dict::probability_in_context_ function to point to the given function.voidSetRectangle(int left, int top, int width, int height)Restrict recognition to a sub-rectangle of the image.voidSetSourceResolution(int ppi)Set the resolution of the source image in pixels per inch so font size information can be calculated in results.booleanSetVariable(String name, String value)booleanSetVariable(BytePointer name, BytePointer value)Set the value of an internal "parameter." Supply the name of the parameter and the value as a string, just as you would in a config file.Tesseracttesseract()byte[]TesseractRect(byte[] imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)ByteBufferTesseractRect(ByteBuffer imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)BytePointerTesseractRect(BytePointer imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)Recognize a rectangle from an image and return the result as a string.static BytePointerVersion()Returns the version identifier as a static string.-
Methods inherited from class org.bytedeco.javacpp.Pointer
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, trimMemory, withDeallocator, zero
-
-
-
-
Constructor Detail
-
TessBaseAPI
public TessBaseAPI(Pointer p)
Pointer cast constructor. InvokesPointer(Pointer).
-
TessBaseAPI
public TessBaseAPI(long size)
Native array allocator. Access withPointer.position(long).
-
TessBaseAPI
public TessBaseAPI()
-
-
Method Detail
-
position
public TessBaseAPI position(long position)
-
getPointer
public TessBaseAPI getPointer(long i)
- Overrides:
getPointerin classPointer
-
Version
@Cast("const char*") public static BytePointer Version()
Returns the version identifier as a static string. Do not delete.
-
SetInputName
public void SetInputName(@Cast("const char*") BytePointer name)
Set the name of the input file. Needed for training and reading a UNLV zone file, and for searchable PDF output.
-
SetInputName
public void SetInputName(String name)
-
GetInputName
@Cast("const char*") public BytePointer GetInputName()
These functions are required for searchable PDF output. We need our hands on the input file so that we can include it in the PDF without transcoding. If that is not possible, we need the original image. Finally, resolution metadata is stored in the PDF so we need that as well.
-
SetInputImage
public void SetInputImage(org.bytedeco.leptonica.PIX pix)
-
GetInputImage
public org.bytedeco.leptonica.PIX GetInputImage()
-
GetSourceYResolution
public int GetSourceYResolution()
-
GetDatapath
@Cast("const char*") public BytePointer GetDatapath()
-
SetOutputName
public void SetOutputName(@Cast("const char*") BytePointer name)
Set the name of the bonus output files. Needed only for debugging.
-
SetOutputName
public void SetOutputName(String name)
-
SetVariable
@Cast("bool") public boolean SetVariable(@Cast("const char*") BytePointer name, @Cast("const char*") BytePointer value)
Set the value of an internal "parameter." Supply the name of the parameter and the value as a string, just as you would in a config file. Returns false if the name lookup failed. Eg SetVariable("tessedit_char_blacklist", "xyz"); to ignore x, y and z. Or SetVariable("classify_bln_numeric_mode", "1"); to set numeric-only mode. SetVariable may be used before Init, but settings will revert to defaults on End(). Note: Must be called after Init(). Only works for non-init variables (init variables should be passed to Init()).
-
SetDebugVariable
@Cast("bool") public boolean SetDebugVariable(@Cast("const char*") BytePointer name, @Cast("const char*") BytePointer value)
-
GetIntVariable
@Cast("bool") public boolean GetIntVariable(@Cast("const char*") BytePointer name, IntPointer value)
Returns true if the parameter was found among Tesseract parameters. Fills in value with the value of the parameter.
-
GetIntVariable
@Cast("bool") public boolean GetIntVariable(@Cast("const char*") BytePointer name, int[] value)
-
GetIntVariable
@Cast("bool") public boolean GetIntVariable(String name, IntPointer value)
-
GetIntVariable
@Cast("bool") public boolean GetIntVariable(@Cast("const char*") BytePointer name, IntBuffer value)
-
GetBoolVariable
@Cast("bool") public boolean GetBoolVariable(@Cast("const char*") BytePointer name, @Cast("bool*") BoolPointer value)
-
GetBoolVariable
@Cast("bool") public boolean GetBoolVariable(String name, @Cast("bool*") boolean[] value)
-
GetDoubleVariable
@Cast("bool") public boolean GetDoubleVariable(@Cast("const char*") BytePointer name, DoublePointer value)
-
GetDoubleVariable
@Cast("bool") public boolean GetDoubleVariable(String name, DoubleBuffer value)
-
GetDoubleVariable
@Cast("bool") public boolean GetDoubleVariable(@Cast("const char*") BytePointer name, double[] value)
-
GetDoubleVariable
@Cast("bool") public boolean GetDoubleVariable(String name, DoublePointer value)
-
GetDoubleVariable
@Cast("bool") public boolean GetDoubleVariable(@Cast("const char*") BytePointer name, DoubleBuffer value)
-
GetStringVariable
@Cast("const char*") public BytePointer GetStringVariable(@Cast("const char*") BytePointer name)
Returns the pointer to the string that represents the value of the parameter if it was found among Tesseract parameters.
-
PrintFontsTable
public void PrintFontsTable(@Cast("FILE*") Pointer fp)
Print Tesseract fonts table to the given file.
-
PrintVariables
public void PrintVariables(@Cast("FILE*") Pointer fp)
Print Tesseract parameters to the given file.
-
GetVariableAsString
@Cast("bool") public boolean GetVariableAsString(@Cast("const char*") BytePointer name, @StdString @Cast({"char*","std::string*"}) BytePointer val)
Get value of named variable as a string, if it exists.
-
GetVariableAsString
@Cast("bool") public boolean GetVariableAsString(String name, @StdString @Cast({"char*","std::string*"}) BytePointer val)
-
Init
public int Init(@Cast("const char*") BytePointer datapath, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") PointerPointer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params)
Instances are now mostly thread-safe and totally independent, but some global parameters remain. Basically it is safe to use multiple TessBaseAPIs in different threads in parallel, UNLESS: you use SetVariable on some of the Params in classify and textord. If you do, then the effect will be to change it for all your instances. Start tesseract. Returns zero on success and -1 on failure. NOTE that the only members that may be called before Init are those listed above here in the class definition. The datapath must be the name of the tessdata directory. The language is (usually) an ISO 639-3 string or nullptr will default to eng. It is entirely safe (and eventually will be efficient too) to call Init multiple times on the same instance to change language, or just to reset the classifier. The language may be a string of the form [~][+[~] ]* indicating that multiple languages are to be loaded. Eg hin+eng will load Hindi and English. Languages may specify internally that they want to be loaded with one or more other languages, so the ~ sign is available to override that. Eg if hin were set to load eng by default, then hin+~eng would force loading only hin. The number of loaded languages is limited only by memory, with the caveat that loading additional languages will impact both speed and accuracy, as there is more work to do to decide on the applicable language, and there is more chance of hallucinating incorrect words. WARNING: On changing languages, all Tesseract parameters are reset back to their default values. (Which may vary between languages.) If you have a rare need to set a Variable that controls initialization for a second call to Init you should explicitly call End() and then use SetVariable before Init. This is only a very rare use case, since there are very few uses that require any parameters to be set before Init. If set_only_non_debug_params is true, only params that do not contain "debug" in the name will be set.
-
Init
public int Init(@Cast("const char*") BytePointer datapath, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr BytePointer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params)
-
Init
public int Init(String datapath, String language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr ByteBuffer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params)
-
Init
public int Init(@Cast("const char*") BytePointer datapath, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr byte[] configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params)
-
Init
public int Init(String datapath, String language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr BytePointer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params)
-
Init
public int Init(@Cast("const char*") BytePointer datapath, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr ByteBuffer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params)
-
Init
public int Init(String datapath, String language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr byte[] configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params)
-
Init
public int Init(@Cast("const char*") BytePointer datapath, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int oem)
-
Init
public int Init(@Cast("const char*") BytePointer datapath, @Cast("const char*") BytePointer language)
-
Init
public int Init(@Cast("const char*") BytePointer data, int data_size, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") PointerPointer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params, FileReader reader)
-
Init
public int Init(@Cast("const char*") BytePointer data, int data_size, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr BytePointer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params, FileReader reader)
-
Init
public int Init(String data, int data_size, String language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr ByteBuffer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params, FileReader reader)
-
Init
public int Init(@Cast("const char*") BytePointer data, int data_size, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr byte[] configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params, FileReader reader)
-
Init
public int Init(String data, int data_size, String language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr BytePointer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params, FileReader reader)
-
Init
public int Init(@Cast("const char*") BytePointer data, int data_size, @Cast("const char*") BytePointer language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr ByteBuffer configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params, FileReader reader)
-
Init
public int Init(String data, int data_size, String language, @Cast("tesseract::OcrEngineMode") int mode, @Cast("char**") @ByPtrPtr byte[] configs, int configs_size, @Const StringVector vars_vec, @Const StringVector vars_values, @Cast("bool") boolean set_only_non_debug_params, FileReader reader)
-
GetInitLanguagesAsString
@Cast("const char*") public BytePointer GetInitLanguagesAsString()
Returns the languages string used in the last valid initialization. If the last initialization specified "deu+hin" then that will be returned. If hin loaded eng automatically as well, then that will not be included in this list. To find the languages actually loaded use GetLoadedLanguagesAsVector. The returned string should NOT be deleted.
-
GetLoadedLanguagesAsVector
public void GetLoadedLanguagesAsVector(StringVector langs)
Returns the loaded languages in the vector of std::string. Includes all languages loaded by the last Init, including those loaded as dependencies of other loaded languages.
-
GetAvailableLanguagesAsVector
public void GetAvailableLanguagesAsVector(StringVector langs)
Returns the available languages in the sorted vector of std::string.
-
InitForAnalysePage
public void InitForAnalysePage()
Init only for page layout analysis. Use only for calls to SetImage and AnalysePage. Calls that attempt recognition will generate an error.
-
ReadConfigFile
public void ReadConfigFile(@Cast("const char*") BytePointer filename)
Read a "config" file containing a set of param, value pairs. Searches the standard places: tessdata/configs, tessdata/tessconfigs and also accepts a relative or absolute path name. Note: only non-init params will be set (init params are set by Init()).
-
ReadConfigFile
public void ReadConfigFile(String filename)
-
ReadDebugConfigFile
public void ReadDebugConfigFile(@Cast("const char*") BytePointer filename)
Same as above, but only set debug params from the given config file.
-
ReadDebugConfigFile
public void ReadDebugConfigFile(String filename)
-
SetPageSegMode
public void SetPageSegMode(@Cast("tesseract::PageSegMode") int mode)
Set the current page segmentation mode. Defaults to PSM_SINGLE_BLOCK. The mode is stored as an IntParam so it can also be modified by ReadConfigFile or SetVariable("tessedit_pageseg_mode", mode as string).
-
GetPageSegMode
@Cast("tesseract::PageSegMode") public int GetPageSegMode()
Return the current page segmentation mode.
-
TesseractRect
@Cast("char*") public BytePointer TesseractRect(@Cast("const unsigned char*") BytePointer imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)
Recognize a rectangle from an image and return the result as a string. May be called many times for a single Init. Currently has no error checking. Greyscale of 8 and color of 24 or 32 bits per pixel may be given. Palette color images will not work properly and must be converted to 24 bit. Binary images of 1 bit per pixel may also be given but they must be byte packed with the MSB of the first byte being the first pixel, and a 1 represents WHITE. For binary images set bytes_per_pixel=0. The recognized text is returned as a char* which is coded as UTF8 and must be freed with the delete [] operator. Note that TesseractRect is the simplified convenience interface. For advanced uses, use SetImage, (optionally) SetRectangle, Recognize, and one or more of the Get*Text functions below.
-
TesseractRect
@Cast("char*") public ByteBuffer TesseractRect(@Cast("const unsigned char*") ByteBuffer imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)
-
TesseractRect
@Cast("char*") public byte[] TesseractRect(@Cast("const unsigned char*") byte[] imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)
-
ClearAdaptiveClassifier
public void ClearAdaptiveClassifier()
Call between pages or documents etc to free up memory and forget adaptive data.
-
SetImage
public void SetImage(@Cast("const unsigned char*") BytePointer imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)
Provide an image for Tesseract to recognize. Format is as TesseractRect above. Copies the image buffer and converts to Pix. SetImage clears all recognition results, and sets the rectangle to the full image, so it may be followed immediately by a GetUTF8Text, and it will automatically perform recognition.
-
SetImage
public void SetImage(@Cast("const unsigned char*") ByteBuffer imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)
-
SetImage
public void SetImage(@Cast("const unsigned char*") byte[] imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)
-
SetImage
public void SetImage(org.bytedeco.leptonica.PIX pix)
Provide an image for Tesseract to recognize. As with SetImage above, Tesseract takes its own copy of the image, so it need not persist until after Recognize. Pix vs raw, which to use? Use Pix where possible. Tesseract uses Pix as its internal representation and it is therefore more efficient to provide a Pix directly.
-
SetSourceResolution
public void SetSourceResolution(int ppi)
Set the resolution of the source image in pixels per inch so font size information can be calculated in results. Call this after SetImage().
-
SetRectangle
public void SetRectangle(int left, int top, int width, int height)Restrict recognition to a sub-rectangle of the image. Call after SetImage. Each SetRectangle clears the recogntion results so multiple rectangles can be recognized with the same image.
-
GetThresholdedImage
public org.bytedeco.leptonica.PIX GetThresholdedImage()
Get a copy of the internal thresholded image from Tesseract. Caller takes ownership of the Pix and must pixDestroy it. May be called any time after SetImage, or after TesseractRect.
-
GetGradient
public float GetGradient()
Return average gradient of lines on page.
-
GetRegions
public org.bytedeco.leptonica.BOXA GetRegions(@Cast("Pixa**") PointerPointer pixa)
Get the result of page layout analysis as a leptonica-style Boxa, Pixa pair, in reading order. Can be called before or after Recognize.
-
GetRegions
public org.bytedeco.leptonica.BOXA GetRegions(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa)
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@Cast("bool") boolean raw_image, int raw_padding, @Cast("Pixa**") PointerPointer pixa, @Cast("int**") PointerPointer blockids, @Cast("int**") PointerPointer paraids)
Get the textlines as a leptonica-style Boxa, Pixa pair, in reading order. Can be called before or after Recognize. If raw_image is true, then extract from the original image instead of the thresholded image and pad by raw_padding pixels. If blockids is not nullptr, the block-id of each line is also returned as an array of one element per line. delete [] after use. If paraids is not nullptr, the paragraph-id of each line within its block is also returned as an array of one element per line. delete [] after use.
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@Cast("bool") boolean raw_image, int raw_padding, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntPointer blockids, @ByPtrPtr IntPointer paraids)
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@Cast("bool") boolean raw_image, int raw_padding, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntBuffer blockids, @ByPtrPtr IntBuffer paraids)
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@Cast("bool") boolean raw_image, int raw_padding, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr int[] blockids, @ByPtrPtr int[] paraids)
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@Cast("Pixa**") PointerPointer pixa, @Cast("int**") PointerPointer blockids)
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntPointer blockids)
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntBuffer blockids)
-
GetTextlines
public org.bytedeco.leptonica.BOXA GetTextlines(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr int[] blockids)
-
GetStrips
public org.bytedeco.leptonica.BOXA GetStrips(@Cast("Pixa**") PointerPointer pixa, @Cast("int**") PointerPointer blockids)
Get textlines and strips of image regions as a leptonica-style Boxa, Pixa pair, in reading order. Enables downstream handling of non-rectangular regions. Can be called before or after Recognize. If blockids is not nullptr, the block-id of each line is also returned as an array of one element per line. delete [] after use.
-
GetStrips
public org.bytedeco.leptonica.BOXA GetStrips(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntPointer blockids)
-
GetStrips
public org.bytedeco.leptonica.BOXA GetStrips(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntBuffer blockids)
-
GetStrips
public org.bytedeco.leptonica.BOXA GetStrips(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr int[] blockids)
-
GetWords
public org.bytedeco.leptonica.BOXA GetWords(@Cast("Pixa**") PointerPointer pixa)
Get the words as a leptonica-style Boxa, Pixa pair, in reading order. Can be called before or after Recognize.
-
GetWords
public org.bytedeco.leptonica.BOXA GetWords(@ByPtrPtr org.bytedeco.leptonica.PIXA pixa)
-
GetConnectedComponents
public org.bytedeco.leptonica.BOXA GetConnectedComponents(@Cast("Pixa**") PointerPointer cc)
Gets the individual connected (text) components (created after pages segmentation step, but before recognition) as a leptonica-style Boxa, Pixa pair, in reading order. Can be called before or after Recognize. Note: the caller is responsible for calling boxaDestroy() on the returned Boxa array and pixaDestroy() on cc array.
-
GetConnectedComponents
public org.bytedeco.leptonica.BOXA GetConnectedComponents(@ByPtrPtr org.bytedeco.leptonica.PIXA cc)
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("tesseract::PageIteratorLevel") int level, @Cast("bool") boolean text_only, @Cast("bool") boolean raw_image, int raw_padding, @Cast("Pixa**") PointerPointer pixa, @Cast("int**") PointerPointer blockids, @Cast("int**") PointerPointer paraids)
Get the given level kind of components (block, textline, word etc.) as a leptonica-style Boxa, Pixa pair, in reading order. Can be called before or after Recognize. If blockids is not nullptr, the block-id of each component is also returned as an array of one element per component. delete [] after use. If blockids is not nullptr, the paragraph-id of each component with its block is also returned as an array of one element per component. delete [] after use. If raw_image is true, then portions of the original image are extracted instead of the thresholded image and padded with raw_padding. If text_only is true, then only text components are returned.
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("tesseract::PageIteratorLevel") int level, @Cast("bool") boolean text_only, @Cast("bool") boolean raw_image, int raw_padding, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntPointer blockids, @ByPtrPtr IntPointer paraids)
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("tesseract::PageIteratorLevel") int level, @Cast("bool") boolean text_only, @Cast("bool") boolean raw_image, int raw_padding, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntBuffer blockids, @ByPtrPtr IntBuffer paraids)
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("tesseract::PageIteratorLevel") int level, @Cast("bool") boolean text_only, @Cast("bool") boolean raw_image, int raw_padding, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr int[] blockids, @ByPtrPtr int[] paraids)
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("const tesseract::PageIteratorLevel") int level, @Cast("const bool") boolean text_only, @Cast("Pixa**") PointerPointer pixa, @Cast("int**") PointerPointer blockids)
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("const tesseract::PageIteratorLevel") int level, @Cast("const bool") boolean text_only, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntPointer blockids)
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("const tesseract::PageIteratorLevel") int level, @Cast("const bool") boolean text_only, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr IntBuffer blockids)
-
GetComponentImages
public org.bytedeco.leptonica.BOXA GetComponentImages(@Cast("const tesseract::PageIteratorLevel") int level, @Cast("const bool") boolean text_only, @ByPtrPtr org.bytedeco.leptonica.PIXA pixa, @ByPtrPtr int[] blockids)
-
GetThresholdedImageScaleFactor
public int GetThresholdedImageScaleFactor()
Returns the scale factor of the thresholded image that would be returned by GetThresholdedImage() and the various GetX() methods that call GetComponentImages(). Returns 0 if no thresholder has been set.
-
AnalyseLayout
public PageIterator AnalyseLayout()
Runs page layout analysis in the mode set by SetPageSegMode. May optionally be called prior to Recognize to get access to just the page layout results. Returns an iterator to the results. If merge_similar_words is true, words are combined where suitable for use with a line recognizer. Use if you want to use AnalyseLayout to find the textlines, and then want to process textline fragments with an external line recognizer. Returns nullptr on error or an empty page. The returned iterator must be deleted after use. WARNING! This class points to data held within the TessBaseAPI class, and therefore can only be used while the TessBaseAPI class still exists and has not been subjected to a call of Init, SetImage, Recognize, Clear, End DetectOS, or anything else that changes the internal PAGE_RES.
-
AnalyseLayout
public PageIterator AnalyseLayout(@Cast("bool") boolean merge_similar_words)
-
Recognize
public int Recognize(ETEXT_DESC monitor)
Recognize the image from SetAndThresholdImage, generating Tesseract internal structures. Returns 0 on success. Optional. The Get*Text functions below will call Recognize if needed. After Recognize, the output is kept internally until the next SetImage.
-
ProcessPages
@Cast("bool") public boolean ProcessPages(@Cast("const char*") BytePointer filename, @Cast("const char*") BytePointer retry_config, int timeout_millisec, TessResultRenderer renderer)
Turns images into symbolic text. filename can point to a single image, a multi-page TIFF, or a plain text list of image filenames. retry_config is useful for debugging. If not nullptr, you can fall back to an alternate configuration if a page fails for some reason. timeout_millisec terminates processing if any single page takes too long. Set to 0 for unlimited time. renderer is responsible for creating the output. For example, use the TessTextRenderer if you want plaintext output, or the TessPDFRender to produce searchable PDF. If tessedit_page_number is non-negative, will only process that single page. Works for multi-page tiff file, or filelist. Returns true if successful, false on error.
-
ProcessPages
@Cast("bool") public boolean ProcessPages(String filename, String retry_config, int timeout_millisec, TessResultRenderer renderer)
-
ProcessPagesInternal
@Cast("bool") public boolean ProcessPagesInternal(@Cast("const char*") BytePointer filename, @Cast("const char*") BytePointer retry_config, int timeout_millisec, TessResultRenderer renderer)
-
ProcessPagesInternal
@Cast("bool") public boolean ProcessPagesInternal(String filename, String retry_config, int timeout_millisec, TessResultRenderer renderer)
-
ProcessPage
@Cast("bool") public boolean ProcessPage(org.bytedeco.leptonica.PIX pix, int page_index, @Cast("const char*") BytePointer filename, @Cast("const char*") BytePointer retry_config, int timeout_millisec, TessResultRenderer renderer)
Turn a single image into symbolic text. The pix is the image processed. filename and page_index are metadata used by side-effect processes, such as reading a box file or formatting as hOCR. See ProcessPages for descriptions of other parameters.
-
ProcessPage
@Cast("bool") public boolean ProcessPage(org.bytedeco.leptonica.PIX pix, int page_index, String filename, String retry_config, int timeout_millisec, TessResultRenderer renderer)
-
GetIterator
public ResultIterator GetIterator()
Get a reading-order iterator to the results of LayoutAnalysis and/or Recognize. The returned iterator must be deleted after use. WARNING! This class points to data held within the TessBaseAPI class, and therefore can only be used while the TessBaseAPI class still exists and has not been subjected to a call of Init, SetImage, Recognize, Clear, End DetectOS, or anything else that changes the internal PAGE_RES.
-
GetMutableIterator
public MutableIterator GetMutableIterator()
Get a mutable iterator to the results of LayoutAnalysis and/or Recognize. The returned iterator must be deleted after use. WARNING! This class points to data held within the TessBaseAPI class, and therefore can only be used while the TessBaseAPI class still exists and has not been subjected to a call of Init, SetImage, Recognize, Clear, End DetectOS, or anything else that changes the internal PAGE_RES.
-
GetUTF8Text
@Cast("char*") public BytePointer GetUTF8Text()
The recognized text is returned as a char* which is coded as UTF8 and must be freed with the delete [] operator.
-
GetHOCRText
@Cast("char*") public BytePointer GetHOCRText(ETEXT_DESC monitor, int page_number)
Make a HTML-formatted string with hOCR markup from the internal data structures. page_number is 0-based but will appear in the output as 1-based. monitor can be used to cancel the recognition receive progress callbacks Returned string must be freed with the delete [] operator.
-
GetHOCRText
@Cast("char*") public BytePointer GetHOCRText(int page_number)
Make a HTML-formatted string with hOCR markup from the internal data structures. page_number is 0-based but will appear in the output as 1-based. Returned string must be freed with the delete [] operator.
-
GetAltoText
@Cast("char*") public BytePointer GetAltoText(ETEXT_DESC monitor, int page_number)
Make an XML-formatted string with Alto markup from the internal data structures.
-
GetAltoText
@Cast("char*") public BytePointer GetAltoText(int page_number)
Make an XML-formatted string with Alto markup from the internal data structures.
-
GetPAGEText
@Cast("char*") public BytePointer GetPAGEText(ETEXT_DESC monitor, int page_number)
Make an XML-formatted string with PAGE markup from the internal data structures.
-
GetPAGEText
@Cast("char*") public BytePointer GetPAGEText(int page_number)
Make an XML-formatted string with PAGE markup from the internal data structures.
-
GetTSVText
@Cast("char*") public BytePointer GetTSVText(int page_number)
Make a TSV-formatted string from the internal data structures. page_number is 0-based but will appear in the output as 1-based. Returned string must be freed with the delete [] operator.
-
GetLSTMBoxText
@Cast("char*") public BytePointer GetLSTMBoxText(int page_number)
Make a box file for LSTM training from the internal data structures. Constructs coordinates in the original image - not just the rectangle. page_number is a 0-based page index that will appear in the box file. Returned string must be freed with the delete [] operator.
-
GetBoxText
@Cast("char*") public BytePointer GetBoxText(int page_number)
The recognized text is returned as a char* which is coded in the same format as a box file used in training. Constructs coordinates in the original image - not just the rectangle. page_number is a 0-based page index that will appear in the box file. Returned string must be freed with the delete [] operator.
-
GetWordStrBoxText
@Cast("char*") public BytePointer GetWordStrBoxText(int page_number)
The recognized text is returned as a char* which is coded in the same format as a WordStr box file used in training. page_number is a 0-based page index that will appear in the box file. Returned string must be freed with the delete [] operator.
-
GetUNLVText
@Cast("char*") public BytePointer GetUNLVText()
The recognized text is returned as a char* which is coded as UNLV format Latin-1 with specific reject and suspect codes. Returned string must be freed with the delete [] operator.
-
DetectOrientationScript
@Cast("bool") public boolean DetectOrientationScript(IntPointer orient_deg, FloatPointer orient_conf, @Cast("const char**") PointerPointer script_name, FloatPointer script_conf)
Detect the orientation of the input image and apparent script (alphabet). orient_deg is the detected clockwise rotation of the input image in degrees (0, 90, 180, 270) orient_conf is the confidence (15.0 is reasonably confident) script_name is an ASCII string, the name of the script, e.g. "Latin" script_conf is confidence level in the script Returns true on success and writes values to each parameter as an output
-
DetectOrientationScript
@Cast("bool") public boolean DetectOrientationScript(IntPointer orient_deg, FloatPointer orient_conf, @Cast("const char**") @ByPtrPtr BytePointer script_name, FloatPointer script_conf)
-
DetectOrientationScript
@Cast("bool") public boolean DetectOrientationScript(IntBuffer orient_deg, FloatBuffer orient_conf, @Cast("const char**") @ByPtrPtr ByteBuffer script_name, FloatBuffer script_conf)
-
DetectOrientationScript
@Cast("bool") public boolean DetectOrientationScript(int[] orient_deg, float[] orient_conf, @Cast("const char**") @ByPtrPtr byte[] script_name, float[] script_conf)
-
GetOsdText
@Cast("char*") public BytePointer GetOsdText(int page_number)
The recognized text is returned as a char* which is coded as UTF8 and must be freed with the delete [] operator. page_number is a 0-based page index that will appear in the osd file.
-
MeanTextConf
public int MeanTextConf()
Returns the (average) confidence value between 0 and 100.
-
AllWordConfidences
public IntPointer AllWordConfidences()
Returns all word confidences (between 0 and 100) in an array, terminated by -1. The calling function must delete [] after use. The number of confidences should correspond to the number of space- delimited words in GetUTF8Text.
-
AdaptToWordStr
@Cast("bool") public boolean AdaptToWordStr(@Cast("tesseract::PageSegMode") int mode, @Cast("const char*") BytePointer wordstr)
Applies the given word to the adaptive classifier if possible. The word must be SPACE-DELIMITED UTF-8 - l i k e t h i s , so it can tell the boundaries of the graphemes. Assumes that SetImage/SetRectangle have been used to set the image to the given word. The mode arg should be PSM_SINGLE_WORD or PSM_CIRCLE_WORD, as that will be used to control layout analysis. The currently set PageSegMode is preserved. Returns false if adaption was not possible for some reason.
-
AdaptToWordStr
@Cast("bool") public boolean AdaptToWordStr(@Cast("tesseract::PageSegMode") int mode, String wordstr)
-
Clear
public void Clear()
Free up recognition results and any stored image data, without actually freeing any recognition data that would be time-consuming to reload. Afterwards, you must call SetImage or TesseractRect before doing any Recognize or Get* operation.
-
End
public void End()
Close down tesseract and free up all memory. End() is equivalent to destructing and reconstructing your TessBaseAPI. Once End() has been used, none of the other API functions may be used other than Init and anything declared above it in the class definition.
-
ClearPersistentCache
public static void ClearPersistentCache()
Clear any library-level memory caches. There are a variety of expensive-to-load constant data structures (mostly language dictionaries) that are cached globally -- surviving the Init() and End() of individual TessBaseAPI's. This function allows the clearing of these caches.
-
IsValidWord
public int IsValidWord(@Cast("const char*") BytePointer word)
Check whether a word is valid according to Tesseract's language model- Returns:
- 0 if the word is invalid, non-zero if valid. \warning temporary! This function will be removed from here and placed in a separate API at some future time.
-
IsValidWord
public int IsValidWord(String word)
-
IsValidCharacter
@Cast("bool") public boolean IsValidCharacter(@Cast("const char*") BytePointer utf8_character)
-
GetTextDirection
@Cast("bool") public boolean GetTextDirection(IntPointer out_offset, FloatPointer out_slope)
-
GetTextDirection
@Cast("bool") public boolean GetTextDirection(IntBuffer out_offset, FloatBuffer out_slope)
-
GetTextDirection
@Cast("bool") public boolean GetTextDirection(int[] out_offset, float[] out_slope)
-
SetDictFunc
public void SetDictFunc(DictFunc f)
Sets Dict::letter_is_okay_ function to point to the given function.
-
SetProbabilityInContextFunc
public void SetProbabilityInContextFunc(ProbabilityInContextFunc f)
Sets Dict::probability_in_context_ function to point to the given function.
-
DetectOS
@Cast("bool") public boolean DetectOS(OSResults arg0)
Estimates the Orientation And Script of the image.- Returns:
- true if the image was processed successfully.
-
GetBlockTextOrientations
public void GetBlockTextOrientations(@Cast("int**") PointerPointer block_orientation, @Cast("bool**") PointerPointer vertical_writing)
Return text orientation of each block as determined by an earlier run of layout analysis.
-
GetBlockTextOrientations
public void GetBlockTextOrientations(@ByPtrPtr IntPointer block_orientation, @Cast("bool**") @ByPtrPtr BoolPointer vertical_writing)
-
GetBlockTextOrientations
public void GetBlockTextOrientations(@ByPtrPtr IntBuffer block_orientation, @Cast("bool**") @ByPtrPtr boolean[] vertical_writing)
-
GetBlockTextOrientations
public void GetBlockTextOrientations(@ByPtrPtr int[] block_orientation, @Cast("bool**") @ByPtrPtr BoolPointer vertical_writing)
-
GetBlockTextOrientations
public void GetBlockTextOrientations(@ByPtrPtr IntPointer block_orientation, @Cast("bool**") @ByPtrPtr boolean[] vertical_writing)
-
GetBlockTextOrientations
public void GetBlockTextOrientations(@ByPtrPtr IntBuffer block_orientation, @Cast("bool**") @ByPtrPtr BoolPointer vertical_writing)
-
GetBlockTextOrientations
public void GetBlockTextOrientations(@ByPtrPtr int[] block_orientation, @Cast("bool**") @ByPtrPtr boolean[] vertical_writing)
-
GetUnichar
@Cast("const char*") public BytePointer GetUnichar(int unichar_id)
This method returns the string form of the specified unichar.
-
GetDawg
@Const public Dawg GetDawg(int i)
Return the pointer to the i-th dawg loaded into tesseract_ object.
-
NumDawgs
public int NumDawgs()
Return the number of dawgs loaded into tesseract_ object.
-
tesseract
public Tesseract tesseract()
-
oem
@Cast("tesseract::OcrEngineMode") public int oem()
-
set_min_orientation_margin
public void set_min_orientation_margin(double margin)
-
-