Compute bounding boxes and start positions of binary images. More...
Functions | |
int | rapp_crop_seek_bin (const uint8_t *buf, int dim, int width, int height, unsigned pos[2]) |
Find the first non-zero pixel in traversal order. | |
int | rapp_crop_box_bin (const uint8_t *buf, int dim, int width, int height, unsigned box[4]) |
Compute the bounding box. |
Compute bounding boxes and start positions of binary images.
These functions compute the bounding coordinates in either traversal order or in 2D image space that crop image, i.e. discards zero-pixels. The alignment pixels must be cleared before calling any of these functions, or the result may be invalid. The image must be aligned.
Next section: Connected-Components Seed Fill
int rapp_crop_seek_bin | ( | const uint8_t * | buf, | |
int | dim, | |||
int | width, | |||
int | height, | |||
unsigned | pos[2] | |||
) |
Find the first non-zero pixel in traversal order.
[in] | buf | Pixel buffer. |
dim | Row dimension of the buffer. | |
width | Image width in pixels. | |
height | Image height in pixels. | |
[out] | pos | An array with at least two elements where to store the position found. It is filled in as follows:
|
int rapp_crop_box_bin | ( | const uint8_t * | buf, | |
int | dim, | |||
int | width, | |||
int | height, | |||
unsigned | box[4] | |||
) |
Compute the bounding box.
[in] | buf | Pixel buffer. |
dim | Row dimension of the buffer. | |
width | Image width in pixels. | |
height | Image height in pixels. | |
[out] | box | An array with at least four elements where to store the bounding box. It is filled in as follows:
|