Class QuantileThresholder

java.lang.Object
imagingbook.common.threshold.global.QuantileThresholder
All Implemented Interfaces:
GlobalThresholder, Thresholder
Direct Known Subclasses:
MedianThresholder

public class QuantileThresholder extends Object implements GlobalThresholder

This is an implementation of the global "quantile" thresholder, described in Sec. 9.1 (Alg. 9.1) of [1]. Requires the quantile (p) to be specified at instantiation. Method getThreshold(int[]) returns the minimal threshold that will put AT LEAST the p-fraction of pixels (but not all pixels) in the background. If the underlying image is flat (i.e., contains only a single pixel value), GlobalThresholder.NoThreshold is returned to indicate an invalid threshold. Similarly there is no valid threshold if it takes the pixels from all brightness levels to fill the p-quantile.

[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022). Also see the Errata p. 245!

Version:
2022/08/22
  • Constructor Details

  • Method Details

    • getThreshold

      public float getThreshold(int[] h)
      Description copied from interface: GlobalThresholder
      Returns a single (global) threshold value for the specified histogram.
      Specified by:
      getThreshold in interface GlobalThresholder
      Parameters:
      h - a histogram (array of frequencies)
      Returns:
      a single (global) threshold value