Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
makechop.h File Reference
`#include "chop.h"`
`#include "olutil.h"`

Go to the source code of this file.

## Macros
#define | is_split_outline(outline, split)

## Functions
void | apply_seam (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void | form_two_blobs (TBLOB *blob, TBLOB *other_blob, bool italic_blob, const TPOINT &location)
void | make_double_split (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void | make_single_split (TESSLINE *outlines, SPLIT *split)
void | make_split_blobs (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void | make_triple_split (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void | undo_seam (TBLOB *blob, TBLOB *other_blob, SEAM *seam)
void | undo_single_split (TBLOB *blob, SPLIT *split)

## Macro Definition Documentation

#define is_split_outline | ( |  | outline,
|  |  | split
| ) |  |

Value:
(outline->Contains(split->point1->pos) && \
outline->Contains(split->point2->pos)) \

Definition at line 44 of file makechop.h.

## Function Documentation

void apply_seam | ( | TBLOB * | blob,
|  | TBLOB * | other_blob,
|  | bool | italic_blob,
|  | SEAM * | seam
| ) |  |

Definition at line 52 of file makechop.cpp.

{
if (seam->split1 == NULL) {
divide_blobs(blob, other_blob, italic_blob, seam->location);
}
else if (seam->split2 == NULL) {
make_split_blobs(blob, other_blob, italic_blob, seam);
}
else if (seam->split3 == NULL) {
make_double_split(blob, other_blob, italic_blob, seam);
}
else {
make_triple_split(blob, other_blob, italic_blob, seam);
}
}

void form_two_blobs | ( | TBLOB * | blob,
|  | TBLOB * | other_blob,
|  | bool | italic_blob,
|  | const TPOINT & | location
| ) |  |

Definition at line 74 of file makechop.cpp.

{
setup_blob_outlines(blob);
divide_blobs(blob, other_blob, italic_blob, location);
eliminate_duplicate_outlines(blob);
eliminate_duplicate_outlines(other_blob);
correct_blob_order(blob, other_blob);
}

void make_double_split | ( | TBLOB * | blob,
|  | TBLOB * | other_blob,
|  | bool | italic_blob,
|  | SEAM * | seam
| ) |  |

Definition at line 93 of file makechop.cpp.

{
make_single_split(blob->outlines, seam->split1);
make_single_split(blob->outlines, seam->split2);
form_two_blobs(blob, other_blob, italic_blob, seam->location);
}

void make_single_split | ( | TESSLINE * | outlines,
|  | SPLIT * | split
| ) |  |

Definition at line 107 of file makechop.cpp.

{
assert (outlines != NULL);
split_outline (split->point1, split->point2);
while (outlines->next != NULL)
outlines = outlines->next;
outlines->next = new TESSLINE;
outlines->next->loop = split->point1;
outlines->next->ComputeBoundingBox();
outlines = outlines->next;
outlines->next = new TESSLINE;
outlines->next->loop = split->point2;
outlines->next->ComputeBoundingBox();
outlines->next->next = NULL;
}

void make_split_blobs | ( | TBLOB * | blob,
|  | TBLOB * | other_blob,
|  | bool | italic_blob,
|  | SEAM * | seam
| ) |  |

Definition at line 135 of file makechop.cpp.

{
make_single_split(blob->outlines, seam->split1);
form_two_blobs (blob, other_blob, italic_blob, seam->location);
}

void make_triple_split | ( | TBLOB * | blob,
|  | TBLOB * | other_blob,
|  | bool | italic_blob,
|  | SEAM * | seam
| ) |  |

Definition at line 151 of file makechop.cpp.

{
make_single_split(blob->outlines, seam->split1);
make_single_split(blob->outlines, seam->split2);
make_single_split(blob->outlines, seam->split3);
form_two_blobs(blob, other_blob, italic_blob, seam->location);
}

void undo_seam | ( | TBLOB * | blob,
|  | TBLOB * | other_blob,
|  | SEAM * | seam
| ) |  |

Definition at line 168 of file makechop.cpp.

{
TESSLINE *outline;
if (!seam)
return; /* Append other blob outlines */
if (blob->outlines == NULL) {
blob->outlines = other_blob->outlines;
other_blob->outlines = NULL;
}
outline = blob->outlines;
while (outline->next)
outline = outline->next;
outline->next = other_blob->outlines;
other_blob->outlines = NULL;
delete other_blob;
if (seam->split1 == NULL) {
}
else if (seam->split2 == NULL) {
undo_single_split (blob, seam->split1);
}
else if (seam->split3 == NULL) {
undo_single_split (blob, seam->split1);
undo_single_split (blob, seam->split2);
}
else {
undo_single_split (blob, seam->split3);
undo_single_split (blob, seam->split2);
undo_single_split (blob, seam->split1);
}
setup_blob_outlines(blob);
eliminate_duplicate_outlines(blob);
}

void undo_single_split | ( | TBLOB * | blob,
|  | SPLIT * | split
| ) |  |

Definition at line 211 of file makechop.cpp.

{
TESSLINE *outline1;
TESSLINE *outline2;
/* Modify edge points */
unsplit_outlines (split->point1, split->point2);
outline1 = new TESSLINE;
outline1->next = blob->outlines;
blob->outlines = outline1;
outline1->loop = split->point1;
outline2 = new TESSLINE;
outline2->next = blob->outlines;
blob->outlines = outline2;
outline2->loop = split->point2;
}