#include <OCRModule.h>
Inheritance diagram for Conjecture::OCRModule:
*****************************************************************
In order to make customization easy, Conjecture identifies the fundamental algorithms necessary to perform OCR. Each of these algorithms is formalized into a Component class hierarchy - different subclasses provide different implementations of the algorithm. A particular run of the OCR establishes which strategy to use for every one of its algorithms, and performs them in the appropriate sequence (the sequence in which algorithms are applied is also one of the algorithms).
Since the specific strategy for solving one problem might depend on or require a specific strategy for solving some other pattern, we introduce an Abstract Factory design pattern. In general, an Abstract Factory is a collection of Factory Methods (which produce products). An Abstract Factory allows one to enforce dependencies between individual products created.
NOTE: The products being produced here are instances of a specific subclass of each Component hierarchy. Component is another design pattern, and normally the subclasses are Singletons (the classes represent algorithms, and are normally stateless, or at least requiring only a single state). However, I have not yet fully established whether using Singletons will pose problems for multi-threading or parallel/distributed algorithms, so for now I'm not making Component subclasses singletons. If we do decide to do so, it might be easier to just have the OCRModule intern objects than to put the Singleton design pattern into every single Component subclass. There will be many Component hierarchies, and potentially many subclasses in each hierarchy.
Public Member Functions | |
FormatComponent * | format () const |
IdentifyComponent * | identify () const |
SegmentComponent * | segment () const |
ProcessComponent * | process () const |
void | init () |
virtual ProcessComponent * | createProcessComponent () const =0 |
virtual SegmentComponent * | createSegmentComponent () const =0 |
virtual IdentifyComponent * | createIdentifyComponent () const =0 |
virtual FormatComponent * | createFormatComponent () const =0 |
virtual void | processArgs (int argc, const char **argv, Env *env=NULL) |
Protected Member Functions | |
void | formatIs (FormatComponent *format) |
void | identifyIs (IdentifyComponent *identify) |
void | segmentIs (SegmentComponent *segment) |
void | processIs (ProcessComponent *process) |
|
Command-line processing This method provides module-specific command-line processing. The default implementation is a no-op. Subclasses redefine as necessary. Reimplemented in Conjecture::GocrModule. |