Class Filter8bit

java.lang.Object
toxi.image.util.Filter8bit

public class Filter8bit extends Object
Filter8bit is a collection of non-destructive, threadsafe filters for grayscale images in Processing PImage format. All filters are implemented as static methods so no instance is needed.
Version:
0.1
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int[]
    adaptiveThreshold(int[] pix, int width, int height, int kernelSize, int filterConst)
     
    static processing.core.PImage
    adaptiveThreshold(processing.core.PImage img, int ks, int c)
    Non-destructively applies an adaptive thresholding filter to the passed in image (grayscale only).
    static int[]
    erodePixels(int[] pixels, int width, int height, boolean isInverted)
     
    static processing.core.PImage
    erodePixels(processing.core.PImage img, boolean isInverted)
     
    static int[]
    stretchLevels(int[] srcpix, int lolim, int uplim)
     
    static processing.core.PImage
    stretchLevels(processing.core.PImage img, int lolim, int uplim)
    Non-destructively stretches levels of an 8bit grayscale image
    static int[]
    threshold(int[] pix, int threshold)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Filter8bit

      public Filter8bit()
  • Method Details

    • adaptiveThreshold

      public static int[] adaptiveThreshold(int[] pix, int width, int height, int kernelSize, int filterConst)
    • adaptiveThreshold

      public static processing.core.PImage adaptiveThreshold(processing.core.PImage img, int ks, int c)
      Non-destructively applies an adaptive thresholding filter to the passed in image (grayscale only). Filter8bit only uses data stored in the blue channel of the image (lowest 8 bit).
      Parameters:
      img - image to be filtered
      ks - kernel size
      c - constant integer value to be subtracted from kernel result
      Returns:
      filtered version of the image (with alpha channel set to full opacity)
    • erodePixels

      public static int[] erodePixels(int[] pixels, int width, int height, boolean isInverted)
      Parameters:
      pixels -
      width -
      height -
      isInverted -
      Returns:
      filtered pixel array
    • erodePixels

      public static processing.core.PImage erodePixels(processing.core.PImage img, boolean isInverted)
      Parameters:
      img -
      isInverted -
      Returns:
      filtered result as new image
    • stretchLevels

      public static int[] stretchLevels(int[] srcpix, int lolim, int uplim)
    • stretchLevels

      public static processing.core.PImage stretchLevels(processing.core.PImage img, int lolim, int uplim)
      Non-destructively stretches levels of an 8bit grayscale image
      Parameters:
      img - Image to be level stretched
      uplim - The upper limit for the values to be stretched between
      lolim - The lower limit for the values to be stretched between
      Returns:
      filtered version of the image (with alpha channel set to full opacity)
    • threshold

      public static int[] threshold(int[] pix, int threshold)