aimsalgo 6.0.0
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 <cartodata/volume/volume.h>
41
42namespace aims
43{
44
61
62 template <class T>
64 {
65 public :
66
71 const double sigma = 1.2,
72 const double k = 0.6,
73 const double epsilon = 1E-3,
74 const T levels = (T)255 );
75
79 virtual double gaussian(const double x,
80 const double y,
81 const double z);
82
83 virtual void computeDerivatives() {}
84
88 virtual double harrisMeasure(const int x,
89 const int y,
90 const int z,
91 const int t) = 0;
92
96 virtual void computeHarrisMap();
97
101 virtual bool isSpatialMaxima(const int x,
102 const int y,
103 const int z,
104 const int t) = 0;
105
106
110 virtual void computeCorners();
111
117 virtual void filter(int minDistance);
118
123
128
129 protected :
130
131 // Parameters
132 double _epsilon;
133 double _k;
135 double _u;
137 double _f;
140
141 // Image
143 carto::VolumeRef<double> _g; // Gaussian window
144
145 // Harris measure map
147
148 // Corners
150 };
151
152 template <class T, int D>
154 {
155 };
156
157 template <class T>
158 class HarrisDetector<T, 2>
159 : public BaseHarrisDetector<T>
160 {
161
162 public :
163
168 double sigma = 1.2,
169 double k = 0.6,
170 double epsilon = 1E-3,
171 T levels = 255 );
172
176 virtual void computeDerivatives();
177
181 virtual double harrisMeasure( const int x,
182 const int y,
183 const int z,
184 const int t );
185
189 virtual bool isSpatialMaxima( const int x,
190 const int y,
191 const int z,
192 const int t );
193
194 private :
195 // Derivatives
196 carto::VolumeRef<double> _lx2, _ly2, _lxy;
197 };
198
199} // namespace aims
200
201#endif
virtual void computeDerivatives()
Definition harris.h:83
virtual double harrisMeasure(const int x, const int y, const int z, const int t)=0
Compute harris measure for a pixel.
BaseHarrisDetector(const carto::rc_ptr< carto::Volume< T > > &image, const double sigma=1.2, const double k=0.6, const double epsilon=1E-3, const T levels=(T) 255)
Constructor.
virtual void filter(int minDistance)
Filter detected corners.
virtual void computeCorners()
Perfom the Harris Corner Detection.
carto::VolumeRef< T > _image
Definition harris.h:142
aims::BucketMap< Void > corners()
Get detected corners.
aims::BucketMap< double > _corners
Definition harris.h:149
carto::VolumeRef< double > _g
Definition harris.h:143
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 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.
carto::VolumeRef< double > _hmap
Definition harris.h:146
carto::VolumeRef< double > harrisMap()
Get processed Harris map.
virtual double harrisMeasure(const int x, const int y, const int z, const int t)
Compute harris measure for a pixel.
virtual void computeDerivatives()
Compute the 3 arrays Ix, Iy and Ixy.
HarrisDetector(const carto::rc_ptr< carto::Volume< T > > &image, double sigma=1.2, double k=0.6, double epsilon=1E-3, T levels=255)
Constructor.
virtual bool isSpatialMaxima(const int x, const int y, const int z, const int t)
Return true if the measure at pixel (x,y) is a local spatial Maxima.