#include <shapeclassifier.h>
|
virtual | ~ShapeClassifier ()=default |
|
virtual int | UnicharClassifySample (const TrainingSample &sample, Pix *page_pix, int debug, UNICHAR_ID keep_this, GenericVector< UnicharRating > *results) |
|
virtual int | BestShapeForUnichar (const TrainingSample &sample, Pix *page_pix, UNICHAR_ID unichar_id, ShapeRating *result) |
|
virtual const ShapeTable * | GetShapeTable () const =0 |
|
virtual const UNICHARSET & | GetUnicharset () const |
|
virtual void | DebugDisplay (const TrainingSample &sample, Pix *page_pix, UNICHAR_ID unichar_id) |
|
virtual int | DisplayClassifyAs (const TrainingSample &sample, Pix *page_pix, UNICHAR_ID unichar_id, int index, PointerVector< ScrollView > *windows) |
|
virtual void | UnicharPrintResults (const char *context, const GenericVector< UnicharRating > &results) const |
|
virtual void | PrintResults (const char *context, const GenericVector< ShapeRating > &results) const |
|
Definition at line 43 of file shapeclassifier.h.
◆ ~ShapeClassifier()
virtual tesseract::ShapeClassifier::~ShapeClassifier |
( |
| ) |
|
|
virtualdefault |
◆ BestShapeForUnichar()
Definition at line 69 of file shapeclassifier.cpp.
75 for (
int r = 0; r < num_results; ++r) {
76 if (shapes->GetShape(results[r].shape_id).ContainsUnichar(unichar_id)) {
77 if (result !=
nullptr)
79 return results[r].shape_id;
◆ ClassifySample()
◆ DebugDisplay()
Definition at line 96 of file shapeclassifier.cpp.
99 #ifndef GRAPHICS_DISABLED
101 if (terminator ==
nullptr) {
102 terminator =
new ScrollView(
"XIT", 0, 0, 50, 50, 50, 50,
true);
107 popup_menu->AddChild(
"Choose class to debug", 0,
"x",
"Class to debug");
108 popup_menu->BuildMenu(debug_win,
false);
111 uint32_t num_features =
sample.num_features();
112 for (uint32_t f = 0; f < num_features; ++f) {
122 PointerVector<ScrollView> windows;
123 if (unichar_id >= 0) {
124 tprintf(
"Debugging class %d = %s\n",
129 tprintf(
"Invalid unichar_id: %d\n", unichar_id);
132 if (unichar_id >= 0) {
133 tprintf(
"Debugged class %d = %s\n",
136 tprintf(
"Right-click in ClassifierDebug window to choose debug class,");
137 tprintf(
" Left-click or close window to quit...\n");
140 old_unichar_id = unichar_id;
151 }
while (unichar_id == old_unichar_id &&
155 #endif // GRAPHICS_DISABLED
◆ DisplayClassifyAs()
◆ FilterDuplicateUnichars()
Definition at line 202 of file shapeclassifier.cpp.
207 for (
int r = 0; r < results->
size(); ++r) {
209 const Shape& shape_r = shapes->GetShape((*results)[r].shape_id);
211 for (c = 0; c < shape_r.size(); ++c) {
212 int unichar_id = shape_r[c].unichar_id;
214 for (s = 0; s < r; ++s) {
215 const Shape& shape_s = shapes->GetShape((*results)[s].shape_id);
216 if (shape_s.ContainsUnichar(unichar_id))
222 if (c == shape_r.size())
225 filtered_results.
push_back((*results)[r]);
227 *results = filtered_results;
◆ GetShapeTable()
virtual const ShapeTable* tesseract::ShapeClassifier::GetShapeTable |
( |
| ) |
const |
|
pure virtual |
◆ GetUnicharset()
const UNICHARSET & tesseract::ShapeClassifier::GetUnicharset |
( |
| ) |
const |
|
virtual |
◆ PrintResults()
void tesseract::ShapeClassifier::PrintResults |
( |
const char * |
context, |
|
|
const GenericVector< ShapeRating > & |
results |
|
) |
| const |
|
virtual |
Definition at line 187 of file shapeclassifier.cpp.
190 for (
int i = 0; i < results.
size(); ++i) {
191 tprintf(
"%g:", results[i].rating);
192 if (results[i].joined)
194 if (results[i].broken)
◆ UnicharClassifySample()
◆ UnicharPrintResults()
void tesseract::ShapeClassifier::UnicharPrintResults |
( |
const char * |
context, |
|
|
const GenericVector< UnicharRating > & |
results |
|
) |
| const |
|
virtual |
Definition at line 172 of file shapeclassifier.cpp.
175 for (
int i = 0; i < results.
size(); ++i) {
176 tprintf(
"%g: c_id=%d=%s", results[i].rating, results[i].unichar_id,
178 if (!results[i].fonts.empty()) {
180 for (
int f = 0; f < results[i].fonts.
size(); ++f) {
181 tprintf(
" %d", results[i].fonts[f].fontinfo_id);
The documentation for this class was generated from the following files: