analysis
Class Histogram

java.lang.Object
  extended by analysis.Histogram

public class Histogram
extends java.lang.Object

Considers a bitmap and produces a simple histogram, giving, for each pixel byte value, the number of pixels in the bitmap having that value. Currently creates a separate histogram for each color.

Author:
Jonathan L Dautrich Jr.

Field Summary
private  long[] blue
           
private  boolean chiSquaredComputed
           
private  double chiSquaredP
           
private  double chiSquaredS
           
private  long[] green
           
private  long[] red
           
 
Constructor Summary
Histogram(Bitmap bitmap)
          Creates a Histogram for the specified bitmap over all pixels
Histogram(Bitmap bitmap, int startX, int startY, int endX, int endY)
          Creates a Histogram for the specified bitmap over the range of pixels specified, including all of every row between startY and endY, and only those portions of the startY and endY rows after startX and before startY, respectively, inclusive.
 
Method Summary
private  void countPixel(Pixel pixel)
           
 double getChiSquaredP()
          Returns the ChiSquared p-value for this histogram.
 double getChiSquaredS()
          Returns the ChiSquared S-value for this histogram.
static void printComparison(Histogram a, Histogram b, boolean color)
           
 void printHistogram(boolean color)
           
private static void printHistogram(java.lang.String colorName, long[]... arrays)
           
private  void runChiSquaredTest()
          Runs the ChiSquared test on this distribution if it has not already been run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

red

private long[] red

blue

private long[] blue

green

private long[] green

chiSquaredS

private double chiSquaredS

chiSquaredP

private double chiSquaredP

chiSquaredComputed

private boolean chiSquaredComputed
Constructor Detail

Histogram

public Histogram(Bitmap bitmap)
Creates a Histogram for the specified bitmap over all pixels

Parameters:
bitmap -

Histogram

public Histogram(Bitmap bitmap,
                 int startX,
                 int startY,
                 int endX,
                 int endY)
Creates a Histogram for the specified bitmap over the range of pixels specified, including all of every row between startY and endY, and only those portions of the startY and endY rows after startX and before startY, respectively, inclusive.

Parameters:
bitmap -
startX -
startY -
endX -
endY -
Method Detail

countPixel

private void countPixel(Pixel pixel)

printHistogram

public void printHistogram(boolean color)
Parameters:
grayscale - true to print all three histogram colors, false to print only one (grayscale)

printComparison

public static void printComparison(Histogram a,
                                   Histogram b,
                                   boolean color)

printHistogram

private static void printHistogram(java.lang.String colorName,
                                   long[]... arrays)

runChiSquaredTest

private void runChiSquaredTest()
Runs the ChiSquared test on this distribution if it has not already been run. Populates the chiSquaredS and chiSquaredP values for retrieval. Currently runs only for the red (grayscale) pixel component. Here, the statistic compares the actual number of pixels in every even bin to the expected number of pixels in every even bin (avg of number in even bin and next (odd) bin)


getChiSquaredS

public double getChiSquaredS()
Returns the ChiSquared S-value for this histogram.

Returns:

getChiSquaredP

public double getChiSquaredP()
Returns the ChiSquared p-value for this histogram.

Returns: