Class KernelUtil

Object
KernelUtil

public class KernelUtil extends Object
Static utility methods for KernelImageN objects.
Since:
1.0
Author:
Michael Bedward
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    kernelToString(KernelImageN kernel, boolean multiLine)
    A utility function that returns a string representation of a KernelImageN object's data.
    static KernelImageN
    setElement(KernelImageN kernel, int x, int y, float newValue)
    Creates a new kernel by copying the one provided and setting the element at (x, y) to value.
    static KernelImageN
    standardize(KernelImageN kernel)
    Create a copy of the input kernel with element values standardized to sum to 1.0.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KernelUtil

      public KernelUtil()
  • Method Details

    • standardize

      public static KernelImageN standardize(KernelImageN kernel)
      Create a copy of the input kernel with element values standardized to sum to 1.0. The input kernel's dimensions and location of the key element are retained by the new kernel.
      Parameters:
      kernel - the input kernel
      Returns:
      a new KernelImageN object
    • setElement

      public static KernelImageN setElement(KernelImageN kernel, int x, int y, float newValue)
      Creates a new kernel by copying the one provided and setting the element at (x, y) to value.
      Parameters:
      kernel - the existing kernel
      x - element X ordinate
      y - element Y ordinate
      newValue - new element value
      Returns:
      the new kernel
      Throws:
      IllegalArgumentException - if kernel is null or x or y are out of bounds
    • kernelToString

      public static String kernelToString(KernelImageN kernel, boolean multiLine)
      A utility function that returns a string representation of a KernelImageN object's data.
      Parameters:
      kernel - the input kernel
      multiLine - if true, each row of kernel data is followed by a newline; if false, the string contains no newlines
      Returns:
      a String