#include <blobs.h>
|
| 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, Image 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, std::vector< std::vector< int >> &x_coords, std::vector< std::vector< int >> &y_coords) const |
|
Definition at line 291 of file blobs.h.
◆ TBLOB() [1/2]
tesseract::TBLOB::TBLOB |
( |
| ) |
|
|
inline |
◆ TBLOB() [2/2]
tesseract::TBLOB::TBLOB |
( |
const TBLOB & |
src | ) |
|
|
inline |
Definition at line 293 of file blobs.h.
void CopyFrom(const TBLOB &src)
◆ ~TBLOB()
tesseract::TBLOB::~TBLOB |
( |
| ) |
|
|
inline |
◆ BBArea()
int tesseract::TBLOB::BBArea |
( |
| ) |
const |
|
inline |
Definition at line 376 of file blobs.h.
378 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
379 total_area += outline->BBArea();
◆ bounding_box()
TBOX tesseract::TBLOB::bounding_box |
( |
| ) |
const |
Definition at line 466 of file blobs.cpp.
468 return TBOX(0, 0, 0, 0);
471 TBOX box = outline->bounding_box();
472 for (outline = outline->next; outline !=
nullptr; outline = outline->next) {
473 box += outline->bounding_box();
◆ ClassifyNormalizeIfNeeded()
TBLOB * tesseract::TBLOB::ClassifyNormalizeIfNeeded |
( |
| ) |
const |
Definition at line 353 of file blobs.cpp.
354 TBLOB *rotated_blob =
nullptr;
359 int x_middle = (box.left() + box.right()) / 2;
360 int y_middle = (box.top() + box.bottom()) / 2;
361 rotated_blob =
new TBLOB(*
this);
366 kBlnBaselineOffset + (rotation.y() > 0 ? x_middle - box.left() : box.right() - x_middle);
367 rotated_blob->Normalize(
nullptr, &rotation, &denorm_, x_middle, y_middle, 1.0f, 1.0f, 0.0f,
const int kBlnBaselineOffset
TBOX bounding_box() const
const BLOCK * block() const
FCOORD classify_rotation() const
◆ Clear()
void tesseract::TBLOB::Clear |
( |
| ) |
|
◆ ComputeBoundingBoxes()
void tesseract::TBLOB::ComputeBoundingBoxes |
( |
| ) |
|
Definition at line 445 of file blobs.cpp.
446 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
447 outline->ComputeBoundingBox();
◆ ComputeMoments()
int tesseract::TBLOB::ComputeMoments |
( |
FCOORD * |
center, |
|
|
FCOORD * |
second_moments |
|
) |
| const |
Definition at line 520 of file blobs.cpp.
525 CollectEdges(box,
nullptr, &accumulator,
nullptr,
nullptr);
526 *center = accumulator.mean_point() + box.botleft();
528 double x2nd = sqrt(accumulator.x_variance());
529 double y2nd = sqrt(accumulator.y_variance());
536 second_moments->set_x(x2nd);
537 second_moments->set_y(y2nd);
538 return accumulator.count();
◆ Contains()
bool tesseract::TBLOB::Contains |
( |
const TPOINT & |
pt | ) |
const |
|
inline |
Definition at line 351 of file blobs.h.
352 for (
const TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
353 if (outline->Contains(pt)) {
◆ CopyFrom()
void tesseract::TBLOB::CopyFrom |
( |
const TBLOB & |
src | ) |
|
Definition at line 374 of file blobs.cpp.
376 TESSLINE *prev_outline =
nullptr;
377 for (TESSLINE *srcline = src.outlines; srcline !=
nullptr; srcline = srcline->next) {
378 auto *new_outline =
new TESSLINE(*srcline);
382 prev_outline->
next = new_outline;
384 prev_outline = new_outline;
386 denorm_ = src.denorm_;
◆ CorrectBlobOrder()
void tesseract::TBLOB::CorrectBlobOrder |
( |
TBLOB * |
next | ) |
|
Definition at line 500 of file blobs.cpp.
502 TBOX next_box = next->bounding_box();
503 if (box.x_middle() > next_box.x_middle()) {
504 std::swap(
outlines, next->outlines);
◆ denorm()
const DENORM& tesseract::TBLOB::denorm |
( |
| ) |
const |
|
inline |
◆ EliminateDuplicateOutlines()
void tesseract::TBLOB::EliminateDuplicateOutlines |
( |
| ) |
|
Definition at line 480 of file blobs.cpp.
481 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
482 TESSLINE *last_outline = outline;
483 for (TESSLINE *other_outline = outline->next; other_outline !=
nullptr;
484 last_outline = other_outline, other_outline = other_outline->next) {
485 if (outline->SameBox(*other_outline)) {
486 last_outline->next = other_outline->next;
488 other_outline->loop =
nullptr;
489 delete other_outline;
490 other_outline = last_outline;
492 outline->is_hole =
false;
◆ GetEdgeCoords()
void tesseract::TBLOB::GetEdgeCoords |
( |
const TBOX & |
box, |
|
|
std::vector< std::vector< int >> & |
x_coords, |
|
|
std::vector< std::vector< int >> & |
y_coords |
|
) |
| const |
Definition at line 559 of file blobs.cpp.
562 x_coords.resize(box.height());
564 y_coords.resize(box.width());
565 CollectEdges(box,
nullptr,
nullptr, &x_coords, &y_coords);
567 for (
auto &coord : x_coords) {
568 std::sort(coord.begin(), coord.end());
570 for (
auto &coord : y_coords) {
571 std::sort(coord.begin(), coord.end());
◆ GetPreciseBoundingBox()
void tesseract::TBLOB::GetPreciseBoundingBox |
( |
TBOX * |
precise_box | ) |
const |
Definition at line 543 of file blobs.cpp.
545 *precise_box =
TBOX();
546 CollectEdges(box, precise_box,
nullptr,
nullptr,
nullptr);
547 precise_box->move(box.botleft());
◆ Move()
void tesseract::TBLOB::Move |
( |
const ICOORD |
vec | ) |
|
Definition at line 431 of file blobs.cpp.
432 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
◆ Normalize()
void tesseract::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, |
|
|
Image |
pix |
|
) |
| |
Definition at line 400 of file blobs.cpp.
403 denorm_.
SetupNormalization(block, rotation, predecessor, x_origin, y_origin, x_scale, y_scale,
404 final_xshift, final_yshift);
415 for (TESSLINE* outline =
outlines; outline !=
nullptr; outline = outline->
next) {
416 outline->Normalize(denorm_);
void SetupNormalization(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)
void set_inverse(bool value)
void LocalNormBlob(TBLOB *blob) const
◆ NumOutlines()
int tesseract::TBLOB::NumOutlines |
( |
| ) |
const |
Definition at line 452 of file blobs.cpp.
454 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
◆ operator=()
TBLOB& tesseract::TBLOB::operator= |
( |
const TBLOB & |
src | ) |
|
|
inline |
◆ plot()
Definition at line 509 of file blobs.cpp.
510 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
511 outline->plot(window, color, child_color);
◆ PolygonalCopy()
TBLOB * tesseract::TBLOB::PolygonalCopy |
( |
bool |
allow_detailed_fx, |
|
|
C_BLOB * |
src |
|
) |
| |
|
static |
Definition at line 335 of file blobs.cpp.
336 auto *tblob =
new TBLOB;
337 ApproximateOutlineList(allow_detailed_fx, src->out_list(),
false, &tblob->outlines);
◆ Rotate()
void tesseract::TBLOB::Rotate |
( |
const FCOORD |
rotation | ) |
|
Definition at line 424 of file blobs.cpp.
425 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
426 outline->Rotate(rotation);
◆ Scale()
void tesseract::TBLOB::Scale |
( |
float |
factor | ) |
|
Definition at line 438 of file blobs.cpp.
439 for (TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
440 outline->Scale(factor);
◆ SegmentCrossesOutline()
bool tesseract::TBLOB::SegmentCrossesOutline |
( |
const TPOINT & |
pt1, |
|
|
const TPOINT & |
pt2 |
|
) |
| const |
|
inline |
Definition at line 342 of file blobs.h.
343 for (
const TESSLINE *outline =
outlines; outline !=
nullptr; outline = outline->
next) {
344 if (outline->SegmentCrosses(pt1, pt2)) {
◆ ShallowCopy()
TBLOB * tesseract::TBLOB::ShallowCopy |
( |
const TBLOB & |
src | ) |
|
|
static |
Definition at line 342 of file blobs.cpp.
343 auto *blob =
new TBLOB;
344 blob->denorm_ = src.denorm_;
◆ outlines
The documentation for this struct was generated from the following files: