#include <seam.h>
|
| SEAM (float priority, const TPOINT &location) |
|
| SEAM (float priority, const TPOINT &location, const SPLIT &split) |
|
float | priority () const |
|
void | set_priority (float priority) |
|
bool | HasAnySplits () const |
|
TBOX | bounding_box () const |
|
bool | CombineableWith (const SEAM &other, int max_x_dist, float max_total_priority) const |
|
void | CombineWith (const SEAM &other) |
|
bool | ContainedByBlob (const TBLOB &blob) const |
|
bool | UsesPoint (const EDGEPT *point) const |
|
bool | SharesPosition (const SEAM &other) const |
|
bool | OverlappingSplits (const SEAM &other) const |
|
void | Finalize () |
|
bool | IsHealthy (const TBLOB &blob, int min_points, int min_area) const |
|
bool | PrepareToInsertSeam (const std::vector< SEAM * > &seams, const std::vector< TBLOB * > &blobs, int insert_index, bool modify) |
|
bool | FindBlobWidth (const std::vector< TBLOB * > &blobs, int index, bool modify) |
|
void | ApplySeam (bool italic_blob, TBLOB *blob, TBLOB *other_blob) const |
|
void | UndoSeam (TBLOB *blob, TBLOB *other_blob) const |
|
void | Print (const char *label) const |
|
void | Mark (ScrollView *window) const |
|
void | Hide () const |
|
void | Reveal () const |
|
float | FullPriority (int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const |
|
|
static void | PrintSeams (const char *label, const std::vector< SEAM * > &seams) |
|
static void | BreakPieces (const std::vector< SEAM * > &seams, const std::vector< TBLOB * > &blobs, int first, int last) |
|
static void | JoinPieces (const std::vector< SEAM * > &seams, const std::vector< TBLOB * > &blobs, int first, int last) |
|
Definition at line 33 of file seam.h.
◆ SEAM() [1/2]
tesseract::SEAM::SEAM |
( |
float |
priority, |
|
|
const TPOINT & |
location |
|
) |
| |
|
inline |
Definition at line 36 of file seam.h.
37 : priority_(
priority), location_(location), num_splits_(0) {}
◆ SEAM() [2/2]
tesseract::SEAM::SEAM |
( |
float |
priority, |
|
|
const TPOINT & |
location, |
|
|
const SPLIT & |
split |
|
) |
| |
|
inline |
Definition at line 39 of file seam.h.
40 : priority_(
priority), location_(location), num_splits_(1) {
const std::vector< std::string > split(const std::string &s, char c)
◆ ApplySeam()
void tesseract::SEAM::ApplySeam |
( |
bool |
italic_blob, |
|
|
TBLOB * |
blob, |
|
|
TBLOB * |
other_blob |
|
) |
| const |
Definition at line 106 of file seam.cpp.
107 for (
int s = 0; s < num_splits_; ++s) {
110 blob->ComputeBoundingBoxes();
114 blob->EliminateDuplicateOutlines();
115 other_blob->EliminateDuplicateOutlines();
117 blob->CorrectBlobOrder(other_blob);
void divide_blobs(TBLOB *blob, TBLOB *other_blob, bool italic_blob, const TPOINT &location)
void SplitOutlineList(TESSLINE *outlines) const
◆ bounding_box()
TBOX tesseract::SEAM::bounding_box |
( |
| ) |
const |
Definition at line 33 of file seam.cpp.
34 TBOX box(location_.
x, location_.
y, location_.
x, location_.
y);
35 for (
int s = 0; s < num_splits_; ++s) {
TBOX bounding_box() const
◆ BreakPieces()
void tesseract::SEAM::BreakPieces |
( |
const std::vector< SEAM * > & |
seams, |
|
|
const std::vector< TBLOB * > & |
blobs, |
|
|
int |
first, |
|
|
int |
last |
|
) |
| |
|
static |
Definition at line 181 of file seam.cpp.
183 for (
int x = first; x <
last; ++x) {
187 TESSLINE *outline = blobs[first]->outlines;
188 int next_blob = first + 1;
190 while (outline !=
nullptr && next_blob <=
last) {
191 if (outline->next == blobs[next_blob]->outlines) {
192 outline->next =
nullptr;
193 outline = blobs[next_blob]->outlines;
196 outline = outline->next;
◆ CombineableWith()
bool tesseract::SEAM::CombineableWith |
( |
const SEAM & |
other, |
|
|
int |
max_x_dist, |
|
|
float |
max_total_priority |
|
) |
| const |
|
inline |
Definition at line 60 of file seam.h.
61 int dist = location_.
x - other.location_.x;
62 return -max_x_dist < dist && dist < max_x_dist &&
63 num_splits_ + other.num_splits_ <= kMaxNumSplits &&
bool SharesPosition(const SEAM &other) const
bool OverlappingSplits(const SEAM &other) const
◆ CombineWith()
void tesseract::SEAM::CombineWith |
( |
const SEAM & |
other | ) |
|
|
inline |
Definition at line 69 of file seam.h.
70 priority_ += other.priority_;
71 location_ += other.location_;
74 for (uint8_t s = 0; s < other.num_splits_ && num_splits_ < kMaxNumSplits; ++s) {
75 splits_[num_splits_++] = other.splits_[s];
◆ ContainedByBlob()
bool tesseract::SEAM::ContainedByBlob |
( |
const TBLOB & |
blob | ) |
const |
|
inline |
Definition at line 80 of file seam.h.
81 for (
int s = 0; s < num_splits_; ++s) {
bool ContainedByBlob(const TBLOB &blob) const
◆ Finalize()
void tesseract::SEAM::Finalize |
( |
| ) |
|
|
inline |
Definition at line 126 of file seam.h.
127 for (
int s = 0; s < num_splits_; ++s) {
◆ FindBlobWidth()
bool tesseract::SEAM::FindBlobWidth |
( |
const std::vector< TBLOB * > & |
blobs, |
|
|
int |
index, |
|
|
bool |
modify |
|
) |
| |
Definition at line 74 of file seam.cpp.
80 for (
int s = 0; s < num_splits_; ++s) {
81 const SPLIT &
split = splits_[s];
82 bool found_split =
split.ContainedByBlob(*blobs[index]);
84 for (
unsigned b = index + 1; !found_split && b < blobs.size(); ++b) {
85 found_split =
split.ContainedByBlob(*blobs[b]);
86 if (found_split && b - index > widthp_ && modify) {
91 for (
int b = index - 1; !found_split && b >= 0; --b) {
92 found_split =
split.ContainedByBlob(*blobs[b]);
93 if (found_split && index - b > widthn_ && modify) {
101 return num_found == num_splits_;
◆ FullPriority()
float tesseract::SEAM::FullPriority |
( |
int |
xmin, |
|
|
int |
xmax, |
|
|
double |
overlap_knob, |
|
|
int |
centered_maxwidth, |
|
|
double |
center_knob, |
|
|
double |
width_change_knob |
|
) |
| const |
Definition at line 238 of file seam.cpp.
240 if (num_splits_ == 0) {
243 for (
int s = 1; s < num_splits_; ++s) {
246 float full_priority =
247 priority_ + splits_[0].
FullPriority(xmin, xmax, overlap_knob, centered_maxwidth, center_knob,
249 for (
int s = num_splits_ - 1; s >= 1; --s) {
252 return full_priority;
void SplitOutline() const
void UnsplitOutlines() const
float FullPriority(int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const
◆ HasAnySplits()
bool tesseract::SEAM::HasAnySplits |
( |
| ) |
const |
|
inline |
Definition at line 52 of file seam.h.
53 return num_splits_ > 0;
◆ Hide()
void tesseract::SEAM::Hide |
( |
| ) |
const |
Definition at line 224 of file seam.cpp.
225 for (
int s = 0; s < num_splits_; ++s) {
◆ IsHealthy()
bool tesseract::SEAM::IsHealthy |
( |
const TBLOB & |
blob, |
|
|
int |
min_points, |
|
|
int |
min_area |
|
) |
| const |
Definition at line 44 of file seam.cpp.
47 return num_splits_ == 0 || splits_[0].
IsHealthy(blob, min_points, min_area);
bool IsHealthy(const TBLOB &blob, int min_points, int min_area) const
◆ JoinPieces()
void tesseract::SEAM::JoinPieces |
( |
const std::vector< SEAM * > & |
seams, |
|
|
const std::vector< TBLOB * > & |
blobs, |
|
|
int |
first, |
|
|
int |
last |
|
) |
| |
|
static |
Definition at line 204 of file seam.cpp.
206 TESSLINE *outline = blobs[first]->outlines;
211 for (
int x = first; x <
last; ++x) {
212 SEAM *seam = seams[x];
213 if (x - seam->widthn_ >= first && x + seam->widthp_ <
last) {
216 while (outline->next) {
217 outline = outline->next;
219 outline->next = blobs[x + 1]->outlines;
SEAM(float priority, const TPOINT &location)
◆ Mark()
void tesseract::SEAM::Mark |
( |
ScrollView * |
window | ) |
const |
Definition at line 171 of file seam.cpp.
172 for (
int s = 0; s < num_splits_; ++s) {
173 splits_[s].
Mark(window);
void Mark(ScrollView *window) const
◆ OverlappingSplits()
bool tesseract::SEAM::OverlappingSplits |
( |
const SEAM & |
other | ) |
const |
|
inline |
Definition at line 111 of file seam.h.
112 for (
int s = 0; s < num_splits_; ++s) {
114 for (
int t = 0; t < other.num_splits_; ++t) {
115 TBOX split2_box = other.splits_[t].bounding_box();
116 if (split1_box.y_overlap(split2_box)) {
◆ PrepareToInsertSeam()
bool tesseract::SEAM::PrepareToInsertSeam |
( |
const std::vector< SEAM * > & |
seams, |
|
|
const std::vector< TBLOB * > & |
blobs, |
|
|
int |
insert_index, |
|
|
bool |
modify |
|
) |
| |
Definition at line 54 of file seam.cpp.
56 for (
int s = 0; s < insert_index; ++s) {
64 for (
unsigned s = insert_index; s < seams.size(); ++s) {
bool FindBlobWidth(const std::vector< TBLOB * > &blobs, int index, bool modify)
◆ Print()
void tesseract::SEAM::Print |
( |
const char * |
label | ) |
const |
Definition at line 144 of file seam.cpp.
146 tprintf(
" %6.2f @ (%d,%d), p=%u, n=%u ", priority_, location_.
x, location_.
y, widthp_, widthn_);
147 for (
int s = 0; s < num_splits_; ++s) {
149 if (s + 1 < num_splits_) {
void tprintf(const char *format,...)
◆ PrintSeams()
void tesseract::SEAM::PrintSeams |
( |
const char * |
label, |
|
|
const std::vector< SEAM * > & |
seams |
|
) |
| |
|
static |
Definition at line 158 of file seam.cpp.
159 if (!seams.empty()) {
161 for (
unsigned x = 0; x < seams.size(); ++x) {
◆ priority()
float tesseract::SEAM::priority |
( |
| ) |
const |
|
inline |
◆ Reveal()
void tesseract::SEAM::Reveal |
( |
| ) |
const |
Definition at line 231 of file seam.cpp.
232 for (
int s = 0; s < num_splits_; ++s) {
◆ set_priority()
void tesseract::SEAM::set_priority |
( |
float |
priority | ) |
|
|
inline |
◆ SharesPosition()
bool tesseract::SEAM::SharesPosition |
( |
const SEAM & |
other | ) |
const |
|
inline |
Definition at line 100 of file seam.h.
101 for (
int s = 0; s < num_splits_; ++s) {
102 for (
int t = 0; t < other.num_splits_; ++t) {
◆ UndoSeam()
void tesseract::SEAM::UndoSeam |
( |
TBLOB * |
blob, |
|
|
TBLOB * |
other_blob |
|
) |
| const |
Definition at line 122 of file seam.cpp.
123 if (blob->outlines ==
nullptr) {
124 blob->outlines = other_blob->outlines;
125 other_blob->outlines =
nullptr;
128 TESSLINE *outline = blob->outlines;
129 while (outline->next) {
130 outline = outline->next;
132 outline->next = other_blob->outlines;
133 other_blob->outlines =
nullptr;
136 for (
int s = 0; s < num_splits_; ++s) {
139 blob->ComputeBoundingBoxes();
140 blob->EliminateDuplicateOutlines();
void UnsplitOutlineList(TBLOB *blob) const
◆ UsesPoint()
bool tesseract::SEAM::UsesPoint |
( |
const EDGEPT * |
point | ) |
const |
|
inline |
Definition at line 91 of file seam.h.
92 for (
int s = 0; s < num_splits_; ++s) {
bool UsesPoint(const EDGEPT *point) const
The documentation for this class was generated from the following files: