KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
filterbank.h
Go to the documentation of this file.
1 // filterbank.h - filterbank convolution class
3 // Author: Doron Tal
4 // Date created: April, 2000
5 
6 #ifndef _FILTERBANK_H
7 #define _FILTERBANK_H
8 
9 #include "wrap_dtlib_cpp/img.h"
11 
12 // 'KERNEL_SIDE_FACTOR' is how much we multiply the largest sigma of our
13 // filterbank gaussians by in order to get the Kernel side. FWHM is 2.35
14 // sigma, so use 3.0 to be safe (but 3.0 is multiplied by sqrt(2) to get
15 // diagonal cases right..)
16 
17 #define KERNEL_SIDE_FACTOR 4.2426f
18 
19 namespace DTLib {
20 
21  // filterbank class 'CFilterbank':
22  // after constructing it and setting it up with Setup(..), it's
23  // ready to perform convolutions using Convolve().
24  // Separating the setup stage from convolution stage allows us
25  // to perform repetitive convolutions without the setup overhead.
26 
28  {
29  public:
30  CFilterbank();
31 
32  ~CFilterbank();
33 
34  // returns the number of kernels
35  inline int nKernels() { return m_nKernels; }
36 
37  // returns a pointer to a vector of pointers to float images,
38  // which are the kernels ***TODO***: change this to use a
39  // CImgVec object instead.
40  inline vector<CImg<float>*>* pvecKernels() { return &m_vecKernels; }
41 
43  // sets up the kernels
44 
45  bool Setup(const int nGaussScales,
46  const int nGaussOrientations,
47  const float GaussSigmaY,
48  const float GaussX2YSigmaRatio,
49  const int nDOGScales,
50  const float DOGExcitSigma,
51  const float DOGInhibSigmaRatio1,
52  const float DOGInhibSigmaRatio2);
53 
55  // convolutions with input image 'InImg'. The results are returned
56  // in the image sequence 'OutSeq', where elongated kernels come
57  // first (outer loop over scales, inner loop over orientations,
58  // inner loop over phase, so there are
59  // m_nGaussScales*m_nGaussOrientations*2 frames for the oriented
60  // Gaussian convolutions, plus m_nDOGScales frames for the isotropic
61  // DOG convolutions. scale and orientations are always increasing
62  // in the loops above.
63  void Convolve(CImg<float> &InImg, CImgVec<float> &OutConvVec);
64 
66  // END OF INTERFACE
68 
69  protected:
71 
72  vector<CImg<float>*> m_vecKernels;
73 
74  // input parameters:
83 
84  private:
85  void FreeMemory();
86 
87  };
88 
89 } // namespace DTLib {
90 
91 #endif /* #ifndef _FILTERBANK_H */
int m_nKernels
Definition: filterbank.h:70
void Convolve(CImg< float > &InImg, CImgVec< float > &OutConvVec)
Definition: filterbank.cpp:128
~CFilterbank()
Definition: filterbank.cpp:31
float m_DOGExcitSigma
Definition: filterbank.h:80
int m_nDOGScales
Definition: filterbank.h:79
float m_DOGInhibSigmaRatio2
Definition: filterbank.h:82
vector< CImg< float > * > * pvecKernels()
Definition: filterbank.h:40
int nKernels()
Definition: filterbank.h:35
Definition: filterbank.h:27
Definition: img.h:42
int m_nGaussOrientations
Definition: filterbank.h:76
bool Setup(const int nGaussScales, const int nGaussOrientations, const float GaussSigmaY, const float GaussX2YSigmaRatio, const int nDOGScales, const float DOGExcitSigma, const float DOGInhibSigmaRatio1, const float DOGInhibSigmaRatio2)
Definition: filterbank.cpp:47
vector< CImg< float > * > m_vecKernels
Definition: filterbank.h:72
float m_GaussSigmaY
Definition: filterbank.h:77
float m_GaussX2YSigmaRatio
Definition: filterbank.h:78
int m_nGaussScales
Definition: filterbank.h:75
CFilterbank()
Definition: filterbank.cpp:21
float m_DOGInhibSigmaRatio1
Definition: filterbank.h:81