tesseract  4.00.00dev
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 73 of file alignedblob.cpp.

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

◆ AlignedBlobParams() [2/2]

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

Definition at line 114 of file alignedblob.cpp.

116  : gutter_fraction(0.0),
117  right_tab(false),
118  ragged(false),
123  min_points(1),
125  // Compute threshold for left and right alignment.
128 
129  // Fit the vertical vector into an ICOORD, which is 16 bit.
130  set_vertical(vertical_x, vertical_y);
131 }
const int kVLineSearchSize
Definition: alignedblob.cpp:50
const int kVLineAlignment
Definition: alignedblob.cpp:46
void set_vertical(int vertical_x, int vertical_y)
const int kVLineMinLength
Definition: alignedblob.cpp:56
#define MAX(x, y)
Definition: ndminx.h:24
const int kVLineGutter
Definition: alignedblob.cpp:48

Member Function Documentation

◆ set_vertical()

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

Definition at line 134 of file alignedblob.cpp.

134  {
135  int factor = 1;
136  if (vertical_y > MAX_INT16)
137  factor = vertical_y / MAX_INT16 + 1;
138  vertical.set_x(vertical_x / factor);
139  vertical.set_y(vertical_y / factor);
140 }
void set_x(inT16 xin)
rewrite function
Definition: points.h:61
#define MAX_INT16
Definition: host.h:61
void set_y(inT16 yin)
rewrite function
Definition: points.h:65

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: