Cropping

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.

Detailed Description

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


Function Documentation

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.

Parameters:
[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:

  • pos[0]: x coordinate
  • pos[1]: y coordinate
Returns:
A positive value if the image is non-empty, zero if it is empty, and a negative error code on error.
int rapp_crop_box_bin ( const uint8_t *  buf,
int  dim,
int  width,
int  height,
unsigned  box[4] 
)

Compute the bounding box.

Parameters:
[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:

  • box[0]: x coordinate of upper-left corner
  • box[1]: y coordinate of upper-left corner
  • box[2]: bounding box width
  • box[3]: bounding box height
Returns:
A positive value if the image is non-empty, zero if it is empty, and a negative error code on error.

Generated on 1 Jun 2016 for RAPP by  doxygen 1.6.1