#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 GenericVector< SEAM * > &seams, const GenericVector< TBLOB * > &blobs, int insert_index, bool modify) |
|
bool | FindBlobWidth (const GenericVector< 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 |
|
Definition at line 36 of file seam.h.
◆ SEAM() [1/2]
SEAM::SEAM |
( |
float |
priority, |
|
|
const TPOINT & |
location |
|
) |
| |
|
inline |
◆ SEAM() [2/2]
SEAM::SEAM |
( |
float |
priority, |
|
|
const TPOINT & |
location, |
|
|
const SPLIT & |
split |
|
) |
| |
|
inline |
◆ ApplySeam()
void SEAM::ApplySeam |
( |
bool |
italic_blob, |
|
|
TBLOB * |
blob, |
|
|
TBLOB * |
other_blob |
|
) |
| const |
Definition at line 116 of file seam.cpp.
118 for (
int s = 0; s < num_splits_; ++s) {
◆ bounding_box()
TBOX SEAM::bounding_box |
( |
| ) |
const |
Definition at line 29 of file seam.cpp.
31 TBOX box(location_.
x, location_.
y, location_.
x, location_.
y);
32 for (
int s = 0; s < num_splits_; ++s) {
◆ BreakPieces()
Definition at line 186 of file seam.cpp.
190 for (
int x = first; x <
last; ++x) seams[x]->
Reveal();
192 TESSLINE* outline = blobs[first]->outlines;
193 int next_blob = first + 1;
195 while (outline !=
nullptr && next_blob <=
last) {
196 if (outline->
next == blobs[next_blob]->outlines) {
197 outline->
next =
nullptr;
198 outline = blobs[next_blob]->outlines;
201 outline = outline->
next;
◆ CombineableWith()
bool SEAM::CombineableWith |
( |
const SEAM & |
other, |
|
|
int |
max_x_dist, |
|
|
float |
max_total_priority |
|
) |
| const |
Definition at line 38 of file seam.cpp.
41 int dist = location_.
x - other.location_.
x;
42 if (-max_x_dist < dist && dist < max_x_dist &&
43 num_splits_ + other.num_splits_ <= kMaxNumSplits &&
44 priority_ + other.priority_ < max_total_priority &&
◆ CombineWith()
void SEAM::CombineWith |
( |
const SEAM & |
other | ) |
|
Definition at line 52 of file seam.cpp.
54 priority_ += other.priority_;
55 location_ += other.location_;
58 for (uint8_t s = 0; s < other.num_splits_ && num_splits_ < kMaxNumSplits; ++s)
59 splits_[num_splits_++] = other.splits_[s];
◆ ContainedByBlob()
bool SEAM::ContainedByBlob |
( |
const TBLOB & |
blob | ) |
const |
|
inline |
Definition at line 71 of file seam.h.
73 for (
int s = 0; s < num_splits_; ++s) {
◆ Finalize()
Definition at line 108 of file seam.h.
110 for (
int s = 0; s < num_splits_; ++s) {
◆ FindBlobWidth()
bool SEAM::FindBlobWidth |
( |
const GenericVector< TBLOB * > & |
blobs, |
|
|
int |
index, |
|
|
bool |
modify |
|
) |
| |
Definition at line 89 of file seam.cpp.
97 for (
int s = 0; s < num_splits_; ++s) {
98 const SPLIT& split = splits_[s];
101 for (
int b = index + 1; !found_split && b < blobs.
size(); ++b) {
103 if (found_split && b - index > widthp_ && modify) widthp_ = b - index;
106 for (
int b = index - 1; !found_split && b >= 0; --b) {
108 if (found_split && index - b > widthn_ && modify) widthn_ = index - b;
110 if (found_split) ++num_found;
112 return num_found == num_splits_;
◆ FullPriority()
float SEAM::FullPriority |
( |
int |
xmin, |
|
|
int |
xmax, |
|
|
double |
overlap_knob, |
|
|
int |
centered_maxwidth, |
|
|
double |
center_knob, |
|
|
double |
width_change_knob |
|
) |
| const |
Definition at line 237 of file seam.cpp.
241 if (num_splits_ == 0)
return 0.0f;
242 for (
int s = 1; s < num_splits_; ++s) {
245 float full_priority =
247 splits_[0].
FullPriority(xmin, xmax, overlap_knob, centered_maxwidth,
248 center_knob, width_change_knob);
249 for (
int s = num_splits_ - 1; s >= 1; --s) {
252 return full_priority;
◆ HasAnySplits()
bool SEAM::HasAnySplits |
( |
| ) |
const |
|
inline |
◆ Hide()
void SEAM::Hide |
( |
| ) |
const |
Definition at line 223 of file seam.cpp.
225 for (
int s = 0; s < num_splits_; ++s) {
◆ IsHealthy()
bool SEAM::IsHealthy |
( |
const TBLOB & |
blob, |
|
|
int |
min_points, |
|
|
int |
min_area |
|
) |
| const |
Definition at line 64 of file seam.cpp.
68 return num_splits_ == 0 || splits_[0].
IsHealthy(blob, min_points, min_area);
◆ JoinPieces()
Definition at line 208 of file seam.cpp.
211 TESSLINE* outline = blobs[first]->outlines;
215 for (
int x = first; x <
last; ++x) {
216 SEAM *seam = seams[x];
217 if (x - seam->widthn_ >= first && x + seam->widthp_ <
last) seam->
Hide();
218 while (outline->
next) outline = outline->
next;
219 outline->
next = blobs[x + 1]->outlines;
◆ Mark()
Definition at line 178 of file seam.cpp.
180 for (
int s = 0; s < num_splits_; ++s) splits_[s].
Mark(window);
◆ OverlappingSplits()
bool SEAM::OverlappingSplits |
( |
const SEAM & |
other | ) |
const |
|
inline |
Definition at line 95 of file seam.h.
97 for (
int s = 0; s < num_splits_; ++s) {
99 for (
int t = 0; t < other.num_splits_; ++t) {
101 if (split1_box.
y_overlap(split2_box))
return true;
◆ PrepareToInsertSeam()
Definition at line 74 of file seam.cpp.
78 for (
int s = 0; s < insert_index; ++s) {
81 if (!
FindBlobWidth(blobs, insert_index, modify))
return false;
82 for (
int s = insert_index; s < seams.
size(); ++s) {
83 if (!seams[s]->
FindBlobWidth(blobs, s + 1, modify))
return false;
◆ Print()
void SEAM::Print |
( |
const char * |
label | ) |
const |
Definition at line 152 of file seam.cpp.
155 tprintf(
" %6.2f @ (%d,%d), p=%d, n=%d ", priority_, location_.
x, location_.
y,
157 for (
int s = 0; s < num_splits_; ++s) {
159 if (s + 1 < num_splits_)
tprintf(
", ");
◆ PrintSeams()
Definition at line 165 of file seam.cpp.
167 if (!seams.
empty()) {
169 for (
int x = 0; x < seams.
size(); ++x) {
◆ priority()
float SEAM::priority |
( |
| ) |
const |
|
inline |
◆ Reveal()
void SEAM::Reveal |
( |
| ) |
const |
Definition at line 230 of file seam.cpp.
232 for (
int s = 0; s < num_splits_; ++s) {
◆ set_priority()
void SEAM::set_priority |
( |
float |
priority | ) |
|
|
inline |
◆ SharesPosition()
bool SEAM::SharesPosition |
( |
const SEAM & |
other | ) |
const |
|
inline |
Definition at line 87 of file seam.h.
89 for (
int s = 0; s < num_splits_; ++s) {
90 for (
int t = 0; t < other.num_splits_; ++t)
◆ UndoSeam()
void SEAM::UndoSeam |
( |
TBLOB * |
blob, |
|
|
TBLOB * |
other_blob |
|
) |
| const |
Definition at line 132 of file seam.cpp.
140 while (outline->
next) outline = outline->
next;
145 for (
int s = 0; s < num_splits_; ++s) {
◆ UsesPoint()
bool SEAM::UsesPoint |
( |
const EDGEPT * |
point | ) |
const |
|
inline |
Definition at line 80 of file seam.h.
82 for (
int s = 0; s < num_splits_; ++s) {
83 if (splits_[s].
UsesPoint(point))
return true;
The documentation for this class was generated from the following files: