Class ComputeOtsu

java.lang.Object
boofcv.alg.filter.binary.ComputeOtsu

public class ComputeOtsu
extends Object
Computes different variants of Otsu. Can be configured to compute the standard version. This allows the user to better handle textureless regions and can further tune it by scaling the threshold up and down.
See Also:
GThresholdImageOps.computeOtsu(int[], int, int), GThresholdImageOps.computeOtsu2(int[], int, int)
  • Field Summary

    Fields
    Modifier and Type Field Description
    boolean down
    Is the image being thresholded down or up
    double threshold  
    double variance  
  • Constructor Summary

    Constructors
    Constructor Description
    ComputeOtsu​(boolean useOtsu2, boolean down)  
    ComputeOtsu​(boolean useOtsu2, double tuning, boolean down, double scale)  
  • Method Summary

    Modifier and Type Method Description
    void compute​(int[] histogram, int length, int totalPixels)
    Computes the threshold and stores the result in the 'threshold' variable
    protected void computeOtsu​(int[] histogram, int length, int totalPixels)  
    protected void computeOtsu2​(int[] histogram, int length, int totalPixels)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • threshold

      public double threshold
    • variance

      public double variance
    • down

      public boolean down
      Is the image being thresholded down or up
  • Constructor Details

    • ComputeOtsu

      public ComputeOtsu​(boolean useOtsu2, double tuning, boolean down, double scale)
      Parameters:
      useOtsu2 - true to use modified otsu. false uses clasical
      tuning - Tuning parameter. 0 = standard Otsu. Greater than 0 will penalize zero texture.
      down - Is otsu being used to threshold the image up or down
      scale - scale factor applied to the threshold. 1.0 = unmodified
    • ComputeOtsu

      public ComputeOtsu​(boolean useOtsu2, boolean down)
  • Method Details

    • compute

      public void compute​(int[] histogram, int length, int totalPixels)
      Computes the threshold and stores the result in the 'threshold' variable
      Parameters:
      length - length of histogram
      totalPixels - total sum of all pixels in histogram
    • computeOtsu

      protected void computeOtsu​(int[] histogram, int length, int totalPixels)
    • computeOtsu2

      protected void computeOtsu2​(int[] histogram, int length, int totalPixels)