Class FactoryThresholdBinary

java.lang.Object
boofcv.factory.filter.binary.FactoryThresholdBinary

public class FactoryThresholdBinary extends Object
Factory for creating various filters which convert an input image into a binary one
  • Constructor Details

    • FactoryThresholdBinary

      public FactoryThresholdBinary()
  • Method Details

    • localGaussian

      public static <T extends ImageGray<T>> InputToBinary<T> localGaussian(ConfigLength regionWidth, double scale, boolean down, Class<T> inputType)
      Parameters:
      regionWidth - Width of square region.
      scale - Threshold scale adjustment
      down - Should it threshold up or down.
      inputType - Type of input image
      Returns:
      Filter to binary
    • localSauvola

      public static <T extends ImageGray<T>> InputToBinary<T> localSauvola(ConfigLength width, boolean down, float k, Class<T> inputType)
      Parameters:
      width - Width of square region.
      down - Should it threshold up or down.
      k - User specified threshold adjustment factor. Must be positive. Try 0.3
      inputType - Type of input image
      Returns:
      Filter to binary
    • localWolf

      public static <T extends ImageGray<T>> InputToBinary<T> localWolf(ConfigLength width, boolean down, float k, Class<T> inputType)
      Parameters:
      width - Width of square region.
      down - Should it threshold up or down.
      k - User specified threshold adjustment factor. Must be positive. Try 0.3
      inputType - Type of input image
      Returns:
      Filter to binary
    • localNiblack

      public static <T extends ImageGray<T>> InputToBinary<T> localNiblack(ConfigLength width, boolean down, float k, Class<T> inputType)
      Parameters:
      width - Width of square region.
      down - Should it threshold up or down.
      k - User specified threshold adjustment factor. Must be positive. Try 0.3
      inputType - Type of input image
      Returns:
      Filter to binary
    • localNiblackFamily

      protected static <T extends ImageGray<T>> InputToBinary<T> localNiblackFamily(ThresholdNiblackFamily.Variant variant, ConfigLength width, boolean down, float k, Class<T> inputType)
      Parameters:
      variant - Which variant in the family
      width - Width of square region.
      down - Should it threshold up or down.
      k - User specified threshold adjustment factor. Must be positive. Try 0.3
      inputType - Type of input image
      Returns:
      Filter to binary
    • localNick

      public static <T extends ImageGray<T>> InputToBinary<T> localNick(ConfigLength width, boolean down, float k, Class<T> inputType)
      Parameters:
      width - size of local region. Try 31
      down - Should it threshold up or down.
      k - The Niblack factor. Recommend -0.1 to -0.2
      inputType - Type of input image
      Returns:
      Filter to binary
    • localMean

      public static <T extends ImageGray<T>> InputToBinary<T> localMean(ConfigLength width, double scale, boolean down, Class<T> inputType)
      Parameters:
      width - Width of square region.
      scale - Scale factor adjust for threshold. 1.0 means no change.
      down - Should it threshold up or down.
      inputType - Type of input image
      Returns:
      Filter to binary
    • localOtsu

      public static <T extends ImageGray<T>> InputToBinary<T> localOtsu(ConfigLength regionWidth, double scale, boolean down, boolean otsu2, double tuning, Class<T> inputType)
      Applies a local Otsu threshold. ThresholdLocalOtsu
      Parameters:
      regionWidth - About how wide and tall you wish a block to be in pixels.
      scale - Scale factor adjust for threshold. 1.0 means no change.
      down - Should it threshold up or down.
      tuning - Tuning parameter. 0 = standard Otsu. Greater than 0 will penalize zero texture.
      inputType - Type of input image
      Returns:
      Filter to binary
    • blockMinMax

      public static <T extends ImageGray<T>> InputToBinary<T> blockMinMax(ConfigLength regionWidth, double scale, boolean down, boolean thresholdFromLocalBlocks, double minimumSpread, Class<T> inputType)
      Applies a very fast non-overlapping block thresholding algorithm which uses min/max statistics.
      Parameters:
      regionWidth - Approximate size of block region
      scale - Scale factor adjust for threshold. 1.0 means no change.
      down - Should it threshold up or down.
      minimumSpread - If the difference between min max is less than or equal to this value then it is considered textureless. Set to ≤ -1 to disable.
      inputType - Type of input image
      Returns:
      Filter to binary
      See Also:
    • blockMean

      public static <T extends ImageGray<T>> InputToBinary<T> blockMean(ConfigLength regionWidth, double scale, boolean down, boolean thresholdFromLocalBlocks, Class<T> inputType)
      Applies a non-overlapping block mean threshold
      Parameters:
      scale - Scale factor adjust for threshold. 1.0 means no change.
      down - Should it threshold up or down.
      regionWidth - Approximate size of block region
      inputType - Type of input image
      Returns:
      Filter to binary
      See Also:
    • blockOtsu

      public static <T extends ImageGray<T>> InputToBinary<T> blockOtsu(ConfigLength regionWidth, double scale, boolean down, boolean thresholdFromLocalBlocks, boolean otsu2, double tuning, Class<T> inputType)
      Applies a non-overlapping block Otsu threshold. ThresholdBlockOtsu
      Parameters:
      regionWidth - Approximate size of block region
      scale - Scale factor adjust for threshold. 1.0 means no change.
      down - Should it threshold up or down.
      inputType - Type of input image
      Returns:
      Filter to binary
    • globalEntropy

      public static <T extends ImageGray<T>> InputToBinary<T> globalEntropy(int minValue, int maxValue, double scale, boolean down, Class<T> inputType)
      Parameters:
      minValue - The minimum value of a pixel in the image. (inclusive)
      maxValue - The maximum value of a pixel in the image. (inclusive)
      down - Should it threshold up or down.
      inputType - Type of input image
      Returns:
      Filter to binary
    • globalFixed

      public static <T extends ImageGray<T>> InputToBinary<T> globalFixed(double threshold, boolean down, Class<T> inputType)
      Parameters:
      threshold - threshold value.
      down - If true then the inequality ≤ is used, otherwise if false then ≥ is used.
      inputType - Type of input image
      Returns:
      Filter to binary
    • globalOtsu

      public static <T extends ImageGray<T>> InputToBinary<T> globalOtsu(double minValue, double maxValue, double scale, boolean down, Class<T> inputType)
      Parameters:
      minValue - The minimum value of a pixel in the image. (inclusive)
      maxValue - The maximum value of a pixel in the image. (inclusive)
      down - Should it threshold up or down.
      inputType - Type of input image
      Returns:
      Filter to binary
    • globalLi

      public static <T extends ImageGray<T>> InputToBinary<T> globalLi(double minValue, double maxValue, double scale, boolean down, Class<T> inputType)
      Parameters:
      minValue - The minimum value of a pixel in the image. (inclusive)
      maxValue - The maximum value of a pixel in the image. (inclusive)
      down - Should it threshold up or down.
      inputType - Type of input image
      Returns:
      Filter to binary
    • globalHuang

      public static <T extends ImageGray<T>> InputToBinary<T> globalHuang(double minValue, double maxValue, double scale, boolean down, Class<T> inputType)
      Parameters:
      minValue - The minimum value of a pixel in the image. (inclusive)
      maxValue - The maximum value of a pixel in the image. (inclusive)
      down - Should it threshold up or down.
      inputType - Type of input image
      Returns:
      Filter to binary
    • threshold

      public static <T extends ImageGray<T>> InputToBinary<T> threshold(ConfigThreshold config, Class<T> inputType)
      Creates threshold using a config class
      Parameters:
      config - Configuration
      inputType - Type of input image
      Returns:
      The thresholder