tesseract v5.3.3.20231005
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 38 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 81 of file alignedblob.cpp.

83 : right_tab(align0 == TA_RIGHT_RAGGED || align0 == TA_RIGHT_ALIGNED)
84 , ragged(align0 == TA_LEFT_RAGGED || align0 == TA_RIGHT_RAGGED)
85 , alignment(align0)
87 , min_length(0) {
88 // Set the tolerances according to the type of line sought.
89 // For tab search, these are based on the image resolution for most, or
90 // the height of the starting blob for the maximum vertical gap.
91 max_v_gap = height * v_gap_multiple;
92 if (ragged) {
93 // In the case of a ragged edge, we are much more generous with the
94 // inside alignment fraction, but also require a much bigger gutter.
97 l_align_tolerance = static_cast<int>(resolution * kRaggedFraction + 0.5);
98 r_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
99 } else {
100 l_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
101 r_align_tolerance = static_cast<int>(resolution * kRaggedFraction + 0.5);
102 }
104 } else {
106 l_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
107 r_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
109 }
110 min_gutter = static_cast<int>(height * gutter_fraction + 0.5);
111 if (min_gutter < min_gutter_width) {
112 min_gutter = min_gutter_width;
113 }
114 // Fit the vertical vector into an ICOORD, which is 16 bit.
115 set_vertical(vertical_x, vertical_y);
116}
const int kMinAlignedTabs
Definition: alignedblob.cpp:62
const double kAlignedGapFraction
Definition: alignedblob.cpp:50
const double kRaggedGapFraction
Definition: alignedblob.cpp:52
@ TA_RIGHT_ALIGNED
Definition: tabvector.h:45
@ TA_RIGHT_RAGGED
Definition: tabvector.h:46
@ TA_LEFT_RAGGED
Definition: tabvector.h:43
const double kAlignedFraction
Definition: alignedblob.cpp:46
const double kRaggedFraction
Definition: alignedblob.cpp:48
const int kMinRaggedTabs
Definition: alignedblob.cpp:60
@ TT_CONFIRMED
Definition: blobbox.h:66
void set_vertical(int vertical_x, int vertical_y)

◆ AlignedBlobParams() [2/2]

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

Definition at line 121 of file alignedblob.cpp.

122 : gutter_fraction(0.0)
123 , right_tab(false)
124 , ragged(false)
129 , min_points(1)
131 // Compute threshold for left and right alignment.
132 l_align_tolerance = std::max(kVLineAlignment, width);
133 r_align_tolerance = std::max(kVLineAlignment, width);
134
135 // Fit the vertical vector into an ICOORD, which is 16 bit.
136 set_vertical(vertical_x, vertical_y);
137}
const int kVLineMinLength
Definition: alignedblob.cpp:64
const int kVLineSearchSize
Definition: alignedblob.cpp:58
const int kVLineGutter
Definition: alignedblob.cpp:56
@ TA_SEPARATOR
Definition: tabvector.h:47
const int kVLineAlignment
Definition: alignedblob.cpp:54
@ TT_VLINE
Definition: blobbox.h:67

Member Function Documentation

◆ set_vertical()

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

Definition at line 140 of file alignedblob.cpp.

140 {
141 int factor = 1;
142 if (vertical_y > INT16_MAX) {
143 factor = vertical_y / INT16_MAX + 1;
144 }
145 vertical.set_x(vertical_x / factor);
146 vertical.set_y(vertical_y / factor);
147}
void set_x(TDimension xin)
rewrite function
Definition: points.h:67
void set_y(TDimension yin)
rewrite function
Definition: points.h:71

Member Data Documentation

◆ alignment

TabAlignment tesseract::AlignedBlobParams::alignment

Definition at line 59 of file alignedblob.h.

◆ confirmed_type

TabType tesseract::AlignedBlobParams::confirmed_type

Definition at line 60 of file alignedblob.h.

◆ gutter_fraction

double tesseract::AlignedBlobParams::gutter_fraction

Definition at line 56 of file alignedblob.h.

◆ l_align_tolerance

int tesseract::AlignedBlobParams::l_align_tolerance

Definition at line 64 of file alignedblob.h.

◆ max_v_gap

int tesseract::AlignedBlobParams::max_v_gap

Definition at line 61 of file alignedblob.h.

◆ min_gutter

int tesseract::AlignedBlobParams::min_gutter

Definition at line 62 of file alignedblob.h.

◆ min_length

int tesseract::AlignedBlobParams::min_length

Definition at line 68 of file alignedblob.h.

◆ min_points

int tesseract::AlignedBlobParams::min_points

Definition at line 67 of file alignedblob.h.

◆ r_align_tolerance

int tesseract::AlignedBlobParams::r_align_tolerance

Definition at line 65 of file alignedblob.h.

◆ ragged

bool tesseract::AlignedBlobParams::ragged

Definition at line 58 of file alignedblob.h.

◆ right_tab

bool tesseract::AlignedBlobParams::right_tab

Definition at line 57 of file alignedblob.h.

◆ vertical

ICOORD tesseract::AlignedBlobParams::vertical

Definition at line 70 of file alignedblob.h.


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