pyramid

[ XITE Reference Manual | XITE home ]

Contents


Name

pyramid, pyramidAver2, pyramidRank2, pyramidGauss5, mkPyramidAver2, mkPyramidRank2, mkPyramidGauss5 - create a pyramidal raster data structure

Syntax

 #include <xite/pyramid.h>

 int pyramidAver2( IBAND b1, IBAND b2 );

 int pyramidRank2( IBAND b1, IBAND b2,
    int rank );

 int pyramidGauss5( IBAND b1, IBAND b2,
    ISS_BAND conv );

 int mkPyramidAver2( IBAND b, IMAGE* i, int n );

 int mkPyramidRank2( IBAND b, IMAGE* i,
    int rank, int n );

 int mkPyramidGauss5( IBAND b, IMAGE* i,
    ISS_BAND conv, int n );

Description

pyramidAver2 performs a 2 by 2 average of pixels in b1 and places the result in b2. The 2 by 2 window is then moved two positions, and the process is repeated over the whole band. b2 should thus be half the size of b1 vertically as well as horizontally. If this is not the case, only pixels occurring in b2, and with four "subpixels" in b1, are handled. The final division by four will always truncate.

pyramidRank2 sorts the four pixel values in a 2 by 2 window in b1, looks for the rank 'th value in the sorted sequence, and puts this single value into b2. The 2 by 2 window is then moved two positions, and the process is repeated over the whole band. b2 should thus be half the size of b1 vertically as well as horizontally. If this is not the case, only pixels occurring in b2, and with four "subpixels" in b1, are handled.

pyramidGauss5 performs a 5 by 5 gaussian filtering of pixels in b1 with the filter conv and subsampels the image by 2. The result is placed in b2. b2 should thus be half the size of b1 vertically as well as horizontally.

mkPyramidAver2 creates a pyramid data structure with n levels from the input band b and returns the result as the output image i. The bottom layer will have the same size as the input band rounded down to nearest even, and each layer upwards the pyramid will have half the size of the previous (integer division by 2). The routine uses pyramidAver2 repeatedly. With n equal to zero, use the maximum number of levels.

mkPyramideRank2 creates a pyramid data structure with n levels from the input band b and returns the result as the output image i. The bottom layer will have the same size as the input band rounded down to nearest even, and ach layer upwards the pyramid will have half the size of the previous (integer division by 2). From each 2 by 2 window in one layer, the smallest (rank=1), second smallest (rank=2), second largest (rank=3) or largest (rank=4) pixel value will be inserted in the layer above. The rank parameter should thus be in 1..4. The routine uses pyramidRank2 repeatedly. With n equal to zero, use the maximum number of levels.

mkPyramidGauss5 creates a pyramid data structure with n levels from the input band b and returns the result as the output image i. The bottom layer will have the same size as the input band rounded down to nearest even, and each layer upwards the pyramid will have half the size of the previous (integer division by 2). The routine uses pyramidGauss5 repeatedly. With n equal to zero, use the maximum number of levels.

Restrictions

Input and output pixel types must be unsigned byte.

Return value

 0 => ok
 1 => bad pixel type b1
 2 => bad pixel type b2
 3 => bad rank value (outside 1..4)

Author

Tor Lønnestad, BLAB, ifi, UiO.

Revised

Helene Schulerud, BLAB, ifi, UiO.

Id

$Id: pyramid.c,v 1.30 1997/06/19 08:40:26 svein Exp $