aimsalgo  5.0.5
Neuroimaging image processing
harris.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef AIMS_MATH_HARRIS_H
36 #define AIMS_MATH_HARRIS_H
37 
38 #include <iostream>
39 #include <aims/bucket/bucketMap.h>
40 #include <aims/data/data.h>
41 
59 template <class T>
61  public :
62 
66  BaseHarrisDetector(const AimsData<T> & image,
67  const double sigma = 1.2,
68  const double k = 0.6,
69  const double epsilon = 1E-3,
70  const T levels = (T)255);
71 
75  virtual double gaussian(const double x,
76  const double y,
77  const double z);
78 
79  virtual void computeDerivatives() {}
80 
84  virtual double harrisMeasure(const int x,
85  const int y,
86  const int z,
87  const int t) = 0;
88 
92  virtual void computeHarrisMap();
93 
97  virtual bool isSpatialMaxima(const int x,
98  const int y,
99  const int z,
100  const int t) = 0;
101 
102 
106  virtual void computeCorners();
107 
113  virtual void filter(int minDistance);
114 
119 
124 
125  protected :
126 
127  // Parameters
128  double _epsilon;
129  double _k;
130  double _sigma, _sigma2;
131  double _u;
133  double _f;
134  int _radius;
135  int _window;
136 
137  // Image
139  AimsData<double> _g; // Gaussian window
140 
141  // Harris measure map
143 
144  // Corners
146 };
147 
148 template <class T, int D>
150 };
151 
152 template <class T>
153 class HarrisDetector<T, 2>
154  : public BaseHarrisDetector<T> {
155 
156  public :
157 
162  double sigma = 1.2,
163  double k = 0.6,
164  double epsilon = 1E-3,
165  T levels = 255);
166 
170  virtual void computeDerivatives();
171 
175  virtual double harrisMeasure(const int x,
176  const int y,
177  const int z,
178  const int t);
179 
183  virtual bool isSpatialMaxima(const int x,
184  const int y,
185  const int z,
186  const int t);
187 
188  private :
189  // Derivatives
190  AimsData<double> _lx2, _ly2, _lxy;
191 };
192 
193 
194 #endif
Harris Corner Detector.
Definition: harris.h:60
aims::BucketMap< Void > corners()
Get detected corners.
virtual double harrisMeasure(const int x, const int y, const int z, const int t)=0
Compute harris measure for a pixel.
AimsData< T > _image
Definition: harris.h:138
AimsData< double > _hmap
Definition: harris.h:142
virtual void computeCorners()
Perfom the Harris Corner Detection.
double _epsilon
Definition: harris.h:128
double _sigma2
Definition: harris.h:130
aims::BucketMap< double > _corners
Definition: harris.h:145
AimsData< double > harrisMap()
Get processed Harris map.
virtual bool isSpatialMaxima(const int x, const int y, const int z, const int t)=0
Check that pixel is a maxima of the Harris map.
BaseHarrisDetector(const AimsData< T > &image, const double sigma=1.2, const double k=0.6, const double epsilon=1E-3, const T levels=(T) 255)
Constructor.
T epsilon()
Definition: dynamic_d.h:50
virtual void computeDerivatives()
Definition: harris.h:79
AimsData< double > _g
Definition: harris.h:139
virtual double gaussian(const double x, const double y, const double z)
Gaussian function.
virtual void computeHarrisMap()
Compute the Harris measure for each pixel of the image.
virtual void filter(int minDistance)
Filter detected corners.