features.filterBanks
Class Stereo

java.lang.Object
  extended by features.filterBanks.FilterBank
      extended by features.filterBanks.Stereo
Direct Known Subclasses:
StereoDoG

public class Stereo
extends FilterBank

This class implements a stereo filterbank, i.e. it computes a depth map at different scales. It uses a physiologically plausible steroe algorithm that consists of simple cell and complex cell computations from right and left images using phase shifted horizontally oriented Gabor wavelets with fixed relationship of Gaussian window scale and spatial frequency of the cosine. Copyright (c) 1999-2005, Michael Abramoff. All rights reserved.


Field Summary
 
Fields inherited from class features.filterBanks.FilterBank
OPPONENCIES
 
Constructor Summary
Stereo(float[] scales, float[] phasesleft, float[] phasesright, int[] channels)
           
Stereo(float[] scales, float[] xshifts, int[] channels)
           
Stereo(float[] scales, int[] channels)
           
 
Method Summary
static float[] complexcell(float[] image_left, float[] image_right, int width, double s, double w, double phil, double phir)
          Compute complex cell output from left and right images for phase phil/r, spatial frequency w and width s.
static Feature D(float[] image_left, float[] image_right, int width, double scale, float[] xshifts, java.lang.String extraText)
          Calculate a depth map at the chosen scale.
 Feature depth(float[] left_image, float[] right_image, int width, java.lang.String extraText)
          Compute a depth map.
static float[] disparity(float[] image_left, float[] image_right, int width, double s, float[] phases_left, float[] phases_right)
          Compute disparity from left and right images for shift s.
 Feature filter(int filternumber, int[] left_image, int[] right_image, int width, java.lang.String extraText)
          Apply the filter to a stereo pair.
 int getNumber()
          Return the number of filters in this filter bank.
static float[] linzeros(float[][] mys, float[] yxs, int width, int binning)
          Fit a linear regression line to each of the vectors 0..N*width in matrix[Nxwidth][M] (which is an image of vectors) and return a vector with the zerocrossings of the regression line.
static float[] linzerosOld(float[][] mys, float[] yxs, int width, int binning)
          Deprecated.  
static java.lang.String name(double scale, int color, java.lang.String extraText)
           
 java.lang.String name(int filternumber, java.lang.String preString)
          Get the feature name for filternumber.
static float[] quadraturepair(float[] image_left, float[] image_right, int width, double s, double w, double phil, double phir)
          Compute the output of a quadrature pair of simples cell for phase phil/r, spatial frequency w and width s.
static Feature S(float[] image_left, float[] image_right, int width, double[] params, java.lang.String extraText)
          Wrapper for steroe disparity operations.
 
Methods inherited from class features.filterBanks.FilterBank
scaleSet, thetaSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stereo

public Stereo(float[] scales,
              int[] channels)

Stereo

public Stereo(float[] scales,
              float[] xshifts,
              int[] channels)

Stereo

public Stereo(float[] scales,
              float[] phasesleft,
              float[] phasesright,
              int[] channels)
Method Detail

getNumber

public int getNumber()
Description copied from class: FilterBank
Return the number of filters in this filter bank.

Specified by:
getNumber in class FilterBank

name

public java.lang.String name(int filternumber,
                             java.lang.String preString)
Description copied from class: FilterBank
Get the feature name for filternumber.

Specified by:
name in class FilterBank

name

public static java.lang.String name(double scale,
                                    int color,
                                    java.lang.String extraText)

filter

public Feature filter(int filternumber,
                      int[] left_image,
                      int[] right_image,
                      int width,
                      java.lang.String extraText)
               throws java.lang.Exception
Apply the filter to a stereo pair. The filter is determined by the currentFilter number which indicates which scale, order and orientation to use.

Throws:
java.lang.Exception

depth

public Feature depth(float[] left_image,
                     float[] right_image,
                     int width,
                     java.lang.String extraText)
              throws java.lang.Exception
Compute a depth map. The filter is determined by the currentFilter number which indicates which scale, order and orientation to use.

Throws:
java.lang.Exception

S

public static Feature S(float[] image_left,
                        float[] image_right,
                        int width,
                        double[] params,
                        java.lang.String extraText)
                 throws java.lang.Exception
Wrapper for steroe disparity operations. Return a Feature corresponding to a disparity image. See implementations for details of algorithms.

Throws:
java.lang.Exception

quadraturepair

public static float[] quadraturepair(float[] image_left,
                                     float[] image_right,
                                     int width,
                                     double s,
                                     double w,
                                     double phil,
                                     double phir)
                              throws java.lang.Exception
Compute the output of a quadrature pair of simples cell for phase phil/r, spatial frequency w and width s. See Qian et al, 1997 Computes for a right and a left image the output as follows: convolve left image with a Gabor with phase phil, spatial frequency w and width s. convolve right image with a Gabor with phase phir, spatial frequency w and width s. add these convolutions

Parameters:
image_left - the left image
image_right - the right image.
width - the width of these images
s - the scale of the Gabor wavelet.
w - the (spatial) frequency of the Gabor wavelet (in radians per degree, w = 2PIf in cycles per degree).
phil, - the phase of the left Gabor wavelet (in radians).
phir, - the phase of the right Gabor wavelet (in radians).
Returns:
the output of the simple cell: the square of the sum of left and right colvolutions.
Throws:
java.lang.Exception

complexcell

public static float[] complexcell(float[] image_left,
                                  float[] image_right,
                                  int width,
                                  double s,
                                  double w,
                                  double phil,
                                  double phir)
                           throws java.lang.Exception
Compute complex cell output from left and right images for phase phil/r, spatial frequency w and width s. Computes for a right and a left image the complex cell output for a shift xshift, phase phi, and scale s. Basically blurs the ouput of the simple cells over a small patch.

Parameters:
image_left - the left image
image_right - the right image.
width - the width of these images
xshift - the x shift to perform.
s - the scale.
w - the frequency of the Gabor wavelet.
phi, - the phase of the Gabor wavelet.
Returns:
the output of the complex cell for s, w, phi.
Throws:
java.lang.Exception

disparity

public static float[] disparity(float[] image_left,
                                float[] image_right,
                                int width,
                                double s,
                                float[] phases_left,
                                float[] phases_right)
                         throws java.lang.Exception
Compute disparity from left and right images for shift s. Normalizes the difference for a -PI/4 complex cell and a +PI/4 complex cell with the 0 complex cell.

Parameters:
image_left - the left image
image_right - the right image.
width - the width of these images
xshift - the x shift to perform.
s - the scale.
w - the frequency of the Gabor wavelet.
phi, - the phase of the Gabor wavelet.
Returns:
the output of the complex cell for s, w, phi.
Throws:
java.lang.Exception

D

public static Feature D(float[] image_left,
                        float[] image_right,
                        int width,
                        double scale,
                        float[] xshifts,
                        java.lang.String extraText)
                 throws java.lang.Exception
Calculate a depth map at the chosen scale. Computes the sizes of the difference at many different shifts, does a linear regression on these sizes for each pixel, and computes the zero-crossing for that equation for each pixel.

Parameters:
image_left - the left image
image_right - the right image.
width - the width of these images
xshifts - the x shifts to perform.
scale - the scales at which to perform the shift (firtst do the convolution with a GaussianDerivative kernel of order and scale).
Returns:
ft, a Feature with the depth map.
Throws:
java.lang.Exception

linzeros

public static float[] linzeros(float[][] mys,
                               float[] yxs,
                               int width,
                               int binning)
Fit a linear regression line to each of the vectors 0..N*width in matrix[Nxwidth][M] (which is an image of vectors) and return a vector with the zerocrossings of the regression line. Uses bijfit package for least squares regression.

Parameters:
mys - a matrix[N*width][M] of y values, which is an image.
width - the width in pixels of m.
binning: - how many pixels to bin over in vertical and horizontal directions of the image.
yxs - a vector with the x values corresponding to the y - values.
Returns:
a vector map[Nxwidth] with the zero crossings of each fit.

linzerosOld

public static float[] linzerosOld(float[][] mys,
                                  float[] yxs,
                                  int width,
                                  int binning)
Deprecated. 

Fit a linear regression line to each of the vectors 0..N*width in matrix[Nxwidth][M] (which is an image of vectors) and return a vector with the zerocrossings of the regression line.

Parameters:
mys - a matrix[N*width][M] of y values, which is an image.
width - the width in pixels of m.
binning: - how many pixels to bin over in vertical and horizontal directions of the image.
yxs - a vector with the x values corresponding to the y - values.
Returns:
a vector map[Nxwidth] with the zero crossings of each fit.