sigus.segmentation
Class ColorBasedSegmentation

java.lang.Object
  extended bysigus.segmentation.ColorBasedSegmentation

public class ColorBasedSegmentation
extends java.lang.Object

Implements a color based segmentation technique based on statistichal models of the target object color.


Field Summary
(package private)  int dimension
          Dimension of the color space.
private  boolean estimated
          True when mean e standard deviation parameters have been estimated
(package private)  double[] muValues
          Mean values for each variable
(package private)  int N
          Maximum Number of samples collected.
(package private)  int nn
          Samples collected so far
(package private)  double[] sigmaValues
          Sigma values for each variable
(package private)  double stdMult
          The constant that should be multiplied to the standard deviation when calculating the interval, for each variable, that will be used to identify target pixels
(package private)  java.awt.Rectangle targetSampleWindow
          Dimensions and position of the rectangular window, in the training image, where the samples will be collected
(package private)  int[][] values
          Variable Values
 
Constructor Summary
ColorBasedSegmentation()
           
 
Method Summary
(package private)  void clearSamplesAndParameters()
           
(package private)  void collectSample(float[] hsb)
           
(package private)  void estimateParameters()
          Calculate Means and Standard Deviations values for all variables
 void extractSamples(byte[] inData, byte[] jmfData, byte[] outData, int width, int height)
          Collect H and S values
(package private)  boolean isTargetColor(int R, int G, int B)
          True if H and S value of the pixel are inside the calculated limits
 void segment(byte[] inData, byte[] jmfData, byte[] outData, int width, int height)
          Takes an input image, inData, and creates and output image, outData, with all pixels that are not part of the target object (a hand, a mice, etc), set to zero
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dimension

int dimension
Dimension of the color space. Initialized in 2 because the model will be based on two variables: Hue and Saturation


targetSampleWindow

java.awt.Rectangle targetSampleWindow
Dimensions and position of the rectangular window, in the training image, where the samples will be collected


muValues

double[] muValues
Mean values for each variable


sigmaValues

double[] sigmaValues
Sigma values for each variable


N

int N
Maximum Number of samples collected. It is assumed that the same number of samples will be collected for each variable


nn

int nn
Samples collected so far


values

int[][] values
Variable Values


stdMult

double stdMult
The constant that should be multiplied to the standard deviation when calculating the interval, for each variable, that will be used to identify target pixels


estimated

private boolean estimated
True when mean e standard deviation parameters have been estimated

Constructor Detail

ColorBasedSegmentation

public ColorBasedSegmentation()
Method Detail

segment

public void segment(byte[] inData,
                    byte[] jmfData,
                    byte[] outData,
                    int width,
                    int height)
Takes an input image, inData, and creates and output image, outData, with all pixels that are not part of the target object (a hand, a mice, etc), set to zero

Parameters:
width - Image width
height - Image height

estimateParameters

void estimateParameters()
Calculate Means and Standard Deviations values for all variables


isTargetColor

boolean isTargetColor(int R,
                      int G,
                      int B)
True if H and S value of the pixel are inside the calculated limits


extractSamples

public void extractSamples(byte[] inData,
                           byte[] jmfData,
                           byte[] outData,
                           int width,
                           int height)
Collect H and S values


clearSamplesAndParameters

void clearSamplesAndParameters()

collectSample

void collectSample(float[] hsb)