#include <cube_object.h>
Definition at line 90 of file cube_object.h.
◆ CubeObject() [1/2]
◆ CubeObject() [2/2]
tesseract::CubeObject::CubeObject |
( |
CubeRecoContext * |
cntxt, |
|
|
Pix * |
pix, |
|
|
int |
left, |
|
|
int |
top, |
|
|
int |
wid, |
|
|
int |
hgt |
|
) |
| |
Definition at line 32 of file cube_object.cpp.
36 own_char_samp_ =
true;
static CharSamp * CharSampleFromPix(Pix *pix, int left, int top, int wid, int hgt)
◆ ~CubeObject()
tesseract::CubeObject::~CubeObject |
( |
| ) |
|
Definition at line 64 of file cube_object.cpp.
65 if (own_char_samp_ ==
true) {
73 delete deslanted_srch_obj_;
74 deslanted_srch_obj_ = NULL;
79 delete deslanted_beam_obj_;
80 deslanted_beam_obj_ = NULL;
82 delete deslanted_char_samp_;
83 deslanted_char_samp_ = NULL;
◆ AlternateList()
WordAltList* tesseract::CubeObject::AlternateList |
( |
| ) |
const |
|
inline |
Definition at line 119 of file cube_object.h.
120 return (deslanted_ ==
true ? deslanted_alt_list_ : alt_list_);
◆ BeamObj()
BeamSearch* tesseract::CubeObject::BeamObj |
( |
| ) |
const |
|
inline |
Definition at line 114 of file cube_object.h.
115 return (deslanted_ ==
true ? deslanted_beam_obj_ : beam_obj_);
◆ CharSample()
CharSamp* tesseract::CubeObject::CharSample |
( |
| ) |
const |
|
inline |
Definition at line 130 of file cube_object.h.
131 return (deslanted_ ==
true ? deslanted_char_samp_ : char_samp_);
◆ Normalize()
bool tesseract::CubeObject::Normalize |
( |
| ) |
|
|
protected |
Definition at line 219 of file cube_object.cpp.
221 CubeSearchObject *srch_obj =
new CubeSearchObject(cntxt_, char_samp_);
223 int seg_cnt = srch_obj->SegPtCnt();
225 if (seg_cnt < kMinNormalizationSegmentCnt) {
230 double ar_mean = 0.0;
231 for (
int seg_idx = 0; seg_idx <= seg_cnt; seg_idx++) {
232 CharSamp *seg_samp = srch_obj->CharSample(seg_idx - 1, seg_idx);
233 if (seg_samp != NULL && seg_samp->Width() > 0) {
234 ar_mean += (1.0 * seg_samp->Height() / seg_samp->Width());
237 ar_mean /= (seg_cnt + 1);
239 if (ar_mean > kMinNormalizationAspectRatio) {
241 CharSamp *new_samp = char_samp_->
Scale(char_samp_->
Width(),
242 2.0 * char_samp_->
Height() / ar_mean,
244 if (new_samp != NULL) {
246 if (own_char_samp_) {
250 char_samp_ = new_samp;
251 own_char_samp_ =
true;
unsigned short Height() const
CharSamp * Scale(int wid, int hgt, bool isotropic=true)
unsigned short Width() const
◆ RecognizeChar()
Definition at line 209 of file cube_object.cpp.
210 if (char_samp_ == NULL)
return NULL;
211 CharAltList* alt_list = NULL;
212 CharClassifier *char_classifier = cntxt_->
Classifier();
214 alt_list = char_classifier->Classify(char_samp_);
CharClassifier * Classifier() const
◆ RecognizePhrase()
Recognize the member char sample as a phrase
Definition at line 178 of file cube_object.cpp.
179 return Recognize(lang_mod,
false);
◆ RecognizeWord()
Recognize the member char sample as a word
Definition at line 171 of file cube_object.cpp.
172 return Recognize(lang_mod,
true);
◆ SetCharSampOwnership()
void tesseract::CubeObject::SetCharSampOwnership |
( |
bool |
own_char_samp | ) |
|
|
inline |
Definition at line 135 of file cube_object.h.
136 own_char_samp_ = own_char_samp;
◆ SrchObj()
Definition at line 124 of file cube_object.h.
125 return (deslanted_ ==
true ? deslanted_srch_obj_ : srch_obj_);
◆ WordCost()
int tesseract::CubeObject::WordCost |
( |
const char * |
str | ) |
|
Computes the cost of a specific string. This is done by performing recognition of a language model that allows only the specified word
Definition at line 186 of file cube_object.cpp.
187 WordListLangModel *lang_mod =
new WordListLangModel(cntxt_);
189 if (lang_mod->AddString(str) ==
false) {
199 if (alt_list != NULL) {
200 if (alt_list->AltCount() > 0) {
201 cost = alt_list->AltCost(0);
WordAltList * RecognizeWord(LangModel *lang_mod=NULL)
The documentation for this class was generated from the following files: