Class LemireMinMaxFilter

java.lang.Object
be.panako.util.LemireMinMaxFilter

public class LemireMinMaxFilter extends Object
Implementation of a min-max filter algorithm described in "Streaming Maximum-Minimum Filter Using No More than 3 Comparisons per Element". It is based on the c++ code by Daniel Lemire, provided under the GPLv2.
  • Constructor Details

    • LemireMinMaxFilter

      public LemireMinMaxFilter(int windowSize, int dataLength, boolean clampEdges)
      Create a new min-max filter.
      Parameters:
      windowSize - The size of the window, if clampEdges is true this should be odd.
      dataLength - The length of the data to filter
      clampEdges - If true the length of the resulting filtered values is as long as the data. Otherwise the length of the filtered values is data.length - windowsize/2 + 1. The data is extended with the values at the edges to make this possible.
  • Method Details

    • getMinVal

      public float[] getMinVal()
    • getMaxVal

      public float[] getMaxVal()
    • maxFilter

      public void maxFilter(float[] array, float[] maxFiltered)
      Run only a max filter. The resulting filtered data is stored in maxFiltered
      Parameters:
      array - the data to filter. It should have the same length as given in the constructor.
      maxFiltered - the data to filter. It should have the same length as the data array
    • filter

      public void filter(float[] array)
      Run the filter. The resulting filtered data can requested by calling getMaxVal() and getMinVal().
      Parameters:
      array - the data to filter. It should have the same length as given in the constructor.
    • main

      public static void main(String... args)