Class GaussianSmooth

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--GaussianSmooth

public class GaussianSmooth
extends java.lang.Thread

Contains the functionality to generate a gaussian filter kernel and apply it to an image.

Author:
Simon Horne.

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GaussianSmooth()
          Default no-args constructor.
 
Method Summary
static double[][] gaussian2D(double theta, int size)
          Calculates several discrete values of the 2D gaussian distribution.
static double gaussianDiscrete2D(double theta, int x, int y)
          Calculates the discrete value at x,y of the 2D gaussian distribution.
static int[] smooth_image(int[] input, int w, int h, int ks, double theta)
          Takes an input image and a gaussian distribution, calculates an appropriate kernel and applies a convolution to gaussian smooth the image.
static double[][] smooth(double[][] input, int width, int height, int ks, double theta)
          Takes an image and a gaussian distribution, calculates an appropriate kernel and applies a convolution to smooth the image.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GaussianSmooth

public GaussianSmooth()
Default no-args constructor.
Method Detail

gaussianDiscrete2D

public static double gaussianDiscrete2D(double theta,
                                        int x,
                                        int y)
Calculates the discrete value at x,y of the 2D gaussian distribution.
Parameters:
theta - the theta value for the gaussian distribution
x - the point at which to calculate the discrete value
y - the point at which to calculate the discrete value
Returns:
the discrete gaussian value

gaussian2D

public static double[][] gaussian2D(double theta,
                                    int size)
Calculates several discrete values of the 2D gaussian distribution.
Parameters:
theta - the theta value for the gaussian distribution
size - the number of discrete values to calculate (pixels)
Returns:
2Darray (size*size) containing the calculated discrete values

smooth

public static double[][] smooth(double[][] input,
                                int width,
                                int height,
                                int ks,
                                double theta)
Takes an image and a gaussian distribution, calculates an appropriate kernel and applies a convolution to smooth the image.
Parameters:
2D - array representing the input image
w - width of the image
h - height of the image
ks - the required size of the kernel
theta - the gaussian distribution
Returns:
2D array representing the smoothed image

smooth_image

public static int[] smooth_image(int[] input,
                                 int w,
                                 int h,
                                 int ks,
                                 double theta)
Takes an input image and a gaussian distribution, calculates an appropriate kernel and applies a convolution to gaussian smooth the image.
Parameters:
input - the input image array
w - the width of the image
h - the height of the image
ks - the size of the kernel to be generated
theta - the gaussian distribution
Returns:
smoothed image array