tesseract
5.0.0-alpha-619-ge9db
|
#include <renderer.h>
Public Member Functions | |
virtual | ~TessResultRenderer () |
void | insert (TessResultRenderer *next) |
TessResultRenderer * | next () |
bool | BeginDocument (const char *title) |
bool | AddImage (TessBaseAPI *api) |
bool | EndDocument () |
const char * | file_extension () const |
const char * | title () const |
bool | happy () |
int | imagenum () const |
Protected Member Functions | |
TessResultRenderer (const char *outputbase, const char *extension) | |
virtual bool | BeginDocumentHandler () |
virtual bool | AddImageHandler (TessBaseAPI *api)=0 |
virtual bool | EndDocumentHandler () |
void | AppendString (const char *s) |
void | AppendData (const char *s, int len) |
Interface for rendering tesseract results into a document, such as text, HOCR or pdf. This class is abstract. Specific classes handle individual formats. This interface is then used to inject the renderer class into tesseract when processing images.
For simplicity implementing this with tesseract version 3.01, the renderer contains document state that is cleared from document to document just as the TessBaseAPI is. This way the base API can just delegate its rendering functionality to injected renderers, and the renderers can manage the associated state needed for the specific formats in addition to the heuristics for producing it.
Definition at line 49 of file renderer.h.
|
virtual |
Definition at line 48 of file renderer.cpp.
|
protected |
Called by concrete classes.
outputbase is the name of the output file excluding extension. For example, "/path/to/chocolate-chip-cookie-recipe"
extension indicates the file extension to be used for output files. For example "pdf" will produce a .pdf file, and "hocr" will produce .hocr files.
Definition at line 32 of file renderer.cpp.
bool tesseract::TessResultRenderer::AddImage | ( | TessBaseAPI * | api | ) |
Adds the recognized text from the source image to the current document. Invalid if BeginDocument not yet called.
Note that this API is a bit weird but is designed to fit into the current TessBaseAPI implementation where the api has lots of state information that we might want to add in.
Definition at line 82 of file renderer.cpp.
|
protectedpure virtual |
Implemented in tesseract::TessOsdRenderer, tesseract::TessWordStrBoxRenderer, tesseract::TessBoxTextRenderer, tesseract::TessLSTMBoxRenderer, tesseract::TessUnlvRenderer, tesseract::TessPDFRenderer, tesseract::TessTsvRenderer, tesseract::TessAltoRenderer, tesseract::TessHOcrRenderer, and tesseract::TessTextRenderer.
|
protected |
Definition at line 105 of file renderer.cpp.
|
protected |
Definition at line 101 of file renderer.cpp.
bool tesseract::TessResultRenderer::BeginDocument | ( | const char * | title | ) |
Starts a new document with the given title. This clears the contents of the output data. Title should use UTF-8 encoding.
Definition at line 71 of file renderer.cpp.
|
protectedvirtual |
Reimplemented in tesseract::TessPDFRenderer, tesseract::TessTsvRenderer, tesseract::TessAltoRenderer, and tesseract::TessHOcrRenderer.
Definition at line 110 of file renderer.cpp.
bool tesseract::TessResultRenderer::EndDocument | ( | ) |
Finishes the document and finalizes the output data Invalid if BeginDocument not yet called.
Definition at line 92 of file renderer.cpp.
|
protectedvirtual |
Reimplemented in tesseract::TessPDFRenderer, tesseract::TessTsvRenderer, tesseract::TessAltoRenderer, and tesseract::TessHOcrRenderer.
Definition at line 114 of file renderer.cpp.
|
inline |
Definition at line 86 of file renderer.h.
|
inline |
Definition at line 94 of file renderer.h.
|
inline |
Returns the index of the last image given to AddImage (i.e. images are incremented whether the image succeeded or not)
This is always defined. It means either the number of the current image, the last image ended, or in the completed document depending on when in the document lifecycle you are looking at it. Will return -1 if a document was never started.
Definition at line 107 of file renderer.h.
void tesseract::TessResultRenderer::insert | ( | TessResultRenderer * | next | ) |
Definition at line 58 of file renderer.cpp.
|
inline |
Definition at line 59 of file renderer.h.
|
inline |
Definition at line 89 of file renderer.h.