tesseract
3.03
|
#include <ratngs.h>
Public Member Functions | |
BLOB_CHOICE () | |
BLOB_CHOICE (UNICHAR_ID src_unichar_id, float src_rating, float src_cert, inT16 src_fontinfo_id, inT16 src_fontinfo_id2, int script_id, float min_xheight, float max_xheight, float yshift, BlobChoiceClassifier c) | |
BLOB_CHOICE (const BLOB_CHOICE &other) | |
~BLOB_CHOICE () | |
UNICHAR_ID | unichar_id () const |
float | rating () const |
float | certainty () const |
inT16 | fontinfo_id () const |
inT16 | fontinfo_id2 () const |
int | script_id () const |
const MATRIX_COORD & | matrix_cell () |
inT16 | xgap_before () const |
inT16 | xgap_after () const |
float | min_xheight () const |
float | max_xheight () const |
float | yshift () const |
BlobChoiceClassifier | classifier () const |
bool | IsAdapted () const |
bool | IsClassified () const |
void | set_unichar_id (UNICHAR_ID newunichar_id) |
void | set_rating (float newrat) |
void | set_certainty (float newrat) |
void | set_fontinfo_id (inT16 newfont) |
void | set_fontinfo_id2 (inT16 newfont) |
void | set_script (int newscript_id) |
void | set_matrix_cell (int col, int row) |
void | set_xgap_before (inT16 gap) |
void | set_xgap_after (inT16 gap) |
void | set_classifier (BlobChoiceClassifier classifier) |
bool | PosAndSizeAgree (const BLOB_CHOICE &other, float x_height, bool debug) const |
void | print (const UNICHARSET *unicharset) const |
void | print_full () const |
Static Public Member Functions | |
static BLOB_CHOICE * | deep_copy (const BLOB_CHOICE *src) |
static int | SortByRating (const void *p1, const void *p2) |
BLOB_CHOICE::BLOB_CHOICE | ( | ) | [inline] |
Definition at line 50 of file ratngs.h.
{ unichar_id_ = INVALID_UNICHAR_ID; fontinfo_id_ = -1; fontinfo_id2_ = -1; rating_ = MAX_FLOAT32; certainty_ = -MAX_FLOAT32; script_id_ = -1; xgap_before_ = 0; xgap_after_ = 0; min_xheight_ = 0.0f; max_xheight_ = 0.0f; yshift_ = 0.0f; classifier_ = BCC_FAKE; }
BLOB_CHOICE::BLOB_CHOICE | ( | UNICHAR_ID | src_unichar_id, |
float | src_rating, | ||
float | src_cert, | ||
inT16 | src_fontinfo_id, | ||
inT16 | src_fontinfo_id2, | ||
int | src_script_id, | ||
float | min_xheight, | ||
float | max_xheight, | ||
float | yshift, | ||
BlobChoiceClassifier | c | ||
) |
Constructor to build a BLOB_CHOICE from a char, rating and certainty.
Definition at line 90 of file ratngs.cpp.
{ // adapted match or other unichar_id_ = src_unichar_id; rating_ = src_rating; certainty_ = src_cert; fontinfo_id_ = src_fontinfo_id; fontinfo_id2_ = src_fontinfo_id2; script_id_ = src_script_id; min_xheight_ = min_xheight; max_xheight_ = max_xheight; yshift_ = yshift; classifier_ = c; }
BLOB_CHOICE::BLOB_CHOICE | ( | const BLOB_CHOICE & | other | ) |
Constructor to build a BLOB_CHOICE from another BLOB_CHOICE.
Definition at line 117 of file ratngs.cpp.
{ unichar_id_ = other.unichar_id(); rating_ = other.rating(); certainty_ = other.certainty(); fontinfo_id_ = other.fontinfo_id(); fontinfo_id2_ = other.fontinfo_id2(); script_id_ = other.script_id(); matrix_cell_ = other.matrix_cell_; min_xheight_ = other.min_xheight_; max_xheight_ = other.max_xheight_; yshift_ = other.yshift(); classifier_ = other.classifier_; }
BLOB_CHOICE::~BLOB_CHOICE | ( | ) | [inline] |
float BLOB_CHOICE::certainty | ( | ) | const [inline] |
BlobChoiceClassifier BLOB_CHOICE::classifier | ( | ) | const [inline] |
static BLOB_CHOICE* BLOB_CHOICE::deep_copy | ( | const BLOB_CHOICE * | src | ) | [inline, static] |
Definition at line 156 of file ratngs.h.
{ BLOB_CHOICE* choice = new BLOB_CHOICE; *choice = *src; return choice; }
inT16 BLOB_CHOICE::fontinfo_id | ( | ) | const [inline] |
inT16 BLOB_CHOICE::fontinfo_id2 | ( | ) | const [inline] |
bool BLOB_CHOICE::IsAdapted | ( | ) | const [inline] |
Definition at line 116 of file ratngs.h.
{ return classifier_ == BCC_ADAPTED_CLASSIFIER; }
bool BLOB_CHOICE::IsClassified | ( | ) | const [inline] |
Definition at line 119 of file ratngs.h.
{ return classifier_ == BCC_STATIC_CLASSIFIER || classifier_ == BCC_ADAPTED_CLASSIFIER || classifier_ == BCC_SPECKLE_CLASSIFIER; }
const MATRIX_COORD& BLOB_CHOICE::matrix_cell | ( | ) | [inline] |
float BLOB_CHOICE::max_xheight | ( | ) | const [inline] |
float BLOB_CHOICE::min_xheight | ( | ) | const [inline] |
bool BLOB_CHOICE::PosAndSizeAgree | ( | const BLOB_CHOICE & | other, |
float | x_height, | ||
bool | debug | ||
) | const |
Definition at line 133 of file ratngs.cpp.
{ double baseline_diff = fabs(yshift() - other.yshift()); if (baseline_diff > kMaxBaselineDrift * x_height) { if (debug) { tprintf("Baseline diff %g for %d v %d\n", baseline_diff, unichar_id_, other.unichar_id_); } return false; } double this_range = max_xheight() - min_xheight(); double other_range = other.max_xheight() - other.min_xheight(); double denominator = ClipToRange(MIN(this_range, other_range), 1.0, kMaxOverlapDenominator * x_height); double overlap = MIN(max_xheight(), other.max_xheight()) - MAX(min_xheight(), other.min_xheight()); overlap /= denominator; if (debug) { tprintf("PosAndSize for %d v %d: bl diff = %g, ranges %g, %g / %g ->%g\n", unichar_id_, other.unichar_id_, baseline_diff, this_range, other_range, denominator, overlap); } return overlap >= kMinXHeightMatch; }
void BLOB_CHOICE::print | ( | const UNICHARSET * | unicharset | ) | const [inline] |
void BLOB_CHOICE::print_full | ( | ) | const [inline] |
float BLOB_CHOICE::rating | ( | ) | const [inline] |
int BLOB_CHOICE::script_id | ( | ) | const [inline] |
void BLOB_CHOICE::set_certainty | ( | float | newrat | ) | [inline] |
void BLOB_CHOICE::set_classifier | ( | BlobChoiceClassifier | classifier | ) | [inline] |
Definition at line 153 of file ratngs.h.
{ classifier_ = classifier; }
void BLOB_CHOICE::set_fontinfo_id | ( | inT16 | newfont | ) | [inline] |
void BLOB_CHOICE::set_fontinfo_id2 | ( | inT16 | newfont | ) | [inline] |
void BLOB_CHOICE::set_matrix_cell | ( | int | col, |
int | row | ||
) | [inline] |
void BLOB_CHOICE::set_rating | ( | float | newrat | ) | [inline] |
void BLOB_CHOICE::set_script | ( | int | newscript_id | ) | [inline] |
void BLOB_CHOICE::set_unichar_id | ( | UNICHAR_ID | newunichar_id | ) | [inline] |
void BLOB_CHOICE::set_xgap_after | ( | inT16 | gap | ) | [inline] |
void BLOB_CHOICE::set_xgap_before | ( | inT16 | gap | ) | [inline] |
static int BLOB_CHOICE::SortByRating | ( | const void * | p1, |
const void * | p2 | ||
) | [inline, static] |
Definition at line 179 of file ratngs.h.
{ const BLOB_CHOICE *bc1 = *reinterpret_cast<const BLOB_CHOICE * const *>(p1); const BLOB_CHOICE *bc2 = *reinterpret_cast<const BLOB_CHOICE * const *>(p2); return (bc1->rating_ < bc2->rating_) ? -1 : 1; }
UNICHAR_ID BLOB_CHOICE::unichar_id | ( | ) | const [inline] |
inT16 BLOB_CHOICE::xgap_after | ( | ) | const [inline] |
inT16 BLOB_CHOICE::xgap_before | ( | ) | const [inline] |
float BLOB_CHOICE::yshift | ( | ) | const [inline] |