Interface WeightPixel_F32

All Known Implementing Classes:
WeightPixelGaussian_F32, WeightPixelKernel_F32, WeightPixelUniform_F32

public interface WeightPixel_F32
Used to get the weight for a pixel from a kernel in 2D space. The kernel is assumed to be centered around 0 and has the specified radius. The kernel has a width of radius*2 + 1. The information stored inside this interface could be represented as a 2D array, but the interface allows a simple return to be used if the value is constant.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the kernel's radius along the x-axis
    int
    Returns the kernel's radius along the y-axis
    boolean
    If the width is an even or odd number
    void
    setRadius(int radiusX, int radiusY, boolean odd)
    Change the kernel's size
    float
    weight(int x, int y)
    Access the weight using coordinates.
    float
    weightIndex(int index)
    Faster way to access the weight.
  • Method Details

    • weightIndex

      float weightIndex(int index)

      Faster way to access the weight. Refers to the index in a row major matrix.

      x = (index % widthX) - radiusX
      y = (index / widthX) - radiusY

      Parameters:
      index - index of grid element
      Returns:
      the weight
    • weight

      float weight(int x, int y)
      Access the weight using coordinates.
      Parameters:
      x - x-coordinate: range = -radius to radius, inclusive
      y - y-coordinate: range = -radius to radius, inclusive
      Returns:
      the weight
    • setRadius

      void setRadius(int radiusX, int radiusY, boolean odd)
      Change the kernel's size
      Parameters:
      radiusX - Radius along x-axis
      radiusY - Radius along y-axis
      odd - If odd then the width will be 2*radius+1, otherwise 2*radius
    • getRadiusX

      int getRadiusX()
      Returns the kernel's radius along the x-axis
      Returns:
      Radius of kernel
    • getRadiusY

      int getRadiusY()
      Returns the kernel's radius along the y-axis
      Returns:
      Radius of kernel
    • isOdd

      boolean isOdd()
      If the width is an even or odd number