#include <osdetect.h>
Definition at line 82 of file osdetect.h.
| OrientationDetector::OrientationDetector |
( |
const GenericVector< int > * |
allowed_scripts, |
|
|
OSResults * |
results |
|
) |
| |
Definition at line 371 of file osdetect.cpp.
374 allowed_scripts_ = allowed_scripts;
| bool OrientationDetector::detect_blob |
( |
BLOB_CHOICE_LIST * |
scores | ) |
|
Definition at line 379 of file osdetect.cpp.
380 float blob_o_score[4] = {0.0f, 0.0f, 0.0f, 0.0f};
381 float total_blob_o_score = 0.0f;
383 for (
int i = 0;
i < 4; ++
i) {
384 BLOB_CHOICE_IT choice_it(scores +
i);
385 if (!choice_it.empty()) {
387 if (allowed_scripts_ != NULL && !allowed_scripts_->
empty()) {
389 for (choice_it.mark_cycle_pt(); !choice_it.cycled_list() &&
390 choice == NULL; choice_it.forward()) {
391 int choice_script = choice_it.data()->
script_id();
393 for (s = 0; s < allowed_scripts_->
size(); ++s) {
394 if ((*allowed_scripts_)[s] == choice_script) {
395 choice = choice_it.data();
401 choice = choice_it.data();
403 if (choice != NULL) {
406 blob_o_score[
i] = 1 + 0.05 * choice->
certainty();
407 total_blob_o_score += blob_o_score[
i];
411 if (total_blob_o_score == 0.0)
return false;
414 float worst_score = 0.0f;
415 int num_good_scores = 0;
416 for (
int i = 0;
i < 4; ++
i) {
417 if (blob_o_score[
i] > 0.0f) {
419 if (worst_score == 0.0f || blob_o_score[
i] < worst_score)
420 worst_score = blob_o_score[
i];
423 if (num_good_scores == 1) {
427 for (
int i = 0;
i < 4; ++
i) {
428 if (blob_o_score[
i] == 0.0f) {
429 blob_o_score[
i] = worst_score;
430 total_blob_o_score += worst_score;
435 for (
int i = 0; total_blob_o_score != 0 &&
i < 4; ++
i) {
436 osr_->
orientations[
i] += log(blob_o_score[
i] / total_blob_o_score);
| int OrientationDetector::get_orientation |
( |
| ) |
|
Definition at line 444 of file osdetect.cpp.
void update_best_orientation()
The documentation for this class was generated from the following files: