lvmos2band(3)

LIBRARY ROUTINE
lvmos2band - Converts a mosaic input image to an output image in which each subimage of the input mosaic constitutes a band of the output image.

LIBRARY CALL
#include "vinclude.h"
int
lvmos2band(image, img1, sub_rows, sub_cols, sub_border, img_border, sub_x_off, sub_y_off, sub_skip, num_flag, num_subs)
struct xvimage  *image,     /* imput mosaic image */
                **img1;     /*  multiband output image */
int             sub_rows,   /* num rows per subimage (including borders) */
                sub_cols,   /* num cols per subimage (including borders) */
                sub_border, /* subimage border (inner border) size in pixels */
                img_border, /* overall image border (outer) size in pixels */
                sub_x_off,  /* col index through subimages (1 img per index) */
                sub_y_off,  /* row index through subimages (1 img per index) */
                sub_skip,   /* skip value between subimages to be banded */
                num_flag,   /* if set, user specifies num subimages banded */
                num_subs;   /* number of subimages that will be banded */

INPUT

image
    pointer to input xvimage structure

sub_rows
    num rows per subimage (including borders)

sub_cols
    num cols per subimage (including borders)

sub_border
    subimage border (inner border) size in pixels

sub_x_off
    col index through subimages (1 img per index)

sub_y_off
    row index through subimages (1 img per index)

sub_skip
    skip value between subimages to be banded

num_flag
    if set, user specifies num subimages banded

num_subs
    number of subimages that will be banded

OUTPUT

img1
    output banded image

MODIFICATIONS

DESCRIPTION
lvmos2band converts a mosaic input image to an output image in which each subimage of the input mosaic constitutes a band of the output image.

The output image generated by lvmos2band, img1, will be (r-2*bs) rows by (c-2*bs) columns with n bands, where r and c are the number of rows and columns per subimage, bs is the subimage border size, and n is the number of subimages that are to be put into band format. Lvmos2band assumes that all subimages are same size (r*c) and all subimages have the same border size (bs). Subimages from the input mosaic image (image) are assigned to bands in the multiband output image (img1) in the following manner: The first subimage specified is assigned to the first band in img1. Subsequent bands are assigned subsequent subimages indexed from left to right, top to bottom. Lvmos2band accepts VIFF data_types (excluding VFF_TYP_BIT) and returns that same data_type. If a map is associated with the input mosaic image, the same map will be assigned to the output multiband image.

number of columns and number of rows in subimages

The sub_rows and sub_cols parameters are used to specify the number of rows and the number of columns, respecively, per subimage. Lvmos2band assumes that all subimages in the mosaic image are the same size. The sub_rows and sub_cols values SHOULD include any borders associated with the subimages.

subimage border size

The sub_border parameter specifies the subimage border size in pixels. Again, this parameter will be applied to all subimages in the mosaic. When lvmos2band converts the mosaic image to a multiband image, the subimage borders will be removed from the subimages before storing them in bands. The size of the output image, img1, will therefore be (sub_rows-2*sub_border) rows by (sub_cols-2*sub_border) columns by n bands.

overall mosaic image border size

The img_border parameter specifies, in pixels, the size of an outer border that should be removed from the mosaic image before extracting the subimages. The overall mosaic image border and the subimage borders are independent.

horizontal and vertical offset of first subimage to be banded

The the first subimage in the mosaic that will be put into the multiband output image is specified by sub_x_off (horizontal offset) and sub_y_off (vertical offset). The specified subimage will then be the first band in the output image. The indices, x and y, index through the subimages (they are NOT indices through the input mosaic image rows and columns). Therefore, if a mosaic image contained 9 4-row by 4-col subimages arranged as 3 subimages in the horizontal direction by 3 subimages in the vertical direction, the center subimage would be indexed by sub_x_offset=1, sub_y_offset=1 (not by sub_x_offset=4, sub_y_offset=4).

number of subimages to be put into band format

Two parameters are passed to lvmos2band to indicate the number of subimages that should be put into band format, starting with the first subimage described by sub_x_offset and sub_y_offset. The num_flag is set if the user specifies the number of subimages option. In the case that num_flag is TRUE, the value passed in by num_subs is used. If the specified number of subimages cannot be extracted, lvmos2band will return an error and the output image will not be created. If num_flag is FALSE, lvmos2band calculates the number of subimages that will be banded, taking into account both the subimage skip value and the subimage offsets.

subimage skip value

The subimage skip value parameter (sub_skip) specifies the number of subimages to be skipped each time a subimage is stored as a band. For example, a skip value of sub_skip=1 in a 3x3 subimage mosaic would band the subimages in a checkerboard pattern (every other subimage is a band in the output image). When applying the subimage skip value, lvmos2band looks at the series of subimages as a linear array. Therefore, the row/column arrangement of subimages does not affect how the skipping occurs.

SEE ALSO
vmos2band(1), intro(3), vipl(3), verror(3), vutils(3)

RESTRICTIONS
Vmos2band does not work on explicit location data and will return an error when such an image is encountered. No output image will be created.

AUTHOR
Donna Koechner

COPYRIGHT
Copyright 1992, University of New Mexico. All rights reserved.