Module imagingbook.common
Class NearestNeighborInterpolator
java.lang.Object
imagingbook.common.image.interpolation.NearestNeighborInterpolator
- All Implemented Interfaces:
PixelInterpolator
A PixelInterpolator
implementing nearest-neighbor interpolation in 2D. See Sec. 22.5.1 of [1] for additional
details.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
getInterpolatedValue
(ScalarAccessor ia, double x, double y) Returns the interpolated pixel value for the specified position.double
getWeight
(double x) Corresponds to function w_nn(x), see Eqn.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface imagingbook.common.image.interpolation.PixelInterpolator
getWeight
-
Constructor Details
-
NearestNeighborInterpolator
public NearestNeighborInterpolator()Constructor.
-
-
Method Details
-
getInterpolatedValue
Description copied from interface:PixelInterpolator
Returns the interpolated pixel value for the specified position.- Specified by:
getInterpolatedValue
in interfacePixelInterpolator
- Parameters:
ia
- aScalarAccessor
to the interpolated imagex
- continuous interpolation position (horiz.)y
- continuous interpolation position (vert.)- Returns:
- the interpolated pixel value at position (x,y).
-
getWeight
Corresponds to function w_nn(x), see Eqn. 22.10 in [1]. TODO: test, not used currently.- Specified by:
getWeight
in interfacePixelInterpolator
- Parameters:
x
- the position relative to the interpolation point- Returns:
- the weight for this position
-