17#include <allheaders.h>
28static bool file_exists(
const char *filename) {
30 return _access(filename, 0) == 0;
32 return access(filename, 0) == 0;
45 static std::locale system_locale(
"");
46 std::locale::global(system_locale);
88 std::string filename =
file::JoinPath(TESTING_DIR,
"segmodeimg.tif");
89 if (!file_exists(filename.c_str())) {
90 LOG(
INFO) <<
"Skip test because of missing " << filename <<
'\n';
93 SetImage(filename.c_str());
100 #ifdef DISABLED_LEGACY_ENGINE
102 LOG(
INFO) <<
"Skip `Whatshould` test in LSTM Mode\n";
#define EXPECT_STREQ(s1, s2)
#define EXPECT_STRNE(s1, s2)
@ PSM_SINGLE_WORD
Treat the image as a single word.
@ PSM_SINGLE_BLOCK
Assume a single uniform block of text. (Default.)
@ PSM_SINGLE_LINE
Treat the image as a single text line.
void chomp_string(char *str)
TEST_F(EuroText, FastLatinOCR)
void SetPageSegMode(PageSegMode mode)
void SetRectangle(int left, int top, int width, int height)
int Init(const char *datapath, const char *language, OcrEngineMode mode, char **configs, int configs_size, const std::vector< std::string > *vars_vec, const std::vector< std::string > *vars_values, bool set_only_non_debug_params)
void SetImage(const unsigned char *imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)
static std::string JoinPath(const std::string &s1, const std::string &s2)
PageSegModeTest()=default
~PageSegModeTest() override
void NotRectText(tesseract::PageSegMode mode, const char *str, int left, int top, int width, int height)
void SetImage(const char *filename)
tesseract::TessBaseAPI api_
void VerifyRectText(tesseract::PageSegMode mode, const char *str, int left, int top, int width, int height)