Kernels.H File Reference

#include "Util/Types.H"
#include "Image/Pixels.H"
#include <complex>
Include dependency graph for Kernels.H:

Go to the source code of this file.

Functions

template<class T >
Image< T > dogFilterHmax (const float theta, const float gamma, const int halfsize, const float div)
 Create a DoG kernel for HMax.
template<class T >
Image< T > dogFilter (const float stddev, const float theta, const int halfsize=0)
 Create a DoG kernel; if halfsize is 0, compute it automatically.
template<class T >
Image< T > dogFilter (const float stddev, const int halfsize=0)
 Create a non oriented DoG kernel; if halfsize is 0, compute it automatically.
template<class T >
Image< T > dogFilterHmax (const float stddev, const float theta, const int cBegin, const int cEnd)
 Create a dog kernel for HMAX.
Image< PixRGB< byte > > gaborFilterRGB (const float stddev, const float freq, const float theta, const float hueShift)
template<class T >
Image< T > gaborFilter (const float stddev, const float period, const float phase, const float theta, const float=0.0f, const float ampl=1.0f)
 Create a Gabor kernel.
template<class T >
Image< T > gaborFilter (const float scale, const float theta)
 Create a Gabor kernel with a a given scale and angle (in radians).
template<class T >
Image< T > gaborFilter2 (const float stddev, const float period, const float phase, const float theta, const float sigMod=1.0F, const float amplitude=1.0F)
 Create a Gabor kernel with default 1*sigma^2 instead of 2*sigma^2.
Image< float > gaborFilter3 (const float major_stddev, const float minor_stddev, const float period, const float phase, const float theta, int size=-1)
 Produces a Gabor kernel with optionally unequal major+minor axis lengths.
template<class T >
Image< T > gaussian2D (const float stddev, const float sigMod=1.0F, const float amplitude=255.0F)
 Create a 2D gaussian, compatible with gaborFilter2 for mask purposes.
template<class T >
Image< T > gaussianBlob (const Dims &dims, const Point2D< int > &center, const float sigmaX, const float sigmaY)
 Create a 2D Gaussian blob centered at given coords.
template<class T >
Image< T > gaussianBlobUnnormalized (const Dims &dims, const Point2D< int > &center, const float sigmaX, const float sigmaY)
 Create a 2D Gaussian blob centered at given coords, with peak value = 1.0.
Image< float > binomialKernel (const int sz)
 Create a 1D binomial distribution kernel (shape of sz-by-1).
template<class T >
Image< T > grating (const int width, const int height, const float period, const float phase, const float theta)
 Create a sinusoidal grating.
template<class T >
Image< T > gaussian (const float coeff, const float sigma, const int maxhw, const float threshperc=1.0)
 Generate 1D gaussian.
template<class T >
Image< T > longRangeExcFilter (const float factor, const float orient)
 Build a long-range excitatory filter.
template<class T >
Image< T > fixationMask (const Dims &dims, const Point2D< int > &fixation, const float pixperdeg, const T maxval, const float sigma=0.5f)
 Generate a fixation mask, i.e., a Gaussian blob.
template<class T >
Image< T > fixationMask (const Image< T > &mask, const Point2D< int > &fixation, const float pixperdeg, const T maxval, const float sigma=0.5f)
 Generate a fixation mask, adding it to existing mask.
Image< bytetwofiftyfives (Dims d)
 Return an image of Dimensions d filled with 255s.
Image< bytetwofiftyfives (int w, int h)
 Return an image of width w and height h filled with 255s.
Image< bytetwofiftyfives (int w)
 Return a square image of width w filled with 255s.

Detailed Description

Functions to construct various kinds of filter kernels

Definition in file Kernels.H.


Function Documentation

Image<float> binomialKernel ( const int  sz  ) 

Create a 1D binomial distribution kernel (shape of sz-by-1).

These kernels are normalized to sum to 1, and are used (implicitly) in the various lowPass*() functions.

Definition at line 502 of file Kernels.C.

References ASSERT, NO_INIT, and Image< T >::setVal().

template<class T >
Image<T> dogFilter ( const float  stddev,
const int  halfsize = 0 
) [inline]

Create a non oriented DoG kernel; if halfsize is 0, compute it automatically.

Definition at line 123 of file Kernels.C.

References Image< T >::beginw(), exp(), and NO_INIT.

template<class T >
Image<T> dogFilter ( const float  stddev,
const float  theta,
const int  halfsize = 0 
) [inline]

Create a DoG kernel; if halfsize is 0, compute it automatically.

Definition at line 93 of file Kernels.C.

References Image< T >::beginw(), exp(), NO_INIT, and sqrt().

template<class T >
Image<T> dogFilterHmax ( const float  stddev,
const float  theta,
const int  cBegin,
const int  cEnd 
) [inline]

Create a dog kernel for HMAX.

Definition at line 149 of file Kernels.C.

References mean(), squared(), sum(), and Rectangle::tlbrI().

template<class T >
Image<T> dogFilterHmax ( const float  theta,
const float  gamma,
const int  halfsize,
const float  div 
) [inline]

Create a DoG kernel for HMax.

Definition at line 56 of file Kernels.C.

References Image< T >::beginw(), exp(), NO_INIT, and sqrt().

template<class T >
Image<T> fixationMask ( const Image< T > &  mask,
const Point2D< int > &  fixation,
const float  pixperdeg,
const T  maxval,
const float  sigma = 0.5f 
) [inline]

Generate a fixation mask, adding it to existing mask.

Definition at line 614 of file Kernels.C.

References Image< T >::beginw(), exp(), Image< T >::getHeight(), Image< T >::getWidth(), Point2D< T >::i, and sqrt().

template<class T >
Image<T> fixationMask ( const Dims dims,
const Point2D< int > &  fixation,
const float  pixperdeg,
const T  maxval,
const float  sigma = 0.5f 
) [inline]

Generate a fixation mask, i.e., a Gaussian blob.

Definition at line 605 of file Kernels.C.

References ZEROS.

template<class T >
Image<T> gaborFilter ( const float  scale,
const float  theta 
) [inline]

Create a Gabor kernel with a a given scale and angle (in radians).

Definition at line 193 of file Kernels.C.

References Image< T >::beginw(), exp(), and NO_INIT.

template<class T >
Image<T> gaborFilter ( const float  stddev,
const float  period,
const float  phase,
const float  theta,
const   float = 0.0f,
const float  ampl = 1.0f 
) [inline]

Create a Gabor kernel.

Definition at line 162 of file Kernels.C.

References Image< T >::beginw(), exp(), log(), NO_INIT, psi(), and sqrt().

template<class T >
Image<T> gaborFilter2 ( const float  stddev,
const float  period,
const float  phase,
const float  theta,
const float  sigMod = 1.0F,
const float  amplitude = 1.0F 
) [inline]

Create a Gabor kernel with default 1*sigma^2 instead of 2*sigma^2.

this is essentailly used in some psycho metric experiments (for instance , Polat and Sagi, 1994) instead of 2*sigma^2 so it is included here, if your weird you may make sigMod something other than 1.0 (or 2.0). As always feel free to be loopy

Definition at line 321 of file Kernels.C.

References Image< T >::beginw(), exp(), log(), NO_INIT, psi(), and sqrt().

Image<float> gaborFilter3 ( const float  major_stddev,
const float  minor_stddev,
const float  period,
const float  phase,
const float  theta,
int  size = -1 
)

Produces a Gabor kernel with optionally unequal major+minor axis lengths.

Parameters:
size determines the filter size (in pixels) - in the default case (-1), the size is computed from the stddev

Definition at line 352 of file Kernels.C.

References Image< T >::beginw(), exp(), log(), mean(), NO_INIT, psi(), and sqrt().

template<class T >
Image<T> gaussian ( const float  coeff,
const float  sigma,
const int  maxhw,
const float  threshperc = 1.0 
) [inline]

Generate 1D gaussian.

Parameters:
coeff a coefficient so that the peak of the Gaussian has the value coeff. If coeff is given as 0.0, then it will be computed internally as 1/(sigma*sqrt(2*pi)), i.e., the normal Gaussian coefficient.
sigma the Gaussian standard deviation, in pixels
maxhw maximum allower filter half-width. If maxhw is 0 there is no limit.
threshperc cut the spatial extent of the kernel so that only values greater than threshperc times the max remain in the kernel. This allows us to automatically compute the appropriate kernel size to use for a given sigma and approximation tolerance given by threshpec.

Definition at line 548 of file Kernels.C.

References exp(), log(), NO_INIT, Image< T >::setVal(), and sqrt().

template<class T >
Image<T> gaussian2D ( const float  stddev,
const float  sigMod = 1.0F,
const float  amplitude = 255.0F 
) [inline]

Create a 2D gaussian, compatible with gaborFilter2 for mask purposes.

Definition at line 395 of file Kernels.C.

References Image< T >::beginw(), exp(), log(), NO_INIT, and sqrt().

template<class T >
Image<T> gaussianBlob ( const Dims dims,
const Point2D< int > &  center,
const float  sigmaX,
const float  sigmaY 
) [inline]

Create a 2D Gaussian blob centered at given coords.

Definition at line 421 of file Kernels.C.

References Dims::h(), Point2D< T >::i, NO_INIT, Image< T >::setVal(), and Dims::w().

template<class T >
Image<T> gaussianBlobUnnormalized ( const Dims dims,
const Point2D< int > &  center,
const float  sigmaX,
const float  sigmaY 
) [inline]

Create a 2D Gaussian blob centered at given coords, with peak value = 1.0.

Definition at line 445 of file Kernels.C.

References Dims::h(), Point2D< T >::i, NO_INIT, Image< T >::setVal(), and Dims::w().

template<class T >
Image<T> grating ( const int  width,
const int  height,
const float  period,
const float  phase,
const float  theta 
) [inline]

Create a sinusoidal grating.

Definition at line 525 of file Kernels.C.

References Image< T >::beginw(), NO_INIT, and psi().

template<class T >
Image<T> longRangeExcFilter ( const float  factor,
const float  orient 
) [inline]

Build a long-range excitatory filter.

Definition at line 578 of file Kernels.C.

References Image< T >::beginw(), exp(), NO_INIT, and sqrt().

Image<byte> twofiftyfives ( int  w  ) 

Return a square image of width w filled with 255s.

Definition at line 647 of file Kernels.C.

Image<byte> twofiftyfives ( int  w,
int  h 
)

Return an image of width w and height h filled with 255s.

Definition at line 641 of file Kernels.C.

Image<byte> twofiftyfives ( Dims  d  ) 

Return an image of Dimensions d filled with 255s.

Definition at line 633 of file Kernels.C.

References Image< T >::clear(), and NO_INIT.

Generated on Sun May 8 08:42:41 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3