Tesseract
3.02
|
#include <blobs.h>
Public Member Functions | |
TWERD () | |
TWERD (const TWERD &src) | |
~TWERD () | |
TWERD & | operator= (const TWERD &src) |
void | SetupBLNormalize (const BLOCK *block, const ROW *row, float x_height, bool numeric_mode, DENORM *denorm) const |
void | Normalize (const DENORM &denorm) |
void | CopyFrom (const TWERD &src) |
void | Clear () |
void | ComputeBoundingBoxes () |
int | NumBlobs () const |
TBOX | bounding_box () const |
void | MergeBlobs (int start, int end) |
void | plot (ScrollView *window) |
Static Public Member Functions | |
static TWERD * | PolygonalCopy (WERD *src) |
Public Attributes | |
TBLOB * | blobs |
bool | latin_script |
TWERD * | next |
TWERD::TWERD | ( | ) | [inline] |
TWERD::TWERD | ( | const TWERD & | src | ) | [inline] |
TBOX TWERD::bounding_box | ( | ) | const |
void TWERD::Clear | ( | ) |
void TWERD::ComputeBoundingBoxes | ( | ) |
void TWERD::CopyFrom | ( | const TWERD & | src | ) |
void TWERD::MergeBlobs | ( | int | start, |
int | end | ||
) |
Definition at line 487 of file blobs.cpp.
{ TBLOB* blob = blobs; for (int i = 0; i < start && blob != NULL; ++i) blob = blob->next; if (blob == NULL || blob->next == NULL) return; TBLOB* next_blob = blob->next; TESSLINE* outline = blob->outlines; for (int i = start + 1; i < end && next_blob != NULL; ++i) { // Take the outlines from the next blob. if (outline == NULL) { blob->outlines = next_blob->outlines; outline = blob->outlines; } else { while (outline->next != NULL) outline = outline->next; outline->next = next_blob->outlines; next_blob->outlines = NULL; } // Delete the next blob and move on. TBLOB* dead_blob = next_blob; next_blob = next_blob->next; blob->next = next_blob; delete dead_blob; } }
void TWERD::Normalize | ( | const DENORM & | denorm | ) |
int TWERD::NumBlobs | ( | ) | const [inline] |
Definition at line 259 of file blobs.h.
{ return count_blobs(blobs); }
void TWERD::plot | ( | ScrollView * | window | ) |
Definition at line 514 of file blobs.cpp.
{ ScrollView::Color color = WERD::NextColor(ScrollView::BLACK); for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) { blob->plot(window, color, ScrollView::BROWN); color = WERD::NextColor(color); } }
Definition at line 398 of file blobs.cpp.
{ TWERD* tessword = new TWERD; tessword->latin_script = src->flag(W_SCRIPT_IS_LATIN); C_BLOB_IT b_it(src->cblob_list()); TBLOB *tail = NULL; for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) { C_BLOB* blob = b_it.data(); TBLOB* tblob = TBLOB::PolygonalCopy(blob); if (tail == NULL) { tessword->blobs = tblob; } else { tail->next = tblob; } tail = tblob; } return tessword; }
void TWERD::SetupBLNormalize | ( | const BLOCK * | block, |
const ROW * | row, | ||
float | x_height, | ||
bool | numeric_mode, | ||
DENORM * | denorm | ||
) | const |
Definition at line 417 of file blobs.cpp.
{ int num_segments = 0; DENORM_SEG* segs = NULL; if (numeric_mode) { segs = new DENORM_SEG[NumBlobs()]; for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) { TBOX blob_box = blob->bounding_box(); float factor = kBlnXHeight / x_height; factor = ClipToRange(kBlnXHeight * 4.0f / (3 * blob_box.height()), factor, factor * 1.5f); segs[num_segments].xstart = blob_box.left(); segs[num_segments].ycoord = blob_box.bottom(); segs[num_segments++].scale_factor = factor; } } denorm->SetupBLNormalize(block, row, x_height, bounding_box(), num_segments, segs); delete [] segs; }
bool TWERD::latin_script |