#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, 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 |
|
Definition at line 284 of file blobs.h.
◆ TBLOB() [1/2]
◆ TBLOB() [2/2]
TBLOB::TBLOB |
( |
const TBLOB & |
src | ) |
|
|
inline |
Definition at line 286 of file blobs.h.
288 }
void CopyFrom(const TBLOB &src)
◆ ~TBLOB()
◆ BBArea()
int TBLOB::BBArea |
( |
| ) |
const |
|
inline |
Definition at line 372 of file blobs.h.
372 {
373 int total_area = 0;
375 total_area += outline->BBArea();
376 return total_area;
377 }
◆ bounding_box()
TBOX TBLOB::bounding_box |
( |
| ) |
const |
Definition at line 468 of file blobs.cpp.
468 {
472 for (outline = outline->
next; outline !=
nullptr; outline = outline->
next) {
474 }
475 return box;
476}
TBOX bounding_box() const
◆ ClassifyNormalizeIfNeeded()
TBLOB * TBLOB::ClassifyNormalizeIfNeeded |
( |
| ) |
const |
Definition at line 346 of file blobs.cpp.
346 {
347 TBLOB* rotated_blob =
nullptr;
348
349
350 if (denorm_.
block() !=
nullptr &&
353 int x_middle = (box.
left() + box.
right()) / 2;
354 int y_middle = (box.
top() + box.
bottom()) / 2;
355 rotated_blob =
new TBLOB(*
this);
357
358
359 float target_y =
361 (rotation.
y() > 0 ? x_middle - box.
left() : box.
right() - x_middle);
362 rotated_blob->
Normalize(
nullptr, &rotation, &denorm_, x_middle, y_middle,
363 1.0f, 1.0f, 0.0f, target_y, denorm_.
inverse(),
365 }
366 return rotated_blob;
367}
const int kBlnBaselineOffset
TBOX bounding_box() const
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)
const BLOCK * block() const
FCOORD classify_rotation() const
◆ Clear()
◆ ComputeBoundingBoxes()
void TBLOB::ComputeBoundingBoxes |
( |
| ) |
|
Definition at line 446 of file blobs.cpp.
446 {
448 outline = outline->
next) {
449 outline->ComputeBoundingBox();
450 }
451}
◆ ComputeMoments()
int TBLOB::ComputeMoments |
( |
FCOORD * |
center, |
|
|
FCOORD * |
second_moments |
|
) |
| const |
Definition at line 522 of file blobs.cpp.
522 {
523
526
527 CollectEdges(box, nullptr, &accumulator, nullptr, nullptr);
529
532 if (x2nd < 1.0) x2nd = 1.0;
533 if (y2nd < 1.0) y2nd = 1.0;
534 second_moments->
set_x(x2nd);
535 second_moments->
set_y(y2nd);
536 return accumulator.
count();
537}
double y_variance() const
double x_variance() const
FCOORD mean_point() const
void set_y(float yin)
rewrite function
void set_x(float xin)
rewrite function
const ICOORD & botleft() const
◆ Contains()
bool TBLOB::Contains |
( |
const TPOINT & |
pt | ) |
const |
|
inline |
Definition at line 347 of file blobs.h.
347 {
349 outline = outline->
next) {
350 if (outline->Contains(pt)) return true;
351 }
352 return false;
353 }
◆ CopyFrom()
void TBLOB::CopyFrom |
( |
const TBLOB & |
src | ) |
|
Definition at line 370 of file blobs.cpp.
370 {
374 srcline = srcline->
next) {
375 auto* new_outline =
new TESSLINE(*srcline);
378 else
379 prev_outline->
next = new_outline;
380 prev_outline = new_outline;
381 }
382 denorm_ = src.denorm_;
383}
◆ CorrectBlobOrder()
void TBLOB::CorrectBlobOrder |
( |
TBLOB * |
next | ) |
|
◆ denorm()
const DENORM & TBLOB::denorm |
( |
| ) |
const |
|
inline |
Definition at line 363 of file blobs.h.
363 {
364 return denorm_;
365 }
◆ EliminateDuplicateOutlines()
void TBLOB::EliminateDuplicateOutlines |
( |
| ) |
|
Definition at line 480 of file blobs.cpp.
480 {
482 outline = outline->
next) {
484 for (
TESSLINE* other_outline = outline->
next; other_outline !=
nullptr;
485 last_outline = other_outline, other_outline = other_outline->
next) {
486 if (outline->SameBox(*other_outline)) {
487 last_outline->
next = other_outline->
next;
488
489 other_outline->
loop =
nullptr;
490 delete other_outline;
491 other_outline = last_outline;
492
494 }
495 }
496 }
497}
◆ GetEdgeCoords()
Definition at line 557 of file blobs.cpp.
559 {
563 CollectEdges(box, nullptr, nullptr, x_coords, y_coords);
564
565 for (
int i = 0; i < x_coords->
size(); ++i) (*x_coords)[i].sort();
566 for (
int i = 0; i < y_coords->
size(); ++i) (*y_coords)[i].sort();
567}
void init_to_size(int size, const T &t)
◆ GetPreciseBoundingBox()
void TBLOB::GetPreciseBoundingBox |
( |
TBOX * |
precise_box | ) |
const |
Definition at line 541 of file blobs.cpp.
541 {
543 *precise_box =
TBOX();
544 CollectEdges(box, precise_box, nullptr, nullptr, nullptr);
546}
void move(const ICOORD vec)
◆ Move()
void TBLOB::Move |
( |
const ICOORD |
vec | ) |
|
Definition at line 430 of file blobs.cpp.
430 {
432 outline = outline->
next) {
433 outline->Move(vec);
434 }
435}
◆ Normalize()
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 |
|
) |
| |
Definition at line 397 of file blobs.cpp.
400 {
402 x_scale, y_scale, final_xshift, final_yshift);
405
406
407
408
409
410
411
412#if 0
414 outline->Normalize(denorm_);
415 }
416#else
418#endif
419}
void LocalNormBlob(TBLOB *blob) const
void set_inverse(bool value)
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)
◆ NumOutlines()
int TBLOB::NumOutlines |
( |
| ) |
const |
Definition at line 454 of file blobs.cpp.
454 {
455 int result = 0;
457 outline = outline->
next)
458 ++result;
459 return result;
460}
◆ operator=()
Definition at line 292 of file blobs.h.
292 {
294 return *this;
295 }
◆ plot()
Definition at line 510 of file blobs.cpp.
511 {
513 outline = outline->
next)
514 outline->plot(window, color, child_color);
515}
◆ PolygonalCopy()
TBLOB * TBLOB::PolygonalCopy |
( |
bool |
allow_detailed_fx, |
|
|
C_BLOB * |
src |
|
) |
| |
|
static |
Definition at line 327 of file blobs.cpp.
327 {
328 auto* tblob =
new TBLOB;
329 ApproximateOutlineList(allow_detailed_fx, src->
out_list(),
false,
330 &tblob->outlines);
331 return tblob;
332}
C_OUTLINE_LIST * out_list()
◆ Rotate()
void TBLOB::Rotate |
( |
const FCOORD |
rotation | ) |
|
Definition at line 422 of file blobs.cpp.
422 {
424 outline = outline->
next) {
425 outline->Rotate(rotation);
426 }
427}
◆ Scale()
void TBLOB::Scale |
( |
float |
factor | ) |
|
Definition at line 438 of file blobs.cpp.
438 {
440 outline = outline->
next) {
441 outline->Scale(factor);
442 }
443}
◆ SegmentCrossesOutline()
bool TBLOB::SegmentCrossesOutline |
( |
const TPOINT & |
pt1, |
|
|
const TPOINT & |
pt2 |
|
) |
| const |
|
inline |
Definition at line 339 of file blobs.h.
339 {
341 outline = outline->
next) {
342 if (outline->SegmentCrosses(pt1, pt2)) return true;
343 }
344 return false;
345 }
◆ ShallowCopy()
Definition at line 335 of file blobs.cpp.
335 {
336 auto* blob =
new TBLOB;
337 blob->denorm_ = src.denorm_;
338 return blob;
339}
◆ outlines
The documentation for this struct was generated from the following files: