tesseract  5.0.0-alpha-619-ge9db
TO_ROW Class Reference

#include <blobbox.h>

Inheritance diagram for TO_ROW:
ELIST2_LINK

Public Member Functions

 TO_ROW ()
 
 TO_ROW (BLOBNBOX *blob, float top, float bottom, float row_size)
 
void print () const
 
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

bool merged = false
 
bool all_caps
 
bool used_dm_model
 
int16_t projection_left
 
int16_t 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_t min_space
 
int32_t max_nonspace
 
int32_t 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 543 of file blobbox.h.

Constructor & Destructor Documentation

◆ TO_ROW() [1/2]

TO_ROW::TO_ROW ( )
inline

Definition at line 548 of file blobbox.h.

549  {
550  clear();

◆ TO_ROW() [2/2]

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

Definition at line 680 of file blobbox.cpp.

694  {
695  clear();
696  y_min = bottom;
697  y_max = top;
698  initial_y_min = bottom;
699 
700  float diff; //in size
701  BLOBNBOX_IT it = &blobs; //list of blobs
702 
703  it.add_to_end (blob);
704  diff = top - bottom - row_size;
705  if (diff > 0) {
706  y_max -= diff / 2;

Member Function Documentation

◆ add_blob()

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

Definition at line 723 of file blobbox.cpp.

738  {
739  float allowed; //allowed expansion
740  float available; //expansion
741  BLOBNBOX_IT it = &blobs; //list of blobs
742 
743  it.add_to_end (blob);
744  allowed = row_size + y_min - y_max;
745  if (allowed > 0) {
746  available = top > y_max ? top - y_max : 0;
747  if (bottom < y_min)
748  //total available
749  available += y_min - bottom;
750  if (available > 0) {

◆ believability()

float TO_ROW::believability ( ) const
inline

Definition at line 585 of file blobbox.h.

586  { //baseline goodness
587  return credibility;

◆ blob_list()

BLOBNBOX_LIST* TO_ROW::blob_list ( )
inline

Definition at line 599 of file blobbox.h.

600  { //get list
601  return &blobs;

◆ clear_rep_chars_marked()

void TO_ROW::clear_rep_chars_marked ( )
inline

Definition at line 633 of file blobbox.h.

634  {
635  num_repeated_sets_ = -1;

◆ compute_vertical_projection()

void TO_ROW::compute_vertical_projection ( )

Definition at line 784 of file blobbox.cpp.

796  { //project whole row
797  TBOX row_box; //bound of row
798  BLOBNBOX *blob; //current blob
799  TBOX blob_box; //bounding box
800  BLOBNBOX_IT blob_it = blob_list ();
801 
802  if (blob_it.empty ())
803  return;
804  row_box = blob_it.data ()->bounding_box ();
805  for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ())

◆ initial_min_y()

float TO_ROW::initial_min_y ( ) const
inline

Definition at line 567 of file blobbox.h.

568  {
569  return initial_y_min;

◆ insert_blob()

void TO_ROW::insert_blob ( BLOBNBOX blob)

Definition at line 758 of file blobbox.cpp.

771  {
772  BLOBNBOX_IT it = &blobs; //list of blobs
773 
774  if (it.empty ())
775  it.add_before_then_move (blob);
776  else {

◆ intercept()

float TO_ROW::intercept ( ) const
inline

Definition at line 588 of file blobbox.h.

589  { //real parallel_c
590  return y_origin;

◆ line_c()

float TO_ROW::line_c ( ) const
inline

Definition at line 573 of file blobbox.h.

574  {
575  return c;

◆ line_error()

float TO_ROW::line_error ( ) const
inline

Definition at line 576 of file blobbox.h.

577  {
578  return error;

◆ line_m()

float TO_ROW::line_m ( ) const
inline

Definition at line 570 of file blobbox.h.

571  { //access to line fit
572  return m;

◆ max_y()

float TO_ROW::max_y ( ) const
inline

Definition at line 558 of file blobbox.h.

559  { //access function
560  return y_max;

◆ mean_y()

float TO_ROW::mean_y ( ) const
inline

Definition at line 564 of file blobbox.h.

565  {
566  return (y_min + y_max) / 2.0f;

◆ min_y()

float TO_ROW::min_y ( ) const
inline

Definition at line 561 of file blobbox.h.

562  {
563  return y_min;

◆ num_repeated_sets()

int TO_ROW::num_repeated_sets ( ) const
inline

Definition at line 636 of file blobbox.h.

637  {
638  return num_repeated_sets_;

◆ parallel_c()

float TO_ROW::parallel_c ( ) const
inline

Definition at line 579 of file blobbox.h.

580  {
581  return para_c;

◆ parallel_error()

float TO_ROW::parallel_error ( ) const
inline

Definition at line 582 of file blobbox.h.

583  {
584  return para_error;

◆ print()

void TO_ROW::print ( ) const

Definition at line 708 of file blobbox.cpp.

710  {
711  diff = row_size / 3 + bottom - top;
712  y_max += diff / 2;
713  y_min -= diff / 2;
714  }
715 }
716 

◆ rep_chars_marked()

bool TO_ROW::rep_chars_marked ( ) const
inline

Definition at line 630 of file blobbox.h.

631  {
632  return num_repeated_sets_ != -1;

◆ set_limits()

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

Definition at line 621 of file blobbox.h.

624  { //top of row
625  y_min = new_min;
626  y_max = new_max;

◆ set_line()

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

Definition at line 603 of file blobbox.h.

607  {
608  m = new_m;
609  c = new_c;
610  error = new_error;

◆ set_num_repeated_sets()

void TO_ROW::set_num_repeated_sets ( int  num_sets)
inline

Definition at line 639 of file blobbox.h.

640  {
641  num_repeated_sets_ = num_sets;

◆ set_parallel_line()

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

Definition at line 611 of file blobbox.h.

615  {
616  para_c = new_c;
617  para_error = new_error;
618  credibility = blobs.length() - kErrorWeight * new_error;
619  y_origin = new_c / std::sqrt(1 + gradient * gradient);
620  //real intercept

Member Data Documentation

◆ all_caps

bool TO_ROW::all_caps

Definition at line 645 of file blobbox.h.

◆ ascrise

float TO_ROW::ascrise

Definition at line 658 of file blobbox.h.

◆ baseline

QSPLINE TO_ROW::baseline

Definition at line 669 of file blobbox.h.

◆ body_size

float TO_ROW::body_size

Definition at line 660 of file blobbox.h.

◆ char_cells

ICOORDELT_LIST TO_ROW::char_cells

Definition at line 668 of file blobbox.h.

◆ descdrop

float TO_ROW::descdrop

Definition at line 659 of file blobbox.h.

◆ fixed_pitch

float TO_ROW::fixed_pitch

Definition at line 650 of file blobbox.h.

◆ fp_nonsp

float TO_ROW::fp_nonsp

Definition at line 652 of file blobbox.h.

◆ fp_space

float TO_ROW::fp_space

Definition at line 651 of file blobbox.h.

◆ kern_size

float TO_ROW::kern_size

Definition at line 665 of file blobbox.h.

◆ kErrorWeight

const int TO_ROW::kErrorWeight = 3
static

Definition at line 546 of file blobbox.h.

◆ max_nonspace

int32_t TO_ROW::max_nonspace

Definition at line 663 of file blobbox.h.

◆ merged

bool TO_ROW::merged = false

Definition at line 644 of file blobbox.h.

◆ min_space

int32_t TO_ROW::min_space

Definition at line 662 of file blobbox.h.

◆ pitch_decision

PITCH_TYPE TO_ROW::pitch_decision

Definition at line 649 of file blobbox.h.

◆ pr_nonsp

float TO_ROW::pr_nonsp

Definition at line 654 of file blobbox.h.

◆ pr_space

float TO_ROW::pr_space

Definition at line 653 of file blobbox.h.

◆ projection

STATS TO_ROW::projection

Definition at line 670 of file blobbox.h.

◆ projection_left

int16_t TO_ROW::projection_left

Definition at line 647 of file blobbox.h.

◆ projection_right

int16_t TO_ROW::projection_right

Definition at line 648 of file blobbox.h.

◆ rep_words

WERD_LIST TO_ROW::rep_words

Definition at line 667 of file blobbox.h.

◆ space_size

float TO_ROW::space_size

Definition at line 666 of file blobbox.h.

◆ space_threshold

int32_t TO_ROW::space_threshold

Definition at line 664 of file blobbox.h.

◆ spacing

float TO_ROW::spacing

Definition at line 655 of file blobbox.h.

◆ used_dm_model

bool TO_ROW::used_dm_model

Definition at line 646 of file blobbox.h.

◆ xheight

float TO_ROW::xheight

Definition at line 656 of file blobbox.h.

◆ xheight_evidence

int TO_ROW::xheight_evidence

Definition at line 657 of file blobbox.h.


The documentation for this class was generated from the following files:
BLOBNBOX
Definition: blobbox.h:142
TO_ROW::kErrorWeight
static const int kErrorWeight
Definition: blobbox.h:546
TO_ROW::blob_list
BLOBNBOX_LIST * blob_list()
Definition: blobbox.h:599
TBOX
Definition: rect.h:33