expand_edge

[ XITE Reference Manual | XITE home ]

Name

expand_edge - Expand image by edge mirroring.

Syntax

 #include <xite/binarize.h>

 int expand_edge( IBAND inband, int zero_expand,
    int even_expand, int expand_depth,
    IBAND outband );

Description

expand_edge is used on a band to avoid some types of edge difficulties.

Expands inband by expand_depth pixels on all four edges, and writes the result to outband. If the dimensions of inband are n x m, then the dimensions of outband will be (n + 2*size) x (m + 2*size).

Imagine placing mirrors on the edges of inband. These mirror bands are mapped to outband. Using expand_depth = 3 and even_expand == 1, the result will be like this:

        inband:                          outband:

                            ihg|ghi               xyz|zyx
                            fed|def     . . .     uvw|wvu
                            cba|abc               rst|tsr
 +------- - - - -------+    ---+------- - - - -------+---
 |abc               rst|    cba|abc               rst|tsr
 |def     . . .     uvw|    fed|def     . . .     uvw|wvu
 |ghi               xyz|    ihg|ghi               xyz|zyx
 |                     |       |                     |
 .                     .       .                     .
 .                     .       .                     .
 .                     .       .                     .

If zero_expand == 1, the new pixels are set to 0 instead. Else, if zero_expand <= -1, then the new pixels are set to -zero_expand. To expand a binary image with a white border, use zero_expand = -255. If even_expand == 0, the pixels closest to the edge are not mirrored/repeated. `expand_depth specifies the width in pixels of the sections of inband to be mirrored.

Restrictions

inband and outband must have pixel type unsigned byte. `expand_depth must not exceed the smallest of the X dimension and the Y dimension of inband.

Return value

 0  => ok
 1  => Bad pixel type
 2  => parameter 'expand_depth' too large.
 3  => outband too small.

See also

expand_edge(1)

Files

src/binarize/expand_edge.c

Author

Řivind Due Trier, BLAB, Ifi, UiO.

Id

$Id: expand_edge.c,v 1.19 1997/01/14 15:47:01 svein Exp $