#include <osdetect.h>
Definition at line 84 of file osdetect.h.
◆ OrientationDetector()
OrientationDetector::OrientationDetector |
( |
const GenericVector< int > * |
allowed_scripts, |
|
|
OSResults * |
results |
|
) |
| |
Definition at line 374 of file osdetect.cpp.
377 allowed_scripts_ = allowed_scripts;
◆ detect_blob()
bool OrientationDetector::detect_blob |
( |
BLOB_CHOICE_LIST * |
scores | ) |
|
Definition at line 382 of file osdetect.cpp.
383 float blob_o_score[4] = {0.0f, 0.0f, 0.0f, 0.0f};
384 float total_blob_o_score = 0.0f;
386 for (
int i = 0; i < 4; ++i) {
387 BLOB_CHOICE_IT choice_it(scores + i);
388 if (!choice_it.empty()) {
390 if (allowed_scripts_ !=
nullptr && !allowed_scripts_->
empty()) {
392 for (choice_it.mark_cycle_pt(); !choice_it.cycled_list() &&
393 choice ==
nullptr; choice_it.forward()) {
394 int choice_script = choice_it.data()->
script_id();
396 for (s = 0; s < allowed_scripts_->
size(); ++s) {
397 if ((*allowed_scripts_)[s] == choice_script) {
398 choice = choice_it.data();
404 choice = choice_it.data();
406 if (choice !=
nullptr) {
409 blob_o_score[i] = 1 + 0.05 * choice->
certainty();
410 total_blob_o_score += blob_o_score[i];
414 if (total_blob_o_score == 0.0)
return false;
417 float worst_score = 0.0f;
418 int num_good_scores = 0;
419 for (
int i = 0; i < 4; ++i) {
420 if (blob_o_score[i] > 0.0f) {
422 if (worst_score == 0.0f || blob_o_score[i] < worst_score)
423 worst_score = blob_o_score[i];
426 if (num_good_scores == 1) {
430 for (
int i = 0; i < 4; ++i) {
431 if (blob_o_score[i] == 0.0f) {
432 blob_o_score[i] = worst_score;
433 total_blob_o_score += worst_score;
438 for (
int i = 0; total_blob_o_score != 0 && i < 4; ++i) {
439 osr_->
orientations[i] += log(blob_o_score[i] / total_blob_o_score);
◆ get_orientation()
int OrientationDetector::get_orientation |
( |
| ) |
|
Definition at line 447 of file osdetect.cpp.
void update_best_orientation()
The documentation for this class was generated from the following files: