Class Dilate

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

public class Dilate
extends java.lang.Thread

Dilate is an algorithm to dilate a binary image using a 3x3 kernel.

Author:
Simon Horne, Craig Strachan, Judy Robertson, SELLIC Online

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Dilate()
          Default no-arg constructor.
 
Method Summary
static BinaryFast dilate_image(BinaryFast binary, int[] kernel, int iterations)
          Takes a BinaryFast image, a kernel and the number of iterations and performs the necessary number of dilations on the image.
static BinaryFast dilateSingleIteration(BinaryFast binary, int[] kernel)
          Takes a BinaryFast representation of an image and a kernel and applies a single iteration of the dilate algorithm.
static boolean kernelAll1s(int[] kernel)
          Returns true if the kernel consists of 9 1s.
static boolean kernelMatch(java.awt.Point p, int[][] pixels, int w, int h, int[] kernel)
          Takes a point and a 2D array representing an image and a kernel, if the area around the point matches the kernel then the method returns true.
 
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

Dilate

public Dilate()
Default no-arg constructor.
Method Detail

kernelMatch

public static boolean kernelMatch(java.awt.Point p,
                                  int[][] pixels,
                                  int w,
                                  int h,
                                  int[] kernel)
Takes a point and a 2D array representing an image and a kernel, if the area around the point matches the kernel then the method returns true.
Parameters:
p - The point in the centre of the neighbourhood to be checked.
pixels - The 2D array representing the image.
w - The width of the image.
h - The height of the image.
kernel - The kernel used to match with the image.
Returns:
True or false (true - the kernel and image match).

kernelAll1s

public static boolean kernelAll1s(int[] kernel)
Returns true if the kernel consists of 9 1s.
Parameters:
kernel - The array representing the kernel.
Returns:
True or false (true - kernel all 1s).

dilateSingleIteration

public static BinaryFast dilateSingleIteration(BinaryFast binary,
                                               int[] kernel)
Takes a BinaryFast representation of an image and a kernel and applies a single iteration of the dilate algorithm.
Parameters:
binary - The BinaryFast representation of the input image.
kernel - The array representing the kernel.
Returns:
The BinaryFast representation of the new image after dilation.

dilate_image

public static BinaryFast dilate_image(BinaryFast binary,
                                      int[] kernel,
                                      int iterations)
Takes a BinaryFast image, a kernel and the number of iterations and performs the necessary number of dilations on the image.
Parameters:
binary - The BinaryFast representation of the input image.
kernel - The array representing the kernel.
iterations - The requested number of iterations.
Returns:
The BinaryFast representation of the new image after dilation.