net.grelf.image
Class ByteMask

java.lang.Object
  extended by net.grelf.image.ByteMask
Direct Known Subclasses:
BlobMask

public class ByteMask
extends java.lang.Object

holding a byte array, eg for use as a binary mask over an image, in segmentation.


Field Summary
protected  byte[][] data
           
static byte MASK_CLEAR
           
static byte MASK_SET
          For the blob detection mechanism to work, thresholding/segmentation must set value 3 at all detected pixels and 0 at all others.
 
Constructor Summary
ByteMask(byte[][] mask)
          Construct with a reference to an external byte array.
ByteMask(int width, int height)
          Construct an empty mask of the given dimensions.
 
Method Summary
 void dilate()
          Operation on mask.
 void erode()
          Operation on mask.
 byte[][] getData()
          Get a reference to the mask array itself.
 void setData(byte[][] aMask)
          Set the mask array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MASK_SET

public static final byte MASK_SET
For the blob detection mechanism to work, thresholding/segmentation must set value 3 at all detected pixels and 0 at all others.

See Also:
Constant Field Values

MASK_CLEAR

public static final byte MASK_CLEAR
See Also:
Constant Field Values

data

protected byte[][] data
Constructor Detail

ByteMask

public ByteMask(int width,
                int height)
Construct an empty mask of the given dimensions.


ByteMask

public ByteMask(byte[][] mask)
Construct with a reference to an external byte array.

Method Detail

getData

public byte[][] getData()
Get a reference to the mask array itself.


setData

public void setData(byte[][] aMask)
Set the mask array.


dilate

public void dilate()
Operation on mask. Pixels which are set become a 3 x 3 block of set pixels. Useful for joining up poorly segmented blobs. Does nothing if mask is not set.


erode

public void erode()
Operation on mask. Pixels which are clear (0) become a 3 x 3 block of clear pixels. Useful for separating poorly segmented blobs which are joined by narrow necks. Does nothing if mask is not set.