|
tesseract 3.04.01
|
#include <seam.h>
Public Member Functions | |
| 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 |
Static Public Member Functions | |
| static void | PrintSeams (const char *label, const GenericVector< SEAM * > &seams) |
| static void | BreakPieces (const GenericVector< SEAM * > &seams, const GenericVector< TBLOB * > &blobs, int first, int last) |
| static void | JoinPieces (const GenericVector< SEAM * > &seams, const GenericVector< TBLOB * > &blobs, int first, int last) |
| SEAM::SEAM | ( | float | priority, |
| const TPOINT & | location | ||
| ) | [inline] |
Definition at line 124 of file seam.cpp.
{
for (int s = 0; s < num_splits_; ++s) {
splits_[s].SplitOutlineList(blob->outlines);
}
blob->ComputeBoundingBoxes();
divide_blobs(blob, other_blob, italic_blob, location_);
blob->EliminateDuplicateOutlines();
other_blob->EliminateDuplicateOutlines();
blob->CorrectBlobOrder(other_blob);
}
| TBOX SEAM::bounding_box | ( | ) | const |
| void SEAM::BreakPieces | ( | const GenericVector< SEAM * > & | seams, |
| const GenericVector< TBLOB * > & | blobs, | ||
| int | first, | ||
| int | last | ||
| ) | [static] |
Definition at line 194 of file seam.cpp.
{
for (int x = first; x < last; ++x) seams[x]->Reveal();
TESSLINE* outline = blobs[first]->outlines;
int next_blob = first + 1;
while (outline != NULL && next_blob <= last) {
if (outline->next == blobs[next_blob]->outlines) {
outline->next = NULL;
outline = blobs[next_blob]->outlines;
++next_blob;
} else {
outline = outline->next;
}
}
}
| bool SEAM::CombineableWith | ( | const SEAM & | other, |
| int | max_x_dist, | ||
| float | max_total_priority | ||
| ) | const |
Definition at line 46 of file seam.cpp.
{
int dist = location_.x - other.location_.x;
if (-max_x_dist < dist && dist < max_x_dist &&
num_splits_ + other.num_splits_ <= kMaxNumSplits &&
priority_ + other.priority_ < max_total_priority &&
!OverlappingSplits(other) && !SharesPosition(other)) {
return true;
} else {
return false;
}
}
| void SEAM::CombineWith | ( | const SEAM & | other | ) |
| bool SEAM::ContainedByBlob | ( | const TBLOB & | blob | ) | const [inline] |
Definition at line 79 of file seam.h.
{
for (int s = 0; s < num_splits_; ++s) {
if (!splits_[s].ContainedByBlob(blob)) return false;
}
return true;
}
| void SEAM::Finalize | ( | ) | [inline] |
| bool SEAM::FindBlobWidth | ( | const GenericVector< TBLOB * > & | blobs, |
| int | index, | ||
| bool | modify | ||
| ) |
Definition at line 97 of file seam.cpp.
{
int num_found = 0;
if (modify) {
widthp_ = 0;
widthn_ = 0;
}
for (int s = 0; s < num_splits_; ++s) {
const SPLIT& split = splits_[s];
bool found_split = split.ContainedByBlob(*blobs[index]);
// Look right.
for (int b = index + 1; !found_split && b < blobs.size(); ++b) {
found_split = split.ContainedByBlob(*blobs[b]);
if (found_split && b - index > widthp_ && modify) widthp_ = b - index;
}
// Look left.
for (int b = index - 1; !found_split && b >= 0; --b) {
found_split = split.ContainedByBlob(*blobs[b]);
if (found_split && index - b > widthn_ && modify) widthn_ = index - b;
}
if (found_split) ++num_found;
}
return num_found == num_splits_;
}
| float SEAM::FullPriority | ( | int | xmin, |
| int | xmax, | ||
| double | overlap_knob, | ||
| int | centered_maxwidth, | ||
| double | center_knob, | ||
| double | width_change_knob | ||
| ) | const |
Definition at line 245 of file seam.cpp.
{
if (num_splits_ == 0) return 0.0f;
for (int s = 1; s < num_splits_; ++s) {
splits_[s].SplitOutline();
}
float full_priority =
priority_ +
splits_[0].FullPriority(xmin, xmax, overlap_knob, centered_maxwidth,
center_knob, width_change_knob);
for (int s = num_splits_ - 1; s >= 1; --s) {
splits_[s].UnsplitOutlines();
}
return full_priority;
}
| bool SEAM::HasAnySplits | ( | ) | const [inline] |
| void SEAM::Hide | ( | ) | const |
| bool SEAM::IsHealthy | ( | const TBLOB & | blob, |
| int | min_points, | ||
| int | min_area | ||
| ) | const |
| void SEAM::JoinPieces | ( | const GenericVector< SEAM * > & | seams, |
| const GenericVector< TBLOB * > & | blobs, | ||
| int | first, | ||
| int | last | ||
| ) | [static] |
| void SEAM::Mark | ( | ScrollView * | window | ) | const |
| bool SEAM::OverlappingSplits | ( | const SEAM & | other | ) | const [inline] |
Definition at line 103 of file seam.h.
{
for (int s = 0; s < num_splits_; ++s) {
TBOX split1_box = splits_[s].bounding_box();
for (int t = 0; t < other.num_splits_; ++t) {
TBOX split2_box = other.splits_[t].bounding_box();
if (split1_box.y_overlap(split2_box)) return true;
}
}
return false;
}
| bool SEAM::PrepareToInsertSeam | ( | const GenericVector< SEAM * > & | seams, |
| const GenericVector< TBLOB * > & | blobs, | ||
| int | insert_index, | ||
| bool | modify | ||
| ) |
Definition at line 82 of file seam.cpp.
{
for (int s = 0; s < insert_index; ++s) {
if (!seams[s]->FindBlobWidth(blobs, s, modify)) return false;
}
if (!FindBlobWidth(blobs, insert_index, modify)) return false;
for (int s = insert_index; s < seams.size(); ++s) {
if (!seams[s]->FindBlobWidth(blobs, s + 1, modify)) return false;
}
return true;
}
| void SEAM::Print | ( | const char * | label | ) | const |
| void SEAM::PrintSeams | ( | const char * | label, |
| const GenericVector< SEAM * > & | seams | ||
| ) | [static] |
| void SEAM::Reveal | ( | ) | const |
| void SEAM::set_priority | ( | float | priority | ) | [inline] |
| bool SEAM::SharesPosition | ( | const SEAM & | other | ) | const [inline] |
Definition at line 95 of file seam.h.
{
for (int s = 0; s < num_splits_; ++s) {
for (int t = 0; t < other.num_splits_; ++t)
if (splits_[s].SharesPosition(other.splits_[t])) return true;
}
return false;
}
Definition at line 140 of file seam.cpp.
{
if (blob->outlines == NULL) {
blob->outlines = other_blob->outlines;
other_blob->outlines = NULL;
}
TESSLINE* outline = blob->outlines;
while (outline->next) outline = outline->next;
outline->next = other_blob->outlines;
other_blob->outlines = NULL;
delete other_blob;
for (int s = 0; s < num_splits_; ++s) {
splits_[s].UnsplitOutlineList(blob);
}
blob->ComputeBoundingBoxes();
blob->EliminateDuplicateOutlines();
}
| bool SEAM::UsesPoint | ( | const EDGEPT * | point | ) | const [inline] |