tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
19 #ifndef TESSERACT_IMAGE_IMAGEDATA_H_
20 #define TESSERACT_IMAGE_IMAGEDATA_H_
63 int* max_x,
int* max_y);
69 int x()
const {
return x_; }
70 int y()
const {
return y_; }
71 int dir()
const {
return dir_; }
114 const char* imagedata,
int imagedatasize,
115 const char* truth_text,
const char*
box_text);
126 return imagefilename_;
129 imagefilename_ = name;
147 return transcription_;
156 return box_texts_[index];
170 Pix*
PreScale(
int target_height,
int max_height,
float* scale_factor,
171 int* scaled_width,
int* scaled_height,
198 int32_t page_number_;
217 bool LoadDocument(
const char* filename,
int start_page, int64_t max_memory,
229 std::lock_guard<std::mutex> lock(general_mutex_);
230 return document_name_;
233 std::lock_guard<std::mutex> lock(general_mutex_);
237 return pages_.size();
240 std::lock_guard<std::mutex> lock(general_mutex_);
264 std::lock_guard<std::mutex> lock(pages_mutex_);
266 pages_[index] =
nullptr;
280 void set_total_pages(
int total) {
281 std::lock_guard<std::mutex> lock(general_mutex_);
282 total_pages_ = total;
285 std::lock_guard<std::mutex> lock(general_mutex_);
296 PointerVector<ImageData> pages_;
302 int64_t memory_used_;
309 std::mutex pages_mutex_;
312 mutable std::mutex general_mutex_;
328 num_pages_per_doc_ = 0;
345 return GetPageSequential(serial);
347 return GetPageRoundRobin(serial);
361 const ImageData* GetPageRoundRobin(
int serial);
365 const ImageData* GetPageSequential(
int serial);
369 int CountNeighbourDocs(
int index,
int dir);
377 int num_pages_per_doc_;
385 #endif // TESSERACT_IMAGE_IMAGEDATA_H_
const STRING & document_name() const
bool Serialize(FILE *fp) const
bool(*)(const GenericVector< char > &data, const char *filename) FileWriter
DocumentData * FindDocument(const STRING &document_name) const
bool Serialize(TFile *fp) const
Pix * PreScale(int target_height, int max_height, float *scale_factor, int *scaled_width, int *scaled_height, GenericVector< TBOX > *boxes) const
bool IsPageAvailable(int index, ImageData **page)
void set_imagefilename(const STRING &name)
bool DeSerialize(bool swap, FILE *fp)
bool LoadDocuments(const GenericVector< STRING > &filenames, CachingStrategy cache_strategy, FileReader reader)
friend void * ReCachePagesFunc(void *data)
void AddBoxes(const GenericVector< TBOX > &boxes, const GenericVector< STRING > &texts, const GenericVector< int > &box_pages)
bool(*)(const char *filename, GenericVector< char > *data) FileReader
const GenericVector< STRING > & box_texts() const
static void FromWordFeatures(const GenericVector< WordFeature > &word_features, GenericVector< FloatWordFeature > *float_features)
const STRING & imagefilename() const
const int kFeaturePadding
const ImageData * GetPage(int index)
void SetDocument(const char *filename, int64_t max_memory, FileReader reader)
bool SaveDocument(const char *filename, FileWriter writer)
const GenericVector< TBOX > & boxes() const
const ImageData * GetPageBySerial(int serial)
static bool SkipDeSerialize(TFile *fp)
const STRING & transcription() const
int64_t memory_used() const
const STRING & box_text(int index) const
bool AddToCache(DocumentData *data)
const GenericVector< char > & image_data() const
static void ComputeSize(const GenericVector< WordFeature > &features, int *max_x, int *max_y)
void AddPageToDocument(ImageData *page)
static void Draw(const GenericVector< WordFeature > &features, ScrollView *window)
bool LoadDocument(const char *filename, int start_page, int64_t max_memory, FileReader reader)
bool DeSerialize(TFile *fp)
void LoadPageInBackground(int index)
static ImageData * Build(const char *name, int page_number, const char *lang, const char *imagedata, int imagedatasize, const char *truth_text, const char *box_text)
const STRING & language() const
DocumentData(const STRING &name)
void set_page_number(int num)
void set_language(const STRING &lang)
DocumentCache(int64_t max_memory)
bool SaveToBuffer(GenericVector< char > *buffer)
static int SortByXBucket(const void *, const void *)
const PointerVector< DocumentData > & documents() const
ImageData * TakePage(int index)