#include <blobbox.h>
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) |
| ELIST2_LINK () |
| ELIST2_LINK (const ELIST2_LINK &) |
void | operator= (const ELIST2_LINK &) |
Detailed Description
Definition at line 516 of file blobbox.h.
Constructor & Destructor Documentation
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;
BLOBNBOX_IT it = &blobs;
it.add_to_end (blob);
diff = top - bottom - row_size;
if (diff > 0) {
y_max -= diff / 2;
y_min += diff / 2;
}
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;
float available;
BLOBNBOX_IT it = &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)
available += y_min - bottom;
if (available > 0) {
available += available;
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 |
BLOBNBOX_LIST* TO_ROW::blob_list |
( |
| ) |
|
|
inline |
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.
{
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 ();
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ()) {
blob = blob_it.data();
}
}
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;
if (it.empty ())
it.add_before_then_move (blob);
else {
it.mark_cycle_pt ();
while (!it.cycled_list ()
&& it.data ()->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 |
float TO_ROW::line_c |
( |
| ) |
const |
|
inline |
float TO_ROW::line_error |
( |
| ) |
const |
|
inline |
float TO_ROW::line_m |
( |
| ) |
const |
|
inline |
float TO_ROW::max_y |
( |
| ) |
const |
|
inline |
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 |
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 |
float TO_ROW::parallel_error |
( |
| ) |
const |
|
inline |
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.
{
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 =
y_origin = (float) (new_c / sqrt (1 + gradient * gradient));
}
Member Data Documentation
ICOORDELT_LIST TO_ROW::char_cells |
float TO_ROW::fixed_pitch |
const int TO_ROW::kErrorWeight = 3 |
|
static |
inT32 TO_ROW::max_nonspace |
inT16 TO_ROW::projection_left |
inT16 TO_ROW::projection_right |
WERD_LIST TO_ROW::rep_words |
inT32 TO_ROW::space_threshold |
BOOL8 TO_ROW::used_dm_model |
int TO_ROW::xheight_evidence |
The documentation for this class was generated from the following files: