ResampledImageclass, which gives the sample values to the
interpolate(…)method of this interpolation.
All methods in this interface shall be safe for concurrent use in multi-threading context. For example interpolations may be executed in a different thread for each tile in an image.
This interface is designed for interpolations in a two-dimensional space only.
Defined in the
Method SummaryModifier and TypeMethodDescriptionReturns the size of the area over which the resampling function needs to provide values.
(DoubleBuffer source, int numBands, double xfrac, double yfrac, double writeTo, int writeToOffset)Interpolates sample values for all bands using the given pixel values in local neighborhood.
NEARESTstatic final Interpolation NEARESTA nearest-neighbor interpolation using 1×1 pixel.
BILINEARstatic final Interpolation BILINEARA bilinear interpolation using 2×2 pixels. If the interpolation result is NaN, this method fallbacks on nearest-neighbor.
LANCZOSstatic final Interpolation LANCZOSLanczos interpolation for photographic images. This interpolation is not recommended for images that may contain NaN values.
- See Also:
getSupportSizeDimension getSupportSize()Returns the size of the area over which the resampling function needs to provide values. Common values are:
Common support sizes Interpolation Width Height Nearest-neighbor 1 1 Bilinear 2 2 Bicubic 4 4 Lanczos 4 4
- number of sample values required for interpolations.
(DoubleBuffer source, int numBands, double xfrac, double yfrac, double writeTo, int writeToOffset)Interpolates sample values for all bands using the given pixel values in local neighborhood. The given
sourceis a buffer with the number of elements shown below, where support width and support height are given by
(number of bands) × (support width) × (support height)Values in
sourcebuffer are always given with band index varying fastest, then column index, then row index. Columns are traversed from left to right and rows are traversed from top to bottom (
The interpolation point is in the middle. For example if the support size is 4×4 pixels, then the interpolation point is the dot below and the fractional coordinates are relative to the horizontal and vertical lines drawn below. This figure is for an image with only one band, otherwise all indices between brackets would need to be multiplied by
On output, this method shall write the interpolation results as
s s s s s s───s s ← yfrac = 0 │ ● ← yfrac given s s s s ← yfrac = 1 s s s s ↑ xfrac
numBandsconsecutive values in the supplied
writeToarray, starting at
writeToOffsetindex. This method should not modify the buffer position (use
source- pixel values from the source image to use for interpolation.
numBands- number of bands. This is the number of values to put in the
xfrac- the X subsample position, usually (but not always) in the range [0 … 1).
yfrac- the Y subsample position, usually (but not always) in the range [0 … 1).
writeTo- the array where this method shall write interpolated values.
writeToOffset- index of the first value to put in the