tesseract  4.0.0-1-g2a2b
tesseract::AlignedBlobParams Struct Reference

#include <alignedblob.h>

Public Member Functions

 AlignedBlobParams (int vertical_x, int vertical_y, int height, int v_gap_multiple, int min_gutter_width, int resolution, TabAlignment alignment0)
 
 AlignedBlobParams (int vertical_x, int vertical_y, int width)
 
void set_vertical (int vertical_x, int vertical_y)
 

Public Attributes

double gutter_fraction
 
bool right_tab
 
bool ragged
 
TabAlignment alignment
 
TabType confirmed_type
 
int max_v_gap
 
int min_gutter
 
int l_align_tolerance
 
int r_align_tolerance
 
int min_points
 
int min_length
 
ICOORD vertical
 

Detailed Description

Definition at line 42 of file alignedblob.h.

Constructor & Destructor Documentation

◆ AlignedBlobParams() [1/2]

tesseract::AlignedBlobParams::AlignedBlobParams ( int  vertical_x,
int  vertical_y,
int  height,
int  v_gap_multiple,
int  min_gutter_width,
int  resolution,
TabAlignment  alignment0 
)

Definition at line 74 of file alignedblob.cpp.

78  : right_tab(align0 == TA_RIGHT_RAGGED || align0 == TA_RIGHT_ALIGNED),
79  ragged(align0 == TA_LEFT_RAGGED || align0 == TA_RIGHT_RAGGED),
80  alignment(align0),
82  min_length(0) {
83  // Set the tolerances according to the type of line sought.
84  // For tab search, these are based on the image resolution for most, or
85  // the height of the starting blob for the maximum vertical gap.
86  max_v_gap = height * v_gap_multiple;
87  if (ragged) {
88  // In the case of a ragged edge, we are much more generous with the
89  // inside alignment fraction, but also require a much bigger gutter.
91  if (alignment == TA_RIGHT_RAGGED) {
92  l_align_tolerance = static_cast<int>(resolution * kRaggedFraction + 0.5);
93  r_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
94  } else {
95  l_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
96  r_align_tolerance = static_cast<int>(resolution * kRaggedFraction + 0.5);
97  }
99  } else {
101  l_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
102  r_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
104  }
105  min_gutter = static_cast<int>(height * gutter_fraction + 0.5);
106  if (min_gutter < min_gutter_width)
107  min_gutter = min_gutter_width;
108  // Fit the vertical vector into an ICOORD, which is 16 bit.
109  set_vertical(vertical_x, vertical_y);
110 }
const int kMinAlignedTabs
Definition: alignedblob.cpp:55
const double kRaggedFraction
Definition: alignedblob.cpp:41
const double kAlignedGapFraction
Definition: alignedblob.cpp:43
const double kRaggedGapFraction
Definition: alignedblob.cpp:45
void set_vertical(int vertical_x, int vertical_y)
const int kMinRaggedTabs
Definition: alignedblob.cpp:53
const double kAlignedFraction
Definition: alignedblob.cpp:39

◆ AlignedBlobParams() [2/2]

tesseract::AlignedBlobParams::AlignedBlobParams ( int  vertical_x,
int  vertical_y,
int  width 
)

Definition at line 115 of file alignedblob.cpp.

117  : gutter_fraction(0.0),
118  right_tab(false),
119  ragged(false),
124  min_points(1),
126  // Compute threshold for left and right alignment.
127  l_align_tolerance = std::max(kVLineAlignment, width);
128  r_align_tolerance = std::max(kVLineAlignment, width);
129 
130  // Fit the vertical vector into an ICOORD, which is 16 bit.
131  set_vertical(vertical_x, vertical_y);
132 }
const int kVLineSearchSize
Definition: alignedblob.cpp:51
const int kVLineGutter
Definition: alignedblob.cpp:49
void set_vertical(int vertical_x, int vertical_y)
const int kVLineMinLength
Definition: alignedblob.cpp:57
const int kVLineAlignment
Definition: alignedblob.cpp:47

Member Function Documentation

◆ set_vertical()

void tesseract::AlignedBlobParams::set_vertical ( int  vertical_x,
int  vertical_y 
)

Definition at line 135 of file alignedblob.cpp.

135  {
136  int factor = 1;
137  if (vertical_y > INT16_MAX)
138  factor = vertical_y / INT16_MAX + 1;
139  vertical.set_x(vertical_x / factor);
140  vertical.set_y(vertical_y / factor);
141 }
void set_x(int16_t xin)
rewrite function
Definition: points.h:62
void set_y(int16_t yin)
rewrite function
Definition: points.h:66

Member Data Documentation

◆ alignment

TabAlignment tesseract::AlignedBlobParams::alignment

Definition at line 64 of file alignedblob.h.

◆ confirmed_type

TabType tesseract::AlignedBlobParams::confirmed_type

Definition at line 65 of file alignedblob.h.

◆ gutter_fraction

double tesseract::AlignedBlobParams::gutter_fraction

Definition at line 61 of file alignedblob.h.

◆ l_align_tolerance

int tesseract::AlignedBlobParams::l_align_tolerance

Definition at line 69 of file alignedblob.h.

◆ max_v_gap

int tesseract::AlignedBlobParams::max_v_gap

Definition at line 66 of file alignedblob.h.

◆ min_gutter

int tesseract::AlignedBlobParams::min_gutter

Definition at line 67 of file alignedblob.h.

◆ min_length

int tesseract::AlignedBlobParams::min_length

Definition at line 73 of file alignedblob.h.

◆ min_points

int tesseract::AlignedBlobParams::min_points

Definition at line 72 of file alignedblob.h.

◆ r_align_tolerance

int tesseract::AlignedBlobParams::r_align_tolerance

Definition at line 70 of file alignedblob.h.

◆ ragged

bool tesseract::AlignedBlobParams::ragged

Definition at line 63 of file alignedblob.h.

◆ right_tab

bool tesseract::AlignedBlobParams::right_tab

Definition at line 62 of file alignedblob.h.

◆ vertical

ICOORD tesseract::AlignedBlobParams::vertical

Definition at line 75 of file alignedblob.h.


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