#include <boxchar.h>
List of all members.
Public Member Functions |
| BoxChar (const char *utf8_str, int len) |
| ~BoxChar () |
const string & | ch () const |
const Box * | box () const |
const int & | page () const |
void | AddBox (int x, int y, int width, int height) |
void | set_page (int page) |
string * | mutable_ch () |
Box * | mutable_box () |
Static Public Member Functions |
static void | TranslateBoxes (int xshift, int yshift, vector< BoxChar * > *boxes) |
static void | RotateBoxes (float rotation, int xcenter, int ycenter, int start_box, int end_box, vector< BoxChar * > *boxes) |
static void | WriteTesseractBoxFile (const string &name, int height, const vector< BoxChar * > &boxes) |
Detailed Description
Definition at line 40 of file boxchar.h.
Constructor & Destructor Documentation
Definition at line 31 of file boxchar.cpp.
: ch_(utf8_str, len) {
box_ = NULL;
}
Member Function Documentation
Definition at line 39 of file boxchar.cpp.
{
box_ = boxCreate(x, y, width, height);
}
Definition at line 58 of file boxchar.cpp.
{
Boxa* orig = boxaCreate(0);
for (int i = start_box; i < end_box; ++i) {
BOX* box = (*boxes)[i]->box_;
if (box) boxaAddBox(orig, box, L_CLONE);
}
Boxa* rotated = boxaRotate(orig, xcenter, ycenter, rotation);
boxaDestroy(&orig);
for (int i = start_box, box_ind = 0; i < end_box; ++i) {
if ((*boxes)[i]->box_) {
boxDestroy(&((*boxes)[i]->box_));
(*boxes)[i]->box_ = boxaGetBox(rotated, box_ind++, L_CLONE);
}
}
boxaDestroy(&rotated);
}
Definition at line 44 of file boxchar.cpp.
{
for (int i = 0; i < boxes->size(); ++i) {
BOX* box = (*boxes)[i]->box_;
if (box != NULL) {
box->x += xshift;
box->y += yshift;
}
}
}
Definition at line 81 of file boxchar.cpp.
{
string output;
const int kMaxLineLength = 1024;
char buffer[kMaxLineLength];
for (int i = 0; i < boxes.size(); ++i) {
if (boxes[i]->box_ != NULL) {
int nbytes = snprintf(buffer, kMaxLineLength,
"%s %d %d %d %d %d\n",
boxes[i]->ch_.c_str(),
boxes[i]->box_->x,
height - boxes[i]->box_->y - boxes[i]->box_->h,
boxes[i]->box_->x + boxes[i]->box_->w,
height - boxes[i]->box_->y,
boxes[i]->page_);
output.append(buffer, nbytes);
}
}
File::WriteStringToFileOrDie(output, filename);
}
The documentation for this class was generated from the following files:
- /usr/local/google/home/jbreiden/tesseract-ocr-read-only/training/boxchar.h
- /usr/local/google/home/jbreiden/tesseract-ocr-read-only/training/boxchar.cpp