Horizontal and vertical logical margins. More...
Functions | |
int | rapp_margin_horz_bin (uint8_t *restrict margin, const uint8_t *restrict src, int dim, int width, int height) |
Compute the horizontal logical margin. | |
int | rapp_margin_vert_bin (uint8_t *restrict margin, const uint8_t *restrict src, int dim, int width, int height) |
Compute the vertical logical margin. |
Horizontal and vertical logical margins.
Computes the logical margins of a binary image. The margin is defined as the logical inclusive-OR between all pixels in the rows (vertical) or in the columns (horizontal). The result is a binary image that consist only of one row or one column. The main use case is to compute the vertical margin and divide the image into horizontal blocks containing non-zero pixels that can be processed efficiently, while skipping the parts in between.
All images must be aligned.
Next section: Segmentation and Labelling
int rapp_margin_horz_bin | ( | uint8_t *restrict | margin, | |
const uint8_t *restrict | src, | |||
int | dim, | |||
int | width, | |||
int | height | |||
) |
Compute the horizontal logical margin.
[out] | margin | Margin pixel buffer with one row of at least width pixels. |
[in] | src | Source pixel buffer. |
dim | Row dimension of the source buffer. | |
width | Image width in pixels. | |
height | Image height in pixels. |
int rapp_margin_vert_bin | ( | uint8_t *restrict | margin, | |
const uint8_t *restrict | src, | |||
int | dim, | |||
int | width, | |||
int | height | |||
) |
Compute the vertical logical margin.
The margin is stored as a 1xheight horizontal image in the margin buffer. Since this function may process pixels up to the nearest alignment boundary, the alignment padding must be explicitly cleared by the caller or the result may be invalid.
[out] | margin | Margin pixel buffer with one row of least height pixels. |
[in] | src | Source pixel buffer. |
dim | Row dimension of the source buffer. | |
width | Image width in pixels. | |
height | Image height in pixels. |