REBIN Function
Returns a vector or array resized to the given dimensions.
enabled.
Usage
result = REBIN(array, dim1, ... , dimn)
Input Parameters
array—The array to be sampled. Cannot be of string data type. Must have the same number of dimensions as the number of dimension parameters that you supply.
dimi—The dimension(s) of the resampled array. Must be integral multiples or factors of the original array’s dimension(s).
Returned Value
result—The resized (resampled) vector or array.
Keywords
Sample—If present and nonzero, specifies that nearest neighbor sampling is to be used for both magnifying and shrinking operations.
If not present, specifies that bilinear interpolation is to be used for magnifying and that neighborhood averaging is to be used for shrinking. (Bilinear interpolation gives higher quality results, but requires more time.)
note | REBIN is multi-threaded for pure magnifications (including expansion into more dimensions) using nearest-neighbor sampling. |
Discussion
The expansion or compression of each dimension is independent of the others; REBIN can expand or compress one dimension while leaving the others untouched.
Example
This example creates an image of a shaded surface, resizes the image using REBIN, then displays the resized image. The results are shown in
Figure 15-1: Original and Resized Image.
; Create 20-by-20 single-precision, floating-point array where
; each element is proportional to its frequency.
x = DIST(20)
; Display a shaded-surface representation of x.
SHADE_SURF, x, Color=0
LOADCT, 7
y = TVRD(0, 0, 640, 512)
; Get the content of the display subsystem's memory.
INFO, y
; PV-WAVE prints: VARIABLE BYTE = Array(640, 512)
; Resize the 640-by-512 array y and place the result in z.
z = REBIN(y, 320, 256)
; Create window of size 960-by-512.
WINDOW, 0, Xsize=960, Ysize=512
; Display larger image in position 0 of window.
TV, y, 0
; Display resized image in position 3 of window.
TV, z, 5
See Also
For more information on resampling and resizing images, see the PV‑WAVE User’s Guide.
For information on interpolation methods, see the PV‑WAVE User’s Guide.