Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
tesseract::CubeClassifier Class Reference

`#include <cubeclassifier.h>`

Inheritance diagram for tesseract::CubeClassifier:

List of all members.

## Public Member Functions

| CubeClassifier (Tesseract *tesseract)
virtual | ~CubeClassifier ()
virtual int | ClassifySample (const TrainingSample &sample, Pix *page_pix, int debug, int keep_this, GenericVector< ShapeRating > *results)
virtual const ShapeTable * | GetShapeTable () const
Public Member Functions inherited from tesseract::ShapeClassifier
virtual | ~ShapeClassifier ()

## Detailed Description

Definition at line 37 of file cubeclassifier.h.

## Constructor & Destructor Documentation

tesseract::CubeClassifier::CubeClassifier | ( | tesseract::Tesseract * | tesseract | ) |

explicit

Definition at line 35 of file cubeclassifier.cpp.

: cube_cntxt_(tesseract->GetCubeRecoContext()),
shape_table_(*tesseract->shape_table()) {
}

tesseract::CubeClassifier::~CubeClassifier | ( |  | ) |

virtual

Definition at line 39 of file cubeclassifier.cpp.

{
}

## Member Function Documentation

int tesseract::CubeClassifier::ClassifySample | ( | const TrainingSample & | sample,
|  | Pix * | page_pix,
|  | int | debug,
|  | int | keep_this,
|  | GenericVector< ShapeRating > * | results
| ) |  |

virtual

Implements tesseract::ShapeClassifier.

Definition at line 44 of file cubeclassifier.cpp.

{
results->clear();
if (page_pix == NULL) return 0;
ASSERT_HOST(cube_cntxt_ != NULL);
const TBOX& char_box = sample.bounding_box();
CubeObject* cube_obj = new tesseract::CubeObject(
cube_cntxt_, page_pix, char_box.left(),
pixGetHeight(page_pix) - char_box.top(),
char_box.width(), char_box.height());
CharAltList* alt_list = cube_obj->RecognizeChar();
alt_list->Sort();
CharSet* char_set = cube_cntxt_->CharacterSet();
if (alt_list != NULL) {
for (int i = 0; i < alt_list->AltCount(); ++i) {
// Convert cube representation to a shape_id.
int alt_id = alt_list->Alt(i);
int unichar_id = char_set->UnicharID(char_set->ClassString(alt_id));
int shape_id = shape_table_.FindShape(unichar_id, -1);
if (shape_id >= 0)
results->push_back(ShapeRating(shape_id, alt_list->AltProb(i)));
}
delete alt_list;
}
delete cube_obj;
return results->size();
}

const ShapeTable * tesseract::CubeClassifier::GetShapeTable | ( |  | ) | const

virtual

Implements tesseract::ShapeClassifier.

Definition at line 75 of file cubeclassifier.cpp.

{
return &shape_table_;
}

The documentation for this class was generated from the following files:

- /mnt/data/src/tesseract-ocr/ccmain/cubeclassifier.h
- /mnt/data/src/tesseract-ocr/ccmain/cubeclassifier.cpp