tesseract
5.0.0-alpha-619-ge9db
|
#include <coutln.h>
Public Member Functions | |||||
C_OUTLINE () | |||||
~C_OUTLINE () | |||||
bool | flag (C_OUTLINE_FLAGS mask) const | ||||
void | set_flag (C_OUTLINE_FLAGS mask, bool value) | ||||
C_OUTLINE_LIST * | child () | ||||
const TBOX & | bounding_box () const | ||||
void | set_step (int16_t stepindex, int8_t stepdir) | ||||
void | set_step (int16_t stepindex, DIR128 stepdir) | ||||
int32_t | pathlength () const | ||||
DIR128 | step_dir (int index) const | ||||
ICOORD | step (int index) const | ||||
const ICOORD & | start_pos () const | ||||
ICOORD | position_at_index (int index) const | ||||
FCOORD | sub_pixel_pos_at_index (const ICOORD &pos, int index) const | ||||
int | direction_at_index (int index) const | ||||
int | edge_strength_at_index (int index) const | ||||
int | chain_code (int index) const | ||||
bool | operator> (C_OUTLINE &other) const | ||||
C_OUTLINE::area | |||||
Compute the area of the outline. | |||||
int32_t | area () const | ||||
C_OUTLINE::perimeter | |||||
Compute the perimeter of the outline and its first level children. | |||||
int32_t | perimeter () const | ||||
C_OUTLINE::outer_area | |||||
Compute the area of the outline. | |||||
int32_t | outer_area () const | ||||
C_OUTLINE::count_transitions | |||||
Compute the number of x and y maxes and mins in the outline.
| |||||
int32_t | count_transitions (int32_t threshold) | ||||
C_OUTLINE::operator< | |||||
| |||||
bool | operator< (const C_OUTLINE &other) const | ||||
C_OUTLINE::winding_number | |||||
| |||||
int16_t | winding_number (ICOORD testpt) const | ||||
int16_t | turn_direction () const | ||||
C_OUTLINE::reverse | |||||
Reverse the direction of an outline. | |||||
void | reverse () | ||||
C_OUTLINE::move | |||||
Move C_OUTLINE by vector
| |||||
void | move (const ICOORD vec) | ||||
bool | IsLegallyNested () const | ||||
void | RemoveSmallRecursive (int min_size, C_OUTLINE_IT *it) | ||||
void | ComputeEdgeOffsets (int threshold, Pix *pix) | ||||
void | ComputeBinaryOffsets () | ||||
void | render (int left, int top, Pix *pix) const | ||||
void | render_outline (int left, int top, Pix *pix) const | ||||
C_OUTLINE::plot | |||||
Draw the outline in the given colour.
| |||||
void | plot (ScrollView *window, ScrollView::Color colour) const | ||||
void | plot_normed (const DENORM &denorm, ScrollView::Color colour, ScrollView *window) const | ||||
Public Member Functions inherited from ELIST_LINK | |||||
ELIST_LINK () | |||||
ELIST_LINK (const ELIST_LINK &) | |||||
void | operator= (const ELIST_LINK &) | ||||
Static Public Member Functions | |
static C_OUTLINE * | deep_copy (const C_OUTLINE *src) |
Static Public Attributes | |
static const int | kMaxOutlineLength = 16000 |
C_OUTLINE::C_OUTLINE | |||||
Constructor to build a C_OUTLINE from a rotation of a C_OUTLINE.
| |||||
C_OUTLINE (CRACKEDGE *startpt, ICOORD bot_left, ICOORD top_right, int16_t length) | |||||
C_OUTLINE (ICOORD startpt, DIR128 *new_steps, int16_t length) | |||||
C_OUTLINE (C_OUTLINE *srcline, FCOORD rotation) | |||||
static void | FakeOutline (const TBOX &box, C_OUTLINE_LIST *outlines) | ||||
C_OUTLINE::operator= | |||
| |||
C_OUTLINE & | operator= (const C_OUTLINE &source) | ||
static ICOORD | chain_step (int chaindir) | ||
|
inline |
Definition at line 54 of file coutln.cpp.
Definition at line 81 of file coutln.cpp.
Definition at line 142 of file coutln.cpp.
|
inline |
int32_t C_OUTLINE::area | ( | ) | const |
Definition at line 255 of file coutln.cpp.
|
inline |
|
inline |
|
static |
Definition at line 1049 of file coutln.cpp.
|
inline |
void C_OUTLINE::ComputeBinaryOffsets | ( | ) |
Adds sub-pixel resolution EdgeOffsets for the outline using only a binary image source.
Runs a sliding window of 5 edge steps over the outline, maintaining a count of the number of steps in each of the 4 directions in the window, and a sum of the x or y position of each step (as appropriate to its direction.) Ignores single-count steps EXCEPT the sharp U-turn and smoothes out the perpendicular direction. Eg
* ___ ___ Chain code from the left: * |___ ___ ___| 222122212223221232223000 * |___| |_| Corresponding counts of each direction: * 0 00000000000000000123 * 1 11121111001111100000 * 2 44434443443333343321 * 3 00000001111111112111 * Count of direction at center 41434143413313143313 * Step gets used? YNYYYNYYYNYYNYNYYYyY (y= U-turn exception) * Path redrawn showing only the used points: * ___ ___ * ___ ___ ___| * ___ _ *
Sub-pixel edge position cannot be shown well with ASCII-art, but each horizontal step's y position is the mean of the y positions of the steps in the same direction in the sliding window, which makes a much smoother outline, without losing important detail.
Definition at line 837 of file coutln.cpp.
void C_OUTLINE::ComputeEdgeOffsets | ( | int | threshold, |
Pix * | pix | ||
) |
Adds sub-pixel resolution EdgeOffsets for the outline if the supplied pix is 8-bit. Does nothing otherwise. Operation: Consider the following near-horizontal line:
* _________ * |________ * |________ *
At every position along this line, the gradient direction will be close to vertical. Extrapoaltion/interpolation of the position of the threshold that was used to binarize the image gives a more precise vertical position for each horizontal step, and the conflict in step direction and gradient direction can be used to ignore the vertical steps.
Definition at line 721 of file coutln.cpp.
int32_t C_OUTLINE::count_transitions | ( | int32_t | threshold | ) |
Definition at line 340 of file coutln.cpp.
|
inline |
|
inline |
|
static |
Definition at line 239 of file coutln.cpp.
|
inline |
bool C_OUTLINE::IsLegallyNested | ( | ) | const |
Returns true if *this and its children are legally nested. The outer area of a child should have the opposite sign to the parent. If not, it means we have discarded an outline in between (probably due to excessive length).
Definition at line 604 of file coutln.cpp.
void C_OUTLINE::move | ( | const ICOORD | vec | ) |
Definition at line 588 of file coutln.cpp.
bool C_OUTLINE::operator< | ( | const C_OUTLINE & | other | ) | const |
Definition at line 467 of file coutln.cpp.
Definition at line 1010 of file coutln.cpp.
|
inline |
int32_t C_OUTLINE::outer_area | ( | ) | const |
Definition at line 308 of file coutln.cpp.
|
inline |
int32_t C_OUTLINE::perimeter | ( | ) | const |
Definition at line 289 of file coutln.cpp.
void C_OUTLINE::plot | ( | ScrollView * | window, |
ScrollView::Color | colour | ||
) | const |
Definition at line 942 of file coutln.cpp.
void C_OUTLINE::plot_normed | ( | const DENORM & | denorm, |
ScrollView::Color | colour, | ||
ScrollView * | window | ||
) | const |
Draws the outline in the given colour, normalized using the given denorm, making use of sub-pixel accurate information if available.
Definition at line 974 of file coutln.cpp.
|
inline |
void C_OUTLINE::RemoveSmallRecursive | ( | int | min_size, |
C_OUTLINE_IT * | it | ||
) |
If this outline is smaller than the given min_size, delete this and remove from its list, via *it, after checking that *it points to this. Otherwise, if any children of this are too small, delete them. On entry, *it must be an iterator pointing to this. If this gets deleted then this is extracted from *it, so an iteration can continue.
min_size | minimum size for outline |
it | outline iterator |
Definition at line 627 of file coutln.cpp.
void C_OUTLINE::render | ( | int | left, |
int | top, | ||
Pix * | pix | ||
) | const |
Renders the outline to the given pix, with left and top being the coords of the upper-left corner of the pix.
Definition at line 894 of file coutln.cpp.
void C_OUTLINE::render_outline | ( | int | left, |
int | top, | ||
Pix * | pix | ||
) | const |
Renders just the outline to the given pix (no fill), with left and top being the coords of the upper-left corner of the pix.
left | coord |
top | coord |
pix | the pix to outline |
Definition at line 916 of file coutln.cpp.
void C_OUTLINE::reverse | ( | ) |
Definition at line 565 of file coutln.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int16_t C_OUTLINE::turn_direction | ( | ) | const |
int16_t C_OUTLINE::winding_number | ( | ICOORD | testpt | ) | const |
Definition at line 500 of file coutln.cpp.