#include <blobs.h>
List of all members.
Public Member Functions |
| | TBLOB () |
| | TBLOB (const TBLOB &src) |
| | ~TBLOB () |
| TBLOB & | operator= (const TBLOB &src) |
| TBLOB * | ClassifyNormalizeIfNeeded () const |
| void | CopyFrom (const TBLOB &src) |
| void | Clear () |
| void | Normalize (const BLOCK *block, const FCOORD *rotation, const DENORM *predecessor, float x_origin, float y_origin, float x_scale, float y_scale, float final_xshift, float final_yshift, bool inverse, Pix *pix) |
| void | Rotate (const FCOORD rotation) |
| void | Move (const ICOORD vec) |
| void | Scale (float factor) |
| void | ComputeBoundingBoxes () |
| int | NumOutlines () const |
| TBOX | bounding_box () const |
| bool | SegmentCrossesOutline (const TPOINT &pt1, const TPOINT &pt2) const |
| bool | Contains (const TPOINT &pt) const |
| void | EliminateDuplicateOutlines () |
| void | CorrectBlobOrder (TBLOB *next) |
| const DENORM & | denorm () const |
| void | plot (ScrollView *window, ScrollView::Color color, ScrollView::Color child_color) |
| int | BBArea () const |
| int | ComputeMoments (FCOORD *center, FCOORD *second_moments) const |
| void | GetPreciseBoundingBox (TBOX *precise_box) const |
| void | GetEdgeCoords (const TBOX &box, GenericVector< GenericVector< int > > *x_coords, GenericVector< GenericVector< int > > *y_coords) const |
Static Public Member Functions |
| static TBLOB * | PolygonalCopy (bool allow_detailed_fx, C_BLOB *src) |
| static TBLOB * | ShallowCopy (const TBLOB &src) |
Public Attributes |
| TESSLINE * | outlines |
Detailed Description
Definition at line 261 of file blobs.h.
Constructor & Destructor Documentation
| TBLOB::TBLOB |
( |
| ) |
[inline] |
| TBLOB::TBLOB |
( |
const TBLOB & |
src | ) |
[inline] |
| TBLOB::~TBLOB |
( |
| ) |
[inline] |
Member Function Documentation
| int TBLOB::BBArea |
( |
| ) |
const [inline] |
Definition at line 349 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 |
| TBLOB * TBLOB::ClassifyNormalizeIfNeeded |
( |
| ) |
const |
Definition at line 363 of file blobs.cpp.
{
TBLOB* rotated_blob = NULL;
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();
float target_y = kBlnBaselineOffset +
(rotation.y() > 0 ? x_middle - box.left() : box.right() - x_middle);
rotated_blob->Normalize(NULL, &rotation, &denorm_, x_middle, y_middle,
1.0f, 1.0f, 0.0f, target_y,
denorm_.inverse(), denorm_.pix());
}
return rotated_blob;
}
| void TBLOB::ComputeBoundingBoxes |
( |
| ) |
|
| int TBLOB::ComputeMoments |
( |
FCOORD * |
center, |
|
|
FCOORD * |
second_moments |
|
) |
| const |
Definition at line 535 of file blobs.cpp.
{
LLSQ accumulator;
TBOX box = bounding_box();
CollectEdges(box, NULL, &accumulator, NULL, NULL);
*center = accumulator.mean_point() + box.botleft();
double x2nd = sqrt(accumulator.x_variance());
double y2nd = sqrt(accumulator.y_variance());
if (x2nd < 1.0) x2nd = 1.0;
if (y2nd < 1.0) y2nd = 1.0;
second_moments->set_x(x2nd);
second_moments->set_y(y2nd);
return accumulator.count();
}
| bool TBLOB::Contains |
( |
const TPOINT & |
pt | ) |
const [inline] |
Definition at line 324 of file blobs.h.
{
for (const TESSLINE* outline = outlines; outline != NULL;
outline = outline->next) {
if (outline->Contains(pt)) return true;
}
return false;
}
| void TBLOB::CopyFrom |
( |
const TBLOB & |
src | ) |
|
| void TBLOB::CorrectBlobOrder |
( |
TBLOB * |
next | ) |
|
| const DENORM& TBLOB::denorm |
( |
| ) |
const [inline] |
| void TBLOB::EliminateDuplicateOutlines |
( |
| ) |
|
Definition at line 495 of file blobs.cpp.
{
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next) {
TESSLINE* last_outline = outline;
for (TESSLINE* other_outline = outline->next; other_outline != NULL;
last_outline = other_outline, other_outline = other_outline->next) {
if (outline->SameBox(*other_outline)) {
last_outline->next = other_outline->next;
other_outline->loop = NULL;
delete other_outline;
other_outline = last_outline;
outline->is_hole = false;
}
}
}
}
| void TBLOB::GetPreciseBoundingBox |
( |
TBOX * |
precise_box | ) |
const |
| void TBLOB::Move |
( |
const ICOORD |
vec | ) |
|
| void TBLOB::Normalize |
( |
const BLOCK * |
block, |
|
|
const FCOORD * |
rotation, |
|
|
const DENORM * |
predecessor, |
|
|
float |
x_origin, |
|
|
float |
y_origin, |
|
|
float |
x_scale, |
|
|
float |
y_scale, |
|
|
float |
final_xshift, |
|
|
float |
final_yshift, |
|
|
bool |
inverse, |
|
|
Pix * |
pix |
|
) |
| |
| int TBLOB::NumOutlines |
( |
| ) |
const |
Definition at line 469 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 524 of file blobs.cpp.
{
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next)
outline->plot(window, color, child_color);
}
| TBLOB * TBLOB::PolygonalCopy |
( |
bool |
allow_detailed_fx, |
|
|
C_BLOB * |
src |
|
) |
| [static] |
| void TBLOB::Rotate |
( |
const FCOORD |
rotation | ) |
|
| void TBLOB::Scale |
( |
float |
factor | ) |
|
| bool TBLOB::SegmentCrossesOutline |
( |
const TPOINT & |
pt1, |
|
|
const TPOINT & |
pt2 |
|
) |
| const [inline] |
Definition at line 316 of file blobs.h.
{
for (const TESSLINE* outline = outlines; outline != NULL;
outline = outline->next) {
if (outline->SegmentCrosses(pt1, pt2)) return true;
}
return false;
}
| TBLOB * TBLOB::ShallowCopy |
( |
const TBLOB & |
src | ) |
[static] |
Definition at line 352 of file blobs.cpp.
{
TBLOB* blob = new TBLOB;
blob->denorm_ = src.denorm_;
return blob;
}
Member Data Documentation
The documentation for this struct was generated from the following files: