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
Namespaces
chopper.cpp File Reference
`#include <math.h>`
`#include "chopper.h"`
`#include "assert.h"`
`#include "associate.h"`
`#include "callcpp.h"`
`#include "const.h"`
`#include "findseam.h"`
`#include "freelist.h"`
`#include "globals.h"`
`#include "makechop.h"`
`#include "render.h"`
`#include "pageres.h"`
`#include "permute.h"`
`#include "seam.h"`
`#include "stopper.h"`
`#include "structures.h"`
`#include "unicharset.h"`
`#include "wordclass.h"`
`#include "wordrec.h"`

Go to the source code of this file.

## Namespaces
namespace | tesseract

## Functions
preserve_outline_tree
Copy the list of outlines.
void | preserve_outline (EDGEPT *start)
void | preserve_outline_tree (TESSLINE *srcline)
restore_outline_tree
Copy the list of outlines.
EDGEPT * | restore_outline (EDGEPT *start)
void | restore_outline_tree (TESSLINE *srcline)
any_shared_split_points
Return true if any of the splits share a point with this one.
int | any_shared_split_points (SEAMS seam_list, SEAM *seam)
check_blob
Returns: true if blob has a non whole outline.
int | check_blob (TBLOB *blob)
check_seam_order
Make sure that each of the splits in this seam match to outlines in this blob. If any of the splits could not correspond to this blob then there is a problem (and FALSE should be returned to the caller).
inT16 | check_seam_order (TBLOB *blob, SEAM *seam)
inT16 | total_containment (TBLOB *blob1, TBLOB *blob2)

## Function Documentation

int any_shared_split_points | ( | SEAMS | seam_list,
|  | SEAM * | seam
| ) |  |

Definition at line 289 of file chopper.cpp.

{
int length;
int index;
length = array_count (seam_list);
for (index = 0; index < length; index++)
if (shared_split_points ((SEAM *) array_value (seam_list, index), seam))
return TRUE;
return FALSE;
}

int check_blob | ( | TBLOB * | blob | ) |

Definition at line 306 of file chopper.cpp.

{
TESSLINE *outline;
EDGEPT *edgept;
for (outline = blob->outlines; outline != NULL; outline = outline->next) {
edgept = outline->loop;
do {
if (edgept == NULL)
break;
edgept = edgept->next;
}
while (edgept != outline->loop);
if (edgept == NULL)
return 1;
}
return 0;
}

inT16 check_seam_order | ( | TBLOB * | blob,
|  | SEAM * | seam
| ) |  |

Definition at line 539 of file chopper.cpp.

{
TESSLINE *outline;
TESSLINE *last_outline;
inT8 found_em[3];
if (seam->split1 == NULL || seam->split1 == NULL || blob == NULL)
return (TRUE);
found_em[0] = found_em[1] = found_em[2] = FALSE;
for (outline = blob->outlines; outline; outline = outline->next) {
if (!found_em[0] &&
((seam->split1 == NULL) ||
is_split_outline (outline, seam->split1))) {
found_em[0] = TRUE;
}
if (!found_em[1] &&
((seam->split2 == NULL) ||
is_split_outline (outline, seam->split2))) {
found_em[1] = TRUE;
}
if (!found_em[2] &&
((seam->split3 == NULL) ||
is_split_outline (outline, seam->split3))) {
found_em[2] = TRUE;
}
last_outline = outline;
}
if (!found_em[0] || !found_em[1] || !found_em[2])
return (FALSE);
else
return (TRUE);
}

void preserve_outline | ( | EDGEPT * | start | ) |

Definition at line 65 of file chopper.cpp.

{
EDGEPT *srcpt;
if (start == NULL)
return;
srcpt = start;
do {
srcpt->flags[1] = 1;
srcpt = srcpt->next;
}
while (srcpt != start);
srcpt->flags[1] = 2;
}

void preserve_outline_tree | ( | TESSLINE * | srcline | ) |

Definition at line 81 of file chopper.cpp.

{
TESSLINE *outline;
for (outline = srcline; outline != NULL; outline = outline->next) {
preserve_outline (outline->loop);
}
}

EDGEPT* restore_outline | ( | EDGEPT * | start | ) |

Definition at line 95 of file chopper.cpp.

{
EDGEPT *srcpt;
EDGEPT *real_start;
EDGEPT *deadpt;
if (start == NULL)
return NULL;
srcpt = start;
do {
if (srcpt->flags[1] == 2)
break;
srcpt = srcpt->next;
}
while (srcpt != start);
real_start = srcpt;
do {
if (srcpt->flags[1] == 0) {
deadpt = srcpt;
srcpt = srcpt->next;
srcpt->prev = deadpt->prev;
deadpt->prev->next = srcpt;
deadpt->prev->vec.x = srcpt->pos.x - deadpt->prev->pos.x;
deadpt->prev->vec.y = srcpt->pos.y - deadpt->prev->pos.y;
delete deadpt;
}
else
srcpt = srcpt->next;
}
while (srcpt != real_start);
return real_start;
}

void restore_outline_tree | ( | TESSLINE * | srcline | ) |

Definition at line 129 of file chopper.cpp.

{
TESSLINE *outline;
for (outline = srcline; outline != NULL; outline = outline->next) {
outline->loop = restore_outline (outline->loop);
outline->start = outline->loop->pos;
}
}

inT16 total_containment | ( | TBLOB * | blob1,
|  | TBLOB * | blob2
| ) |  |

Definition at line 1050 of file chopper.cpp.

{
TBOX box1 = blob1->bounding_box();
TBOX box2 = blob2->bounding_box();
return box1.contains(box2) || box2.contains(box1);
}