toxi.image.util
Class Filter8bit

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

public class Filter8bit
extends java.lang.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
Author:
Karsten Schmidt < i n f o [ a t ] t o x i . co . u k >

Constructor Summary
Filter8bit()
           
 
Method Summary
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter8bit

public Filter8bit()
Method Detail

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)

adaptiveThreshold

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

threshold

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

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)

stretchLevels

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

erodePixels

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

erodePixels

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