Class InterpAverage

Object
Interpolation
InterpAverage
All Implemented Interfaces:
Serializable

public class InterpAverage extends Interpolation
An Interpolation class which performs simple averaging of all pixels within a specified neighborhood. It is used by the "SubsampleAverage" operation implementations.
See Also:
  • Constructor Details

    • InterpAverage

      public InterpAverage(int blockX, int blockY)
      Creates an InterpAverage instance having the supplied dimensions. The left and top padding are (blockX - 1)/2 and (blockY - 1)/2, respectively. The subsampleBitsH and subsampleBitsV instance variables are set to 32.
      Parameters:
      blockX - The width of the interpolation block.
      blockY - The height of the interpolation block.
      Throws:
      IllegalArgumentException - if either parameter is non-positive.
  • Method Details

    • interpolateH

      public int interpolateH(int[] samples, int xfrac)
      Returns the average of all elements in samples; xfrac is ignored.
      Specified by:
      interpolateH in class Interpolation
      Parameters:
      samples - an array of ints.
      xfrac - the subsample position, multiplied by 2(subsampleBitsH).
      Returns:
      the interpolated value as an int.
    • interpolateH

      public float interpolateH(float[] samples, float xfrac)
      Returns the average of all elements in samples; xfrac is ignored.
      Specified by:
      interpolateH in class Interpolation
      Parameters:
      samples - an array of floats.
      xfrac - the X subsample position, in the range [0.0F, 1.0F).
      Returns:
      the interpolated value as a float.
    • interpolateH

      public double interpolateH(double[] samples, float xfrac)
      Returns the average of all elements in samples; xfrac is ignored.
      Specified by:
      interpolateH in class Interpolation
      Parameters:
      samples - an array of doubles.
      xfrac - the X subsample position, in the range [0.0F, 1.0F).
      Returns:
      the interpolated value as a double.