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
TBLOB Struct Reference

`#include <blobs.h>`

List of all members.

## Public Member Functions

| TBLOB ()
| TBLOB (const TBLOB &src)
| ~TBLOB ()
TBLOB & | operator= (const TBLOB &src)
TBLOB * | ClassifyNormalizeIfNeeded (const DENORM **denorm) const
void | CopyFrom (const TBLOB &src)
void | Clear ()
void | Normalize (const DENORM &denorm)
void | Rotate (const FCOORD rotation)
void | Move (const ICOORD vec)
void | Scale (float factor)
void | ComputeBoundingBoxes ()
int | NumOutlines () const
TBOX | bounding_box () const
void | plot (ScrollView *window, ScrollView::Color color, ScrollView::Color child_color)
int | BBArea () const

## Static Public Member Functions

static TBLOB * | PolygonalCopy (C_BLOB *src)

## Public Attributes

TESSLINE * | outlines
TBLOB * | next

## Detailed Description

Definition at line 174 of file blobs.h.

## Constructor & Destructor Documentation

TBLOB::TBLOB | ( |  | ) |

inline

Definition at line 175 of file blobs.h.

: outlines(NULL), next(NULL) {}

TBLOB::TBLOB | ( | const TBLOB & | src | ) |

inline

Definition at line 176 of file blobs.h.

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

TBLOB::~TBLOB | ( |  | ) |

inline

Definition at line 179 of file blobs.h.

{
Clear();
}

## Member Function Documentation

int TBLOB::BBArea | ( |  | ) | const

inline

Definition at line 220 of file blobs.h.

{
int total_area = 0;
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next)
total_area += outline->BBArea();
return total_area;
}

TBOX TBLOB::bounding_box | ( |  | ) | const

Definition at line 384 of file blobs.cpp.

{
if (outlines == NULL)
return TBOX(0, 0, 0, 0);
TESSLINE *outline = outlines;
TBOX box = outline->bounding_box();
for (outline = outline->next; outline != NULL; outline = outline->next) {
box += outline->bounding_box();
}
return box;
}

TBLOB * TBLOB::ClassifyNormalizeIfNeeded | ( | const DENORM ** | denorm | ) | const

Definition at line 281 of file blobs.cpp.

{
TBLOB* rotated_blob = NULL;
// If necessary, copy the blob and rotate it. The rotation is always
// +/- 90 degrees, as 180 was already taken care of.
if ((*denorm)->block() != NULL &&
(*denorm)->block()->classify_rotation().y() != 0.0) {
TBOX box = bounding_box();
int x_middle = (box.left() + box.right()) / 2;
int y_middle = (box.top() + box.bottom()) / 2;
rotated_blob = new TBLOB(*this);
const FCOORD& rotation = (*denorm)->block()->classify_rotation();
DENORM* norm = new DENORM;
// Move the rotated blob back to the same y-position so that we
// can still distinguish similar glyphs with differeny y-position.
float target_y = kBlnBaselineOffset +
(rotation.y() > 0 ? x_middle - box.left() : box.right() - x_middle);
norm->SetupNormalization(NULL, NULL, &rotation, *denorm, NULL, 0,
x_middle, y_middle, 1.0f, 1.0f, 0.0f, target_y);
// x_middle, y_middle, 1.0f, 1.0f, 0.0f, y_middle);
rotated_blob->Normalize(*norm);
*denorm = norm;
}
return rotated_blob;
}

void TBLOB::Clear | ( |  | ) |

Definition at line 322 of file blobs.cpp.

{
for (TESSLINE* next_outline = NULL; outlines != NULL;
outlines = next_outline) {
next_outline = outlines->next;
delete outlines;
}
}

void TBLOB::ComputeBoundingBoxes | ( |  | ) |

Definition at line 364 of file blobs.cpp.

{
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next) {
outline->ComputeBoundingBox();
}
}

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

Definition at line 307 of file blobs.cpp.

{
Clear();
TESSLINE* prev_outline = NULL;
for (TESSLINE* srcline = src.outlines; srcline != NULL;
srcline = srcline->next) {
TESSLINE* new_outline = new TESSLINE(*srcline);
if (outlines == NULL)
outlines = new_outline;
else
prev_outline->next = new_outline;
prev_outline = new_outline;
}
}

void TBLOB::Move | ( | const ICOORD | vec | ) |

Definition at line 350 of file blobs.cpp.

{
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next) {
outline->Move(vec);
}
}

void TBLOB::Normalize | ( | const DENORM & | denorm | ) |

Definition at line 330 of file blobs.cpp.

{
// TODO(rays) outline->Normalize is more accurate, but breaks tests due
// the changes it makes. Reinstate this code with a retraining.
#if 1
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next) {
outline->Normalize(denorm);
}
#else
denorm.LocalNormBlob(this);
#endif
}

int TBLOB::NumOutlines | ( |  | ) | const

Definition at line 371 of file blobs.cpp.

{
int result = 0;
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next)
++result;
return result;
}

TBLOB& TBLOB::operator= | ( | const TBLOB & | src | ) |

inline

Definition at line 182 of file blobs.h.

{
CopyFrom(src);
return *this;
}

void TBLOB::plot | ( | ScrollView * | window,
|  | ScrollView::Color | color,
|  | ScrollView::Color | child_color
| ) |  |

Definition at line 396 of file blobs.cpp.

{
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next)
outline->plot(window, color, child_color);
}

TBLOB * TBLOB::PolygonalCopy | ( | C_BLOB * | src | ) |

static

Definition at line 269 of file blobs.cpp.

{
C_OUTLINE_IT ol_it = src->out_list();
TBLOB* tblob = new TBLOB;
ApproximateOutlineList(src->out_list(), false, &tblob->outlines);
return tblob;
}

void TBLOB::Rotate | ( | const FCOORD | rotation | ) |

Definition at line 343 of file blobs.cpp.

{
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next) {
outline->Rotate(rotation);
}
}

void TBLOB::Scale | ( | float | factor | ) |

Definition at line 357 of file blobs.cpp.

{
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next) {
outline->Scale(factor);
}
}

## Member Data Documentation

TBLOB* TBLOB::next

Definition at line 228 of file blobs.h.

TESSLINE* TBLOB::outlines

Definition at line 227 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