#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 (
float f : blob_o_score) {
422 if (worst_score == 0.0f || f < worst_score)
426 if (num_good_scores == 1) {
430 for (
float& f : blob_o_score) {
433 total_blob_o_score += worst_score;
438 for (
int i = 0; total_blob_o_score != 0 && i < 4; ++i) {
◆ get_orientation()
int OrientationDetector::get_orientation |
( |
| ) |
|
The documentation for this class was generated from the following files: