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
BLOBNBOX Class Reference

`#include <blobbox.h>`

Inheritance diagram for BLOBNBOX:

List of all members.

## Public Member Functions
| BLOBNBOX ()
| BLOBNBOX (C_BLOB *srcblob)
void | rotate (FCOORD rotation)
void | reflect_box_in_y_axis ()
void | rotate_box (FCOORD rotation)
void | translate_box (ICOORD v)
void | merge (BLOBNBOX *nextblob)
void | really_merge (BLOBNBOX *other)
void | chop (BLOBNBOX_IT *start_it, BLOBNBOX_IT *blob_it, FCOORD rotation, float xheight)
void | NeighbourGaps (int gaps[BND_COUNT]) const
void | MinMaxGapsClipped (int *h_min, int *h_max, int *v_min, int *v_max) const
void | CleanNeighbours ()
int | GoodTextBlob () const
int | NoisyNeighbours () const
bool | DeletableNoise () const
bool | DefiniteIndividualFlow ()
bool | ConfirmNoTabViolation (const BLOBNBOX &other) const
bool | MatchingStrokeWidth (const BLOBNBOX &other, double fractional_tolerance, double constant_tolerance) const
TBOX | BoundsWithinLimits (int left, int right)
const TBOX & | bounding_box () const
void | set_bounding_box (const TBOX &new_box)
void | compute_bounding_box ()
const TBOX & | reduced_box () const
void | set_reduced_box (TBOX new_box)
inT32 | enclosed_area () const
bool | joined_to_prev () const
bool | red_box_set () const
int | repeated_set () const
void | set_repeated_set (int set_id)
C_BLOB * | cblob () const
TabType | left_tab_type () const
void | set_left_tab_type (TabType new_type)
TabType | right_tab_type () const
void | set_right_tab_type (TabType new_type)
BlobRegionType | region_type () const
void | set_region_type (BlobRegionType new_type)
BlobSpecialTextType | special_text_type () const
void | set_special_text_type (BlobSpecialTextType new_type)
BlobTextFlowType | flow () const
void | set_flow (BlobTextFlowType value)
bool | vert_possible () const
void | set_vert_possible (bool value)
bool | horz_possible () const
void | set_horz_possible (bool value)
int | left_rule () const
void | set_left_rule (int new_left)
int | right_rule () const
void | set_right_rule (int new_right)
int | left_crossing_rule () const
void | set_left_crossing_rule (int new_left)
int | right_crossing_rule () const
void | set_right_crossing_rule (int new_right)
float | horz_stroke_width () const
void | set_horz_stroke_width (float width)
float | vert_stroke_width () const
void | set_vert_stroke_width (float width)
float | area_stroke_width () const
tesseract::ColPartition * | owner () const
void | set_owner (tesseract::ColPartition *new_owner)
bool | leader_on_left () const
void | set_leader_on_left (bool flag)
bool | leader_on_right () const
void | set_leader_on_right (bool flag)
BLOBNBOX * | neighbour (BlobNeighbourDir n) const
bool | good_stroke_neighbour (BlobNeighbourDir n) const
void | set_neighbour (BlobNeighbourDir n, BLOBNBOX *neighbour, bool good)
bool | IsDiacritic () const
int | base_char_top () const
int | base_char_bottom () const
int | line_crossings () const
void | set_line_crossings (int value)
void | set_diacritic_box (const TBOX &diacritic_box)
BLOBNBOX * | base_char_blob () const
void | set_base_char_blob (BLOBNBOX *blob)
bool | UniquelyVertical () const
bool | UniquelyHorizontal () const
ScrollView::Color | BoxColor () const
void | plot (ScrollView *window, ScrollView::Color blob_colour, ScrollView::Color child_colour)
void | ConstructionInit ()
void | ReInit ()
void | ClearNeighbours ()
Public Member Functions inherited from ELIST_LINK
| ELIST_LINK ()
| ELIST_LINK (const ELIST_LINK &)
void | operator= (const ELIST_LINK &)

## Static Public Member Functions
static BLOBNBOX * | RealBlob (C_OUTLINE *outline)
static bool | IsTextType (BlobRegionType type)
static bool | IsImageType (BlobRegionType type)
static bool | IsLineType (BlobRegionType type)
static bool | UnMergeableType (BlobRegionType type)
static void | CleanNeighbours (BLOBNBOX_LIST *blobs)
static void | DeleteNoiseBlobs (BLOBNBOX_LIST *blobs)
static void | PlotBlobs (BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
static void | PlotNoiseBlobs (BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
static ScrollView::Color | TextlineColor (BlobRegionType region_type, BlobTextFlowType flow_type)

## Detailed Description

Definition at line 128 of file blobbox.h.

## Constructor & Destructor Documentation

BLOBNBOX::BLOBNBOX | ( |  | ) |
| inline

Definition at line 131 of file blobbox.h.

{
ConstructionInit();
}

BLOBNBOX::BLOBNBOX | ( | C_BLOB * | srcblob | ) |
| inline explicit

Definition at line 134 of file blobbox.h.

{
box = srcblob->bounding_box();
ConstructionInit();
cblob_ptr = srcblob;
area = static_cast<int>(srcblob->area());
}

## Member Function Documentation

float BLOBNBOX::area_stroke_width | ( |  | ) | const
| inline

Definition at line 326 of file blobbox.h.

{
return area_stroke_width_;
}

BLOBNBOX* BLOBNBOX::base_char_blob | ( |  | ) | const
| inline

Definition at line 376 of file blobbox.h.

{
return base_char_blob_;
}

int BLOBNBOX::base_char_bottom | ( |  | ) | const
| inline

Definition at line 363 of file blobbox.h.

{
return base_char_bottom_;
}

int BLOBNBOX::base_char_top | ( |  | ) | const
| inline

Definition at line 360 of file blobbox.h.

{
return base_char_top_;
}

const TBOX& BLOBNBOX::bounding_box | ( |  | ) | const
| inline

Definition at line 208 of file blobbox.h.

{
return box;
}

TBOX BLOBNBOX::BoundsWithinLimits | ( | int | left,
|  | int | right
| ) |  |

Definition at line 323 of file blobbox.cpp.

{
FCOORD no_rotation(1.0f, 0.0f);
float top = box.top();
float bottom = box.bottom();
if (cblob_ptr != NULL) {
find_cblob_limits(cblob_ptr, static_cast<float>(left),
static_cast<float>(right), no_rotation,
bottom, top);
}
if (top < bottom) {
top = box.top();
bottom = box.bottom();
}
FCOORD bot_left(left, bottom);
FCOORD top_right(right, top);
TBOX shrunken_box(bot_left);
TBOX shrunken_box2(top_right);
shrunken_box += shrunken_box2;
return shrunken_box;
}

ScrollView::Color BLOBNBOX::BoxColor | ( |  | ) | const

Definition at line 430 of file blobbox.cpp.

{
return TextlineColor(region_type_, flow_);
}

C_BLOB* BLOBNBOX::cblob | ( |  | ) | const
| inline

Definition at line 245 of file blobbox.h.

{
return cblob_ptr;
}

void BLOBNBOX::chop | ( | BLOBNBOX_IT * | start_it,
|  | BLOBNBOX_IT * | blob_it,
|  | FCOORD | rotation,
|  | float | xheight
| ) |  |

Definition at line 111 of file blobbox.cpp.

{
inT16 blobcount; //no of blobs
BLOBNBOX *newblob; //fake blob
BLOBNBOX *blob; //current blob
inT16 blobindex; //number of chop
inT16 leftx; //left edge of blob
float blobwidth; //width of each
float rightx; //right edge to scan
float ymin, ymax; //limits of new blob
float test_ymin, test_ymax; //limits of part blob
ICOORD bl, tr; //corners of box
BLOBNBOX_IT blob_it; //blob iterator
//get no of chops
blobcount = (inT16) floor (box.width () / xheight);
if (blobcount > 1 && cblob_ptr != NULL) {
//width of each
blobwidth = (float) (box.width () + 1) / blobcount;
for (blobindex = blobcount - 1, rightx = box.right ();
blobindex >= 0; blobindex--, rightx -= blobwidth) {
ymin = (float) MAX_INT32;
ymax = (float) -MAX_INT32;
blob_it = *start_it;
do {
blob = blob_it.data ();
find_cblob_vlimits(blob->cblob_ptr, rightx - blobwidth,
rightx,
/*rotation, */ test_ymin, test_ymax);
blob_it.forward ();
UpdateRange(test_ymin, test_ymax, &ymin, &ymax);
}
while (blob != end_it->data ());
if (ymin < ymax) {
leftx = (inT16) floor (rightx - blobwidth);
if (leftx < box.left ())
leftx = box.left (); //clip to real box
bl = ICOORD (leftx, (inT16) floor (ymin));
tr = ICOORD ((inT16) ceil (rightx), (inT16) ceil (ymax));
if (blobindex == 0)
box = TBOX (bl, tr); //change box
else {
newblob = new BLOBNBOX;
//box is all it has
newblob->box = TBOX (bl, tr);
//stay on current
newblob->base_char_top_ = tr.y();
newblob->base_char_bottom_ = bl.y();
end_it->add_after_stay_put (newblob);
}
}
}
}
}

void BLOBNBOX::CleanNeighbours | ( |  | ) |

Definition at line 205 of file blobbox.cpp.

{
for (int dir = 0; dir < BND_COUNT; ++dir) {
BLOBNBOX* neighbour = neighbours_[dir];
if (neighbour != NULL && neighbour->DeletableNoise()) {
neighbours_[dir] = NULL;
good_stroke_neighbours_[dir] = false;
}
}
}

void BLOBNBOX::CleanNeighbours | ( | BLOBNBOX_LIST * | blobs | ) |
| static

Definition at line 346 of file blobbox.cpp.

{
BLOBNBOX_IT blob_it(blobs);
for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
blob_it.data()->CleanNeighbours();
}
}

void BLOBNBOX::ClearNeighbours | ( |  | ) |
| inline

Definition at line 476 of file blobbox.h.

{
for (int n = 0; n < BND_COUNT; ++n) {
neighbours_[n] = NULL;
good_stroke_neighbours_[n] = false;
}
}

void BLOBNBOX::compute_bounding_box | ( |  | ) |
| inline

Definition at line 218 of file blobbox.h.

{
box = cblob_ptr->bounding_box();
base_char_top_ = box.top();
base_char_bottom_ = box.bottom();
}

bool BLOBNBOX::ConfirmNoTabViolation | ( | const BLOBNBOX & | other | ) | const

Definition at line 282 of file blobbox.cpp.

{
if (box.left() < other.box.left() && box.left() < other.left_rule_)
return false;
if (other.box.left() < box.left() && other.box.left() < left_rule_)
return false;
if (box.right() > other.box.right() && box.right() > other.right_rule_)
return false;
if (other.box.right() > box.right() && other.box.right() > right_rule_)
return false;
return true;
}

void BLOBNBOX::ConstructionInit | ( |  | ) |
| inline

Definition at line 439 of file blobbox.h.

{
cblob_ptr = NULL;
area = 0;
area_stroke_width_ = 0.0f;
horz_stroke_width_ = 0.0f;
vert_stroke_width_ = 0.0f;
ReInit();
}

bool BLOBNBOX::DefiniteIndividualFlow | ( |  | ) |

Definition at line 243 of file blobbox.cpp.

{
int box_perimeter = 2 * (box.height() + box.width());
if (box.width() > box.height() * kDefiniteAspectRatio) {
// Attempt to distinguish a wide joined word from a dash.
// If it is a dash, then its perimeter is approximately
// 2 * (box width + stroke width), but more if the outline is noisy,
// so perimeter - 2*(box width + stroke width) should be close to zero.
// A complex shape such as a joined word should have a much larger value.
int perimeter = cblob()->perimeter();
if (vert_stroke_width() > 0)
perimeter -= 2 * vert_stroke_width();
else
perimeter -= 4 * cblob()->area() / perimeter;
perimeter -= 2 * box.width();
// Use a multiple of the box perimeter as a threshold.
if (perimeter > kComplexShapePerimeterRatio * box_perimeter) {
set_vert_possible(false);
set_horz_possible(true);
return true;
}
}
if (box.height() > box.width() * kDefiniteAspectRatio) {
// As above, but for a putative vertical word vs a I/1/l.
int perimeter = cblob()->perimeter();
if (horz_stroke_width() > 0)
perimeter -= 2 * horz_stroke_width();
else
perimeter -= 4 * cblob()->area() / perimeter;
perimeter -= 2 * box.height();
if (perimeter > kComplexShapePerimeterRatio * box_perimeter) {
set_vert_possible(true);
set_horz_possible(false);
return true;
}
}
return false;
}

bool BLOBNBOX::DeletableNoise | ( |  | ) | const
| inline

Definition at line 185 of file blobbox.h.

{
return owner() == NULL && region_type() == BRT_NOISE;
}

void BLOBNBOX::DeleteNoiseBlobs | ( | BLOBNBOX_LIST * | blobs | ) |
| static

Definition at line 354 of file blobbox.cpp.

{
BLOBNBOX_IT blob_it(blobs);
for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
BLOBNBOX* blob = blob_it.data();
if (blob->DeletableNoise()) {
delete blob->cblob();
delete blob_it.extract();
}
}
}

inT32 BLOBNBOX::enclosed_area | ( |  | ) | const
| inline

Definition at line 230 of file blobbox.h.

{
return area;
}

BlobTextFlowType BLOBNBOX::flow | ( |  | ) | const
| inline

Definition at line 272 of file blobbox.h.

{
return flow_;
}

bool BLOBNBOX::good_stroke_neighbour | ( | BlobNeighbourDir | n | ) | const
| inline

Definition at line 350 of file blobbox.h.

{
return good_stroke_neighbours_[n];
}

int BLOBNBOX::GoodTextBlob | ( |  | ) | const

Definition at line 217 of file blobbox.cpp.

{
int score = 0;
for (int dir = 0; dir < BND_COUNT; ++dir) {
BlobNeighbourDir bnd = static_cast<BlobNeighbourDir>(dir);
if (good_stroke_neighbour(bnd))
++score;
}
return score;
}

bool BLOBNBOX::horz_possible | ( |  | ) | const
| inline

Definition at line 284 of file blobbox.h.

{
return horz_possible_;
}

float BLOBNBOX::horz_stroke_width | ( |  | ) | const
| inline

Definition at line 314 of file blobbox.h.

{
return horz_stroke_width_;
}

bool BLOBNBOX::IsDiacritic | ( |  | ) | const
| inline

Definition at line 357 of file blobbox.h.

{
return base_char_top_ != box.top() || base_char_bottom_ != box.bottom();
}

static bool BLOBNBOX::IsImageType | ( | BlobRegionType | type | ) |
| inline static

Definition at line 395 of file blobbox.h.

{
return type == BRT_RECTIMAGE || type == BRT_POLYIMAGE;
}

static bool BLOBNBOX::IsLineType | ( | BlobRegionType | type | ) |
| inline static

Definition at line 399 of file blobbox.h.

{
return type == BRT_HLINE || type == BRT_VLINE;
}

static bool BLOBNBOX::IsTextType | ( | BlobRegionType | type | ) |
| inline static

Definition at line 391 of file blobbox.h.

{
return type == BRT_TEXT || type == BRT_VERT_TEXT;
}

bool BLOBNBOX::joined_to_prev | ( |  | ) | const
| inline

Definition at line 233 of file blobbox.h.

{
return joined != 0;
}

bool BLOBNBOX::leader_on_left | ( |  | ) | const
| inline

Definition at line 335 of file blobbox.h.

{
return leader_on_left_;
}

bool BLOBNBOX::leader_on_right | ( |  | ) | const
| inline

Definition at line 341 of file blobbox.h.

{
return leader_on_right_;
}

int BLOBNBOX::left_crossing_rule | ( |  | ) | const
| inline

Definition at line 302 of file blobbox.h.

{
return left_crossing_rule_;
}

int BLOBNBOX::left_rule | ( |  | ) | const
| inline

Definition at line 290 of file blobbox.h.

{
return left_rule_;
}

TabType BLOBNBOX::left_tab_type | ( |  | ) | const
| inline

Definition at line 248 of file blobbox.h.

{
return left_tab_type_;
}

int BLOBNBOX::line_crossings | ( |  | ) | const
| inline

Definition at line 366 of file blobbox.h.

{
return line_crossings_;
}

bool BLOBNBOX::MatchingStrokeWidth | ( | const BLOBNBOX & | other,
|  | double | fractional_tolerance,
|  | double | constant_tolerance
| ) |  | const

Definition at line 295 of file blobbox.cpp.

{
// The perimeter-based width is used as a backup in case there is
// no information in the blob.
double p_width = area_stroke_width();
double n_p_width = other.area_stroke_width();
float h_tolerance = horz_stroke_width_ * fractional_tolerance
+ constant_tolerance;
float v_tolerance = vert_stroke_width_ * fractional_tolerance
+ constant_tolerance;
double p_tolerance = p_width * fractional_tolerance
+ constant_tolerance;
bool h_zero = horz_stroke_width_ == 0.0f || other.horz_stroke_width_ == 0.0f;
bool v_zero = vert_stroke_width_ == 0.0f || other.vert_stroke_width_ == 0.0f;
bool h_ok = !h_zero && NearlyEqual(horz_stroke_width_,
other.horz_stroke_width_, h_tolerance);
bool v_ok = !v_zero && NearlyEqual(vert_stroke_width_,
other.vert_stroke_width_, v_tolerance);
bool p_ok = h_zero && v_zero && NearlyEqual(p_width, n_p_width, p_tolerance);
// For a match, at least one of the horizontal and vertical widths
// must match, and the other one must either match or be zero.
// Only if both are zero will we look at the perimeter metric.
return p_ok || ((v_ok || h_ok) && (h_ok || h_zero) && (v_ok || v_zero));
}

void BLOBNBOX::merge | ( | BLOBNBOX * | nextblob | ) |

Definition at line 83 of file blobbox.cpp.

{
box += nextblob->box; //merge boxes
set_diacritic_box(box);
nextblob->joined = TRUE;
}

void BLOBNBOX::MinMaxGapsClipped | ( | int * | h_min,
|  | int * | h_max,
|  | int * | v_min,
|  | int * | v_max
| ) |  | const

Definition at line 191 of file blobbox.cpp.

{
int max_dimension = MAX(box.width(), box.height());
int gaps[BND_COUNT];
NeighbourGaps(gaps);
*h_min = MIN(gaps[BND_LEFT], gaps[BND_RIGHT]);
*h_max = MAX(gaps[BND_LEFT], gaps[BND_RIGHT]);
if (*h_max > max_dimension && *h_min < max_dimension) *h_max = *h_min;
*v_min = MIN(gaps[BND_ABOVE], gaps[BND_BELOW]);
*v_max = MAX(gaps[BND_ABOVE], gaps[BND_BELOW]);
if (*v_max > max_dimension && *v_min < max_dimension) *v_max = *v_min;
}

BLOBNBOX* BLOBNBOX::neighbour | ( | BlobNeighbourDir | n | ) | const
| inline

Definition at line 347 of file blobbox.h.

{
return neighbours_[n];
}

void BLOBNBOX::NeighbourGaps | ( | int | gaps[BND_COUNT] | ) | const

Definition at line 172 of file blobbox.cpp.

{
for (int dir = 0; dir < BND_COUNT; ++dir) {
gaps[dir] = MAX_INT16;
BLOBNBOX* neighbour = neighbours_[dir];
if (neighbour != NULL) {
TBOX n_box = neighbour->bounding_box();
if (dir == BND_LEFT || dir == BND_RIGHT) {
gaps[dir] = box.x_gap(n_box);
} else {
gaps[dir] = box.y_gap(n_box);
}
}
}
}

int BLOBNBOX::NoisyNeighbours | ( |  | ) | const

Definition at line 228 of file blobbox.cpp.

{
int count = 0;
for (int dir = 0; dir < BND_COUNT; ++dir) {
BlobNeighbourDir bnd = static_cast<BlobNeighbourDir>(dir);
BLOBNBOX* blob = neighbour(bnd);
if (blob != NULL && blob->region_type() == BRT_NOISE)
++count;
}
return count;
}

tesseract::ColPartition* BLOBNBOX::owner | ( |  | ) | const
| inline

Definition at line 329 of file blobbox.h.

{
return owner_;
}

void BLOBNBOX::plot | ( | ScrollView * | window,
|  | ScrollView::Color | blob_colour,
|  | ScrollView::Color | child_colour
| ) |  |

Definition at line 434 of file blobbox.cpp.

{ // for holes
if (cblob_ptr != NULL)
cblob_ptr->plot(window, blob_colour, child_colour);
}

void BLOBNBOX::PlotBlobs | ( | BLOBNBOX_LIST * | list,
|  | ScrollView::Color | body_colour,
|  | ScrollView::Color | child_colour,
|  | ScrollView * | win
| ) |  |
| static

Definition at line 368 of file blobbox.cpp.

{
BLOBNBOX_IT it(list);
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
it.data()->plot(win, body_colour, child_colour);
}
}

void BLOBNBOX::PlotNoiseBlobs | ( | BLOBNBOX_LIST * | list,
|  | ScrollView::Color | body_colour,
|  | ScrollView::Color | child_colour,
|  | ScrollView * | win
| ) |  |
| static

Definition at line 381 of file blobbox.cpp.

{
BLOBNBOX_IT it(list);
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
BLOBNBOX* blob = it.data();
if (blob->DeletableNoise())
blob->plot(win, body_colour, child_colour);
}
}

static BLOBNBOX* BLOBNBOX::RealBlob | ( | C_OUTLINE * | outline | ) |
| inline static

Definition at line 140 of file blobbox.h.

{
C_BLOB* blob = new C_BLOB(outline);
return new BLOBNBOX(blob);
}

void BLOBNBOX::really_merge | ( | BLOBNBOX * | other | ) |

Definition at line 94 of file blobbox.cpp.

{
if (cblob_ptr != NULL && other->cblob_ptr != NULL) {
C_OUTLINE_IT ol_it(cblob_ptr->out_list());
ol_it.add_list_after(other->cblob_ptr->out_list());
}
compute_bounding_box();
}

bool BLOBNBOX::red_box_set | ( |  | ) | const
| inline

Definition at line 236 of file blobbox.h.

{
return reduced != 0;
}

const TBOX& BLOBNBOX::reduced_box | ( |  | ) | const
| inline

Definition at line 223 of file blobbox.h.

{
return red_box;
}

void BLOBNBOX::reflect_box_in_y_axis | ( |  | ) |

Definition at line 53 of file blobbox.cpp.

{
int left = -box.right();
box.set_right(-box.left());
box.set_left(left);
}

BlobRegionType BLOBNBOX::region_type | ( |  | ) | const
| inline

Definition at line 260 of file blobbox.h.

{
return region_type_;
}

void BLOBNBOX::ReInit | ( |  | ) |
| inline

Definition at line 449 of file blobbox.h.

{
joined = false;
reduced = false;
repeated_set_ = 0;
left_tab_type_ = TT_NONE;
right_tab_type_ = TT_NONE;
region_type_ = BRT_UNKNOWN;
flow_ = BTFT_NONE;
spt_type_ = BSTT_SKIP;
left_rule_ = 0;
right_rule_ = 0;
left_crossing_rule_ = 0;
right_crossing_rule_ = 0;
if (area_stroke_width_ == 0.0f && area > 0 && cblob() != NULL)
area_stroke_width_ = 2.0f * area / cblob()->perimeter();
owner_ = NULL;
base_char_top_ = box.top();
base_char_bottom_ = box.bottom();
line_crossings_ = 0;
base_char_blob_ = NULL;
horz_possible_ = false;
vert_possible_ = false;
leader_on_left_ = false;
leader_on_right_ = false;
ClearNeighbours();
}

int BLOBNBOX::repeated_set | ( |  | ) | const
| inline

Definition at line 239 of file blobbox.h.

{
return repeated_set_;
}

int BLOBNBOX::right_crossing_rule | ( |  | ) | const
| inline

Definition at line 308 of file blobbox.h.

{
return right_crossing_rule_;
}

int BLOBNBOX::right_rule | ( |  | ) | const
| inline

Definition at line 296 of file blobbox.h.

{
return right_rule_;
}

TabType BLOBNBOX::right_tab_type | ( |  | ) | const
| inline

Definition at line 254 of file blobbox.h.

{
return right_tab_type_;
}

void BLOBNBOX::rotate | ( | FCOORD | rotation | ) |

Definition at line 46 of file blobbox.cpp.

{
cblob_ptr->rotate(rotation);
rotate_box(rotation);
compute_bounding_box();
}

void BLOBNBOX::rotate_box | ( | FCOORD | rotation | ) |

Definition at line 62 of file blobbox.cpp.

{
if (IsDiacritic()) {
ASSERT_HOST(rotation.x() >= kCosSmallAngle)
ICOORD top_pt((box.left() + box.right()) / 2, base_char_top_);
ICOORD bottom_pt(top_pt.x(), base_char_bottom_);
top_pt.rotate(rotation);
base_char_top_ = top_pt.y();
bottom_pt.rotate(rotation);
base_char_bottom_ = bottom_pt.y();
box.rotate(rotation);
} else {
box.rotate(rotation);
set_diacritic_box(box);
}
}

void BLOBNBOX::set_base_char_blob | ( | BLOBNBOX * | blob | ) |
| inline

Definition at line 379 of file blobbox.h.

{
base_char_blob_ = blob;
}

void BLOBNBOX::set_bounding_box | ( | const TBOX & | new_box | ) |
| inline

Definition at line 213 of file blobbox.h.

{
box = new_box;
base_char_top_ = box.top();
base_char_bottom_ = box.bottom();
}

void BLOBNBOX::set_diacritic_box | ( | const TBOX & | diacritic_box | ) |
| inline

Definition at line 372 of file blobbox.h.

{
base_char_top_ = diacritic_box.top();
base_char_bottom_ = diacritic_box.bottom();
}

void BLOBNBOX::set_flow | ( | BlobTextFlowType | value | ) |
| inline

Definition at line 275 of file blobbox.h.

{
flow_ = value;
}

void BLOBNBOX::set_horz_possible | ( | bool | value | ) |
| inline

Definition at line 287 of file blobbox.h.

{
horz_possible_ = value;
}

void BLOBNBOX::set_horz_stroke_width | ( | float | width | ) |
| inline

Definition at line 317 of file blobbox.h.

{
horz_stroke_width_ = width;
}

void BLOBNBOX::set_leader_on_left | ( | bool | flag | ) |
| inline

Definition at line 338 of file blobbox.h.

{
leader_on_left_ = flag;
}

void BLOBNBOX::set_leader_on_right | ( | bool | flag | ) |
| inline

Definition at line 344 of file blobbox.h.

{
leader_on_right_ = flag;
}

void BLOBNBOX::set_left_crossing_rule | ( | int | new_left | ) |
| inline

Definition at line 305 of file blobbox.h.

{
left_crossing_rule_ = new_left;
}

void BLOBNBOX::set_left_rule | ( | int | new_left | ) |
| inline

Definition at line 293 of file blobbox.h.

{
left_rule_ = new_left;
}

void BLOBNBOX::set_left_tab_type | ( | TabType | new_type | ) |
| inline

Definition at line 251 of file blobbox.h.

{
left_tab_type_ = new_type;
}

void BLOBNBOX::set_line_crossings | ( | int | value | ) |
| inline

Definition at line 369 of file blobbox.h.

{
line_crossings_ = value;
}

void BLOBNBOX::set_neighbour | ( | BlobNeighbourDir | n,
|  | BLOBNBOX * | neighbour,
|  | bool | good
| ) |  |
| inline

Definition at line 353 of file blobbox.h.

{
neighbours_[n] = neighbour;
good_stroke_neighbours_[n] = good;
}

void BLOBNBOX::set_owner | ( | tesseract::ColPartition * | new_owner | ) |
| inline

Definition at line 332 of file blobbox.h.

{
owner_ = new_owner;
}

void BLOBNBOX::set_reduced_box | ( | TBOX | new_box | ) |
| inline

Definition at line 226 of file blobbox.h.

{
red_box = new_box;
reduced = TRUE;
}

void BLOBNBOX::set_region_type | ( | BlobRegionType | new_type | ) |
| inline

Definition at line 263 of file blobbox.h.

{
region_type_ = new_type;
}

void BLOBNBOX::set_repeated_set | ( | int | set_id | ) |
| inline

Definition at line 242 of file blobbox.h.

{
repeated_set_ = set_id;
}

void BLOBNBOX::set_right_crossing_rule | ( | int | new_right | ) |
| inline

Definition at line 311 of file blobbox.h.

{
right_crossing_rule_ = new_right;
}

void BLOBNBOX::set_right_rule | ( | int | new_right | ) |
| inline

Definition at line 299 of file blobbox.h.

{
right_rule_ = new_right;
}

void BLOBNBOX::set_right_tab_type | ( | TabType | new_type | ) |
| inline

Definition at line 257 of file blobbox.h.

{
right_tab_type_ = new_type;
}

void BLOBNBOX::set_special_text_type | ( | BlobSpecialTextType | new_type | ) |
| inline

Definition at line 269 of file blobbox.h.

{
spt_type_ = new_type;
}

void BLOBNBOX::set_vert_possible | ( | bool | value | ) |
| inline

Definition at line 281 of file blobbox.h.

{
vert_possible_ = value;
}

void BLOBNBOX::set_vert_stroke_width | ( | float | width | ) |
| inline

Definition at line 323 of file blobbox.h.

{
vert_stroke_width_ = width;
}

BlobSpecialTextType BLOBNBOX::special_text_type | ( |  | ) | const
| inline

Definition at line 266 of file blobbox.h.

{
return spt_type_;
}

ScrollView::Color BLOBNBOX::TextlineColor | ( | BlobRegionType | region_type,
|  | BlobTextFlowType | flow_type
| ) |  |
| static

Definition at line 393 of file blobbox.cpp.

{
switch (region_type) {
case BRT_HLINE:
return ScrollView::BROWN;
case BRT_VLINE:
return ScrollView::DARK_GREEN;
case BRT_RECTIMAGE:
return ScrollView::RED;
case BRT_POLYIMAGE:
return ScrollView::ORANGE;
case BRT_UNKNOWN:
return flow_type == BTFT_NONTEXT ? ScrollView::CYAN : ScrollView::WHITE;
case BRT_VERT_TEXT:
if (flow_type == BTFT_STRONG_CHAIN || flow_type == BTFT_TEXT_ON_IMAGE)
return ScrollView::GREEN;
if (flow_type == BTFT_CHAIN)
return ScrollView::LIME_GREEN;
return ScrollView::YELLOW;
case BRT_TEXT:
if (flow_type == BTFT_STRONG_CHAIN)
return ScrollView::BLUE;
if (flow_type == BTFT_TEXT_ON_IMAGE)
return ScrollView::LIGHT_BLUE;
if (flow_type == BTFT_CHAIN)
return ScrollView::MEDIUM_BLUE;
if (flow_type == BTFT_LEADER)
return ScrollView::WHEAT;
if (flow_type == BTFT_NONTEXT)
return ScrollView::PINK;
return ScrollView::MAGENTA;
default:
return ScrollView::GREY;
}
}

void BLOBNBOX::translate_box | ( | ICOORD | v | ) |
| inline

Definition at line 156 of file blobbox.h.

{
if (IsDiacritic()) {
box.move(v);
base_char_top_ += v.y();
base_char_bottom_ += v.y();
} else {
box.move(v);
set_diacritic_box(box);
}
}

bool BLOBNBOX::UniquelyHorizontal | ( |  | ) | const
| inline

Definition at line 386 of file blobbox.h.

{
return horz_possible_ && !vert_possible_;
}

bool BLOBNBOX::UniquelyVertical | ( |  | ) | const
| inline

Definition at line 383 of file blobbox.h.

{
return vert_possible_ && !horz_possible_;
}

static bool BLOBNBOX::UnMergeableType | ( | BlobRegionType | type | ) |
| inline static

Definition at line 403 of file blobbox.h.

{
return IsLineType(type) || IsImageType(type);
}

bool BLOBNBOX::vert_possible | ( |  | ) | const
| inline

Definition at line 278 of file blobbox.h.

{
return vert_possible_;
}

float BLOBNBOX::vert_stroke_width | ( |  | ) | const
| inline

Definition at line 320 of file blobbox.h.

{
return vert_stroke_width_;
}

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

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