Class HitMiss

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

public class HitMiss
extends java.lang.Thread

HitMiss is an algorithm to 'hit and miss' a binary image using a 3x3 kernel.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HitMiss()
          Default no-args constructor.
 
Method Summary
static BinaryFast hitmiss_image(BinaryFast b, int[] kernel)
          Takes a BinaryFast image representation and a kernel and applies the hitmiss algorithm to the image.
static java.util.HashSet HitMissHashSet(BinaryFast b, java.util.HashSet input, int[] kernel)
          Applies the hitmiss operation to a set of pixels stored in a hash table.
static boolean kernelAll0s(int[] kernel)
          Returns true if the 3x3 kernel consists of 9 0s.
static boolean kernelAll1s(int[] kernel)
          Returns true if the 3x3 kernel consists of 9 1s.
static boolean kernelMatch(java.awt.Point p, int[][] pixels, int w, int h, int[] kernel)
          Returns true if the 8 neighbours of p match the kernel 0 is background 1 is foreground 2 is don't care.
static boolean kernelNo0s(int[] kernel)
          Returns true if the 3x3 kernel has no 0s.
static boolean kernelNo1s(int[] kernel)
          Returns true if the 3x3 kernel has no 1s.
 
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

HitMiss

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

kernelMatch

public static boolean kernelMatch(java.awt.Point p,
                                  int[][] pixels,
                                  int w,
                                  int h,
                                  int[] kernel)
Returns true if the 8 neighbours of p match the kernel 0 is background 1 is foreground 2 is don't care.
Parameters:
p - the point at the centre of the 9 pixel neighbourhood
pixels - the 2D array of the image
w - the width of the image
h - the height of the image
kernel - the array of the kernel values
Returns:
True if the kernel and image match.

HitMissHashSet

public static java.util.HashSet HitMissHashSet(BinaryFast b,
                                               java.util.HashSet input,
                                               int[] kernel)
Applies the hitmiss operation to a set of pixels stored in a hash table.
Parameters:
b - the BinaryFast input image
input - the set of pixels requiring matching
kernel - the kernel to match them with
Returns:
A hash table containing all the successful matches.

kernelAll1s

public static boolean kernelAll1s(int[] kernel)
Returns true if the 3x3 kernel consists of 9 1s.
Parameters:
kernel - the array storing the 9 values
Returns:
True if all 1s (false otherwise)

kernelAll0s

public static boolean kernelAll0s(int[] kernel)
Returns true if the 3x3 kernel consists of 9 0s.
Parameters:
kernel - the array storing the 9 values
Returns:
True if all 0s (false otherwise)

kernelNo0s

public static boolean kernelNo0s(int[] kernel)
Returns true if the 3x3 kernel has no 0s.
Parameters:
kernel - the array storing the 9 values
Returns:
True if no 0s (false otherwise)

kernelNo1s

public static boolean kernelNo1s(int[] kernel)
Returns true if the 3x3 kernel has no 1s.
Parameters:
kernel - the array storing the 9 values
Returns:
True if no 1s (false otherwise)

hitmiss_image

public static BinaryFast hitmiss_image(BinaryFast b,
                                       int[] kernel)
Takes a BinaryFast image representation and a kernel and applies the hitmiss algorithm to the image.
Parameters:
b - the image in BinaryFast representation
kernel - the kernel in 1D array form
Returns:
The new BinaryFast image after hitmissing