Facemorph
Class GaborPyramid

java.lang.Object
  extended by Facemorph.GaborPyramid

public class GaborPyramid
extends java.lang.Object


Field Summary
 FloatImage[] imaginary_x
          imaginary x direction filtered images
 FloatImage[] imaginary_xy
          imaginary xy direction filtered images
 FloatImage[] imaginary_y
          imaginary y direction filtered images
 FloatImage[] imaginary_yx
          imaginary yx direction filtered images
 int levels
          number of levels in the pyramid
 FloatImage[] real_x
          real x direction filtered images
 FloatImage[] real_xy
          real xy direction filtered images
 FloatImage[] real_y
          real y direction filtered images
 FloatImage[] real_yx
          real yx direction filtered images
 FloatImage smooth
          low pass residual image
 
Constructor Summary
GaborPyramid()
          Constructs an empty gabor Pyramid
GaborPyramid(GaborPyramid rhs)
          Constructs a GaborPyramid by copying the supplied
GaborPyramid(int baseWidth, int baseHeight, int levs)
          Constructs an empty Gabor pyramid of the desired size
 
Method Summary
 void add(GaborPyramid gaborPyramid)
          Add cell-wise two pyramids together
 void addToAverage(GaborPyramid pyr, int N)
          Useful method for creating the mean
 void addWeighted(GaborPyramid gaborPyramid, float w)
          Add cell-wise two pyramids together
 float averageComplexMagnitude(int lev, int direction)
          Finds the average complex magnitude in a particular subband
 float averageSubbandMagnitude(int lev, int direction, boolean real)
          Calculates the average magnitude in the specified subband
 void build_pyramid(FloatImage img, int levs)
          Build a Pyramid
 void buildPyramidSteerable(FloatImage img, int levs)
          Build a Pyramid using steerable filters
 void collapse_pyramid()
          Collapse the Pyramid, the low-pass residual (smooth) holds the result
 void complexMagnitude()
          In place conversion to a magnitude pyramid (imaginary part set to zero)
 void convolve(float[] filter, int m, int scale)
           
 GaborPyramid copy()
          Creates a copy of this and returns it
 double dotProduct(GaborPyramid pyr)
          Calculates a weighted dot product Weights are 1/number of pixels in each subband
 double dotProduct(GaborPyramid pyr, FloatImage[] masks)
          Calculates a weighted dot product Weights are 1/number of pixels in each subband
 boolean getReal()
           
static void main(java.lang.String[] args)
           
 void mask(FloatImage[] masks)
          Apply a mask to the images
 void read(java.lang.String fname)
           
 void scale(float f)
          Multiplies each value in each pyramid by the supplied value
 void setReal(boolean real)
           
 void square()
          Square each component
 void subtract(GaborPyramid gaborPyramid)
          Subtract subband-wise two pyramids
 void write(java.lang.String fname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

real_x

public FloatImage[] real_x
real x direction filtered images


real_y

public FloatImage[] real_y
real y direction filtered images


real_xy

public FloatImage[] real_xy
real xy direction filtered images


real_yx

public FloatImage[] real_yx
real yx direction filtered images


imaginary_x

public FloatImage[] imaginary_x
imaginary x direction filtered images


imaginary_y

public FloatImage[] imaginary_y
imaginary y direction filtered images


imaginary_xy

public FloatImage[] imaginary_xy
imaginary xy direction filtered images


imaginary_yx

public FloatImage[] imaginary_yx
imaginary yx direction filtered images


smooth

public FloatImage smooth
low pass residual image


levels

public int levels
number of levels in the pyramid

Constructor Detail

GaborPyramid

public GaborPyramid()
Constructs an empty gabor Pyramid


GaborPyramid

public GaborPyramid(int baseWidth,
                    int baseHeight,
                    int levs)
Constructs an empty Gabor pyramid of the desired size

Parameters:
baseWidth - the width of the highest res levels
baseHeight - the height of the highest res levels
levs - the number of levels

GaborPyramid

public GaborPyramid(GaborPyramid rhs)
Constructs a GaborPyramid by copying the supplied

Parameters:
rhs - the GaborPyramid to copy into this
Method Detail

copy

public GaborPyramid copy()
Creates a copy of this and returns it

Returns:
returns a copy of this

build_pyramid

public void build_pyramid(FloatImage img,
                          int levs)
Build a Pyramid

Parameters:
img - the image to construct the pyramid on
levs - the number of levels to build

collapse_pyramid

public void collapse_pyramid()
Collapse the Pyramid, the low-pass residual (smooth) holds the result


buildPyramidSteerable

public void buildPyramidSteerable(FloatImage img,
                                  int levs)
Build a Pyramid using steerable filters

Parameters:
img - the image to construct the pyramid on
levs - the number of levels to build

averageComplexMagnitude

public float averageComplexMagnitude(int lev,
                                     int direction)
Finds the average complex magnitude in a particular subband

Parameters:
lev - the level
direction - the subband
Returns:
returns the average complex magnitude

convolve

public void convolve(float[] filter,
                     int m,
                     int scale)

complexMagnitude

public void complexMagnitude()
In place conversion to a magnitude pyramid (imaginary part set to zero)


setReal

public void setReal(boolean real)

getReal

public boolean getReal()

addToAverage

public void addToAverage(GaborPyramid pyr,
                         int N)
Useful method for creating the mean

Parameters:
pyr - The pyramid to add to this average
N - the number in the sequence being added

dotProduct

public double dotProduct(GaborPyramid pyr)
Calculates a weighted dot product Weights are 1/number of pixels in each subband

Parameters:
pyr - the pyramid to dot product with
Returns:
returns the dot product

dotProduct

public double dotProduct(GaborPyramid pyr,
                         FloatImage[] masks)
Calculates a weighted dot product Weights are 1/number of pixels in each subband

Parameters:
pyr - the pyramid to dot product with
masks - masks, one for each level of the pyramid
Returns:
returns the dot product

mask

public void mask(FloatImage[] masks)
Apply a mask to the images

Parameters:
masks - masks, one for each level of the pyramid

averageSubbandMagnitude

public float averageSubbandMagnitude(int lev,
                                     int direction,
                                     boolean real)
Calculates the average magnitude in the specified subband

Parameters:
lev - the level
direction - the direction 0 (x), 1 (y), 2 (xy) or 3 (yx)
real - if true use the real components , else the imaginary
Returns:
returns the subband magnitude

add

public void add(GaborPyramid gaborPyramid)
Add cell-wise two pyramids together

Parameters:
gaborPyramid -

subtract

public void subtract(GaborPyramid gaborPyramid)
Subtract subband-wise two pyramids

Parameters:
gaborPyramid -

addWeighted

public void addWeighted(GaborPyramid gaborPyramid,
                        float w)
Add cell-wise two pyramids together

Parameters:
gaborPyramid -

write

public void write(java.lang.String fname)
           throws java.io.IOException
Throws:
java.io.IOException

read

public void read(java.lang.String fname)
          throws java.io.IOException
Throws:
java.io.IOException

square

public void square()
Square each component


scale

public void scale(float f)
Multiplies each value in each pyramid by the supplied value

Parameters:
f - the amount to scale the coefficients by

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException