Class MinimumKernel

  • All Implemented Interfaces:
    Filter, Serializable

    public class MinimumKernel
    extends NonAveragingKernel
    A maximum kernel is a non linear filter scanning the image and replacing every value with the minimum value found in the neighborhood. This minimum kernel allows a weight matrix to be supplied.

    Example 1D kernel width 5 Kernel and no/uniform mask

            Values: 2 3 2 1 6
     
    During convolution, the kernel looks at the value 2 and replaces it with the value 1 due to it being the minimum. -------------------

    A weight mask [1 2 3 2 1] can give more emphasis on closer pixel values. An intermediary value matrix is calculated:

     Values * Mask = [2 6 6 2 6]
     
    and it is found that the first value is the minimum. (If two values are equal the first value will be chosen). Now the unaltered value at position 1 is taken. Therefore the 2 would be replaced with the value 2.
    Since:
    2.0.0
    Author:
    Kilian
    See Also:
    MedianKernel, MaximumKernel, Serialized Form
    • Constructor Detail

      • MinimumKernel

        public MinimumKernel​(int width,
                             int height)
        Create a minimum kernel with a uniform weight mask (no weighting takes place)
        Parameters:
        width - of the kernel. has to be odd
        height - of the kernel. has to be odd
      • MinimumKernel

        public MinimumKernel​(double[][] mask)
        Create a kernel with the given masks dimension. The masks acts as weight filter increasing or decreasing the weight of the value during convolution. For an example see the javadoc of the class.
        Parameters:
        mask - weight matrix used to judge which value is the maximum
    • Method Detail

      • calcValue

        protected double calcValue​(byte[][] input,
                                   int x,
                                   int y)
        Overrides:
        calcValue in class Kernel
      • calcValue

        protected double calcValue​(int[][] input,
                                   int x,
                                   int y)
        Overrides:
        calcValue in class Kernel
      • calcValue

        protected double calcValue​(double[][] input,
                                   int x,
                                   int y)
        Overrides:
        calcValue in class Kernel
        Parameters:
        input - array
        x - pixelToLookAt
        y - pixelToLookAt
        Returns:
        convolutedPixel fo this x and y
      • resolveMax

        protected double resolveMax​(double[][] values)