"Fossies" - the Fresh Open Source Software Archive

Member "tesseract-ocr/doc/html/class_orientation_detector.html" (26 Oct 2012, 14335 Bytes) of package /linux/misc/old/tesseract-ocr-3.02.02-doc-html.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the tesseract-ocr-3.02.02-doc-html.tar.gz project site itself.

Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OrientationDetector Class Reference

#include <osdetect.h>

List of all members.

Public Member Functions

 OrientationDetector (OSResults *)
bool detect_blob (BLOB_CHOICE_LIST *scores)
int get_orientation ()

Detailed Description

Definition at line 82 of file osdetect.h.


Constructor & Destructor Documentation

OrientationDetector::OrientationDetector ( OSResults osr)

Definition at line 370 of file osdetect.cpp.

{
osr_ = osr;
}

Member Function Documentation

bool OrientationDetector::detect_blob ( BLOB_CHOICE_LIST *  scores)

Definition at line 376 of file osdetect.cpp.

{
float blob_o_score[4] = {0.0, 0.0, 0.0, 0.0};
float total_blob_o_score = 0.0;
for (int i = 0; i < 4; ++i) {
BLOB_CHOICE_IT choice_it;
choice_it.set_to_list(scores + i);
if (!choice_it.empty()) {
// The certainty score ranges between [-20,0]. This is converted here to
// [0,1], with 1 indicating best match.
blob_o_score[i] = 1 + 0.05 * choice_it.data()->certainty();
total_blob_o_score += blob_o_score[i];
}
}
// Normalize the orientation scores for the blob and use them to
// update the aggregated orientation score.
for (int i = 0; total_blob_o_score != 0 && i < 4; ++i) {
osr_->orientations[i] += log(blob_o_score[i] / total_blob_o_score);
}
float first = -1;
float second = -1;
int idx = -1;
for (int i = 0; i < 4; ++i) {
if (osr_->orientations[i] > first) {
idx = i;
second = first;
first = osr_->orientations[i];
} else if (osr_->orientations[i] > second) {
second = osr_->orientations[i];
}
}
return first / second > kOrientationAcceptRatio;
}
int OrientationDetector::get_orientation ( )

Definition at line 413 of file osdetect.cpp.


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