tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
19 #ifndef TESSERACT_TEXTORD_TABVECTOR_H_
20 #define TESSERACT_TEXTORD_TABVECTOR_H_
38 "Max fraction of mean blob width allowed for vertical gaps in vertical text");
40 "Fraction of box matches required to declare a line vertical");
78 static void CreateConstraint(
TabVector* vector,
bool is_top);
81 static bool CompatibleConstraints(TabConstraint_LIST* list1,
82 TabConstraint_LIST* list2);
86 static void MergeConstraints(TabConstraint_LIST* list1,
87 TabConstraint_LIST* list2);
91 static void ApplyConstraints(TabConstraint_LIST* constraints);
97 static void GetConstraints(TabConstraint_LIST* constraints,
98 int* y_min,
int* y_max);
127 int extended_start_y,
int extended_end_y,
128 BLOBNBOX_CLIST* good_points,
129 int* vertical_x,
int* vertical_y);
152 return extended_ymax_;
155 return extended_ymin_;
164 top_constraints_ = constraints;
167 bottom_constraints_ = constraints;
179 return intersects_other_lines_;
182 intersects_other_lines_ = value;
189 int height = endpt_.
y() - startpt_.
y();
191 return (y - startpt_.
y()) * (endpt_.
x() - startpt_.
x()) / height +
199 return std::min(other.endpt_.
y(), endpt_.
y()) -
200 std::max(other.startpt_.
y(), startpt_.
y());
204 return std::min(top_y, static_cast<int>(endpt_.
y())) - std::max(bottom_y, static_cast<int>(startpt_.
y()));
208 return std::min(top_y, extended_ymax_) - std::max(bottom_y, extended_ymin_);
235 return sort_key_ < other.sort_key_;
240 return partners_.empty();
245 return boxes_.length();
250 boxes_.shallow_clear();
255 int x = startpt_.
y();
256 startpt_.
set_y(startpt_.
x());
265 startpt_.
set_x(-startpt_.
x());
266 endpt_.
set_x(-endpt_.
x());
267 sort_key_ = -sort_key_;
281 return pt * vertical;
286 if (vertical.
y() != 0)
287 return (vertical.
x() * y +
sort_key) / vertical.
y();
294 const TabVector* tv1 = *static_cast<const TabVector* const*>(v1);
295 const TabVector* tv2 = *static_cast<const TabVector* const*>(v2);
296 return tv1->sort_key_ - tv2->sort_key_;
328 TabVector_LIST* vectors,
BlobGrid* grid);
348 void Print(
const char* prefix);
351 void Debug(
const char* prefix);
372 bool Fit(
ICOORD vertical,
bool force_parallel);
400 int extended_ymin_ = 0;
402 int extended_ymax_ = 0;
406 int percent_score_ = 0;
410 bool needs_refit_ =
false;
412 bool needs_evaluation_ =
false;
414 bool intersects_other_lines_ =
false;
418 BLOBNBOX_CLIST boxes_;
420 TabVector_CLIST partners_;
423 TabConstraint_LIST* top_constraints_ =
nullptr;
424 TabConstraint_LIST* bottom_constraints_ =
nullptr;
429 #endif // TESSERACT_TEXTORD_TABVECTOR_H_
static int SortVectorsByKey(const void *v1, const void *v2)
void set_x(int16_t xin)
rewrite function
void AddPartner(TabVector *partner)
static int SortKey(const ICOORD &vertical, int x, int y)
static TabVector * FitVector(TabAlignment alignment, ICOORD vertical, int extended_start_y, int extended_end_y, BLOBNBOX_CLIST *good_points, int *vertical_x, int *vertical_y)
double textord_tabvector_vertical_box_ratio
void MergeWith(const ICOORD &vertical, TabVector *other)
const ICOORD & endpt() const
void SetupPartnerConstraints()
void Evaluate(const ICOORD &vertical, TabFind *finder)
bool SimilarTo(const ICOORD &vertical, const TabVector &other, BlobGrid *grid) const
void Print(const char *prefix)
void set_endpt(const ICOORD &end)
void Rotate(const FCOORD &rotation)
bool Fit(ICOORD vertical, bool force_parallel)
void set_startpt(const ICOORD &start)
int ExtendedOverlap(int top_y, int bottom_y) const
void set_intersects_other_lines(bool value)
void ExtendToBox(BLOBNBOX *blob)
int16_t x() const
access function
#define double_VAR_H(name, val, comment)
TabVector_CLIST * partners()
void set_y(int16_t yin)
rewrite function
#define ELISTIZEH(CLASSNAME)
static int XAtY(const ICOORD &vertical, int sort_key, int y)
#define ELIST2IZEH(CLASSNAME)
void set_top_constraints(TabConstraint_LIST *constraints)
void set_bottom_constraints(TabConstraint_LIST *constraints)
void Debug(const char *prefix)
int extended_ymin() const
CLISTIZEH(STRING) CLISTIZE(STRING) namespace tesseract
TabVector * VerticalTextlinePartner()
bool intersects_other_lines() const
double textord_tabvector_vertical_gap_fraction
TabVector * GetSinglePartner()
int VOverlap(const TabVector &other) const
static void MergeSimilarTabVectors(const ICOORD &vertical, TabVector_LIST *vectors, BlobGrid *grid)
bool IsLeftOf(const TabVector &other) const
void FitAndEvaluateIfNeeded(const ICOORD &vertical, TabFind *finder)
void Display(ScrollView *tab_win)
const ICOORD & startpt() const
bool IsAPartner(const TabVector *other)
int extended_ymax() const
TabVector * ShallowCopy() const
void SetYStart(int start_y)
int VOverlap(int top_y, int bottom_y) const
int16_t y() const
access_function