bazar  1.3.1
keypoint_orientation_corrector.h
Go to the documentation of this file.
1 /*
2 Copyright 2005, 2006 Computer Vision Lab,
3 Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland.
4 All rights reserved.
5 
6 This file is part of BazAR.
7 
8 BazAR is free software; you can redistribute it and/or modify it under the
9 terms of the GNU General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 BazAR is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License along with
18 BazAR; if not, write to the Free Software Foundation, Inc., 51 Franklin
19 Street, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21 #ifndef KEYPOINT_ORIENTATION_CORRECTOR_H
22 #define KEYPOINT_ORIENTATION_CORRECTOR_H
23 
24 #include <cv.h>
25 
26 
31 {
32 public:
33  keypoint_orientation_corrector(int width, int height, int neighborhood_size, int nbLev);
35 
36  void compute_gradient_images(IplImage * image, IplImage ** Ix, IplImage ** Iy);
37 
39  int orientation_bucket_index(const IplImage * _Ix, const IplImage * _Iy, const int u, const int v);
41  int optimized_orientation_bucket_index(const IplImage * _Ix, const IplImage * _Iy, const int u, const int v);
42 
44  float estimate_orientation_in_radians(IplImage * image, int u, int v, IplImage * _Ix, IplImage * _Iy);
45 
47  int correct_orientation(IplImage * image, int u, int v,
48  IplImage * rotated_neighborhood,
49  IplImage * Ix, IplImage * Iy, int level);
50 
51  int correct_orientationf(IplImage * image, float u, float v,
52  IplImage * rotated_neighborhood,
53  float orientation_in_radians, int level);
54 
55  static bool subpixel_rotate;
56 
57  static const int ANGLE_QUANTUM = 20; // in degrees
58  static const int ANGLE_BUCKET_NUMBER = 360 / ANGLE_QUANTUM;
59 private:
60  void initialize_tables(void);
61  void rotate_patch(IplImage * original_image, int u, int v,
62  IplImage * rotated_patch,
63  int orientation_bucket_index, int level);
64  void rotate_patchf(IplImage * original_image, float u, float v,
65  IplImage * rotated_patch,
66  float angle);
67 
68  int width, height, neighborhood_size, actual_neighborhood_size;
69 
70  short * atan2_table;
71  int * angle_buckets;
72  IplImage * exp_weights;
73 
74  int ** orientation_lookup_tables;
75  int nbLev;
76 };
77 
78 #endif // KEYPOINT_ORIENTATION_CORRECTOR_H