#include <tabvector.h>
Definition at line 67 of file tabvector.h.
◆ TabConstraint()
tesseract::TabConstraint::TabConstraint |
( |
| ) |
|
|
default |
◆ ApplyConstraints()
void tesseract::TabConstraint::ApplyConstraints |
( |
TabConstraint_LIST * |
constraints | ) |
|
|
static |
Definition at line 122 of file tabvector.cpp.
122 {
123 int y_min = -INT32_MAX;
124 int y_max = INT32_MAX;
125 GetConstraints(constraints, &y_min, &y_max);
126 int y = (y_min + y_max) / 2;
127 TabConstraint_IT it(constraints);
128 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
130 TabVector *v = constraint->vector_;
131 if (constraint->is_top_) {
133 v->set_top_constraints(nullptr);
134 } else {
136 v->set_bottom_constraints(nullptr);
137 }
138 }
139 delete constraints;
140}
◆ CompatibleConstraints()
bool tesseract::TabConstraint::CompatibleConstraints |
( |
TabConstraint_LIST * |
list1, |
|
|
TabConstraint_LIST * |
list2 |
|
) |
| |
|
static |
Definition at line 76 of file tabvector.cpp.
76 {
77 if (list1 == list2) {
78 return false;
79 }
80 int y_min = -INT32_MAX;
81 int y_max = INT32_MAX;
83 tprintf(
"Testing constraint compatibility\n");
84 }
85 GetConstraints(list1, &y_min, &y_max);
86 GetConstraints(list2, &y_min, &y_max);
88 tprintf(
"Resulting range = [%d,%d]\n", y_min, y_max);
89 }
90 return y_max >= y_min;
91}
void tprintf(const char *format,...)
int textord_debug_tabfind
◆ CreateConstraint()
void tesseract::TabConstraint::CreateConstraint |
( |
TabVector * |
vector, |
|
|
bool |
is_top |
|
) |
| |
|
static |
Definition at line 63 of file tabvector.cpp.
63 {
65 auto *constraints = new TabConstraint_LIST;
66 TabConstraint_IT it(constraints);
67 it.add_to_end(constraint);
68 if (is_top) {
69 vector->set_top_constraints(constraints);
70 } else {
71 vector->set_bottom_constraints(constraints);
72 }
73}
◆ MergeConstraints()
void tesseract::TabConstraint::MergeConstraints |
( |
TabConstraint_LIST * |
list1, |
|
|
TabConstraint_LIST * |
list2 |
|
) |
| |
|
static |
Definition at line 95 of file tabvector.cpp.
95 {
96 if (list1 == list2) {
97 return;
98 }
99 TabConstraint_IT it(list2);
101 tprintf(
"Merging constraints\n");
102 }
103
104 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
107 constraint->vector_->Print("Merge");
108 }
109 if (constraint->is_top_) {
110 constraint->vector_->set_top_constraints(list1);
111 } else {
112 constraint->vector_->set_bottom_constraints(list1);
113 }
114 }
115 it = list1;
116 it.add_list_before(list2);
117 delete list2;
118}
The documentation for this class was generated from the following files:
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/textord/tabvector.h
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/textord/tabvector.cpp