Randomly selects a given percentage of predetermined pixel blocks
Randomly selects a given percentage of pixel blocks of user-specified size from an input image to form an output image. Sampling may be done with or without replacement.
- IN
- Input image. May be a multi-band BYTE, INTEGER*2, INTEGER*4 and REAL*4 image. Band and window options may be specified.
- OUT
- Output image. Data type is the same as the input image. The size is determined by the number of randomly selected blocks and the two KERNDIM values.
- KERNDIM(5,5)
- Kernel dimensions. The number of lines and samples in each of the randomly selected sample blocks. See User Note 4.
- SAMPFACT(5)
- Sampling factor. Specifies the percent of sample blocks that will be selected to create the output image. Since only whole blocks are selected, if the value given for SAMPFACT results in a fractional number of samples, this number will be rounded to the nearest whole number.
- DUPFLG(NO)
- Duplication flag. Controls whether or not any duplicate samples will be replaced by unique ones.
= NO: The user has requested that no duplicate samples be used. In this case the program deletes redundant sample blocks and searches for unselected samples. Redundant block will be replaced by new one found by further search. = YES: The program uses redundant sample blocks. Redundant blocks are therefore not going to be replaced.
Five percent of the 2 x 2 sample blocks are selected, resulting in an output image of size 116 x 114. Some sample blocks may be used more than once.
An image of size 120 x 110 results (see Description/ Algorithm section). The input image is sampled to line 510 and pixel 510 because of truncation. Sample blocks are not used more than once.
The user is prompted four times to allow the search for unused sample blocks to continue. If the user responds with YES, the output image size is 96 x 92 (see Description/Algorithm section). If the user decides not to continue the search, the output image size is 96 x 88.
The input image is divided into a number of sample blocks, each having the size specified by the KERNDIM parameter. If the sample blocks do not divide evenly into the number of lines or pixels in the input image, the input image remainder is discarded. The number of random sample blocks needed for the output image is computed from the SAMPFACT of the number of input sample blocks (in the possibly truncated input image). If the value given for SAMPFACT results in a fractional number of random sample blocks, this number is rounded to the nearest integer. A random number generator is used to select the set of randomly sampled blocks to be taken from the input image; the block numbers are then sorted in ascending order.If the user has requested that no duplicate samples be used (DUPFLG=NO), the program deletes redundant sample blocks and searches for unselected samples. After 10 iterations the user is prompted to allow continued searching. If the user chooses not to allow further searching, the output image is constructed of the nonredundant output blocks found at that point.
Otherwise, the program continues selecting nonredundant sample blocks, prompting every 10 iterations. The total number of pixels in the output image is the product of the number of randomly sampled blocks times the two KERNDIM values. The square root of this product is truncated, divided by the number of pixels in a sample row (KERNDIM(2)), and truncated to yield the number of sample blocks in an output row. The number of pixels in an output row is the product of the number of sample blocks in a row and the number of pixels in a sample row.
The number of lines in the output image is the product of the number of lines in a sample block (KERNDIM(1)) and the number of rows of sample blocks necessary to use all the selected samples. One or more blocks in the lower right corner of the output image may contain zero-fill pixels in the event the number of sample blocks is insufficient to completely fill the image. The user is informed of number of zero-fill blocks.
The selected samples are output in ascending order until all have been used. Because the randomly selected sample blocks are sorted into ascending order, some order is preserved in the output image; hence, a local area within it does not have the statistical properties of the output image as a whole.
The number of lines in the output image is the product of the number of lines in a sample block (KERNDIM(1)) and the number of rows of sample blocks necessary to use all the selected samples. One or more blocks in the lower right corner of the output image may contain zero-fill pixels in the event the number of sample blocks is insufficient to completely fill the image.
This message informs the user what is the current percentage of nonredundant samples. The user will be prompted to continue. See Description/Algorithm for more details.
This message informs the user what will be the output image size. See Description/Algorithm for more details.
The size of the sample block should not exceed the image size. Respecify appropriate values for KERNDIM.
If multiple input images are used, they must match in size. Respecify input images with same window size.
The sampling factor specified, was too small and no sample blocks were found. Respecify higher percentage for sampling.