Use std::vector for allowed_scripts

Signed-off-by: Stefan Weil <sw@weil.de>
This commit is contained in:
Stefan Weil 2020-12-26 22:30:39 +01:00
parent 32d53479ae
commit 7c679e777d
2 changed files with 10 additions and 11 deletions

View File

@ -20,7 +20,8 @@
#ifndef TESSERACT_CCMAIN_OSDETECT_H_
#define TESSERACT_CCMAIN_OSDETECT_H_
#include "platform.h" // for TESS_API
#include "platform.h" // for TESS_API
#include <vector> // for std::vector
namespace tesseract {
@ -29,8 +30,6 @@ class BLOBNBOX_CLIST;
class BLOB_CHOICE_LIST;
class TO_BLOCK_LIST;
class UNICHARSET;
template <typename T>
class GenericVector;
class Tesseract;
@ -82,19 +81,19 @@ struct OSResults {
class OrientationDetector {
public:
OrientationDetector(const GenericVector<int>* allowed_scripts,
OrientationDetector(const std::vector<int>* allowed_scripts,
OSResults* results);
bool detect_blob(BLOB_CHOICE_LIST* scores);
int get_orientation();
private:
OSResults* osr_;
const GenericVector<int>* allowed_scripts_;
const std::vector<int>* allowed_scripts_;
};
class ScriptDetector {
public:
ScriptDetector(const GenericVector<int>* allowed_scripts, OSResults* osr,
ScriptDetector(const std::vector<int>* allowed_scripts, OSResults* osr,
tesseract::Tesseract* tess);
void detect_blob(BLOB_CHOICE_LIST* scores);
bool must_stop(int orientation);
@ -113,7 +112,7 @@ class ScriptDetector {
int latin_id_;
int fraktur_id_;
tesseract::Tesseract* tess_;
const GenericVector<int>* allowed_scripts_;
const std::vector<int>* allowed_scripts_;
};
int orientation_and_script_detection(const char* filename, OSResults*,
@ -122,7 +121,7 @@ int orientation_and_script_detection(const char* filename, OSResults*,
int os_detect(TO_BLOCK_LIST* port_blocks, OSResults* osr,
tesseract::Tesseract* tess);
int os_detect_blobs(const GenericVector<int>* allowed_scripts,
int os_detect_blobs(const std::vector<int>* allowed_scripts,
BLOBNBOX_CLIST* blob_list, OSResults* osr,
tesseract::Tesseract* tess);

View File

@ -278,7 +278,7 @@ int os_detect(TO_BLOCK_LIST* port_blocks, OSResults* osr,
// If allowed_scripts is non-null and non-empty, it is a list of scripts that
// constrains both orientation and script detection to consider only scripts
// from the list.
int os_detect_blobs(const GenericVector<int>* allowed_scripts,
int os_detect_blobs(const std::vector<int>* allowed_scripts,
BLOBNBOX_CLIST* blob_list, OSResults* osr,
tesseract::Tesseract* tess) {
OSResults osr_;
@ -375,7 +375,7 @@ bool os_detect_blob(BLOBNBOX* bbox, OrientationDetector* o,
OrientationDetector::OrientationDetector(
const GenericVector<int>* allowed_scripts, OSResults* osr) {
const std::vector<int>* allowed_scripts, OSResults* osr) {
osr_ = osr;
allowed_scripts_ = allowed_scripts;
}
@ -453,7 +453,7 @@ int OrientationDetector::get_orientation() {
}
ScriptDetector::ScriptDetector(const GenericVector<int>* allowed_scripts,
ScriptDetector::ScriptDetector(const std::vector<int>* allowed_scripts,
OSResults* osr, tesseract::Tesseract* tess) {
osr_ = osr;
tess_ = tess;