20 #ifndef TESSERACT_TEXTORD_TABVECTOR_H_ 21 #define TESSERACT_TEXTORD_TABVECTOR_H_ 38 extern double_VAR_H(textord_tabvector_vertical_gap_fraction, 0.5,
39 "Max fraction of mean blob width allowed for vertical gaps in vertical text");
40 extern double_VAR_H(textord_tabvector_vertical_box_ratio, 0.5,
41 "Fraction of box matches required to declare a line vertical");
79 static void CreateConstraint(
TabVector* vector,
bool is_top);
82 static bool CompatibleConstraints(TabConstraint_LIST* list1,
83 TabConstraint_LIST* list2);
87 static void MergeConstraints(TabConstraint_LIST* list1,
88 TabConstraint_LIST* list2);
92 static void ApplyConstraints(TabConstraint_LIST* constraints);
98 static void GetConstraints(TabConstraint_LIST* constraints,
99 int* y_min,
int* y_max);
128 int extended_start_y,
int extended_end_y,
129 BLOBNBOX_CLIST* good_points,
130 int* vertical_x,
int* vertical_y);
205 return std::min(top_y, static_cast<int>(
endpt_.
y())) - std::max(bottom_y, static_cast<int>(
startpt_.
y()));
282 return pt * vertical;
287 if (vertical.
y() != 0)
288 return (vertical.
x() * y +
sort_key) / vertical.
y();
329 TabVector_LIST* vectors,
BlobGrid* grid);
349 void Print(
const char* prefix);
352 void Debug(
const char* prefix);
373 bool Fit(
ICOORD vertical,
bool force_parallel);
430 #endif // TESSERACT_TEXTORD_TABVECTOR_H_ static int SortVectorsByKey(const void *v1, const void *v2)
Definition: tabvector.h:294
int sort_key_
Definition: tabvector.h:405
Definition: tabvector.h:51
static void MergeSimilarTabVectors(const ICOORD &vertical, TabVector_LIST *vectors, BlobGrid *grid)
Definition: tabvector.cpp:356
bool Fit(ICOORD vertical, bool force_parallel)
Definition: tabvector.cpp:783
int mean_width() const
Definition: tabvector.h:161
const ICOORD & endpt() const
Definition: tabvector.h:149
int BoxCount()
Definition: tabvector.h:245
BLOBNBOX_CLIST boxes_
Definition: tabvector.h:419
void set_x(int16_t xin)
rewrite function
Definition: points.h:62
TabAlignment
Definition: tabvector.h:45
int16_t x() const
access function
Definition: points.h:53
int VOverlap(const TabVector &other) const
Definition: tabvector.h:199
bool IsLeftOf(const TabVector &other) const
Definition: tabvector.h:235
bool IsCenterTab() const
Definition: tabvector.h:225
bool Partnerless()
Definition: tabvector.h:240
int percent_score_
Definition: tabvector.h:407
Definition: tabvector.h:112
bool IsRagged() const
Definition: tabvector.h:229
int XAtY(int y) const
Definition: tabvector.h:189
Definition: tabvector.h:52
void Debug(const char *prefix)
Definition: tabvector.cpp:530
void Display(ScrollView *tab_win)
Definition: tabvector.cpp:542
void ReflectInYAxis()
Definition: tabvector.h:265
bool SimilarTo(const ICOORD &vertical, const TabVector &other, BlobGrid *grid) const
Definition: tabvector.cpp:389
void XYFlip()
Definition: tabvector.h:255
Definition: tabvector.h:46
bool intersects_other_lines() const
Definition: tabvector.h:179
int mean_width_
Definition: tabvector.h:409
Definition: baseapi.cpp:94
int y_max_
Definition: tabvector.h:107
void ExtendToBox(BLOBNBOX *blob)
Definition: tabvector.cpp:241
TabAlignment alignment_
Definition: tabvector.h:417
void set_bottom_constraints(TabConstraint_LIST *constraints)
Definition: tabvector.h:167
bool intersects_other_lines_
Definition: tabvector.h:415
int sort_key() const
Definition: tabvector.h:158
int extended_ymin() const
Definition: tabvector.h:155
TabVector * ShallowCopy() const
Definition: tabvector.cpp:228
double_VAR_H(textord_tabvector_vertical_gap_fraction, 0.5, "Max fraction of mean blob width allowed for vertical gaps in vertical text")
void Print(const char *prefix)
Definition: tabvector.cpp:520
void AddPartner(TabVector *partner)
Definition: tabvector.cpp:487
Definition: blobbox.h:144
TabVector_CLIST * partners()
Definition: tabvector.h:170
bool IsLeftTab() const
Definition: tabvector.h:213
TabVector_CLIST partners_
Definition: tabvector.h:421
void SetupConstraints()
Definition: tabvector.cpp:291
static int XAtY(const ICOORD &vertical, int sort_key, int y)
Definition: tabvector.h:286
int16_t y() const
access_function
Definition: points.h:57
TabVector * GetSinglePartner()
Definition: tabvector.cpp:869
void ApplyConstraints()
Definition: tabvector.cpp:348
void set_endpt(const ICOORD &end)
Definition: tabvector.h:176
TabVector * vector_
Definition: tabvector.h:102
int extended_ymax() const
Definition: tabvector.h:152
Definition: blobgrid.h:33
void set_intersects_other_lines(bool value)
Definition: tabvector.h:182
Definition: tabvector.h:47
int VOverlap(int top_y, int bottom_y) const
Definition: tabvector.h:204
const ICOORD & startpt() const
Definition: tabvector.h:146
void set_startpt(const ICOORD &start)
Definition: tabvector.h:173
ICOORD endpt_
Definition: tabvector.h:399
Definition: tabvector.h:48
void FitAndEvaluateIfNeeded(const ICOORD &vertical, TabFind *finder)
Definition: tabvector.cpp:568
void set_y(int16_t yin)
rewrite function
Definition: points.h:66
Definition: tabvector.h:49
bool needs_evaluation_
Definition: tabvector.h:413
int y_min_
Definition: tabvector.h:106
integer coordinate
Definition: points.h:32
bool IsAPartner(const TabVector *other)
Definition: tabvector.cpp:500
void Delete(TabVector *replacement)
Definition: tabvector.cpp:951
void Freeze()
Definition: tabvector.h:250
bool is_top_
Definition: tabvector.h:104
TabConstraint_LIST * top_constraints_
Definition: tabvector.h:424
Definition: tabvector.h:50
bool IsSeparator() const
Definition: tabvector.h:221
static int SortKey(const ICOORD &vertical, int x, int y)
Definition: tabvector.h:280
Definition: tabvector.h:71
void SetupPartnerConstraints()
Definition: tabvector.cpp:297
void Evaluate(const ICOORD &vertical, TabFind *finder)
Definition: tabvector.cpp:582
void Rotate(const FCOORD &rotation)
Definition: tabvector.cpp:276
bool needs_refit_
Definition: tabvector.h:411
ICOORD startpt_
Definition: tabvector.h:397
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)
Definition: tabvector.cpp:177
int extended_ymin_
Definition: tabvector.h:401
void MergeWith(const ICOORD &vertical, TabVector *other)
Definition: tabvector.cpp:453
void SetYStart(int start_y)
Definition: tabvector.cpp:265
TabConstraint_LIST * bottom_constraints_
Definition: tabvector.h:425
void SetYEnd(int end_y)
Definition: tabvector.cpp:270
bool IsRightTab() const
Definition: tabvector.h:217
int ExtendedOverlap(int top_y, int bottom_y) const
Definition: tabvector.h:208
int extended_ymax_
Definition: tabvector.h:403
void set_top_constraints(TabConstraint_LIST *constraints)
Definition: tabvector.h:164
TabVector * VerticalTextlinePartner()
Definition: tabvector.cpp:879