Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes
TWERD Struct Reference

`#include <blobs.h>`

List of all members.

## 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

## Detailed Description

Definition at line 233 of file blobs.h.

## Constructor & Destructor Documentation

TWERD::TWERD | ( |  | ) |
| inline

Definition at line 234 of file blobs.h.

: blobs(NULL), latin_script(false), next(NULL) {}

TWERD::TWERD | ( | const TWERD & | src | ) |
| inline

Definition at line 235 of file blobs.h.

: blobs(NULL), next(NULL) {
CopyFrom(src);
}

TWERD::~TWERD | ( |  | ) |
| inline

Definition at line 238 of file blobs.h.

{
Clear();
}

## Member Function Documentation

TBOX TWERD::bounding_box | ( |  | ) | const

Definition at line 483 of file blobs.cpp.

{
TBOX result;
for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) {
TBOX box = blob->bounding_box();
result += box;
}
return result;
}

void TWERD::Clear | ( |  | ) |

Definition at line 469 of file blobs.cpp.

{
for (TBLOB* next_blob = NULL; blobs != NULL; blobs = next_blob) {
next_blob = blobs->next;
delete blobs;
}
}

void TWERD::ComputeBoundingBoxes | ( |  | ) |

Definition at line 477 of file blobs.cpp.

{
for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) {
blob->ComputeBoundingBoxes();
}
}

void TWERD::CopyFrom | ( | const TWERD & | src | ) |

Definition at line 454 of file blobs.cpp.

{
Clear();
latin_script = src.latin_script;
TBLOB* prev_blob = NULL;
for (TBLOB* srcblob = src.blobs; srcblob != NULL; srcblob = srcblob->next) {
TBLOB* new_blob = new TBLOB(*srcblob);
if (blobs == NULL)
blobs = new_blob;
else
prev_blob->next = new_blob;
prev_blob = new_blob;
}
}

void TWERD::MergeBlobs | ( | int | start,
|  | int | end
| ) |  |

Definition at line 494 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 | ) |

Definition at line 447 of file blobs.cpp.

{
for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) {
blob->Normalize(denorm);
}
}

int TWERD::NumBlobs | ( |  | ) | const
| inline

Definition at line 263 of file blobs.h.

{
return count_blobs(blobs);
}

TWERD& TWERD::operator= | ( | const TWERD & | src | ) |
| inline

Definition at line 241 of file blobs.h.

{
CopyFrom(src);
return *this;
}

void TWERD::plot | ( | ScrollView * | window | ) |

Definition at line 522 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);
}
}

TWERD * TWERD::PolygonalCopy | ( | WERD * | src | ) |
| static

Definition at line 405 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 424 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;
}

## Member Data Documentation

TBLOB* TWERD::blobs

Definition at line 274 of file blobs.h.

bool TWERD::latin_script

Definition at line 275 of file blobs.h.

TWERD* TWERD::next

Definition at line 276 of file blobs.h.

The documentation for this struct was generated from the following files:

- /mnt/data/src/tesseract-ocr/ccstruct/blobs.h
- /mnt/data/src/tesseract-ocr/ccstruct/blobs.cpp