FOSSredder 0.5.0
Loading...
Searching...
No Matches
TesseractCore.cpp File Reference

Implements Tesseract OCR extraction helpers. More...

#include "text-recognition/pch.h"
#include "text-recognition/TesseractCore.h"
#include "core/ports/diagnostics/IDiagnostics.h"
#include "core/ports/infra/text-recognition/TextRecognitionTypes.h"
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <array>
#include <filesystem>
#include <cstdlib>
#include <system_error>
Include dependency graph for TesseractCore.cpp:

Go to the source code of this file.

Functions

static Pix * pixFromBytes (const std::vector< uint8_t > &data)
static std::string readEnvironmentVariable (const char *name)
static std::filesystem::path executableDirectory ()
static std::string resolveTessdataPath (const std::string &provided)
static tesseract::OcrEngineMode toTesseractOem (ports::EngineMode mode)
static std::string resolveLanguage (const ports::Settings &recognition)
static void configureForStatements (tesseract::TessBaseAPI &ocr, const ports::Settings &recognition)
static void applyPsm (tesseract::TessBaseAPI &ocr, int psm)
static ports::Text recognizeTextFromBytes (const std::vector< uint8_t > &data, const std::string &tessdataPath, const ports::Settings &recognition, std::shared_ptr< core::ports::diagnostics::IDiagnostics > dbg)
static vector< ports::Word > getWordsFromBytes (const std::vector< uint8_t > &data, const std::string &tessdataPath, const ports::Settings &recognition, std::shared_ptr< core::ports::diagnostics::IDiagnostics > dbg)

Detailed Description

Implements Tesseract OCR extraction helpers.

Definition in file TesseractCore.cpp.

Function Documentation

◆ applyPsm()

void applyPsm ( tesseract::TessBaseAPI & ocr,
int psm )
static

Definition at line 129 of file TesseractCore.cpp.

Here is the caller graph for this function:

◆ configureForStatements()

void configureForStatements ( tesseract::TessBaseAPI & ocr,
const ports::Settings & recognition )
static

Definition at line 121 of file TesseractCore.cpp.

Here is the caller graph for this function:

◆ executableDirectory()

std::filesystem::path executableDirectory ( )
static

Definition at line 53 of file TesseractCore.cpp.

Here is the caller graph for this function:

◆ getWordsFromBytes()

vector< ports::Word > getWordsFromBytes ( const std::vector< uint8_t > & data,
const std::string & tessdataPath,
const ports::Settings & recognition,
std::shared_ptr< core::ports::diagnostics::IDiagnostics > dbg )
static

Definition at line 166 of file TesseractCore.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pixFromBytes()

Pix * pixFromBytes ( const std::vector< uint8_t > & data)
static

Definition at line 27 of file TesseractCore.cpp.

Here is the caller graph for this function:

◆ readEnvironmentVariable()

std::string readEnvironmentVariable ( const char * name)
static

Definition at line 33 of file TesseractCore.cpp.

Here is the caller graph for this function:

◆ recognizeTextFromBytes()

ports::Text recognizeTextFromBytes ( const std::vector< uint8_t > & data,
const std::string & tessdataPath,
const ports::Settings & recognition,
std::shared_ptr< core::ports::diagnostics::IDiagnostics > dbg )
static

Definition at line 137 of file TesseractCore.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolveLanguage()

std::string resolveLanguage ( const ports::Settings & recognition)
static

Definition at line 117 of file TesseractCore.cpp.

Here is the caller graph for this function:

◆ resolveTessdataPath()

std::string resolveTessdataPath ( const std::string & provided)
static

Definition at line 67 of file TesseractCore.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toTesseractOem()

tesseract::OcrEngineMode toTesseractOem ( ports::EngineMode mode)
static

Definition at line 103 of file TesseractCore.cpp.

Here is the caller graph for this function: