#include <Glyph.h>
Inheritance diagram for SomeName::Glyph:
The Box class represents all information associated with the graphical reprsentation of a to-be-identified character. The correctness of this box (i.e. whether it really does represent a single character) depends on:
Ths class is responsible for converting an image of a character into a unicode character value, and as such is at the heart of the OCR code.
Public Types | |
enum | LineType { Unknown = 0, Base, Ascender, Descender, Total } |
Public Member Functions | |
Glyph (Element *parent=NULL, void *internal=NULL) | |
Glyph (Glyph *glyph) | |
virtual Glyph * | asGlyph () |
virtual const Glyph * | asGlyph () const |
virtual int | type () const |
const Box * | box () const |
void | boxIs (Box *box) |
Box *& | boxRef () |
virtual void | printSummary (std::ostream &os=std::cerr, const std::string &indent="", int index=-1) const |
Print out information about this Element. | |
void | addChar (const Glyph::Char &chr) |
Glyph::LineType | lineType () const |
u2 | topY () const |
u2 | bottomY () const |
u2 | leftX () const |
u2 | rightX () const |
void | writeImage (const std::string &filebase, const ImageArgs &config) |
int | best () const |
const std::vector< Char > & | charset () const |
Static Public Member Functions | |
static void | test (int argc=0, const char *argv[]=NULL) |
Protected Member Functions | |
int & | bestRef () |
void | bestIs (int best) |
std::vector< Char > & | charset () |
Classes | |
class | Char |
|
The LineType enum is used by the 'lineType' method. It categorizes a glyph relative to the line within which it resides Unknown --> if the Glyph isn't in a line Base --> glyphs that do not go above midY or below baseY Ascender --> glyphs that do not go below baseY but do go above midY Descender --> glyphs that do not go above midY but do go below baseY Total --> glyphs that go above midY and below baseY |
|
Allows Image instances to be converted to Glyph instances safely without requiring explicit down-casting. Reimplemented from SomeName::Element. |
|
Returns a categorization of this glyph within its line. See the LineType documentation for semantics. |
|
Unit testing method. This static method should create instances of the class (and instances of any other class necessary) and perform tests to ensure that all methods within the class are working as expected. Reimplemented from SomeName::Element. |
|
Returns an integer establishing how "small" this image type is, relative to other image types. It has nothing to do with width or height, but instead with the conceptual size of the type itself. All instances of a particular subtype will always return the same value. The code is designed so that Glyph returns a larger number than Word, which is larger than Line, which is larger than Region, which is larger than Page. This allows us to perform some sanity checks on hierarchial decompositions to ensure that we don't make silly structures in which Lines have Glyphs as parents, etc. FUTURE FIX: This method should be pure-virtual, but making it pure-virtual causes failure during compilation due to code in the constructor. Must determine why the compilation error is occuring and resolve it. Reimplemented from SomeName::Element. |
|
Write Glyph image to disk. Creates a file (with prefix 'filebase', suffix '.pgm') for the sub-region of the pageImage representing this Glyph. The output may be magnified, thresholded, and/or filtered. See the Image::Image constructor documentation for more. |