#include <ratngs.h>
|
| BLOB_CHOICE () |
|
| BLOB_CHOICE (UNICHAR_ID src_unichar_id, float src_rating, float src_cert, int script_id, float min_xheight, float max_xheight, float yshift, BlobChoiceClassifier c) |
|
| BLOB_CHOICE (const BLOB_CHOICE &other) |
|
| ~BLOB_CHOICE ()=default |
|
UNICHAR_ID | unichar_id () const |
|
float | rating () const |
|
float | certainty () const |
|
int16_t | fontinfo_id () const |
|
int16_t | fontinfo_id2 () const |
|
const GenericVector< tesseract::ScoredFont > & | fonts () const |
|
void | set_fonts (const GenericVector< tesseract::ScoredFont > &fonts) |
|
int | script_id () const |
|
const MATRIX_COORD & | matrix_cell () |
|
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_script (int newscript_id) |
|
void | set_matrix_cell (int col, int row) |
|
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 |
|
| ELIST_LINK () |
|
| ELIST_LINK (const ELIST_LINK &) |
|
void | operator= (const ELIST_LINK &) |
|
Definition at line 51 of file ratngs.h.
◆ BLOB_CHOICE() [1/3]
BLOB_CHOICE::BLOB_CHOICE |
( |
| ) |
|
|
inline |
Definition at line 54 of file ratngs.h.
54 {
56 fontinfo_id_ = -1;
57 fontinfo_id2_ = -1;
58 rating_ = 10.0;
59 certainty_ = -1.0;
60 script_id_ = -1;
61 min_xheight_ = 0.0f;
62 max_xheight_ = 0.0f;
63 yshift_ = 0.0f;
65 }
◆ BLOB_CHOICE() [2/3]
BLOB_CHOICE::BLOB_CHOICE |
( |
UNICHAR_ID |
src_unichar_id, |
|
|
float |
src_rating, |
|
|
float |
src_cert, |
|
|
int |
src_script_id, |
|
|
float |
min_xheight, |
|
|
float |
max_xheight, |
|
|
float |
yshift, |
|
|
BlobChoiceClassifier |
c |
|
) |
| |
BLOB_CHOICE::BLOB_CHOICE
Constructor to build a BLOB_CHOICE from a char, rating and certainty.
Definition at line 92 of file ratngs.cpp.
99 {
100 unichar_id_ = src_unichar_id;
101 rating_ = src_rating;
102 certainty_ = src_cert;
103 fontinfo_id_ = -1;
104 fontinfo_id2_ = -1;
105 script_id_ = src_script_id;
109 classifier_ = c;
110}
float max_xheight() const
float min_xheight() const
◆ BLOB_CHOICE() [3/3]
BLOB_CHOICE::BLOB_CHOICE
Constructor to build a BLOB_CHOICE from another BLOB_CHOICE.
Definition at line 117 of file ratngs.cpp.
124 matrix_cell_ = other.matrix_cell_;
125 min_xheight_ = other.min_xheight_;
126 max_xheight_ = other.max_xheight_;
128 classifier_ = other.classifier_;
129#ifndef DISABLED_LEGACY_ENGINE
130 fonts_ = other.fonts_;
131#endif
132}
int16_t fontinfo_id2() const
int16_t fontinfo_id() const
UNICHAR_ID unichar_id() const
◆ ~BLOB_CHOICE()
BLOB_CHOICE::~BLOB_CHOICE |
( |
| ) |
|
|
default |
◆ certainty()
float BLOB_CHOICE::certainty |
( |
| ) |
const |
|
inline |
Definition at line 83 of file ratngs.h.
83 {
84 return certainty_;
85 }
◆ classifier()
Definition at line 129 of file ratngs.h.
129 {
130 return classifier_;
131 }
◆ deep_copy()
Definition at line 160 of file ratngs.h.
160 {
162 *choice = *src;
163 return choice;
164 }
◆ fontinfo_id()
int16_t BLOB_CHOICE::fontinfo_id |
( |
| ) |
const |
|
inline |
Definition at line 86 of file ratngs.h.
86 {
87 return fontinfo_id_;
88 }
◆ fontinfo_id2()
int16_t BLOB_CHOICE::fontinfo_id2 |
( |
| ) |
const |
|
inline |
Definition at line 89 of file ratngs.h.
89 {
90 return fontinfo_id2_;
91 }
◆ fonts()
Definition at line 93 of file ratngs.h.
93 {
94 return fonts_;
95 }
◆ IsAdapted()
bool BLOB_CHOICE::IsAdapted |
( |
| ) |
const |
|
inline |
◆ IsClassified()
bool BLOB_CHOICE::IsClassified |
( |
| ) |
const |
|
inline |
◆ matrix_cell()
Definition at line 117 of file ratngs.h.
117 {
118 return matrix_cell_;
119 }
◆ max_xheight()
float BLOB_CHOICE::max_xheight |
( |
| ) |
const |
|
inline |
Definition at line 123 of file ratngs.h.
123 {
124 return max_xheight_;
125 }
◆ min_xheight()
float BLOB_CHOICE::min_xheight |
( |
| ) |
const |
|
inline |
Definition at line 120 of file ratngs.h.
120 {
121 return min_xheight_;
122 }
◆ PosAndSizeAgree()
bool BLOB_CHOICE::PosAndSizeAgree |
( |
const BLOB_CHOICE & |
other, |
|
|
float |
x_height, |
|
|
bool |
debug |
|
) |
| const |
Definition at line 156 of file ratngs.cpp.
157 {
160 if (debug) {
161 tprintf(
"Baseline diff %g for %d v %d\n",
162 baseline_diff, unichar_id_, other.unichar_id_);
163 }
164 return false;
165 }
168 double denominator =
ClipToRange(std::min(this_range, other_range),
172 overlap /= denominator;
173 if (debug) {
174 tprintf(
"PosAndSize for %d v %d: bl diff = %g, ranges %g, %g / %g ->%g\n",
175 unichar_id_, other.unichar_id_, baseline_diff,
176 this_range, other_range, denominator, overlap);
177 }
178
180}
const double kMaxBaselineDrift
const double kMaxOverlapDenominator
const double kMinXHeightMatch
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
DLLSYM void tprintf(const char *format,...)
◆ print()
void BLOB_CHOICE::print |
( |
const UNICHARSET * |
unicharset | ) |
const |
|
inline |
Definition at line 170 of file ratngs.h.
170 {
171 tprintf(
"r%.2f c%.2f x[%g,%g]: %d %s",
172 rating_, certainty_,
173 min_xheight_, max_xheight_, unichar_id_,
174 (unicharset == nullptr) ? "" :
176 }
const char * string() const
STRING debug_str(UNICHAR_ID id) const
◆ print_full()
void BLOB_CHOICE::print_full |
( |
| ) |
const |
|
inline |
Definition at line 177 of file ratngs.h.
177 {
179 tprintf(
" script=%d, font1=%d, font2=%d, yshift=%g, classifier=%d\n",
180 script_id_, fontinfo_id_, fontinfo_id2_, yshift_, classifier_);
181 }
void print(const UNICHARSET *unicharset) const
◆ rating()
float BLOB_CHOICE::rating |
( |
| ) |
const |
|
inline |
Definition at line 80 of file ratngs.h.
80 {
81 return rating_;
82 }
◆ script_id()
int BLOB_CHOICE::script_id |
( |
| ) |
const |
|
inline |
Definition at line 114 of file ratngs.h.
114 {
115 return script_id_;
116 }
◆ set_certainty()
void BLOB_CHOICE::set_certainty |
( |
float |
newrat | ) |
|
|
inline |
Definition at line 147 of file ratngs.h.
147 {
148 certainty_ = newrat;
149 }
◆ set_classifier()
Definition at line 157 of file ratngs.h.
157 {
159 }
BlobChoiceClassifier classifier() const
◆ set_fonts()
Definition at line 96 of file ratngs.h.
96 {
98 int score1 = 0, score2 = 0;
99 fontinfo_id_ = -1;
100 fontinfo_id2_ = -1;
101 for (
int f = 0; f < fonts_.
size(); ++f) {
102 if (fonts_[f].score > score1) {
103 score2 = score1;
104 fontinfo_id2_ = fontinfo_id_;
105 score1 = fonts_[f].score;
106 fontinfo_id_ = fonts_[f].fontinfo_id;
107 } else if (fonts_[f].score > score2) {
108 score2 = fonts_[f].score;
109 fontinfo_id2_ = fonts_[f].fontinfo_id;
110 }
111 }
112 }
const GenericVector< tesseract::ScoredFont > & fonts() const
◆ set_matrix_cell()
void BLOB_CHOICE::set_matrix_cell |
( |
int |
col, |
|
|
int |
row |
|
) |
| |
|
inline |
Definition at line 153 of file ratngs.h.
153 {
154 matrix_cell_.
col = col;
155 matrix_cell_.
row = row;
156 }
◆ set_rating()
void BLOB_CHOICE::set_rating |
( |
float |
newrat | ) |
|
|
inline |
Definition at line 144 of file ratngs.h.
144 {
145 rating_ = newrat;
146 }
◆ set_script()
void BLOB_CHOICE::set_script |
( |
int |
newscript_id | ) |
|
|
inline |
Definition at line 150 of file ratngs.h.
150 {
151 script_id_ = newscript_id;
152 }
◆ set_unichar_id()
void BLOB_CHOICE::set_unichar_id |
( |
UNICHAR_ID |
newunichar_id | ) |
|
|
inline |
Definition at line 141 of file ratngs.h.
141 {
142 unichar_id_ = newunichar_id;
143 }
◆ SortByRating()
static int BLOB_CHOICE::SortByRating |
( |
const void * |
p1, |
|
|
const void * |
p2 |
|
) |
| |
|
inlinestatic |
Definition at line 183 of file ratngs.h.
183 {
186 return (bc1->rating_ < bc2->rating_) ? -1 : 1;
187 }
◆ unichar_id()
Definition at line 77 of file ratngs.h.
77 {
78 return unichar_id_;
79 }
◆ yshift()
float BLOB_CHOICE::yshift |
( |
| ) |
const |
|
inline |
Definition at line 126 of file ratngs.h.
126 {
127 return yshift_;
128 }
The documentation for this class was generated from the following files: