Conjecture::Glyph Class Reference

#include <Glyph.h>

Inheritance diagram for Conjecture::Glyph:

Conjecture::Element Conjecture::Root List of all members.

Detailed Description

A rectangular region of the overall image that has been identified as representing a single character.

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 Member Functions

 Glyph (Element *parent=NULL, void *internal=NULL)
 Glyph (Glyph *glyph)
virtual GlyphasGlyph ()
virtual const GlyphasGlyph () const
int best () const
virtual int type () const
const Box * box () const
void boxIs (Box *box)
Box *& boxRef ()
void setUnicode (wchar_t unicode)
virtual void printSummary (std::ostream &os=std::cerr, const std::string &indent="", int index=-1) const
void addChar (const Glyph::Char &chr)
GlyphFeatures::LineType lineType () const
u2 topY () const
u2 bottomY () const
u2 leftX () const
u2 rightX () const
void writeImage (const std::string &filebase, const ImageArgs &config)
virtual void writeText (std::ostream &os) const
wchar_t unicode () const
const std::vector< Char > & charset () const

Static Public Member Functions

static void test (int argc=0, const char *argv[]=NULL)

Protected Member Functions

void bestIs (const int &best)
int & bestRef ()
wchar_t & unicodeRef ()
void unicodeIs (wchar_t unicode)
std::vector< Char > & charset ()

Classes

class  Char


Member Function Documentation

virtual Glyph* Conjecture::Glyph::asGlyph  )  [inline, virtual]
 

Allows Image instances to be converted to Glyph instances safely without requiring explicit down-casting.

Reimplemented from Conjecture::Element.

GlyphFeatures::LineType Conjecture::Glyph::lineType  )  const
 

Returns a categorization of this glyph within its line.

See the LineType documentation for semantics.

virtual void Conjecture::Glyph::printSummary std::ostream &  os = std::cerr,
const std::string &  indent = "",
int  index = -1
const [virtual]
 

Print out information about this Element.

Reimplemented from Conjecture::Element.

void Conjecture::Glyph::test int  argc = 0,
const char *  argv[] = NULL
[static]
 

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 Conjecture::Element.

virtual int Conjecture::Glyph::type  )  const [inline, virtual]
 

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 Conjecture::Element.

void Conjecture::Glyph::writeImage const std::string &  filebase,
const ImageArgs config
 

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.

virtual void Conjecture::Glyph::writeText std::ostream &  os  )  const [virtual]
 

Writes a textual representation of this element to given output stream

Reimplemented from Conjecture::Element.


The documentation for this class was generated from the following files:
Generated on Mon Jun 12 20:27:17 2006 for Conjecture by  doxygen 1.4.6