User's Guide

ZOOM

Change the scale of an image by replicating or deleting pixels.

Function:

Change the scale of an image by deleting or replicating pixels from the input image and producing the zoomed output image. When reducing an image, each output pixel may receive either the value of a single input pixel, or the mean of all the input pixels which are covered by the output pixel. When expanding an image, each output value may be multiplied by a pseudorandom number, subject to the constraint that the average of the multipliers for any given input pixel is always unity. The image may be scaled independently in the line and sample direction.

Parameters:

Subcommand -EXPAND:
Expand size of input image(s) by replicating pixels. The scale of the image is increased. For a given input image line, each pixel will be replicated by a factor of SCALFACT(2). After performing the SCALFACT(2) replication, each line will then be replicated by a factor of SCALFACT(1). If the resulting image is displayed, it will appear "closer."

IN
Input image(s). The input image(s) may be BYTE, INTEGER*2, INTEGER*4, or REAL*4.

OUT
Output image. Data type will be the same as the input.

SCALFACT
Scale factor(s). Scaling factors in the line and sample directions. They must be nonzero integers.
Subcommand -REDUCE:
Reduce size of input image(s) by deleting pixels. The scale of the image is reduced. For a given input image line, every SCALFACT(2) pixel, beginning with the starting pixel, is retained and all other pixels are deleted. Every SCALFACT(1) line, beginning with the first line, is then retained and all other lines are deleted. The minimum output image size possible is 1 X 1. If the resulting image is displayed, it will appear to be "further away."

IN
Input image(s). The input image(s) may be BYTE, INTEGER*2, INTEGER*4, or REAL*4.

OUT
Output image. Data type will be the same as the input.

SCALFACT
Scale factor(s). Scaling factors in the line and sample directions. They must be nonzero integers.
Subcommand -RANDEX:
Expand input image(s) with randomization. The scale of the image is increased. Each input pixel will be expanded to a SCALFACT(1) by SCALFACT(2) array of output pixels. Each output pixel will be created by multiplying the input pixel value by a multiplier selected randomly from an array of NBIN multipliers whose distribution and range are specified by arguments DISTRIB, COEFF, and RANGE, using a random number generator whose initial value is specified by SEED. The multipliers for the array of output pixels corresponding to a single input pixel are normalized so that their average is exactly 1.0; this normalization will mean that the actual distribution of all multipliers used to generate the output image may differ slightly from that specified by DISTRIB, and a few values may lie slightly outside the range specified by RANGE.

IN
Input image(s). The input image(s) may be BYTE, INTEGER*2, INTEGER*4, or REAL*4.

OUT
Output image. Data type will be the same as the input.

SCALFACT
Scale factor(s). Scaling factors in the line and sample directions. They must be nonzero integers.

DISTRIB
Function defining distribution of randomly selected multipliers. Options are:

    UNIFORM	Uniform distribution between RANGE(1) and RANGE(2)
    GAUSS	Gaussian distribution between RANGE(1) and RANGE(2)
    NEGEXP	Decaying exponential specifies distriubtion:  relative
		probabilities of values between RANGE(1) and RANGE(2)
		are given by exp(-x)

COEFF(0)
Coefficient(s) of distribution function. These are needed for the following functions:

    GAUSS	COEFF(1)	Center of distribution
		COEFF(2)	Variance of distribution

RANGE
Minimum and maximum multipliers. The minimum and maximum values are specified in RANGE(1) and RANGE(2), respectively.

For some distribution functions, certain combinations of RANGE and COEFF values will result in a distribution whose mean value is not 1.0. In this case, all multiplier values computed using the specified RANGE and COEFF will be normalized by dividing them by their mean, making the new average exactly 1.0. This will result in maximum and minimum values which do not match those specified by RANGE. ZOOM will print an advisory message specifying the adjusted maximum and minimum.

SELECT("ALL")
Multiplier selection option for each input grid cell (pixel). This specifies how to select the values by which a given input grid cell is multiplied to produce the corresponding SCALFACT(1) by SCALFACT(2) array of output values. A table of multipliers is created during program initialization. The set of multipliers to be used with each input grid cell is chosen randomly in one one of three ways, depending on the value of SELECT:

    ALL		Exactly SCALFACT(1) x SCALFACT(2) multipliers are
		computed during program initialization.  The full set of
		multipliers are used for each input grid cell.  However,
		the assignment of the multipliers to output grid cells
		is based on a set of pseudorandom numbers which is
		different for each input grid cell.
    RAND	The multipliers for each input grid cell are randomly
		selected from a (usually large) set of values.  In
		general, the multipliers chosen for any given input grid
		cell do not average exactly 1.0, with the result that
		the set of output values derived from a given input grid
		cell may have an average value which is less or greater
		than the input value.  See User Note 3. 
    RENORM	The multipliers to be used with each input grid cell are
		randomly selected.  Their values are then adjusted to
		make their average exactly 1.0, so that the average of
		the output values derived from a given input grid cell
		will be exactly equal to the input value.  See User Note
		3.

NBIN(1000)
Number of bins in multipier table (ignored if SELECT = "ALL"). To minimize computation time, a table of multipliers is created in which the distribution of values approximates the distribution function specified by DISTRIB, COEFF, and RANGE. A random number generator is used to select values from this table. For SELECT = "RAND" or "RENORM", the default is 1000 bins. For SELECT = "ALL", NBIN is automatially set to SCALFACT(1) x SCALFACT(2).

SEED(--)
Initial value for random number generator. This is the "seed" value used to initialize the random number generator. The default is to use the system clock time in seconds when the program starts. If the same numeric value is specified for SEED for successive executions of ZOOM, the pattern of multipliers will be reproduced.
Subcommand -MEANRED:
Reduce size of image(s) by taking mean of input pixels covered by each output pixel. The scale of the image is reduced. The input image is divided into SCALFACT(1) by SCALFACT(2) rectangles, with the upper left corner of the first rectangle coinciding with the starting line and pixel of the input-image window. For each band, the mean of the input pixels in each rectangle is computed, and used as the value of one output pixel. If the rectangles at the righthand and/or bottom edge of the input image extend beyond the specified input-image window, only pixels within the window are used for computing the mean.

IN
Input image(s). The input image(s) may be BYTE, INTEGER*2, INTEGER*4, or REAL*4.

OUT
Output image. Data type will be the same as the input.

SCALFACT
Scale factor(s). Scaling factors in the line and sample directions. They must be nonzero integers.

Examples:

  1. LAS> zoom-expand in=in.img(200,200,100,100) out=z.dat scalfact=4,2

    This performs an expansion of the input image IN.IMG using a window of 100 lines and 100 pixels centered at the input file coordinates (250,250) specified by the window used. The zoom is performed by a factor of 4 in the line direction and a factor of 2 in the sample direction. The image Z.DAT will be 400 x 200 with the starting pixel of the input image at 200,200.

  2. LAS> zoom-reduce in=wash.dat(1,1,512,512) out=zoom.dat scalfact=2,2

    This performs a scale reduction on image file WASH.DAT. The input window is 512 x 512 and the image WASH.DAT is reduced by 2 in the line and sample directions. The image ZOOM.DAT will be 256 x 256 with the starting pixel of the input image at 1,1.

  3. LAS> zoom-randex in=precip_4km out=precip_1km scalfact=4,4 distrib="gauss" coeff=(1.0,0.25) range=(0.5,1.5) select="rand"

    This expands the image "precip_4km" by a factor of 4 in each direction. The 4 by 4 array of output pixels corresponding to each input pixel is obtained by multiplying the values of the input pixel by a set of factors selected randomly within the range 0.5 to 1.5 with probabilies given by a Gaussian distribution centered at 1.0 with a variance of 0.25. The Gaussian distribution is approximated by dividing the range into 1000 bins (the default), and randomly selecting bins using as an initial seed for the random-number generator the default value, which is the system time when the program is run.

  4. LAS> zoom-randex in=precip_4km out=precip_1km scalfact=4,4 distrib="uniform" range=(0.5,1.5) seed=1

    This expands the image "precip_4km" by a factor of 4 in each direction, multiplying each of the 16 output values corresponding to any given input pixel by one of 16 factors distributed uniformly between 0.5 and 1.5. The same set of multipliers is used for each input pixel, but their assignment to output pixels is determined by a random number generator initialized with a seed value of 1.

Description/Algorithm:

ZOOM alters image size by replicating or deleting pixels based on user-input scale factors for the line and sample axes.

If subcommand -EXPAND is specified, the scale of the image is increased. For a given input image line, each pixel will be replicated by a factor of SCALFACT(2). After performing the replication, each line will then be replicated by a factor of SCALFACT(1). If the resulting image is displayed, it will appear "closer."

If subcommand -REDUCE is specified, the scale of the image is reduced. For a given input image line, every SCALFACT(2) pixel, beginning with the starting pixel, is retained and all other pixels are deleted. Every SCALFACT(1) line, beginning with the first line, is then retained and all other lines are deleted. The minimum output image size possible is 1 X 1. If the resulting image is displayed, it will appear to be "further away." If subcommand -RANDEX is specified, the scale of the image is increased. An array of NBIN multipliers is created whose distribution and range are specified by arguments DISTRIB, COEFF, and RANGE. Then each input pixel is expanded to a SCALFACT(1) by SCALFACT(2) array of output pixels. This is done by using a random number generator to select a set of SCALFACT(1) by SCALFACT(2) multipliers from the multiplier array, normalizing these multipliers to make their sum exactly 1.0, and then using each of the normalized multipliers to create one output pixel by computing the product of the input pixel value and the multiplier. The multipliers are normalized by dividing each unnormalized multiplier by the sum of the unnormalizied multipliers. The random number generator is initialized using the value specified by SEED.

If subcommand -MEANRED is specified, the input image is divided into SCALFACT(1) by SCALFACT(2) rectangles, with the upper left corner of the first rectangle coinciding with the starting line and pixel of the input-image window. For each band, the mean of the input pixels in each rectangle is computed, and used as the value of one output pixel. If the rectangles at the righthand and/or bottom edge of the input image extend beyond the specified input-image window, only pixels within the window are used for computing the mean.

Nonfatal Error Messages:

  1. [zoom-histry] Error creating history file

    An error occurred when creating the history file.

  2. [zoom-minmax] Error creating minmax file

    The minmax file could not be created.

  3. [zoom-warn] Nonfatal error encountered

    A nonfatal error was encountered during processing. The image data is probably valid.

  4. [zoom-altrange] Normalization altered range of multipliers -- new range is x.xxxx to x.xxxx

    The set of all multipliers is required to have an average value of exactly 1.0. The set of multipliers generated using the specfied values of RANGE and/or COEFF did not meet this criterion. Each multiplier was normalized by dividing it by the average value, making the new average equal to 1.0. The minimum and maximum of these normalized values, which are given in the error message, were found to differ significantly from the values specified in RANGE.

Fatal Error Messages:

  1. [zoom-fatal] Fatal error encountered

    A fatal error was encountered during processing. The output image file is not deleted, and processing is terminated. The message that is displayed immediately preceding this error message is the specific error that was encountered.

  2. [zoom-input] Input images are not of the same data type

    The input images are not of the same data type. Use COPY to change the data types so they are the same.

  3. [zoom-open] Cannot open <XXXXXX> file

    The <XXXXXX> file could not be opened and processing is terminated. Verify that the image named in the <XXXXXX> parameter exists.

  4. [zoom-sizerr] Output image size is invalid

    The calculated size of the output image is less than one. Do not reduce the input image by such a large factor or increase the size of the input image.

  5. [zoom-window] Input images do not have the same window size

    The input images do not have the same window size. Correct the input images window size.

  6. [zoom-alloc] Error allocating buffer space

    Dynamic memory allocation failed. Check that there is sufficient virtual memory available for image buffers. For a very large image, it may be necessary to process the image in segments.

  7. [zoom-badrange] RANGE(2) must be > RANGE(1)

    Range parameters entered in wrong order or incorrectly. Correct the values.

User Notes:

  1. If a window is specified, the size of the window is the size of the input image, not the output image. The size of the output image will be the number of lines of the input image times or divided by the SCALFACT(1), by the number of samples of the input image times or divided by the SCALFACT(2).
  2. For subcommand RANDEX, the specified RANGE values for some distribution functions may be incompatible with the specified COEFF values in the sense that they result in a distribution whose mean value is not 1.0. In this case, a preliminary set of multiplier values is computed using the specified RANGE and COEFF. These preliminary multipiers will be normalized by dividing them by their mean, making the new average exactly 1.0. This will result in minimum and/or maximum values which do not match those specified by RANGE. ZOOM will print an advisory message specifying the adjusted minimum and maximum.
  3. For subcommand RANDEX with SELECT = "RENORM", the renormalization of the randomly selected multipliers for each input pixel to make their average value 1.0 means that the actual distribution of all multipliers used to generate the output image may differ slightly from that specified by DISTRIB. It may also cause an occasional multiplier to fall slightly outside the range specified by RANGE.

    On the other hand, if SELECT = "RAND", the average of all the output pixels corresponding to a given input pixel may differ slightly from the input pixel in value. Over the entire image, however, the average values should be very nearly equal, since the multipliers are randomly selected from an array whose average is exactly 1.0.