Contour Chain Code Generation

Generate a contour chain code from binary image regions. More...

Functions

int rapp_contour_4conn_bin (unsigned origin[2], char *restrict contour, int len, const uint8_t *restrict buf, int dim, int width, int height)
 4-connectivity contour chain code.
int rapp_contour_8conn_bin (unsigned origin[2], char *restrict contour, int len, const uint8_t *restrict buf, int dim, int width, int height)
 8-connectivity contour chain code.

Detailed Description

Generate a contour chain code from binary image regions.

These functions generate the chain code for the outer contour of a binary image. The contour is traced in clockwise order, starting at the first pixel found in traversal order (memory order). Only one contour is traced. To generate all contours, use the connected-components seed fill functions to segment the image into regions and then trace the contours one by one. The images must be aligned.

Note:
The contour tracing algorithm is only limited by zero-pixels, not by the image boundaries. The caller must set a frame of zero-pixel around the region to trace, either padding pixels or pixels in the image, otherwise the contour tracing will trace out into unallocated memory.

Next section: Chain Code Line Rasterization


Function Documentation

int rapp_contour_4conn_bin ( unsigned  origin[2],
char *restrict  contour,
int  len,
const uint8_t *restrict  buf,
int  dim,
int  width,
int  height 
)

4-connectivity contour chain code.

Parameters:
[out] origin An array where to store the start position of the contour. It must have at least two elements.
[out] contour Chain code contour buffer. May be NULL iff len is 0.
len The size in bytes of the contour buffer.
[in] buf Pixel buffer of the image.
dim Row dimension of the pixel buffer.
width Image width in pixels.
height Image height in pixels.
Returns:
The number of codes that should have been written to the chain code buffer if it was long enough, not including the trailing '\0' character (the same semantics as snprintf), or a negative error code on error.
int rapp_contour_8conn_bin ( unsigned  origin[2],
char *restrict  contour,
int  len,
const uint8_t *restrict  buf,
int  dim,
int  width,
int  height 
)

8-connectivity contour chain code.

Parameters:
[out] origin An array where to store the start position of the contour. It must have at least two elements.
[out] contour Chain code contour buffer. May be NULL iff len is 0.
len The size in bytes of the contour buffer.
[in] buf Pixel buffer of the image.
dim Row dimension of the pixel buffer.
width Image width in pixels.
height Image height in pixels.
Returns:
The number of codes that should have been written to the chain code buffer if it was long enough, not including the trailing '\0' character (the same semantics as snprintf), or a negative error code on error.

Generated on 1 Jun 2016 for RAPP by  doxygen 1.6.1