#include <ocrrow.h>
List of all members.
Public Member Functions |
| ROW () |
| ROW (inT32 spline_size, inT32 *xstarts, double *coeffs, float x_height, float ascenders, float descenders, inT16 kern, inT16 space) |
| ROW (TO_ROW *row, inT16 kern, inT16 space) |
WERD_LIST * | word_list () |
float | base_line (float xpos) const |
float | x_height () const |
void | set_x_height (float new_xheight) |
inT32 | kern () const |
float | body_size () const |
void | set_body_size (float new_size) |
inT32 | space () const |
float | ascenders () const |
float | descenders () const |
TBOX | bounding_box () const |
void | set_lmargin (inT16 lmargin) |
void | set_rmargin (inT16 rmargin) |
inT16 | lmargin () const |
inT16 | rmargin () const |
void | set_has_drop_cap (bool has) |
bool | has_drop_cap () const |
void | set_para (PARA *p) |
PARA * | para () const |
void | recalc_bounding_box () |
void | move (const ICOORD vec) |
void | print (FILE *fp) |
void | plot (ScrollView *window, ScrollView::Color colour) |
void | plot (ScrollView *window) |
void | plot_baseline (ScrollView *window, ScrollView::Color colour) |
ROW & | operator= (const ROW &source) |
Friends |
void | tweak_row_baseline (ROW *, double, double) |
Detailed Description
Definition at line 32 of file ocrrow.h.
Constructor & Destructor Documentation
ROW::ROW |
( |
inT32 |
spline_size, |
|
|
inT32 * |
xstarts, |
|
|
double * |
coeffs, |
|
|
float |
x_height, |
|
|
float |
ascenders, |
|
|
float |
descenders, |
|
|
inT16 |
kern, |
|
|
inT16 |
space |
|
) |
| |
Definition at line 66 of file ocrrow.cpp.
: para_(NULL) {
kerning = kern;
spacing = space;
xheight = to_row->xheight;
bodysize = to_row->body_size;
ascrise = to_row->ascrise;
descdrop = to_row->descdrop;
baseline = to_row->baseline;
has_drop_cap_ = false;
lmargin_ = 0;
rmargin_ = 0;
}
Member Function Documentation
Definition at line 105 of file ocrrow.h.
{
return has_drop_cap_;
}
Definition at line 137 of file ocrrow.cpp.
{
WERD_IT it(&words);
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
it.data ()->move (vec);
bound_box.move (vec);
baseline.move (vec);
}
ROW & ROW::operator= |
( |
const ROW & |
source | ) |
|
Definition at line 215 of file ocrrow.cpp.
{
this->ELIST_LINK::operator= (source);
kerning = source.kerning;
spacing = source.spacing;
xheight = source.xheight;
bodysize = source.bodysize;
ascrise = source.ascrise;
descdrop = source.descdrop;
if (!words.empty ())
words.clear ();
baseline = source.baseline;
bound_box = source.bound_box;
has_drop_cap_ = source.has_drop_cap_;
lmargin_ = source.lmargin_;
rmargin_ = source.rmargin_;
para_ = source.para_;
return *this;
}
Definition at line 177 of file ocrrow.cpp.
{
WERD *word;
WERD_IT it = &words;
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
word = it.data ();
word->plot (window, colour);
}
}
Definition at line 196 of file ocrrow.cpp.
{
WERD *word;
WERD_IT it = &words;
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
word = it.data ();
word->plot (window);
}
}
Definition at line 156 of file ocrrow.cpp.
{
tprintf("Kerning= %d\n", kerning);
tprintf("Spacing= %d\n", spacing);
bound_box.print();
tprintf("Xheight= %f\n", xheight);
tprintf("Ascrise= %f\n", ascrise);
tprintf("Descdrop= %f\n", descdrop);
tprintf("has_drop_cap= %d\n", has_drop_cap_);
tprintf("lmargin= %d, rmargin= %d\n", lmargin_, rmargin_);
}
Definition at line 90 of file ocrrow.cpp.
{
WERD *word;
WERD_IT it = &words;
inT16 left;
inT16 prev_left;
if (!it.empty ()) {
word = it.data ();
prev_left = word->bounding_box ().left ();
it.forward ();
while (!it.at_first ()) {
word = it.data ();
left = word->bounding_box ().left ();
if (left < prev_left) {
it.move_to_first ();
it.sort (word_comparator);
break;
}
prev_left = left;
it.forward ();
}
}
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
word = it.data ();
if (it.at_first ())
word->set_flag (W_BOL, TRUE);
else
word->set_flag (W_BOL, FALSE);
if (it.at_last ())
word->set_flag (W_EOL, TRUE);
else
word->set_flag (W_EOL, FALSE);
bound_box += word->bounding_box ();
}
}
Definition at line 64 of file ocrrow.h.
{
xheight = new_xheight;
}
Friends And Related Function Documentation
Definition at line 720 of file tordmain.cpp.
{
TBOX blob_box;
C_BLOB *blob;
WERD *word;
inT32 blob_count;
inT32 src_index;
inT32 dest_index;
inT32 *xstarts;
double *coeffs;
float ydiff;
float x_centre;
WERD_IT word_it = row->word_list ();
C_BLOB_IT blob_it;
blob_count = 0;
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
word = word_it.data ();
blob_count += word->cblob_list ()->length ();
}
if (blob_count == 0)
return;
xstarts =
(inT32 *) alloc_mem ((blob_count + row->baseline.segments + 1) *
sizeof (inT32));
coeffs =
(double *) alloc_mem ((blob_count + row->baseline.segments) * 3 *
sizeof (double));
src_index = 0;
dest_index = 0;
xstarts[0] = row->baseline.xcoords[0];
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
word = word_it.data ();
blob_it.set_to_list (word->cblob_list ());
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list ();
blob_it.forward ()) {
blob = blob_it.data ();
blob_box = blob->bounding_box ();
x_centre = (blob_box.left () + blob_box.right ()) / 2.0;
ydiff = blob_box.bottom () - row->base_line (x_centre);
if (ydiff < 0)
ydiff = -ydiff / row->x_height ();
else
ydiff = ydiff / row->x_height ();
if (ydiff < blshift_maxshift
&& blob_box.height () / row->x_height () > blshift_xfraction) {
if (xstarts[dest_index] >= x_centre)
xstarts[dest_index] = blob_box.left ();
coeffs[dest_index * 3] = 0;
coeffs[dest_index * 3 + 1] = 0;
coeffs[dest_index * 3 + 2] = blob_box.bottom ();
dest_index++;
xstarts[dest_index] = blob_box.right () + 1;
}
else {
if (xstarts[dest_index] <= x_centre) {
while (row->baseline.xcoords[src_index + 1] <= x_centre
&& src_index < row->baseline.segments - 1) {
if (row->baseline.xcoords[src_index + 1] >
xstarts[dest_index]) {
coeffs[dest_index * 3] =
row->baseline.quadratics[src_index].a;
coeffs[dest_index * 3 + 1] =
row->baseline.quadratics[src_index].b;
coeffs[dest_index * 3 + 2] =
row->baseline.quadratics[src_index].c;
dest_index++;
xstarts[dest_index] =
row->baseline.xcoords[src_index + 1];
}
src_index++;
}
coeffs[dest_index * 3] =
row->baseline.quadratics[src_index].a;
coeffs[dest_index * 3 + 1] =
row->baseline.quadratics[src_index].b;
coeffs[dest_index * 3 + 2] =
row->baseline.quadratics[src_index].c;
dest_index++;
xstarts[dest_index] = row->baseline.xcoords[src_index + 1];
}
}
}
}
while (src_index < row->baseline.segments
&& row->baseline.xcoords[src_index + 1] <= xstarts[dest_index])
src_index++;
while (src_index < row->baseline.segments) {
coeffs[dest_index * 3] = row->baseline.quadratics[src_index].a;
coeffs[dest_index * 3 + 1] = row->baseline.quadratics[src_index].b;
coeffs[dest_index * 3 + 2] = row->baseline.quadratics[src_index].c;
dest_index++;
src_index++;
xstarts[dest_index] = row->baseline.xcoords[src_index];
}
row->baseline = QSPLINE (dest_index, xstarts, coeffs);
free_mem(xstarts);
free_mem(coeffs);
}
The documentation for this class was generated from the following files:
- /usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccstruct/ocrrow.h
- /usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccstruct/ocrrow.cpp