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 | Public Attributes | Static Public Attributes
TO_ROW Class Reference

`#include <blobbox.h>`

Inheritance diagram for TO_ROW:

List of all members.

## Public Member Functions

| TO_ROW ()
| TO_ROW (BLOBNBOX *blob, float top, float bottom, float row_size)
float | max_y () const
float | min_y () const
float | mean_y () const
float | initial_min_y () const
float | line_m () const
float | line_c () const
float | line_error () const
float | parallel_c () const
float | parallel_error () const
float | believability () const
float | intercept () const
void | add_blob (BLOBNBOX *blob, float top, float bottom, float row_size)
void | insert_blob (BLOBNBOX *blob)
BLOBNBOX_LIST * | blob_list ()
void | set_line (float new_m, float new_c, float new_error)
void | set_parallel_line (float gradient, float new_c, float new_error)
void | set_limits (float new_min, float new_max)
void | compute_vertical_projection ()
bool | rep_chars_marked () const
void | clear_rep_chars_marked ()
int | num_repeated_sets () const
void | set_num_repeated_sets (int num_sets)
Public Member Functions inherited from ELIST2_LINK
| ELIST2_LINK ()
| ELIST2_LINK (const ELIST2_LINK &)
void | operator= (const ELIST2_LINK &)

## Public Attributes

BOOL8 | merged
BOOL8 | all_caps
BOOL8 | used_dm_model
inT16 | projection_left
inT16 | projection_right
PITCH_TYPE | pitch_decision
float | fixed_pitch
float | fp_space
float | fp_nonsp
float | pr_space
float | pr_nonsp
float | spacing
float | xheight
int | xheight_evidence
float | ascrise
float | descdrop
float | body_size
inT32 | min_space
inT32 | max_nonspace
inT32 | space_threshold
float | kern_size
float | space_size
WERD_LIST | rep_words
ICOORDELT_LIST | char_cells
QSPLINE | baseline
STATS | projection

## Static Public Attributes

static const int | kErrorWeight = 3

## Detailed Description

Definition at line 516 of file blobbox.h.

## Constructor & Destructor Documentation

TO_ROW::TO_ROW | ( |  | ) |

inline

Definition at line 521 of file blobbox.h.

{
clear();
} //empty

TO_ROW::TO_ROW | ( | BLOBNBOX * | blob,
|  | float | top,
|  | float | bottom,
|  | float | row_size
| ) |  |

Definition at line 638 of file blobbox.cpp.

{
clear();
y_min = bottom;
y_max = top;
initial_y_min = bottom;
float diff; //in size
BLOBNBOX_IT it = &blobs; //list of blobs
it.add_to_end (blob);
diff = top - bottom - row_size;
if (diff > 0) {
y_max -= diff / 2;
y_min += diff / 2;
}
//very small object
else if ((top - bottom) * 3 < row_size) {
diff = row_size / 3 + bottom - top;
y_max += diff / 2;
y_min -= diff / 2;
}
}

## Member Function Documentation

void TO_ROW::add_blob | ( | BLOBNBOX * | blob,
|  | float | top,
|  | float | bottom,
|  | float | row_size
| ) |  |

Definition at line 673 of file blobbox.cpp.

{
float allowed; //allowed expansion
float available; //expansion
BLOBNBOX_IT it = &blobs; //list of blobs
it.add_to_end (blob);
allowed = row_size + y_min - y_max;
if (allowed > 0) {
available = top > y_max ? top - y_max : 0;
if (bottom < y_min)
//total available
available += y_min - bottom;
if (available > 0) {
available += available; //do it gradually
if (available < allowed)
available = allowed;
if (bottom < y_min)
y_min -= (y_min - bottom) * allowed / available;
if (top > y_max)
y_max += (top - y_max) * allowed / available;
}
}
}

float TO_ROW::believability | ( |  | ) | const

inline

Definition at line 557 of file blobbox.h.

{ //baseline goodness
return credibility;
}

BLOBNBOX_LIST* TO_ROW::blob_list | ( |  | ) |

inline

Definition at line 571 of file blobbox.h.

{ //get list
return &blobs;
}

void TO_ROW::clear_rep_chars_marked | ( |  | ) |

inline

Definition at line 606 of file blobbox.h.

{
num_repeated_sets_ = -1;
}

void TO_ROW::compute_vertical_projection | ( |  | ) |

Definition at line 736 of file blobbox.cpp.

{ //project whole row
TBOX row_box; //bound of row
BLOBNBOX *blob; //current blob
TBOX blob_box; //bounding box
BLOBNBOX_IT blob_it = blob_list ();
if (blob_it.empty ())
return;
row_box = blob_it.data ()->bounding_box ();
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ())
row_box += blob_it.data ()->bounding_box ();
projection.set_range (row_box.left () - PROJECTION_MARGIN,
row_box.right () + PROJECTION_MARGIN);
projection_left = row_box.left () - PROJECTION_MARGIN;
projection_right = row_box.right () + PROJECTION_MARGIN;
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ()) {
blob = blob_it.data();
if (blob->cblob() != NULL)
vertical_cblob_projection(blob->cblob(), &projection);
}
}

float TO_ROW::initial_min_y | ( |  | ) | const

inline

Definition at line 539 of file blobbox.h.

{
return initial_y_min;
}

void TO_ROW::insert_blob | ( | BLOBNBOX * | blob | ) |

Definition at line 709 of file blobbox.cpp.

{
BLOBNBOX_IT it = &blobs; //list of blobs
if (it.empty ())
it.add_before_then_move (blob);
else {
it.mark_cycle_pt ();
while (!it.cycled_list ()
&& it.data ()->bounding_box ().left () <=
blob->bounding_box ().left ())
it.forward ();
if (it.cycled_list ())
it.add_to_end (blob);
else
it.add_before_stay_put (blob);
}
}

float TO_ROW::intercept | ( |  | ) | const

inline

Definition at line 560 of file blobbox.h.

{ //real parallel_c
return y_origin;
}

float TO_ROW::line_c | ( |  | ) | const

inline

Definition at line 545 of file blobbox.h.

{
return c;
}

float TO_ROW::line_error | ( |  | ) | const

inline

Definition at line 548 of file blobbox.h.

{
return error;
}

float TO_ROW::line_m | ( |  | ) | const

inline

Definition at line 542 of file blobbox.h.

{ //access to line fit
return m;
}

float TO_ROW::max_y | ( |  | ) | const

inline

Definition at line 530 of file blobbox.h.

{ //access function
return y_max;
}

float TO_ROW::mean_y | ( |  | ) | const

inline

Definition at line 536 of file blobbox.h.

{
return (y_min + y_max) / 2.0f;
}

float TO_ROW::min_y | ( |  | ) | const

inline

Definition at line 533 of file blobbox.h.

{
return y_min;
}

int TO_ROW::num_repeated_sets | ( |  | ) | const

inline

Definition at line 609 of file blobbox.h.

{
return num_repeated_sets_;
}

float TO_ROW::parallel_c | ( |  | ) | const

inline

Definition at line 551 of file blobbox.h.

{
return para_c;
}

float TO_ROW::parallel_error | ( |  | ) | const

inline

Definition at line 554 of file blobbox.h.

{
return para_error;
}

bool TO_ROW::rep_chars_marked | ( |  | ) | const

inline

Definition at line 603 of file blobbox.h.

{
return num_repeated_sets_ != -1;
}

void TO_ROW::set_limits | ( | float | new_min,
|  | float | new_max
| ) |  |

inline

Definition at line 594 of file blobbox.h.

{ //top of row
y_min = new_min;
y_max = new_max;
}

void TO_ROW::set_line | ( | float | new_m,
|  | float | new_c,
|  | float | new_error
| ) |  |

inline

Definition at line 575 of file blobbox.h.

{
m = new_m;
c = new_c;
error = new_error;
}

void TO_ROW::set_num_repeated_sets | ( | int | num_sets | ) |

inline

Definition at line 612 of file blobbox.h.

{
num_repeated_sets_ = num_sets;
}

void TO_ROW::set_parallel_line | ( | float | gradient,
|  | float | new_c,
|  | float | new_error
| ) |  |

inline

Definition at line 583 of file blobbox.h.

{
para_c = new_c;
para_error = new_error;
credibility =
(float) (blobs.length () - kErrorWeight * new_error);
y_origin = (float) (new_c / sqrt (1 + gradient * gradient));
//real intercept
}

## Member Data Documentation

BOOL8 TO_ROW::all_caps

Definition at line 618 of file blobbox.h.

float TO_ROW::ascrise

Definition at line 631 of file blobbox.h.

QSPLINE TO_ROW::baseline

Definition at line 642 of file blobbox.h.

float TO_ROW::body_size

Definition at line 633 of file blobbox.h.

ICOORDELT_LIST TO_ROW::char_cells

Definition at line 641 of file blobbox.h.

float TO_ROW::descdrop

Definition at line 632 of file blobbox.h.

float TO_ROW::fixed_pitch

Definition at line 623 of file blobbox.h.

float TO_ROW::fp_nonsp

Definition at line 625 of file blobbox.h.

float TO_ROW::fp_space

Definition at line 624 of file blobbox.h.

float TO_ROW::kern_size

Definition at line 638 of file blobbox.h.

const int TO_ROW::kErrorWeight = 3

static

Definition at line 519 of file blobbox.h.

inT32 TO_ROW::max_nonspace

Definition at line 636 of file blobbox.h.

BOOL8 TO_ROW::merged

Definition at line 617 of file blobbox.h.

inT32 TO_ROW::min_space

Definition at line 635 of file blobbox.h.

PITCH_TYPE TO_ROW::pitch_decision

Definition at line 622 of file blobbox.h.

float TO_ROW::pr_nonsp

Definition at line 627 of file blobbox.h.

float TO_ROW::pr_space

Definition at line 626 of file blobbox.h.

STATS TO_ROW::projection

Definition at line 643 of file blobbox.h.

inT16 TO_ROW::projection_left

Definition at line 620 of file blobbox.h.

inT16 TO_ROW::projection_right

Definition at line 621 of file blobbox.h.

WERD_LIST TO_ROW::rep_words

Definition at line 640 of file blobbox.h.

float TO_ROW::space_size

Definition at line 639 of file blobbox.h.

inT32 TO_ROW::space_threshold

Definition at line 637 of file blobbox.h.

float TO_ROW::spacing

Definition at line 628 of file blobbox.h.

BOOL8 TO_ROW::used_dm_model

Definition at line 619 of file blobbox.h.

float TO_ROW::xheight

Definition at line 629 of file blobbox.h.

int TO_ROW::xheight_evidence

Definition at line 630 of file blobbox.h.

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