Facemorph.haar
Class SAT

java.lang.Object
  extended by Facemorph.haar.SAT

public class SAT
extends java.lang.Object

Summed area table


Constructor Summary
SAT(BufferedImg src)
          Creates a summed area table from the top left corner
SAT(BufferedImg src, boolean squared)
          Creates a summed area table from the top left corner
SAT(BufferedImg src, boolean squared, boolean tilted)
          Creates a summed area table from the top left corner
 
Method Summary
 int getMaxX()
          Returns the maximum X value of the summed area table representation.
 int getMaxY()
          Returns the maximum Y value of the summed area table representation.
 double getSumOfTiltedVals(int x, int y, int w, int h)
          Calculate the sum of values between pixel (startX, startY) and (endX, endY)
 double getSumOfVals(int startX, int startY, int endX, int endY)
          Calculate the sum of values between pixel (startX, startY) and (endX, endY)
static void main(java.lang.String[] args)
          Main method for testing
static double sumOfTiltedVals(BufferedImg img, int x, int y, int w, int h)
          Direct calculation of tilted sums for testing
static double sumOfVals(BufferedImg img, int x, int y, int w, int h)
          Direct calculation of sums for testing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAT

public SAT(BufferedImg src)
Creates a summed area table from the top left corner

Parameters:
src - The image to create a summed area table from

SAT

public SAT(BufferedImg src,
           boolean squared)
Creates a summed area table from the top left corner

Parameters:
src - The image to create a summed area table from
squared - should the pixel values be squared prior to building the SAT

SAT

public SAT(BufferedImg src,
           boolean squared,
           boolean tilted)
Creates a summed area table from the top left corner

Parameters:
src - The image to create a summed area table from
squared - should the pixel values be squared prior to building the SAT
tilted - should the SAT be for tilted rectangles
Method Detail

getSumOfVals

public double getSumOfVals(int startX,
                           int startY,
                           int endX,
                           int endY)
Calculate the sum of values between pixel (startX, startY) and (endX, endY)

Parameters:
startX - The x coordinate of the bottom left of the region
startY - The y coordinate of the bottom left of the region
endX - The x coordinate of the top right of the region
endY - The y coordinate of the top right of the region
Returns:
return the sum of values in the rectangle

getSumOfTiltedVals

public double getSumOfTiltedVals(int x,
                                 int y,
                                 int w,
                                 int h)
Calculate the sum of values between pixel (startX, startY) and (endX, endY)

Parameters:
x - The x coordinate of the bottom left of the region
y - The y coordinate of the bottom left of the region
w - The width of the region
h - The height of the region
Returns:
returns the sum of values

sumOfVals

public static double sumOfVals(BufferedImg img,
                               int x,
                               int y,
                               int w,
                               int h)
Direct calculation of sums for testing

Parameters:
img - the image to sum the values from
x - the x-coord of the rectangle
y - the y-coord of the rectangle
w - the width of the rectangle
h - the height of the rectangle
Returns:
return the sum of values

sumOfTiltedVals

public static double sumOfTiltedVals(BufferedImg img,
                                     int x,
                                     int y,
                                     int w,
                                     int h)
Direct calculation of tilted sums for testing

Parameters:
img - the image to sum the values from
x - the x-coord of the rectangle
y - the y-coord of the rectangle
w - the width of the rectangle
h - the height of the rectangle
Returns:
return the sum of values

getMaxX

public int getMaxX()
Returns the maximum X value of the summed area table representation.

Returns:
the maximum X value of the summed area table representation.

getMaxY

public int getMaxY()
Returns the maximum Y value of the summed area table representation.

Returns:
the maximum Y value of the summed area table representation.

main

public static void main(java.lang.String[] args)
Main method for testing

Parameters:
args - the program args