automatic commit
[folded-ctf.git] / pi_feature.h
1
2 ///////////////////////////////////////////////////////////////////////////
3 // This program is free software: you can redistribute it and/or modify  //
4 // it under the terms of the version 3 of the GNU General Public License //
5 // as published by the Free Software Foundation.                         //
6 //                                                                       //
7 // This program is distributed in the hope that it will be useful, but   //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of            //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      //
10 // General Public License for more details.                              //
11 //                                                                       //
12 // You should have received a copy of the GNU General Public License     //
13 // along with this program. If not, see <http://www.gnu.org/licenses/>.  //
14 //                                                                       //
15 // Written by Francois Fleuret                                           //
16 // (C) Idiap Research Institute                                          //
17 //                                                                       //
18 // Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
19 ///////////////////////////////////////////////////////////////////////////
20
21 /*
22
23   A PiFeatures is the central new idea of this approach. It is a
24   feature which can be evaluated on a pair image / referential, where
25   the referential is computed from a pose cell.
26
27 */
28
29 #ifndef PI_FEATURE_H
30 #define PI_FEATURE_H
31
32 #include "misc.h"
33 #include "global.h"
34 #include "rich_image.h"
35 #include "pi_referential.h"
36
37 class PiFeature {
38
39   enum {
40     PF_EDGE_THRESHOLDING,
41     PF_EDGE_HISTOGRAM_COMPARISON,
42     PF_GRAYSCALE_HISTOGRAM_COMPARISON,
43   } _type;
44
45   int _tag, _edge_scale;
46   Rectangle _window_a, _window_b;
47   int _registration_a, _registration_b;
48
49   int random_registration_mode(int level);
50   void randomize_window(int registration_mode, Rectangle *window);
51   void draw_window(RGBImage *image, int registration_mode, Rectangle *window);
52
53   // EDGE THRESHOLDING
54
55   scalar_t response_edge_thresholding(RichImage *image, PiReferential *referential);
56   void draw_edge_thresholding(RGBImage *image, int r, int g, int b,
57                               PiReferential *referential);
58   void print_edge_thresholding(ostream *os);
59
60   // EDGE ORIENTATION HISTOGRAM COMPARISON
61
62   scalar_t response_edge_histogram_comparison(RichImage *image, PiReferential *referential);
63   void draw_edge_histogram_comparison(RGBImage *image, int r, int g, int b,
64                                       PiReferential *referential);
65   void print_edge_histogram_comparison(ostream *os);
66
67   // GRAYSCALE HISTOGRAM COMPARISON
68
69   scalar_t response_grayscale_histogram_comparison(RichImage *image, PiReferential *referential);
70   void draw_grayscale_histogram_comparison(RGBImage *image,
71                                            int r, int g, int b,
72                                            PiReferential *referential);
73   void print_grayscale_histogram_comparison(ostream *os);
74
75 public:
76
77   void randomize(int level);
78
79   scalar_t response(RichImage *image, PiReferential *referential);
80
81   void draw(RGBImage *image,
82             int r, int g, int b,
83             PiReferential *referential);
84
85   void print(ostream *os);
86 };
87
88 #endif