#include <boxword.h>
Definition at line 37 of file boxword.h.
◆ BoxWord() [1/2]
tesseract::BoxWord::BoxWord |
( |
| ) |
|
◆ BoxWord() [2/2]
tesseract::BoxWord::BoxWord |
( |
const BoxWord & |
src | ) |
|
|
explicit |
Definition at line 36 of file boxword.cpp.
36 {
38}
void CopyFrom(const BoxWord &src)
◆ ~BoxWord()
tesseract::BoxWord::~BoxWord |
( |
| ) |
|
|
default |
◆ BlobBox()
const TBOX & tesseract::BoxWord::BlobBox |
( |
int |
index | ) |
const |
|
inline |
Definition at line 84 of file boxword.h.
84 {
85 return boxes_[index];
86 }
◆ bounding_box()
const TBOX & tesseract::BoxWord::bounding_box |
( |
| ) |
const |
|
inline |
Definition at line 80 of file boxword.h.
80 {
81 return bbox_;
82 }
◆ ChangeBox()
void tesseract::BoxWord::ChangeBox |
( |
int |
index, |
|
|
const TBOX & |
box |
|
) |
| |
Definition at line 159 of file boxword.cpp.
159 {
160 boxes_[index] = box;
161 ComputeBoundingBox();
162}
◆ ClipToOriginalWord()
void tesseract::BoxWord::ClipToOriginalWord |
( |
const BLOCK * |
block, |
|
|
WERD * |
original_word |
|
) |
| |
Definition at line 92 of file boxword.cpp.
92 {
93 for (int i = 0; i < length_; ++i) {
95
98
101 for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
102 TBOX blob_box = b_it.data()->bounding_box();
103 if (block != nullptr)
106 original_box += blob_box;
107 }
108 }
112 if (NearlyEqual<int>(original_box.
right(), box.
right(),
117 if (NearlyEqual<int>(original_box.
bottom(), box.
bottom(),
120 }
122 if (block != nullptr)
125 }
126 ComputeBoundingBox();
127}
const int kBoxClipTolerance
FCOORD re_rotation() const
void rotate(const FCOORD &vec)
bool major_overlap(const TBOX &box) const
TBOX intersection(const TBOX &box) const
C_BLOB_LIST * cblob_list()
TBOX bounding_box() const
◆ CopyFrom()
void tesseract::BoxWord::CopyFrom |
( |
const BoxWord & |
src | ) |
|
Definition at line 45 of file boxword.cpp.
45 {
46 bbox_ = src.bbox_;
47 length_ = src.length_;
50 for (int i = 0; i < length_; ++i)
52}
◆ CopyFromNormalized()
BoxWord * tesseract::BoxWord::CopyFromNormalized |
( |
TWERD * |
tessword | ) |
|
|
static |
Definition at line 56 of file boxword.cpp.
56 {
58
59 boxword->length_ = tessword->
NumBlobs();
60
61 boxword->boxes_.reserve(boxword->length_);
62
63 for (int b = 0; b < boxword->length_; ++b) {
67 outline = outline->
next) {
68 EDGEPT* edgept = outline->loop;
69
70 do {
75 pos.set_x(denormed.
x);
76 pos.set_y(denormed.
y);
77 TBOX pt_box(pos, pos);
78 blob_box += pt_box;
79 }
80 edgept = edgept->
next;
81 } while (edgept != outline->loop);
82 }
83 boxword->boxes_.push_back(blob_box);
84 }
85 boxword->ComputeBoundingBox();
86 return boxword;
87}
const DENORM & denorm() const
GenericVector< TBLOB * > blobs
void DenormTransform(const DENORM *last_denorm, const TPOINT &pt, TPOINT *original) const
◆ DeleteAllBoxes()
void tesseract::BoxWord::DeleteAllBoxes |
( |
| ) |
|
Definition at line 174 of file boxword.cpp.
174 {
175 length_ = 0;
178}
◆ DeleteBox()
void tesseract::BoxWord::DeleteBox |
( |
int |
index | ) |
|
Definition at line 166 of file boxword.cpp.
166 {
169 --length_;
170 ComputeBoundingBox();
171}
◆ InsertBox()
void tesseract::BoxWord::InsertBox |
( |
int |
index, |
|
|
const TBOX & |
box |
|
) |
| |
Definition at line 148 of file boxword.cpp.
148 {
149 if (index < length_)
150 boxes_.
insert(box, index);
151 else
153 length_ = boxes_.
size();
154 ComputeBoundingBox();
155}
void insert(const T &t, int index)
◆ length()
int tesseract::BoxWord::length |
( |
| ) |
const |
|
inline |
◆ MergeBoxes()
void tesseract::BoxWord::MergeBoxes |
( |
int |
start, |
|
|
int |
end |
|
) |
| |
Definition at line 131 of file boxword.cpp.
131 {
134 if (end <= start + 1)
135 return;
136 for (int i = start + 1; i < end; ++i) {
137 boxes_[start] += boxes_[i];
138 }
139 int shrinkage = end - 1 - start;
140 length_ -= shrinkage;
141 for (int i = start + 1; i < length_; ++i)
142 boxes_[i] = boxes_[i + shrinkage];
144}
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
◆ operator=()
Definition at line 40 of file boxword.cpp.
40 {
42 return *this;
43}
◆ ProcessMatchedBlobs()
void tesseract::BoxWord::ProcessMatchedBlobs |
( |
const TWERD & |
other, |
|
|
TessCallback1< int > * |
cb |
|
) |
| const |
Definition at line 190 of file boxword.cpp.
191 {
192 for (
int i = 0; i < length_ && i < other.
NumBlobs(); ++i) {
193 TBOX blob_box = other.
blobs[i]->bounding_box();
194 if (blob_box == boxes_[i])
196 }
197 delete cb;
198}
The documentation for this class was generated from the following files: