mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
pagewalk.cpp cube_reco_context.cpp
This commit is contained in:
parent
84acf08bf0
commit
50fe1ffc40
@ -32,11 +32,11 @@
|
|||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
// Instantiate a CubeRecoContext object using a Tesseract object.
|
/// Instantiate a CubeRecoContext object using a Tesseract object.
|
||||||
// CubeRecoContext will not take ownership of tess_obj, but will
|
/// CubeRecoContext will not take ownership of tess_obj, but will
|
||||||
// record the pointer to it and will make use of various Tesseract
|
/// record the pointer to it and will make use of various Tesseract
|
||||||
// components (language model, flags, etc). Thus the caller should
|
/// components (language model, flags, etc). Thus the caller should
|
||||||
// keep tess_obj alive so long as the instantiated CubeRecoContext is used.
|
/// keep tess_obj alive so long as the instantiated CubeRecoContext is used.
|
||||||
CubeRecoContext::CubeRecoContext(Tesseract *tess_obj) {
|
CubeRecoContext::CubeRecoContext(Tesseract *tess_obj) {
|
||||||
tess_obj_ = tess_obj;
|
tess_obj_ = tess_obj;
|
||||||
lang_ = "";
|
lang_ = "";
|
||||||
@ -89,23 +89,23 @@ CubeRecoContext::~CubeRecoContext() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the path of the data files by looking up the TESSDATA_PREFIX
|
/// Returns the path of the data files by looking up the TESSDATA_PREFIX
|
||||||
// environment variable and appending a "tessdata" directory to it
|
/// environment variable and appending a "tessdata" directory to it
|
||||||
bool CubeRecoContext::GetDataFilePath(string *path) const {
|
bool CubeRecoContext::GetDataFilePath(string *path) const {
|
||||||
*path = tess_obj_->datadir.string();
|
*path = tess_obj_->datadir.string();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The object initialization function that loads all the necessary
|
/// The object initialization function that loads all the necessary
|
||||||
// components of a RecoContext. TessdataManager is used to load the
|
/// components of a RecoContext. TessdataManager is used to load the
|
||||||
// data from [lang].traineddata file. If TESSDATA_CUBE_UNICHARSET
|
/// data from [lang].traineddata file. If TESSDATA_CUBE_UNICHARSET
|
||||||
// component is present, Cube will be instantiated with the unicharset
|
/// component is present, Cube will be instantiated with the unicharset
|
||||||
// specified in this component and the corresponding dictionary
|
/// specified in this component and the corresponding dictionary
|
||||||
// (TESSDATA_CUBE_SYSTEM_DAWG), and will map Cube's unicharset to
|
/// (TESSDATA_CUBE_SYSTEM_DAWG), and will map Cube's unicharset to
|
||||||
// Tesseract's. Otherwise, TessdataManager will assume that Cube will
|
/// Tesseract's. Otherwise, TessdataManager will assume that Cube will
|
||||||
// be using Tesseract's unicharset and dawgs, and will load the
|
/// be using Tesseract's unicharset and dawgs, and will load the
|
||||||
// unicharset from the TESSDATA_UNICHARSET component and will load the
|
/// unicharset from the TESSDATA_UNICHARSET component and will load the
|
||||||
// dawgs from TESSDATA_*_DAWG components.
|
/// dawgs from TESSDATA_*_DAWG components.
|
||||||
bool CubeRecoContext::Load(TessdataManager *tessdata_manager,
|
bool CubeRecoContext::Load(TessdataManager *tessdata_manager,
|
||||||
UNICHARSET *tess_unicharset) {
|
UNICHARSET *tess_unicharset) {
|
||||||
ASSERT_HOST(tess_obj_ != NULL);
|
ASSERT_HOST(tess_obj_ != NULL);
|
||||||
@ -178,7 +178,7 @@ bool CubeRecoContext::Load(TessdataManager *tessdata_manager,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a CubeRecoContext object using a tesseract object
|
/// Creates a CubeRecoContext object using a tesseract object
|
||||||
CubeRecoContext * CubeRecoContext::Create(Tesseract *tess_obj,
|
CubeRecoContext * CubeRecoContext::Create(Tesseract *tess_obj,
|
||||||
TessdataManager *tessdata_manager,
|
TessdataManager *tessdata_manager,
|
||||||
UNICHARSET *tess_unicharset) {
|
UNICHARSET *tess_unicharset) {
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
#include "pageres.h"
|
#include "pageres.h"
|
||||||
#include "tesseractclass.h"
|
#include "tesseractclass.h"
|
||||||
|
|
||||||
|
namespace tesseract {
|
||||||
/**
|
/**
|
||||||
* process_selected_words()
|
* @name process_selected_words()
|
||||||
*
|
*
|
||||||
* Walk the current block list applying the specified word processor function
|
* Walk the current block list applying the specified word processor function
|
||||||
* to each word that overlaps the selection_box.
|
* to each word that overlaps the selection_box.
|
||||||
*/
|
*/
|
||||||
namespace tesseract {
|
|
||||||
void Tesseract::process_selected_words(
|
void Tesseract::process_selected_words(
|
||||||
PAGE_RES* page_res, // blocks to check
|
PAGE_RES* page_res, // blocks to check
|
||||||
TBOX & selection_box,
|
TBOX & selection_box,
|
||||||
|
Loading…
Reference in New Issue
Block a user