|
| 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 |
|
|
Compute the area of the outline.
|
int32_t | area () const |
|
|
Compute the perimeter of the outline and its first level children.
|
int32_t | perimeter () const |
|
|
Compute the area of the outline.
|
int32_t | outer_area () const |
|
|
Compute the number of x and y maxes and mins in the outline. - Parameters
-
threshold | winding number on size |
|
int32_t | count_transitions (int32_t threshold) |
|
|
- Returns
- TRUE if the left operand is inside the right one.
- Parameters
-
|
bool | operator< (const C_OUTLINE &other) const |
|
|
- Returns
- the winding number of the outline around the given point.
- Parameters
-
point | point to wind around |
|
int16_t | winding_number (ICOORD testpt) const |
|
int16_t | turn_direction () const |
|
|
Reverse the direction of an outline.
|
void | reverse () |
|
|
Move C_OUTLINE by vector - Parameters
-
vec | vector to reposition OUTLINE by |
|
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 |
|
|
Draw the outline in the given colour. - Parameters
-
window | window to draw in |
colour | colour to draw in |
|
void | plot (ScrollView *window, ScrollView::Color colour) const |
|
void | plot_normed (const DENORM &denorm, ScrollView::Color colour, ScrollView *window) const |
|
| ELIST_LINK () |
|
| ELIST_LINK (const ELIST_LINK &) |
|
void | operator= (const ELIST_LINK &) |
|
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.
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.
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.
- Parameters
-
min_size | minimum size for outline |
it | outline iterator |